mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 12:25:13 +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:
parent
b2658db108
commit
96ec2da3ce
5 changed files with 49 additions and 20 deletions
|
@ -4491,7 +4491,7 @@
|
||||||
"message": "This will reset all PID settings to firmware default values and save.\nDo you want to continue?"
|
"message": "This will reset all PID settings to firmware default values and save.\nDo you want to continue?"
|
||||||
},
|
},
|
||||||
"mappingTableOutput": {
|
"mappingTableOutput": {
|
||||||
"message": "Output"
|
"message": "Output (timer)"
|
||||||
},
|
},
|
||||||
"mappingTableFunction": {
|
"mappingTableFunction": {
|
||||||
"message": "Function"
|
"message": "Function"
|
||||||
|
|
|
@ -180,6 +180,9 @@ var MSPCodes = {
|
||||||
MSPV2_INAV_SET_RATE_PROFILE: 0x2008,
|
MSPV2_INAV_SET_RATE_PROFILE: 0x2008,
|
||||||
MSPV2_INAV_AIR_SPEED: 0x2009,
|
MSPV2_INAV_AIR_SPEED: 0x2009,
|
||||||
MSPV2_INAV_OUTPUT_MAPPING: 0x200A,
|
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_MIXER: 0x2010,
|
||||||
MSP2_INAV_SET_MIXER: 0x2011,
|
MSP2_INAV_SET_MIXER: 0x2011,
|
||||||
|
@ -191,9 +194,6 @@ var MSPCodes = {
|
||||||
MSP2_INAV_OSD_PREFERENCES: 0x2016,
|
MSP2_INAV_OSD_PREFERENCES: 0x2016,
|
||||||
MSP2_INAV_OSD_SET_PREFERENCES: 0x2017,
|
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_SELECT_BATTERY_PROFILE: 0x2018,
|
||||||
|
|
||||||
MSP2_INAV_DEBUG: 0x2019,
|
MSP2_INAV_DEBUG: 0x2019,
|
||||||
|
@ -217,6 +217,7 @@ var MSPCodes = {
|
||||||
MSP2_INAV_SET_PROGRAMMING_PID: 0x2029,
|
MSP2_INAV_SET_PROGRAMMING_PID: 0x2029,
|
||||||
MSP2_INAV_PROGRAMMING_PID_STATUS: 0x202A,
|
MSP2_INAV_PROGRAMMING_PID_STATUS: 0x202A,
|
||||||
|
|
||||||
|
|
||||||
MSP2_PID: 0x2030,
|
MSP2_PID: 0x2030,
|
||||||
MSP2_SET_PID: 0x2031,
|
MSP2_SET_PID: 0x2031,
|
||||||
|
|
||||||
|
|
|
@ -1482,9 +1482,26 @@ var mspHelper = (function (gui) {
|
||||||
case MSPCodes.MSPV2_INAV_OUTPUT_MAPPING:
|
case MSPCodes.MSPV2_INAV_OUTPUT_MAPPING:
|
||||||
OUTPUT_MAPPING.flush();
|
OUTPUT_MAPPING.flush();
|
||||||
for (i = 0; i < data.byteLength; ++i)
|
for (i = 0; i < data.byteLength; ++i)
|
||||||
OUTPUT_MAPPING.put(data.getUint8(i));
|
OUTPUT_MAPPING.put({
|
||||||
|
'timerId': i,
|
||||||
|
'usageFlags': data.getUint8(i)});
|
||||||
break;
|
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:
|
case MSPCodes.MSP2_INAV_MC_BRAKING:
|
||||||
try {
|
try {
|
||||||
BRAKING_CONFIG.speedThreshold = data.getUint16(0, true);
|
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);
|
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) {
|
self.loadBatteryConfig = function (callback) {
|
||||||
MSP.send_message(MSPCodes.MSPV2_BATTERY_CONFIG, false, false, callback);
|
MSP.send_message(MSPCodes.MSPV2_BATTERY_CONFIG, false, false, callback);
|
||||||
};
|
};
|
||||||
|
|
|
@ -31,20 +31,19 @@ let OutputMappingCollection = function () {
|
||||||
if (servosToGo > 0 && bit_check(data[i], TIM_USE_MC_SERVO)) {
|
if (servosToGo > 0 && bit_check(data[i], TIM_USE_MC_SERVO)) {
|
||||||
servosToGo--;
|
servosToGo--;
|
||||||
timerMap[i] = OUTPUT_TYPE_SERVO;
|
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--;
|
motorsToGo--;
|
||||||
timerMap[i] = OUTPUT_TYPE_MOTOR;
|
timerMap[i] = OUTPUT_TYPE_MOTOR;
|
||||||
}
|
}
|
||||||
} else {
|
} 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--;
|
servosToGo--;
|
||||||
timerMap[i] = OUTPUT_TYPE_SERVO;
|
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--;
|
motorsToGo--;
|
||||||
timerMap[i] = OUTPUT_TYPE_MOTOR;
|
timerMap[i] = OUTPUT_TYPE_MOTOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return timerMap;
|
return timerMap;
|
||||||
|
@ -89,10 +88,10 @@ let OutputMappingCollection = function () {
|
||||||
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
if (
|
if (
|
||||||
bit_check(data[i], TIM_USE_MC_MOTOR) ||
|
bit_check(data[i]['usageFlags'], TIM_USE_MC_MOTOR) ||
|
||||||
bit_check(data[i], TIM_USE_MC_SERVO) ||
|
bit_check(data[i]['usageFlags'], TIM_USE_MC_SERVO) ||
|
||||||
bit_check(data[i], TIM_USE_FW_MOTOR) ||
|
bit_check(data[i]['usageFlags'], TIM_USE_FW_MOTOR) ||
|
||||||
bit_check(data[i], TIM_USE_FW_SERVO)
|
bit_check(data[i]['usageFlags'], TIM_USE_FW_SERVO)
|
||||||
) {
|
) {
|
||||||
retVal++;
|
retVal++;
|
||||||
};
|
};
|
||||||
|
@ -104,10 +103,10 @@ let OutputMappingCollection = function () {
|
||||||
function getFirstOutputOffset() {
|
function getFirstOutputOffset() {
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
if (
|
if (
|
||||||
bit_check(data[i], TIM_USE_MC_MOTOR) ||
|
bit_check(data[i]['usageFlags'], TIM_USE_MC_MOTOR) ||
|
||||||
bit_check(data[i], TIM_USE_MC_SERVO) ||
|
bit_check(data[i]['usageFlags'], TIM_USE_MC_SERVO) ||
|
||||||
bit_check(data[i], TIM_USE_FW_MOTOR) ||
|
bit_check(data[i]['usageFlags'], TIM_USE_FW_MOTOR) ||
|
||||||
bit_check(data[i], TIM_USE_FW_SERVO)
|
bit_check(data[i]['usageFlags'], TIM_USE_FW_SERVO)
|
||||||
) {
|
) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +114,10 @@ let OutputMappingCollection = function () {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getTimerId(outputIndex) {
|
||||||
|
return data[outputIndex]['timerId'];
|
||||||
|
}
|
||||||
|
|
||||||
function getOutput(servoIndex, bit) {
|
function getOutput(servoIndex, bit) {
|
||||||
|
|
||||||
let offset = getFirstOutputOffset();
|
let offset = getFirstOutputOffset();
|
||||||
|
@ -122,7 +125,7 @@ let OutputMappingCollection = function () {
|
||||||
let lastFound = 0;
|
let lastFound = 0;
|
||||||
|
|
||||||
for (let i = offset; i < data.length; i++) {
|
for (let i = offset; i < data.length; i++) {
|
||||||
if (bit_check(data[i], bit)) {
|
if (bit_check(data[i]['usageFlags'], bit)) {
|
||||||
if (lastFound == servoIndex) {
|
if (lastFound == servoIndex) {
|
||||||
return i - offset + 1;
|
return i - offset + 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -134,6 +137,10 @@ let OutputMappingCollection = function () {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.getTimerId = function(outputIndex) {
|
||||||
|
return getTimerId(outputIndex)
|
||||||
|
}
|
||||||
|
|
||||||
self.getFwServoOutput = function (servoIndex) {
|
self.getFwServoOutput = function (servoIndex) {
|
||||||
return getOutput(servoIndex, TIM_USE_FW_SERVO);
|
return getOutput(servoIndex, TIM_USE_FW_SERVO);
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,7 +27,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
mspHelper.loadMotors,
|
mspHelper.loadMotors,
|
||||||
mspHelper.loadServoMixRules,
|
mspHelper.loadServoMixRules,
|
||||||
mspHelper.loadMotorMixRules,
|
mspHelper.loadMotorMixRules,
|
||||||
mspHelper.loadOutputMapping,
|
mspHelper.loadOutputMappingExt,
|
||||||
mspHelper.loadLogicConditions
|
mspHelper.loadLogicConditions
|
||||||
]);
|
]);
|
||||||
loadChainer.setExitPoint(loadHtml);
|
loadChainer.setExitPoint(loadHtml);
|
||||||
|
@ -74,7 +74,7 @@ TABS.mixer.initialize = function (callback, scrollPosition) {
|
||||||
$functionRow.append('<th data-i18n="mappingTableFunction"></th>');
|
$functionRow.append('<th data-i18n="mappingTableFunction"></th>');
|
||||||
|
|
||||||
for (let i = 1; i <= outputCount; i++) {
|
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>');
|
$functionRow.append('<td id="function-' + i +'">-</td>');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue