1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-14 20:10:11 +03:00

Basic changes to display timers on mixer screen

Still thinking about how to handle individual timer overriding.

Full overridie table can be quite long
This commit is contained in:
Marcelo Bezerra 2023-09-02 12:53:07 +02:00
parent b2658db108
commit 96ec2da3ce
5 changed files with 49 additions and 20 deletions

View file

@ -4491,7 +4491,7 @@
"message": "This will reset all PID settings to firmware default values and save.\nDo you want to continue?"
},
"mappingTableOutput": {
"message": "Output"
"message": "Output (timer)"
},
"mappingTableFunction": {
"message": "Function"

View file

@ -180,6 +180,9 @@ var MSPCodes = {
MSPV2_INAV_SET_RATE_PROFILE: 0x2008,
MSPV2_INAV_AIR_SPEED: 0x2009,
MSPV2_INAV_OUTPUT_MAPPING: 0x200A,
MSP2_INAV_MC_BRAKING: 0x200B,
MSP2_INAV_SET_MC_BRAKING: 0x200C,
MSPV2_INAV_OUTPUT_MAPPING_EXT: 0x200D,
MSP2_INAV_MIXER: 0x2010,
MSP2_INAV_SET_MIXER: 0x2011,
@ -191,9 +194,6 @@ var MSPCodes = {
MSP2_INAV_OSD_PREFERENCES: 0x2016,
MSP2_INAV_OSD_SET_PREFERENCES: 0x2017,
MSP2_INAV_MC_BRAKING: 0x200B,
MSP2_INAV_SET_MC_BRAKING: 0x200C,
MSP2_INAV_SELECT_BATTERY_PROFILE: 0x2018,
MSP2_INAV_DEBUG: 0x2019,
@ -217,6 +217,7 @@ var MSPCodes = {
MSP2_INAV_SET_PROGRAMMING_PID: 0x2029,
MSP2_INAV_PROGRAMMING_PID_STATUS: 0x202A,
MSP2_PID: 0x2030,
MSP2_SET_PID: 0x2031,

View file

@ -1482,9 +1482,26 @@ var mspHelper = (function (gui) {
case MSPCodes.MSPV2_INAV_OUTPUT_MAPPING:
OUTPUT_MAPPING.flush();
for (i = 0; i < data.byteLength; ++i)
OUTPUT_MAPPING.put(data.getUint8(i));
OUTPUT_MAPPING.put({
'timerId': i,
'usageFlags': data.getUint8(i)});
break;
case MSPCodes.MSPV2_INAV_OUTPUT_MAPPING_EXT:
OUTPUT_MAPPING.flush();
for (i = 0; i < data.byteLength; i += 2) {
timerId = data.getUint8(i);
usageFlags = data.getUint8(i + 1);
OUTPUT_MAPPING.put(
{
'timerId': timerId,
'usageFlags': usageFlags
});
}
break;
case MSPCodes.MSP2_INAV_MC_BRAKING:
try {
BRAKING_CONFIG.speedThreshold = data.getUint16(0, true);
@ -2820,6 +2837,10 @@ var mspHelper = (function (gui) {
MSP.send_message(MSPCodes.MSPV2_INAV_OUTPUT_MAPPING, false, false, callback);
};
self.loadOutputMappingExt = function (callback) {
MSP.send_message(MSPCodes.MSPV2_INAV_OUTPUT_MAPPING_EXT, false, false, callback);
};
self.loadBatteryConfig = function (callback) {
MSP.send_message(MSPCodes.MSPV2_BATTERY_CONFIG, false, false, callback);
};

View file

@ -31,20 +31,19 @@ let OutputMappingCollection = function () {
if (servosToGo > 0 && bit_check(data[i], TIM_USE_MC_SERVO)) {
servosToGo--;
timerMap[i] = OUTPUT_TYPE_SERVO;
} else if (motorsToGo > 0 && bit_check(data[i], TIM_USE_MC_MOTOR)) {
} else if (motorsToGo > 0 && bit_check(data[i]['usageFlags'], TIM_USE_MC_MOTOR)) {
motorsToGo--;
timerMap[i] = OUTPUT_TYPE_MOTOR;
}
} else {
if (servosToGo > 0 && bit_check(data[i], TIM_USE_FW_SERVO)) {
if (servosToGo > 0 && bit_check(data[i]['usageFlags'], TIM_USE_FW_SERVO)) {
servosToGo--;
timerMap[i] = OUTPUT_TYPE_SERVO;
} else if (motorsToGo > 0 && bit_check(data[i], TIM_USE_FW_MOTOR)) {
} else if (motorsToGo > 0 && bit_check(data[i]['usageFlags'], TIM_USE_FW_MOTOR)) {
motorsToGo--;
timerMap[i] = OUTPUT_TYPE_MOTOR;
}
}
}
return timerMap;
@ -89,10 +88,10 @@ let OutputMappingCollection = function () {
for (let i = 0; i < data.length; i++) {
if (
bit_check(data[i], TIM_USE_MC_MOTOR) ||
bit_check(data[i], TIM_USE_MC_SERVO) ||
bit_check(data[i], TIM_USE_FW_MOTOR) ||
bit_check(data[i], TIM_USE_FW_SERVO)
bit_check(data[i]['usageFlags'], TIM_USE_MC_MOTOR) ||
bit_check(data[i]['usageFlags'], TIM_USE_MC_SERVO) ||
bit_check(data[i]['usageFlags'], TIM_USE_FW_MOTOR) ||
bit_check(data[i]['usageFlags'], TIM_USE_FW_SERVO)
) {
retVal++;
};
@ -104,10 +103,10 @@ let OutputMappingCollection = function () {
function getFirstOutputOffset() {
for (let i = 0; i < data.length; i++) {
if (
bit_check(data[i], TIM_USE_MC_MOTOR) ||
bit_check(data[i], TIM_USE_MC_SERVO) ||
bit_check(data[i], TIM_USE_FW_MOTOR) ||
bit_check(data[i], TIM_USE_FW_SERVO)
bit_check(data[i]['usageFlags'], TIM_USE_MC_MOTOR) ||
bit_check(data[i]['usageFlags'], TIM_USE_MC_SERVO) ||
bit_check(data[i]['usageFlags'], TIM_USE_FW_MOTOR) ||
bit_check(data[i]['usageFlags'], TIM_USE_FW_SERVO)
) {
return i;
}
@ -115,6 +114,10 @@ let OutputMappingCollection = function () {
return 0;
}
function getTimerId(outputIndex) {
return data[outputIndex]['timerId'];
}
function getOutput(servoIndex, bit) {
let offset = getFirstOutputOffset();
@ -122,7 +125,7 @@ let OutputMappingCollection = function () {
let lastFound = 0;
for (let i = offset; i < data.length; i++) {
if (bit_check(data[i], bit)) {
if (bit_check(data[i]['usageFlags'], bit)) {
if (lastFound == servoIndex) {
return i - offset + 1;
} else {
@ -134,6 +137,10 @@ let OutputMappingCollection = function () {
return null;
}
self.getTimerId = function(outputIndex) {
return getTimerId(outputIndex)
}
self.getFwServoOutput = function (servoIndex) {
return getOutput(servoIndex, TIM_USE_FW_SERVO);
};

View file

@ -27,7 +27,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
mspHelper.loadMotors,
mspHelper.loadServoMixRules,
mspHelper.loadMotorMixRules,
mspHelper.loadOutputMapping,
mspHelper.loadOutputMappingExt,
mspHelper.loadLogicConditions
]);
loadChainer.setExitPoint(loadHtml);
@ -74,7 +74,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
$functionRow.append('<th data-i18n="mappingTableFunction"></th>');
for (let i = 1; i <= outputCount; i++) {
$outputRow.append('<td>S' + i + '</td>');
$outputRow.append('<td>S' + i + ' (T' + (OUTPUT_MAPPING.getTimerId(i -1)) + ')</td>');
$functionRow.append('<td id="function-' + i +'">-</td>');
}