1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-17 05:15:20 +03:00

Rebase CLI tab on latest CF

Integrates Save to File and Clear Output buttons, plus some minor
iNav compatibility patches
This commit is contained in:
Niccolò Maggioni 2018-11-29 14:26:02 +01:00
parent 66e43c0603
commit a340443c43
No known key found for this signature in database
GPG key ID: 4874B0C841E33264
8 changed files with 324 additions and 106 deletions

View file

@ -12,4 +12,37 @@ function constrain(input, min, max) {
}
return input;
}
function zeroPad(value, width) {
value = "" + value;
while (value.length < width) {
value = "0" + value;
}
return value;
}
function generateFilename(prefix, suffix) {
var date = new Date();
var filename = prefix;
if (CONFIG) {
if (CONFIG.flightControllerIdentifier) {
filename = CONFIG.flightControllerIdentifier + '_' + filename;
}
if (CONFIG.name && CONFIG.name.trim() !== '') {
filename = filename + '_' + CONFIG.name.trim().replace(' ', '_');
}
}
filename = filename + '_' + date.getFullYear()
+ zeroPad(date.getMonth() + 1, 2)
+ zeroPad(date.getDate(), 2)
+ '_' + zeroPad(date.getHours(), 2)
+ zeroPad(date.getMinutes(), 2)
+ zeroPad(date.getSeconds(), 2);
return filename + '.' + suffix;
}