mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 19:40:22 +03:00
Merge branch 'release_7.1.0' into Autoland-7.0.1
This commit is contained in:
commit
2a9a366a34
7 changed files with 384 additions and 20 deletions
|
@ -90,7 +90,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
CONFIG.armingFlags = data.getUint32(offset, true);
|
||||
offset += 4;
|
||||
|
||||
|
||||
//As there are 8 bytes for mspBoxModeFlags (number of bytes is actually variable)
|
||||
//read mixer profile as the last byte in the the message
|
||||
profile_byte = data.getUint8(dataHandler.message_length_expected - 1);
|
||||
|
@ -1500,6 +1500,9 @@ var mspHelper = (function (gui) {
|
|||
case MSPCodes.MSP2_INAV_SELECT_BATTERY_PROFILE:
|
||||
console.log('Battery profile selected');
|
||||
break;
|
||||
case MSPCodes.MSP2_INAV_SET_CUSTOM_OSD_ELEMENTS:
|
||||
console.log('OSD custom elements preferences saved');
|
||||
break;
|
||||
case MSPCodes.MSPV2_INAV_OUTPUT_MAPPING:
|
||||
OUTPUT_MAPPING.flush();
|
||||
for (i = 0; i < data.byteLength; ++i)
|
||||
|
@ -1627,6 +1630,48 @@ var mspHelper = (function (gui) {
|
|||
console.log('EzTune settings saved');
|
||||
break;
|
||||
|
||||
case MSPCodes.MSP2_INAV_CUSTOM_OSD_ELEMENTS:
|
||||
OSD_CUSTOM_ELEMENTS.items = [];
|
||||
|
||||
var index = 0;
|
||||
|
||||
OSD_CUSTOM_ELEMENTS.settings.customElementsCount = data.getUint8(index++);
|
||||
OSD_CUSTOM_ELEMENTS.settings.customElementTextSize = data.getUint8(index++);
|
||||
|
||||
for (i = 0; i < OSD_CUSTOM_ELEMENTS.settings.customElementsCount; i++){
|
||||
var customElement = {
|
||||
customElementItems: [],
|
||||
customElementVisibility: {type: 0, value: 0},
|
||||
customElementText: [],
|
||||
};
|
||||
|
||||
for (let ii = 0; ii < OSD_CUSTOM_ELEMENTS.settings.customElementsCount; ii++){
|
||||
var customElementPart = {type: 0, value: 0,};
|
||||
customElementPart.type = data.getUint8(index++);
|
||||
customElementPart.value = data.getUint16(index, true);
|
||||
index += 2;
|
||||
customElement.customElementItems.push(customElementPart);
|
||||
}
|
||||
|
||||
customElement.customElementVisibility.type = data.getUint8(index++);
|
||||
customElement.customElementVisibility.value = data.getUint16(index, true);
|
||||
index += 2;
|
||||
|
||||
for (let ii = 0; ii < OSD_CUSTOM_ELEMENTS.settings.customElementTextSize; ii++){
|
||||
var char = data.getUint8(index++);
|
||||
if(char === 0){
|
||||
index += (OSD_CUSTOM_ELEMENTS.settings.customElementTextSize - 1) - ii;
|
||||
break;
|
||||
}
|
||||
customElement.customElementText[ii] = char;
|
||||
}
|
||||
|
||||
customElement.customElementText = String.fromCharCode(...customElement.customElementText);
|
||||
|
||||
OSD_CUSTOM_ELEMENTS.items.push(customElement)
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log('Unknown code detected: ' + dataHandler.code);
|
||||
} else {
|
||||
|
@ -2571,6 +2616,10 @@ var mspHelper = (function (gui) {
|
|||
}
|
||||
};
|
||||
|
||||
self.loadOsdCustomElements = function (callback) {
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_CUSTOM_OSD_ELEMENTS, false, false, callback);
|
||||
}
|
||||
|
||||
self.sendModeRanges = function (onCompleteCallback) {
|
||||
var nextFunction = send_next_mode_range;
|
||||
|
||||
|
@ -2948,7 +2997,7 @@ var mspHelper = (function (gui) {
|
|||
MSP.send_message(MSPCodes.MSP2_INAV_TIMER_OUTPUT_MODE, false, false, callback);
|
||||
}
|
||||
|
||||
self.sendTimerOutputModes = function(onCompleteCallback) {
|
||||
self.sendTimerOutputModes = function(callback) {
|
||||
var nextFunction = send_next_output_mode;
|
||||
var idIndex = 0;
|
||||
|
||||
|
@ -2973,7 +3022,7 @@ var mspHelper = (function (gui) {
|
|||
// prepare for next iteration
|
||||
idIndex++;
|
||||
if (idIndex == overrideIds.length) {
|
||||
nextFunction = onCompleteCallback;
|
||||
nextFunction = callback;
|
||||
|
||||
}
|
||||
MSP.send_message(MSPCodes.MSP2_INAV_SET_TIMER_OUTPUT_MODE, buffer, false, nextFunction);
|
||||
|
@ -3366,12 +3415,6 @@ var mspHelper = (function (gui) {
|
|||
|
||||
self.encodeSetting = function (name, value) {
|
||||
return this._getSetting(name).then(function (setting) {
|
||||
|
||||
if (!setting) {
|
||||
console.log("Setting invalid: " + name);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (setting.table && !Number.isInteger(value)) {
|
||||
var found = false;
|
||||
for (var ii = 0; ii < setting.table.values.length; ii++) {
|
||||
|
@ -3419,11 +3462,7 @@ var mspHelper = (function (gui) {
|
|||
|
||||
self.setSetting = function (name, value, callback) {
|
||||
this.encodeSetting(name, value).then(function (data) {
|
||||
if (data) {
|
||||
return MSP.promise(MSPCodes.MSPV2_SET_SETTING, data).then(callback);
|
||||
} else {
|
||||
return Promise.resolve().then(callback);
|
||||
}
|
||||
return MSP.promise(MSPCodes.MSPV2_SET_SETTING, data).then(callback);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue