mirror of
https://github.com/opentx/opentx.git
synced 2025-07-18 05:45:21 +03:00
EEPROM structure changes to allow more switches (9bits instead of 8bits)
This commit is contained in:
parent
11fe3d41f8
commit
18e128ef55
7 changed files with 54 additions and 34 deletions
|
@ -263,6 +263,10 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (swtch >= SWSRC_FIRST_SENSOR && swtch <= SWSRC_LAST_SENSOR) {
|
||||||
|
return isTelemetryFieldAvailable(swtch - SWSRC_FIRST_SENSOR);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -712,7 +712,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
||||||
else {
|
else {
|
||||||
idx -= MIXSRC_FIRST_TELEM;
|
idx -= MIXSRC_FIRST_TELEM;
|
||||||
div_t qr = div(idx, 3);
|
div_t qr = div(idx, 3);
|
||||||
lcd_putsnAtt(x, y, g_model.telemetrySensors[qr.quot].label, ZLEN(g_model.telemetrySensors[qr.quot].label), ZCHAR|att);
|
lcd_putsnAtt(x, y, g_model.telemetrySensors[qr.quot].label, TELEM_LABEL_LEN, ZCHAR|att);
|
||||||
if (qr.rem) lcd_putcAtt(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
|
if (qr.rem) lcd_putcAtt(lcdLastPos, y, qr.rem==2 ? '+' : '-', att);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -773,9 +773,15 @@ void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
|
||||||
else if (idx <= SWSRC_ONE) {
|
else if (idx <= SWSRC_ONE) {
|
||||||
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_ON+1+(2*NUM_STICKS), att);
|
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_ON+1+(2*NUM_STICKS), att);
|
||||||
}
|
}
|
||||||
else {
|
else if (idx <= SWSRC_LAST_FLIGHT_MODE) {
|
||||||
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||||
}
|
}
|
||||||
|
else if (idx == SWSRC_TELEMETRY_STREAMING) {
|
||||||
|
lcd_putsAtt(x, y, "Tele", att);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lcd_putsnAtt(x, y, g_model.telemetrySensors[idx-SWSRC_FIRST_SENSOR].label, TELEM_LABEL_LEN, ZCHAR|att);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(FLIGHT_MODES)
|
#if defined(FLIGHT_MODES)
|
||||||
|
|
|
@ -138,6 +138,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, uint8_t event)
|
||||||
TimerData * timer = &g_model.timers[timerIdx];
|
TimerData * timer = &g_model.timers[timerIdx];
|
||||||
putsStrIdx(0*FW, y, STR_TIMER, timerIdx+1);
|
putsStrIdx(0*FW, y, STR_TIMER, timerIdx+1);
|
||||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
|
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, m_posHorz==0 ? attr : 0);
|
||||||
|
|
||||||
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
|
putsTimer(MODEL_SETUP_2ND_COLUMN+5*FW-2+5*FWNUM+1, y, timer->start, m_posHorz==1 ? attr : 0, m_posHorz==2 ? attr : 0);
|
||||||
if (attr && m_posHorz < 0) drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, FH+1);
|
if (attr && m_posHorz < 0) drawFilledRect(MODEL_SETUP_2ND_COLUMN-1, y-1, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH+1, FH+1);
|
||||||
if (attr && s_editMode>0) {
|
if (attr && s_editMode>0) {
|
||||||
|
|
|
@ -274,7 +274,7 @@ typedef int select_menu_value_t;
|
||||||
|
|
||||||
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event);
|
select_menu_value_t selectMenuItem(coord_t x, coord_t y, const pm_char *label, const pm_char *values, select_menu_value_t value, select_menu_value_t min, select_menu_value_t max, LcdFlags attr, uint8_t event);
|
||||||
uint8_t onoffMenuItem(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event);
|
uint8_t onoffMenuItem(uint8_t value, coord_t x, coord_t y, const pm_char *label, LcdFlags attr, uint8_t event);
|
||||||
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event);
|
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event);
|
||||||
|
|
||||||
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = onoffMenuItem(value, x, y, label, attr, event)
|
#define ON_OFF_MENU_ITEM(value, x, y, label, attr, event) value = onoffMenuItem(value, x, y, label, attr, event)
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ uint8_t onoffMenuItem(uint8_t value, coord_t x, coord_t y, const pm_char *label,
|
||||||
return selectMenuItem(x, y, label, NULL, value, 0, 1, attr, event);
|
return selectMenuItem(x, y, label, NULL, value, 0, 1, attr, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, uint8_t event)
|
swsrc_t switchMenuItem(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, uint8_t event)
|
||||||
{
|
{
|
||||||
lcd_putsColumnLeft(x, y, STR_SWITCH);
|
lcd_putsColumnLeft(x, y, STR_SWITCH);
|
||||||
putsSwitches(x, y, value, attr);
|
putsSwitches(x, y, value, attr);
|
||||||
|
|
|
@ -62,10 +62,10 @@
|
||||||
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
|
#define BEEP_VAL ( (g_eeGeneral.warnOpts & WARN_BVAL_BIT) >>3 )
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
#define EEPROM_VER 217
|
#define EEPROM_VER 218
|
||||||
#define FIRST_CONV_EEPROM_VER 216
|
#define FIRST_CONV_EEPROM_VER 216
|
||||||
#elif defined(PCBSKY9X)
|
#elif defined(PCBSKY9X)
|
||||||
#define EEPROM_VER 217
|
#define EEPROM_VER 218
|
||||||
#define FIRST_CONV_EEPROM_VER 216
|
#define FIRST_CONV_EEPROM_VER 216
|
||||||
#elif defined(CPUM2560) || defined(CPUM2561)
|
#elif defined(CPUM2560) || defined(CPUM2561)
|
||||||
#define EEPROM_VER 217
|
#define EEPROM_VER 217
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
#define MAX_FLIGHT_MODES 9
|
#define MAX_FLIGHT_MODES 9
|
||||||
#define MAX_MIXERS 64
|
#define MAX_MIXERS 64
|
||||||
#define MAX_EXPOS 64
|
#define MAX_EXPOS 64
|
||||||
#define NUM_LOGICAL_SWITCH 32 // number of logical switches
|
#define NUM_LOGICAL_SWITCH 64 // number of logical switches
|
||||||
#define NUM_CFN 64 // number of functions assigned to switches
|
#define NUM_CFN 64 // number of functions assigned to switches
|
||||||
#define MAX_SCRIPTS 7
|
#define MAX_SCRIPTS 7
|
||||||
#define MAX_INPUTS 32
|
#define MAX_INPUTS 32
|
||||||
|
@ -628,8 +628,8 @@ enum AdjustGvarFunctionParam {
|
||||||
#define CFN_SPARE_TYPE int16_t
|
#define CFN_SPARE_TYPE int16_t
|
||||||
#endif
|
#endif
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
int8_t swtch;
|
int16_t swtch:9;
|
||||||
uint8_t func;
|
uint16_t func:7;
|
||||||
PACK(union {
|
PACK(union {
|
||||||
PACK(struct {
|
PACK(struct {
|
||||||
char name[LEN_CFN_NAME];
|
char name[LEN_CFN_NAME];
|
||||||
|
@ -817,14 +817,15 @@ PACK(typedef struct {
|
||||||
|
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint32_t srcRaw:10;
|
uint16_t mode:2;
|
||||||
uint32_t scale:14;
|
uint16_t scale:14;
|
||||||
uint32_t chn:8;
|
uint16_t srcRaw:10;
|
||||||
int8_t swtch;
|
int16_t carryTrim:6;
|
||||||
uint16_t flightModes;
|
uint32_t chn:5;
|
||||||
int8_t weight;
|
int32_t swtch:9;
|
||||||
int8_t carryTrim:6;
|
uint32_t flightModes:9;
|
||||||
uint8_t mode:2;
|
int32_t weight:8;
|
||||||
|
int32_t spare:1;
|
||||||
char name[LEN_EXPOMIX_NAME];
|
char name[LEN_EXPOMIX_NAME];
|
||||||
int8_t offset;
|
int8_t offset;
|
||||||
CurveRef curve;
|
CurveRef curve;
|
||||||
|
@ -944,15 +945,16 @@ PACK(typedef struct {
|
||||||
#define SLOW_MAX (25*SLOW_STEP) /* 25 seconds */
|
#define SLOW_MAX (25*SLOW_STEP) /* 25 seconds */
|
||||||
#if defined(PCBTARANIS)
|
#if defined(PCBTARANIS)
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
uint8_t destCh;
|
int16_t weight:11; // GV1=-1024, -GV1=1023
|
||||||
uint16_t flightModes:9;
|
uint16_t destCh:5;
|
||||||
uint16_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
uint16_t srcRaw:10; // srcRaw=0 means not used
|
||||||
uint16_t carryTrim:1;
|
uint16_t carryTrim:1;
|
||||||
uint16_t mixWarn:4; // mixer warning
|
uint16_t mixWarn:2; // mixer warning
|
||||||
int16_t weight;
|
uint16_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
|
||||||
uint32_t srcRaw:10;
|
uint16_t spare:1;
|
||||||
int32_t offset:14;
|
int32_t offset:14;
|
||||||
int32_t swtch:8;
|
int32_t swtch:9;
|
||||||
|
uint32_t flightModes:9;
|
||||||
CurveRef curve;
|
CurveRef curve;
|
||||||
uint8_t delayUp;
|
uint8_t delayUp;
|
||||||
uint8_t delayDown;
|
uint8_t delayDown;
|
||||||
|
@ -1125,13 +1127,15 @@ enum LogicalSwitchesFunctions {
|
||||||
#define MAX_LS_ANDSW SWSRC_LAST
|
#define MAX_LS_ANDSW SWSRC_LAST
|
||||||
typedef int16_t ls_telemetry_value_t;
|
typedef int16_t ls_telemetry_value_t;
|
||||||
PACK(typedef struct { // Logical Switches data
|
PACK(typedef struct { // Logical Switches data
|
||||||
uint16_t func:6;
|
uint8_t func;
|
||||||
int16_t v1:10;
|
int32_t v1:10;
|
||||||
|
int32_t v3:10;
|
||||||
|
int32_t andsw:9; // TODO rename to xswtch
|
||||||
|
uint32_t andswtype:1; // TODO rename to xswtchType (AND / OR)
|
||||||
|
uint32_t spare:2; // anything else needed?
|
||||||
int16_t v2;
|
int16_t v2;
|
||||||
int16_t v3;
|
|
||||||
uint8_t delay;
|
uint8_t delay;
|
||||||
uint8_t duration;
|
uint8_t duration;
|
||||||
int8_t andsw;
|
|
||||||
}) LogicalSwitchData;
|
}) LogicalSwitchData;
|
||||||
#else
|
#else
|
||||||
typedef uint8_t ls_telemetry_value_t;
|
typedef uint8_t ls_telemetry_value_t;
|
||||||
|
@ -1613,10 +1617,11 @@ PACK(typedef struct {
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
TRIMS_ARRAY;
|
TRIMS_ARRAY;
|
||||||
int8_t swtch; // swtch of phase[0] is not used
|
|
||||||
char name[LEN_FLIGHT_MODE_NAME];
|
char name[LEN_FLIGHT_MODE_NAME];
|
||||||
uint8_t fadeIn;
|
int16_t swtch:9; // swtch of phase[0] is not used
|
||||||
uint8_t fadeOut;
|
int16_t spare:7;
|
||||||
|
uint8_t fadeIn;
|
||||||
|
uint8_t fadeOut;
|
||||||
ROTARY_ENCODER_ARRAY;
|
ROTARY_ENCODER_ARRAY;
|
||||||
PHASE_GVARS_DATA;
|
PHASE_GVARS_DATA;
|
||||||
}) FlightModeData;
|
}) FlightModeData;
|
||||||
|
@ -1756,6 +1761,10 @@ enum SwitchSources {
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
SWSRC_FIRST_FLIGHT_MODE,
|
SWSRC_FIRST_FLIGHT_MODE,
|
||||||
SWSRC_LAST_FLIGHT_MODE = SWSRC_FIRST_FLIGHT_MODE+MAX_FLIGHT_MODES-1,
|
SWSRC_LAST_FLIGHT_MODE = SWSRC_FIRST_FLIGHT_MODE+MAX_FLIGHT_MODES-1,
|
||||||
|
|
||||||
|
SWSRC_TELEMETRY_STREAMING,
|
||||||
|
SWSRC_FIRST_SENSOR,
|
||||||
|
SWSRC_LAST_SENSOR = SWSRC_FIRST_SENSOR+MAX_SENSORS-1,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SWSRC_COUNT,
|
SWSRC_COUNT,
|
||||||
|
@ -1974,8 +1983,8 @@ enum CountDownModes {
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
PACK(typedef struct {
|
PACK(typedef struct {
|
||||||
int32_t mode:8; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
int32_t mode:9; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
|
||||||
uint32_t start:24;
|
uint32_t start:23;
|
||||||
int32_t value:24;
|
int32_t value:24;
|
||||||
uint32_t countdownBeep:2;
|
uint32_t countdownBeep:2;
|
||||||
uint32_t minuteBeep:1;
|
uint32_t minuteBeep:1;
|
||||||
|
|
|
@ -423,7 +423,7 @@
|
||||||
typedef int32_t rotenc_t;
|
typedef int32_t rotenc_t;
|
||||||
typedef int32_t getvalue_t;
|
typedef int32_t getvalue_t;
|
||||||
typedef uint32_t mixsrc_t;
|
typedef uint32_t mixsrc_t;
|
||||||
typedef int8_t swsrc_t;
|
typedef int32_t swsrc_t;
|
||||||
#else
|
#else
|
||||||
#define tmr10ms_t uint16_t
|
#define tmr10ms_t uint16_t
|
||||||
extern volatile tmr10ms_t g_tmr10ms;
|
extern volatile tmr10ms_t g_tmr10ms;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue