mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-23 16:25:19 +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
|
@ -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);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue