Skip to content

Commit e159cd6

Browse files
Merge pull request #2620 from iNavFlight/maintenance-9.x
Maintenance 9.x to 10 to handle timer priority revert
2 parents 5eb64b3 + c4e61f1 commit e159cd6

1 file changed

Lines changed: 11 additions & 24 deletions

File tree

js/outputMapping.js

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -86,31 +86,18 @@ var OutputMappingCollection = function () {
8686

8787
for (let i = 0; i < data.length; i++) {
8888
timerMap[i] = null;
89-
}
9089

91-
// Two priority passes: dedicated outputs first, then auto.
92-
// Matches firmware pwmBuildTimerOutputList() behavior.
93-
for (let priority = 0; priority < 2; priority++) {
94-
let isDedicated = (priority === 0);
95-
96-
for (let i = 0; i < data.length; i++) {
97-
if (timerMap[i] !== null) continue;
98-
99-
let flags = data[i]['usageFlags'];
100-
let timerId = data[i]['timerId'];
101-
let mode = timerOverrides[timerId] || self.TIMER_OUTPUT_MODE_AUTO;
102-
103-
if (motorsToGo > 0 && BitHelper.bit_check(flags, TIM_USE_MOTOR)
104-
&& (isDedicated ? mode === self.TIMER_OUTPUT_MODE_MOTORS : mode !== self.TIMER_OUTPUT_MODE_MOTORS)) {
105-
timerMap[i] = OUTPUT_TYPE_MOTOR;
106-
motorsToGo--;
107-
} else if (servosToGo > 0 && BitHelper.bit_check(flags, TIM_USE_SERVO)
108-
&& (isDedicated ? mode === self.TIMER_OUTPUT_MODE_SERVOS : mode !== self.TIMER_OUTPUT_MODE_SERVOS)) {
109-
timerMap[i] = OUTPUT_TYPE_SERVO;
110-
servosToGo--;
111-
} else if (!isDedicated && BitHelper.bit_check(flags, TIM_USE_LED)) {
112-
timerMap[i] = OUTPUT_TYPE_LED;
113-
}
90+
if (servosToGo > 0 && BitHelper.bit_check(data[i]['usageFlags'], TIM_USE_LED)) {
91+
console.log(i + ": LED");
92+
timerMap[i] = OUTPUT_TYPE_LED;
93+
} else if (servosToGo > 0 && BitHelper.bit_check(data[i]['usageFlags'], TIM_USE_SERVO)) {
94+
console.log(i + ": SERVO");
95+
servosToGo--;
96+
timerMap[i] = OUTPUT_TYPE_SERVO;
97+
} else if (motorsToGo > 0 && BitHelper.bit_check(data[i]['usageFlags'], TIM_USE_MOTOR)) {
98+
console.log(i + ": MOTOR");
99+
motorsToGo--;
100+
timerMap[i] = OUTPUT_TYPE_MOTOR;
114101
}
115102
}
116103

0 commit comments

Comments
 (0)