Skip to content

Commit ceea7ef

Browse files
authored
Merge pull request #2465 from klutvott123/mcu-id-for-vtx-table-lua
2 parents 1aa71c4 + b283120 commit ceea7ef

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

locales/en/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5694,7 +5694,7 @@
56945694
"description": "Save Lua script button in the VTX tab"
56955695
},
56965696
"vtxLuaFileHelp" :{
5697-
"message": "The '$t(vtxButtonSaveLua.message)' button will allow you to save a <i>craftname</i>.lua file containing the vtx table configuration that can be used with the betaflight lua scripts. (See more <a target=\"_blank\" rel=\"noopener noreferrer\" href=\"https://github.com/betaflight/betaflight-tx-lua-scripts/\">here</a>.)",
5697+
"message": "The '$t(vtxButtonSaveLua.message)' button will allow you to save a <i>mcuid</i>.lua file containing the VTX table configuration that can be used with the <a href=\"https://github.com/betaflight/betaflight-tx-lua-scripts/\" target=\"_blank\" rel=\"noopener noreferrer\">Betaflight TX Lua Scripts</a>.<br><br>Version 1.6.0 and above can use the file as is, but for older versions of the scripts it should be renamed to match the modelname on the TX.",
56985698
"description": "Tooltip message for the Save Lua script button in the VTX tab"
56995699
},
57005700
"vtxButtonLoadFile": {

src/js/tabs/vtx.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -608,16 +608,13 @@ TABS.vtx.initialize = function (callback) {
608608
}
609609

610610
function save_lua() {
611-
const suggestedName = 'model01';
612611
const suffix = 'lua';
613612

614-
let filename;
615-
if(FC.CONFIG.name && FC.CONFIG.name.trim() !== '') {
616-
filename = FC.CONFIG.name.trim().replace(' ', '_');
617-
}else{
618-
filename = suggestedName;
619-
}
620-
filename += `.${suffix}`;
613+
const uid0 = FC.CONFIG.uid[0].toString(16).padStart(8, '0');
614+
const uid1 = FC.CONFIG.uid[1].toString(16).padStart(8, '0');
615+
const uid2 = FC.CONFIG.uid[2].toString(16).padStart(8, '0');
616+
617+
const filename = `${uid0}${uid1}${uid2}.${suffix}`;
621618

622619
const accepts = [{
623620
description: `${suffix.toUpperCase()} files`, extensions: [suffix],

0 commit comments

Comments
 (0)