Improved logical switches

This commit is contained in:
Raphael Coeffic
2021-11-10 11:07:02 +01:00
parent 4333e4267c
commit 397674021e
41 changed files with 365 additions and 103 deletions
+5
View File
@@ -20,6 +20,7 @@
*/
#include "opentx.h"
#include "switches.h"
#define CS_LAST_VALUE_INIT -32768
@@ -881,6 +882,10 @@ uint8_t lswFamily(uint8_t func)
return LS_FAMILY_TIMER+func-LS_FUNC_TIMER;
}
// val = [-129,-110] => [0,19] (step 1)
// val = [-109,6] => [20,595] (step 5)
// val = [7,122] => [600,1750] (step 10)
//
int16_t lswTimerValue(delayval_t val)
{
return (val < -109 ? 129+val : (val < 7 ? (113+val)*5 : (53+val)*10));