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:
parent
66e43c0603
commit
a340443c43
8 changed files with 324 additions and 106 deletions
|
@ -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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue