diff --git a/src/js/tabs/firmware_flasher.js b/src/js/tabs/firmware_flasher.js index c09b3b3482..e2e0d9ae41 100644 --- a/src/js/tabs/firmware_flasher.js +++ b/src/js/tabs/firmware_flasher.js @@ -654,11 +654,13 @@ firmware_flasher.initialize = function (callback) { } MSP.send_message(MSPCodes.MSP2_GET_TEXT, mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.BUILD_KEY), false, () => { - if (buildKeyExists()) { - self.releaseLoader.requestBuildOptions(FC.CONFIG.buildKey, onLoadCloudBuild, getBoardInfo); - } else { - getBoardInfo(); - } + MSP.send_message(MSPCodes.MSP2_GET_TEXT, mspHelper.crunch(MSPCodes.MSP2_GET_TEXT, MSPCodes.CRAFT_NAME), false, () => { + if (buildKeyExists()) { + self.releaseLoader.requestBuildOptions(FC.CONFIG.buildKey, onLoadCloudBuild, getBoardInfo); + } else { + getBoardInfo(); + } + }); }); } else { getBoardInfo(); @@ -670,9 +672,7 @@ firmware_flasher.initialize = function (callback) { MSP.send_message(MSPCodes.MSP_API_VERSION, false, false, () => { gui_log(i18n.getMessage('apiVersionReceived', FC.CONFIG.apiVersion)); - if (FC.CONFIG.apiVersion.includes('null')) { - onClose(false); // not supported - } else if (semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_39)) { + if (FC.CONFIG.apiVersion.includes('null') || semver.lt(FC.CONFIG.apiVersion, API_VERSION_1_39)) { onClose(false); // not supported } else { MSP.send_message(MSPCodes.MSP_FC_VARIANT, false, false, getBuildInfo); diff --git a/src/js/utils/generate_filename.js b/src/js/utils/generate_filename.js index 57314141d6..543fe38f53 100644 --- a/src/js/utils/generate_filename.js +++ b/src/js/utils/generate_filename.js @@ -16,14 +16,17 @@ export function generateFilename(prefix, suffix) { const date = new Date(); const yyyymmdd = `${date.getFullYear()}${zeroPad(date.getMonth() + 1, 2)}${zeroPad(date.getDate(), 2)}`; const hhmmss = `${zeroPad(date.getHours(), 2)}${zeroPad(date.getMinutes(), 2)}${zeroPad(date.getSeconds(), 2)}`; + const craftName = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? FC.CONFIG.craftName : FC.CONFIG.name; + let filename = `${FC.CONFIG.flightControllerIdentifier || 'UNKNOWN'}_${prefix}`; - let filename = `${FC.CONFIG.flightControllerIdentifier || 'UNKNOWN'}_${prefix}_${yyyymmdd}_${hhmmss}`; + if (craftName.length) { + filename += `_${craftName.trim().replace(" ", "_").toUpperCase()}`; + } - if (FC.CONFIG) { - const craftName = semver.gte(FC.CONFIG.apiVersion, API_VERSION_1_45) ? FC.CONFIG.craftName : FC.CONFIG.name; - const boardName = FC.CONFIG.boardName || craftName.trim().replace(" ", "_"); + filename += `_${yyyymmdd}_${hhmmss}`; - filename = `${filename}_${boardName}`; + if (FC.CONFIG.boardName) { + filename += `_${FC.CONFIG.boardName}`; } return `${filename}.${suffix}`;