mirror of
https://github.com/opentx/opentx.git
synced 2025-07-22 07:45:14 +03:00
New type swsrc_t introduced
This commit is contained in:
parent
3920cc6919
commit
ef56bf3cb4
8 changed files with 16 additions and 14 deletions
|
@ -727,7 +727,7 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
|
|||
}
|
||||
}
|
||||
|
||||
void putsSwitches(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
||||
void putsSwitches(coord_t x, coord_t y, swsrc_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx == SWSRC_OFF)
|
||||
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
|
||||
|
@ -803,7 +803,7 @@ void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
|||
putsStrIdx(x, y, STR_CV, idx, att);
|
||||
}
|
||||
|
||||
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att)
|
||||
void putsTimerMode(coord_t x, coord_t y, swsrc_t mode, LcdFlags att)
|
||||
{
|
||||
if (mode >= 0) {
|
||||
if (mode < TMRMODE_COUNT)
|
||||
|
|
|
@ -167,7 +167,7 @@ void lcd_outdez8(coord_t x, coord_t y, int8_t val);
|
|||
|
||||
void putsStrIdx(coord_t x, coord_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
|
||||
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att);
|
||||
void putsSwitches(coord_t x, coord_t y, int8_t swtch, LcdFlags att=0);
|
||||
void putsSwitches(coord_t x, coord_t y, swsrc_t swtch, LcdFlags att=0);
|
||||
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att=0);
|
||||
void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att=0);
|
||||
void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
|
@ -175,7 +175,7 @@ void putsFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
|||
void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att);
|
||||
#endif
|
||||
void putsCurve(coord_t x, coord_t y, int8_t idx, LcdFlags att=0);
|
||||
void putsTimerMode(coord_t x, coord_t y, int8_t mode, LcdFlags att=0);
|
||||
void putsTimerMode(coord_t x, coord_t y, swsrc_t mode, LcdFlags att=0);
|
||||
void putsTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att);
|
||||
|
||||
#define putsChn(x, y, idx, att) putsMixerSource(x, y, MIXSRC_CH1+idx-1, att)
|
||||
|
|
|
@ -142,15 +142,15 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
|
|||
switch (m_posHorz) {
|
||||
case 0:
|
||||
{
|
||||
int8_t timerMode = timer->mode;
|
||||
swsrc_t timerMode = timer->mode;
|
||||
if (timerMode < 0) timerMode -= TMRMODE_COUNT-1;
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, timerMode, -TMRMODE_COUNT-SWSRC_LAST+1, TMRMODE_COUNT+SWSRC_LAST-1, isSwitchAvailableInTimers);
|
||||
if (timerMode < 0) timerMode += TMRMODE_COUNT-1;
|
||||
timer->mode = timerMode;
|
||||
#if defined(AUTOSWITCH)
|
||||
if (s_editMode>0) {
|
||||
int8_t val = timer->mode - (TMRMODE_COUNT-1);
|
||||
int8_t switchVal = checkIncDecMovedSwitch(val);
|
||||
swsrc_t val = timer->mode - (TMRMODE_COUNT-1);
|
||||
swsrc_t switchVal = checkIncDecMovedSwitch(val);
|
||||
if (val != switchVal) {
|
||||
timer->mode = switchVal + (TMRMODE_COUNT-1);
|
||||
eeDirty(EE_MODEL);
|
||||
|
|
|
@ -176,7 +176,7 @@ extern const CheckIncDecStops &stopsSwitch;
|
|||
(val), (val+1)
|
||||
|
||||
int checkIncDec(unsigned int event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
|
||||
int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
||||
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
|
||||
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
|
||||
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
|
||||
|
|
|
@ -45,10 +45,10 @@ uint8_t calibrationState;
|
|||
int checkIncDecSelection = 0;
|
||||
|
||||
#if defined(AUTOSWITCH)
|
||||
int8_t checkIncDecMovedSwitch(int8_t val)
|
||||
swsrc_t checkIncDecMovedSwitch(swsrc_t val)
|
||||
{
|
||||
if (s_editMode>0) {
|
||||
int8_t swtch = getMovedSwitch();
|
||||
swsrc_t swtch = getMovedSwitch();
|
||||
if (swtch) {
|
||||
div_t info = switchInfo(swtch);
|
||||
if (IS_TOGGLE(info.quot)) {
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
#define MAX_FLIGHT_MODES 9
|
||||
#define MAX_MIXERS 64
|
||||
#define MAX_EXPOS 64
|
||||
#define NUM_LOGICAL_SWITCH 32 // number of custom switches
|
||||
#define NUM_LOGICAL_SWITCH 32 // number of logical switches
|
||||
#define NUM_CFN 64 // number of functions assigned to switches
|
||||
#define MAX_SCRIPTS 7
|
||||
#define MAX_INPUTS 32
|
||||
|
|
|
@ -416,6 +416,7 @@
|
|||
typedef int32_t rotenc_t;
|
||||
typedef int32_t getvalue_t;
|
||||
typedef uint32_t mixsrc_t;
|
||||
typedef int8_t swsrc_t;
|
||||
#else
|
||||
#define tmr10ms_t uint16_t
|
||||
extern volatile tmr10ms_t g_tmr10ms;
|
||||
|
@ -430,6 +431,7 @@
|
|||
typedef int8_t rotenc_t;
|
||||
typedef int16_t getvalue_t;
|
||||
typedef uint8_t mixsrc_t;
|
||||
typedef int8_t swsrc_t;
|
||||
#endif
|
||||
|
||||
#if defined(NAVIGATION_STICKS)
|
||||
|
@ -766,7 +768,7 @@ void logicalSwitchesReset();
|
|||
#endif
|
||||
|
||||
extern swarnstate_t switches_states;
|
||||
int8_t getMovedSwitch();
|
||||
swsrc_t getMovedSwitch();
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define GET_MOVED_SOURCE_PARAMS uint8_t min
|
||||
|
|
|
@ -552,10 +552,10 @@ void evalLogicalSwitches(bool isCurrentPhase)
|
|||
#endif
|
||||
|
||||
swarnstate_t switches_states = 0;
|
||||
int8_t getMovedSwitch()
|
||||
swsrc_t getMovedSwitch()
|
||||
{
|
||||
static tmr10ms_t s_move_last_time = 0;
|
||||
int8_t result = 0;
|
||||
swsrc_t result = 0;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
for (int i=0; i<NUM_SWITCHES; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue