1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-24 16:55:22 +03:00

Add colors to easilly distinguish between timer outputs

This commit is contained in:
Pawel Spychalski (DzikuVx) 2023-09-29 13:16:35 +02:00
parent 55046e53bd
commit 637acdd15d
3 changed files with 30 additions and 4 deletions

View file

@ -20,6 +20,16 @@ let OutputMappingCollection = function () {
const OUTPUT_TYPE_MOTOR = 0;
const OUTPUT_TYPE_SERVO = 1;
const outputColor = [
"#8ecae6",
"#2a9d8f",
"#e9c46a",
"#f4a261",
"#e76f51",
"#ef476f",
"#ffc300"
];
self.TIMER_OUTPUT_MODE_AUTO = 0;
self.TIMER_OUTPUT_MODE_MOTORS = 1;
self.TIMER_OUTPUT_MODE_SERVOS = 2;
@ -36,6 +46,18 @@ let OutputMappingCollection = function () {
return timerOverrides[timer];
}
self.getTimerColor = function (timer) {
let timerIndex = OUTPUT_MAPPING.getUsedTimerIds().indexOf(String(timer));
return outputColor[timerIndex % outputColor.length];
}
self.getOutputTimerColor = function (output) {
let timerId = OUTPUT_MAPPING.getTimerId(output);
return self.getTimerColor(timerId);
}
self.getUsedTimerIds = function (timer) {
let used = {};
let outputCount = self.getOutputCount();