1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-19 14:25:13 +03:00

Add version number to CLI save

This PR adds the version number to the CLI filename. It also adds a secondary way to get the data from the FC if it is out of range. If it fails, it appears as the previous save filename looked.
This commit is contained in:
Darren Lines 2022-07-29 14:18:30 +01:00
parent 64ccd39264
commit bd70d431c0

View file

@ -42,13 +42,28 @@ function generateFilename(prefix, suffix) {
if (CONFIG) {
if (CONFIG.flightControllerIdentifier) {
filename = CONFIG.flightControllerIdentifier + '_' + filename;
}
filename = CONFIG.flightControllerIdentifier + '_' + CONFIG.flightControllerVersion + "_" + filename;
}
if (CONFIG.name && CONFIG.name.trim() !== '') {
filename = filename + '_' + CONFIG.name.trim().replace(' ', '_');
}
} else {
// Attempt to get the version number and
MSPHelper.getSetting("version").then(function (data) {
if (data.value) {
let version = data.value.split('/')[0] + "_" + data.value.split(' ')[1];
filename = "" + version + "_" + filename;
}
});
MSPHelper.getSetting("name").then(function (data) {
if (data.value && data.value.trim() !== '') {
filename += "_" + data.value.trim().replace(' ', '_');
}
});
}
filename = filename + '_' + date.getFullYear()
+ zeroPad(date.getMonth() + 1, 2)
+ zeroPad(date.getDate(), 2)