mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-18 22:05:17 +03:00
Handle channel boundaries better.
More efficient, less code, easier to understand.
This commit is contained in:
parent
2369a63df0
commit
b43fa247de
3 changed files with 10 additions and 20 deletions
|
@ -89,9 +89,11 @@ typedef enum {
|
|||
// this leaves plenty of 'slots' free for cases where you enable multiple modes for a switch
|
||||
// position (like gps rth + horizon + baro + beeper)
|
||||
|
||||
#define CHANNEL_RANGE_MIN 900
|
||||
#define CHANNEL_RANGE_MAX 2100
|
||||
|
||||
#define MODE_STEP_TO_CHANNEL_VALUE(step) (900 + 25 * step)
|
||||
#define CHANNEL_VALUE_TO_STEP(channelValue) ((constrain(channelValue, 900, 2100) - 900) / 25)
|
||||
#define MODE_STEP_TO_CHANNEL_VALUE(step) (CHANNEL_RANGE_MIN + 25 * step)
|
||||
#define CHANNEL_VALUE_TO_STEP(channelValue) ((constrain(channelValue, CHANNEL_RANGE_MIN, CHANNEL_RANGE_MAX) - CHANNEL_RANGE_MIN) / 25)
|
||||
|
||||
typedef struct modeActivationCondition_s {
|
||||
boxId_e modeId;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue