mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 16:25:22 +03:00
Mcu ID for lua vtx table
Use mcu ID as filename for the vtx table .lua file.
This commit is contained in:
parent
9ece824971
commit
b283120bf0
2 changed files with 6 additions and 9 deletions
|
@ -5673,7 +5673,7 @@
|
||||||
"description": "Save Lua script button in the VTX tab"
|
"description": "Save Lua script button in the VTX tab"
|
||||||
},
|
},
|
||||||
"vtxLuaFileHelp" :{
|
"vtxLuaFileHelp" :{
|
||||||
"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>.)",
|
"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.",
|
||||||
"description": "Tooltip message for the Save Lua script button in the VTX tab"
|
"description": "Tooltip message for the Save Lua script button in the VTX tab"
|
||||||
},
|
},
|
||||||
"vtxButtonLoadFile": {
|
"vtxButtonLoadFile": {
|
||||||
|
|
|
@ -608,16 +608,13 @@ TABS.vtx.initialize = function (callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function save_lua() {
|
function save_lua() {
|
||||||
const suggestedName = 'model01';
|
|
||||||
const suffix = 'lua';
|
const suffix = 'lua';
|
||||||
|
|
||||||
let filename;
|
const uid0 = FC.CONFIG.uid[0].toString(16).padStart(8, '0');
|
||||||
if(FC.CONFIG.name && FC.CONFIG.name.trim() !== '') {
|
const uid1 = FC.CONFIG.uid[1].toString(16).padStart(8, '0');
|
||||||
filename = FC.CONFIG.name.trim().replace(' ', '_');
|
const uid2 = FC.CONFIG.uid[2].toString(16).padStart(8, '0');
|
||||||
}else{
|
|
||||||
filename = suggestedName;
|
const filename = `${uid0}${uid1}${uid2}.${suffix}`;
|
||||||
}
|
|
||||||
filename += `.${suffix}`;
|
|
||||||
|
|
||||||
const accepts = [{
|
const accepts = [{
|
||||||
description: `${suffix.toUpperCase()} files`, extensions: [suffix],
|
description: `${suffix.toUpperCase()} files`, extensions: [suffix],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue