mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 17:55:19 +03:00
FrSky flash saving (64bytes)
Condensed display of Mixers lines in MIXER menu (by Max) MOD_EXTRA_ROTARY_ENCODERS added (by Max): on v4.1 it adds the support of an extension board for 3 more rotary encoders
This commit is contained in:
parent
9de279b819
commit
ddcf6db9f7
9 changed files with 97 additions and 36 deletions
|
@ -571,7 +571,7 @@ inline void FRSKY10mspoll(void)
|
|||
else {
|
||||
*ptr++ = (g_eeGeneral.beeperMode != e_mode_quiet ? ((2+alarm+g_model.frsky.rssiAlarms[alarm].level) % 4) : alarm_off);
|
||||
*ptr++ = 0x00 ;
|
||||
frskyPushValue(ptr, 50+g_model.frsky.rssiAlarms[alarm].value);
|
||||
frskyPushValue(ptr, getRssiAlarmValue(alarm));
|
||||
*ptr++ = (RSSI1PKT-alarm); // f7 - f6
|
||||
}
|
||||
|
||||
|
@ -936,11 +936,11 @@ void displayRssiLine()
|
|||
lcd_hline(0, 55, 128, 0); // separator
|
||||
lcd_putsLeft(7*FH+1, STR_TX); lcd_outdezNAtt(4*FW, 7*FH+1, frskyRSSI[1].value, LEADING0, 2);
|
||||
lcd_rect(25, 57, 38, 7);
|
||||
lcd_filled_rect(26, 58, 9*frskyRSSI[1].value/25, 5, (frskyRSSI[1].value < 50 + g_model.frsky.rssiAlarms[0].value) ? DOTTED : SOLID);
|
||||
lcd_filled_rect(26, 58, 9*frskyRSSI[1].value/25, 5, (frskyRSSI[1].value < getRssiAlarmValue(1)) ? DOTTED : SOLID);
|
||||
lcd_puts(105, 7*FH+1, STR_RX); lcd_outdezNAtt(105+4*FW-1, 7*FH+1, frskyRSSI[0].value, LEADING0, 2);
|
||||
lcd_rect(65, 57, 38, 7);
|
||||
uint8_t v = 9*frskyRSSI[0].value/25;
|
||||
lcd_filled_rect(66+36-v, 58, v, 5, (frskyRSSI[0].value < 50 + g_model.frsky.rssiAlarms[0].value) ? DOTTED : SOLID);
|
||||
lcd_filled_rect(66+36-v, 58, v, 5, (frskyRSSI[0].value < getRssiAlarmValue(0)) ? DOTTED : SOLID);
|
||||
}
|
||||
else {
|
||||
lcd_putsAtt(7*FW, 7*FH+1, STR_NODATA, BLINK);
|
||||
|
@ -1001,6 +1001,11 @@ uint8_t getTelemCustomField(uint8_t line, uint8_t col)
|
|||
return result;
|
||||
}
|
||||
|
||||
NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm)
|
||||
{
|
||||
return (50 + g_model.frsky.rssiAlarms[alarm].value);
|
||||
}
|
||||
|
||||
void menuProcFrsky(uint8_t event)
|
||||
{
|
||||
switch (event) {
|
||||
|
@ -1099,7 +1104,7 @@ void menuProcFrsky(uint8_t event)
|
|||
else if (source <= TELEM_A2)
|
||||
threshold = g_model.frsky.channels[source-TELEM_A1].alarms_value[0];
|
||||
else if (source <= TELEM_RSSI_RX)
|
||||
threshold = 50 + g_model.frsky.rssiAlarms[0].value; /* TODO flash saving, it's called 3 times */
|
||||
threshold = getRssiAlarmValue(source-TELEM_RSSI_TX);
|
||||
else
|
||||
threshold = convertTelemValue(source, barsThresholds[source-TELEM_ALT]);
|
||||
int16_t barMin = convertTelemValue(source, bmin);
|
||||
|
|
|
@ -174,6 +174,7 @@ void resetTelemetry();
|
|||
uint8_t getTelemCustomField(uint8_t line, uint8_t col);
|
||||
uint8_t maxTelemValue(uint8_t channel);
|
||||
int16_t convertTelemValue(uint8_t channel, uint8_t value);
|
||||
NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm);
|
||||
|
||||
void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, int16_t val, uint8_t att);
|
||||
void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att);
|
||||
|
|
|
@ -530,6 +530,9 @@ void putsFlightPhase(uint8_t x, uint8_t y, int8_t idx, uint8_t att)
|
|||
{
|
||||
if (idx==0) { lcd_putsiAtt(x, y, STR_MMMINV, 0, att); return; }
|
||||
if (idx < 0) { lcd_vlineStip(x-2, y, 8, 0x5E/*'!'*/); idx = -idx; }
|
||||
if (att & CONDENSED)
|
||||
lcd_outdezNAtt(x+FW*1, y, idx-1, (att & ~CONDENSED), 1);
|
||||
else
|
||||
putsStrIdx(x, y, STR_FP, idx-1, att);
|
||||
}
|
||||
|
||||
|
@ -584,7 +587,7 @@ void putsRotaryEncoderMode(uint8_t x, uint8_t y, uint8_t phase, uint8_t idx, uin
|
|||
lcd_putcAtt(x, y, '0'+p, att);
|
||||
}
|
||||
else {
|
||||
lcd_putcAtt(x, y, 'A'+idx, att);
|
||||
lcd_putcAtt(x, y, 'a'+idx, att);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -289,19 +289,28 @@ void menuMainView(uint8_t event)
|
|||
for (uint8_t i=0; i<8; i++) {
|
||||
int16_t val = g_chans512[8+i];
|
||||
int8_t len = limit((int16_t)0, (int16_t)(((val+1024) * BAR_HEIGHT) / 2048), (int16_t)BAR_HEIGHT);
|
||||
#if defined(PCBV4)
|
||||
V_BAR(SCREEN_WIDTH/2-5*3+5+i*5, SCREEN_HEIGHT-8, len)
|
||||
#if defined(PCBV4) && defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define V_BAR_W 4
|
||||
V_BAR(SCREEN_WIDTH/2-V_BAR_W*1+1+V_BAR_W*i, SCREEN_HEIGHT-8, len)
|
||||
#elif defined(PCBV4) //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#define V_BAR_W 5
|
||||
V_BAR(SCREEN_WIDTH/2-V_BAR_W*3+5+V_BAR_W*i, SCREEN_HEIGHT-8, len)
|
||||
#else
|
||||
V_BAR(SCREEN_WIDTH/2-5*4+2+i*5, SCREEN_HEIGHT-8, len)
|
||||
#define V_BAR_W 5
|
||||
V_BAR(SCREEN_WIDTH/2-V_BAR_W*4+2+V_BAR_W*i, SCREEN_HEIGHT-8, len)
|
||||
#endif
|
||||
}
|
||||
#if defined(PCBV4)
|
||||
for (uint8_t i=0; i<NUM_ROTARY_ENCODERS; i++) {
|
||||
for (uint8_t i=0; i<(NUM_ROTARY_ENCODERS); i++) {
|
||||
int16_t val = getRotaryEncoder(i);
|
||||
int8_t len = limit((int16_t)0, (int16_t)(((val+1024) * BAR_HEIGHT) / 2048), (int16_t)BAR_HEIGHT);
|
||||
V_BAR(SCREEN_WIDTH/2-5*6+5+i*5, SCREEN_HEIGHT-8, len)
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
V_BAR(SCREEN_WIDTH/2-V_BAR_W*7+1+V_BAR_W*i, SCREEN_HEIGHT-8, len)
|
||||
#else //MOD_EXTRA_ROTARY_ENCODERS
|
||||
V_BAR(SCREEN_WIDTH/2-V_BAR_W*6+5+V_BAR_W*i, SCREEN_HEIGHT-8, len)
|
||||
#endif //MOD_EXTRA_ROTARY_ENCODERS
|
||||
}
|
||||
#endif
|
||||
#endif //PCBV4
|
||||
for (uint8_t i=0; i<12; i++) {
|
||||
if ((i%6) < 3) lcd_puts(i<6 ? 2*FW-2 : 16*FW-2, (i%3)*FH+4*FH, STR_SW);
|
||||
lcd_putcAtt((i<6 ? 2*FW-2 : 16*FW-2) + 2 * FW + ((i%6) < 3 ? 0 : FW), (i%3)*FH+4*FH, i<9 ? '1'+i : 'A'+i-9, getSwitch(10+i, 0) ? INVERS : 0);
|
||||
|
|
|
@ -594,11 +594,7 @@ void menuProcPhaseOne(uint8_t event)
|
|||
PhaseData *phase = phaseaddress(s_currIdx);
|
||||
putsFlightPhase(13*FW, 0, s_currIdx+1, 0);
|
||||
|
||||
#if defined(PCBV4)
|
||||
#define MAX_TRIM_LINE 5
|
||||
#else
|
||||
#define MAX_TRIM_LINE 3
|
||||
#endif
|
||||
#define MAX_TRIM_LINE (3+NUM_ROTARY_ENCODERS)
|
||||
|
||||
SUBMENU(STR_MENUFLIGHTPHASE, (s_currIdx==0 ? 3 : 5), {ZCHAR|(sizeof(phase->name)-1), 0, MAX_TRIM_LINE, 0/*, 0*/});
|
||||
|
||||
|
@ -689,11 +685,24 @@ void menuProcPhasesAll(uint8_t event)
|
|||
uint8_t y=(i+1)*FH;
|
||||
att = i==sub ? INVERS : 0;
|
||||
PhaseData *p = phaseaddress(i);
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
// lcd_outdezNAtt(0, y, i, att|LEFT, 1);
|
||||
putsFlightPhase(0, y, i+1, att|CONDENSED);
|
||||
#else //MOD_EXTRA_ROTARY_ENCODERS
|
||||
putsFlightPhase(0, y, i+1, att);
|
||||
#endif //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#if defined PCBV4
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define NAME_OFS (-4-12)
|
||||
#define SWITCH_OFS (-FW/2-2-13)
|
||||
#define TRIMS_OFS (-FW/2-4-15)
|
||||
#define ROTARY_ENC_OFS (0)
|
||||
#else //!MOD_EXTRA_ROTARY_ENCODERS
|
||||
#define NAME_OFS (-4)
|
||||
#define SWITCH_OFS (-FW/2-2)
|
||||
#define TRIMS_OFS (-FW/2-4)
|
||||
#define ROTARY_ENC_OFS (2)
|
||||
#endif //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#else
|
||||
#define NAME_OFS 0
|
||||
#define SWITCH_OFS (FW/2)
|
||||
|
@ -710,7 +719,7 @@ void menuProcPhasesAll(uint8_t event)
|
|||
}
|
||||
#if defined PCBV4
|
||||
for (uint8_t t=0; t<NUM_ROTARY_ENCODERS; t++) {
|
||||
putsRotaryEncoderMode((19+t)*FW+TRIMS_OFS+2, y, i, t, 0);
|
||||
putsRotaryEncoderMode((19+t)*FW+TRIMS_OFS+ROTARY_ENC_OFS, y, i, t, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -1273,24 +1282,26 @@ inline void displayMixerLine(uint8_t row, uint8_t mix, uint8_t ch, uint8_t idx,
|
|||
uint8_t y = (row-s_pgOfs)*FH;
|
||||
MixData *md = mixaddress(mix);
|
||||
if (idx > 0)
|
||||
lcd_putsiAtt(FW, y, STR_VMLTPX2, md->mltpx, 0);
|
||||
lcd_putsiAtt(1*FW+0, y, STR_VMLTPX2, md->mltpx, 0);
|
||||
|
||||
putsMixerSource(4*FW+2, y, md->srcRaw, 0);
|
||||
putsMixerSource(4*FW+0, y, md->srcRaw, 0);
|
||||
|
||||
uint8_t attr = ((s_copyMode || cur != row) ? 0 : INVERS);
|
||||
lcd_outdezAtt(11*FW+7, y, md->weight, attr);
|
||||
lcd_outdezAtt(11*FW+3, y, md->weight, attr);
|
||||
if (attr != 0)
|
||||
CHECK_INCDEC_MODELVAR(event, md->weight, -125, 125);
|
||||
|
||||
if (md->curve) putsCurve(12*FW+7, y, md->curve);
|
||||
if (md->swtch) putsSwitches(16*FW+6, y, md->swtch);
|
||||
if (md->curve) putsCurve(12*FW+2, y, md->curve);
|
||||
if (md->swtch) putsSwitches(15*FW+5, y, md->swtch);
|
||||
|
||||
char cs = ' ';
|
||||
if (md->speedDown || md->speedUp)
|
||||
cs = 'S';
|
||||
if ((md->delayUp || md->delayDown))
|
||||
cs = (cs =='S' ? '*' : 'D');
|
||||
lcd_putcAtt(20*FW+3, y, cs, 0);
|
||||
lcd_putcAtt(18*FW+6, y, cs, 0);
|
||||
|
||||
putsFlightPhase(20*FW+3, y, md->phase, 0|CONDENSED);
|
||||
|
||||
if (s_copyMode) {
|
||||
if ((s_copyMode==COPY_MODE || s_copyTgtOfs == 0) && s_copySrcCh == ch && mix == (s_copySrcIdx + (s_copyTgtOfs<0))) {
|
||||
|
@ -1300,7 +1311,7 @@ inline void displayMixerLine(uint8_t row, uint8_t mix, uint8_t ch, uint8_t idx,
|
|||
|
||||
if (row == cur) {
|
||||
/* invert the raw when it's the current one */
|
||||
lcd_filled_rect(23, y, DISPLAY_W-1-23, 7);
|
||||
lcd_filled_rect(22, y-1, DISPLAY_W-1-21, 9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1943,7 +1954,7 @@ void menuProcTelemetry(uint8_t event)
|
|||
lcd_puts(4, y, STR_ALARM);
|
||||
lcd_putsiAtt(TELEM_COL2, y, STR_VALARM, ((2+j+g_model.frsky.rssiAlarms[j].level)%4), (sub==subN && m_posHorz==0) ? blink : 0);
|
||||
lcd_putc(TELEM_COL2+4*FW, y, '<');
|
||||
lcd_outdezNAtt(TELEM_COL2+6*FW, y, 50+g_model.frsky.rssiAlarms[j].value, LEFT|((sub==subN && m_posHorz==1) ? blink : 0), 3);
|
||||
lcd_outdezNAtt(TELEM_COL2+6*FW, y, getRssiAlarmValue(j), LEFT|((sub==subN && m_posHorz==1) ? blink : 0), 3);
|
||||
|
||||
if (sub==subN && (s_editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
|
|
|
@ -386,13 +386,21 @@ PACK(typedef struct t_SwashRingData { // Swash Ring data
|
|||
#define TRIM_MIN (-TRIM_MAX)
|
||||
|
||||
#if defined(PCBV4)
|
||||
#define NUM_ROTARY_ENCODERS 2
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define NUM_EXTRA_ROTARY_ENCODERS 3
|
||||
#define VPOT_STEP 5
|
||||
#define VPOT_MAX 1000
|
||||
#define VPOT_MIN -VPOT_MAX
|
||||
#else //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#define NUM_EXTRA_ROTARY_ENCODERS 3
|
||||
#endif //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#define NUM_ROTARY_ENCODERS (2+NUM_EXTRA_ROTARY_ENCODERS)
|
||||
#define ROTARY_ENCODER_MAX 1024
|
||||
#define ROTARY_ENCODER_ARRAY int16_t rotaryEncoders[NUM_ROTARY_ENCODERS];
|
||||
#else
|
||||
#else //PCBV4
|
||||
#define NUM_ROTARY_ENCODERS 0
|
||||
#define ROTARY_ENCODER_ARRAY
|
||||
#endif
|
||||
#endif //PCBV4
|
||||
|
||||
|
||||
PACK(typedef struct t_PhaseData {
|
||||
|
|
|
@ -34,7 +34,11 @@
|
|||
|
||||
#define LEN_RETA123 "\001"
|
||||
#if defined(PCBV4)
|
||||
#define TR_RETA123 "RETA123AB"
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define TR_RETA123 "RETA123abcde"
|
||||
#else //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#define TR_RETA123 "RETA123ab"
|
||||
#endif //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#else
|
||||
#define TR_RETA123 "RETA123"
|
||||
#endif
|
||||
|
@ -142,7 +146,11 @@
|
|||
|
||||
#define LEN_VSRCRAW "\004"
|
||||
#if defined(PCBV4)
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REA ""REB "
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REa ""REb ""REc ""REd ""REe "
|
||||
#else
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REa ""REb "
|
||||
#endif
|
||||
#else
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,11 @@
|
|||
|
||||
#define LEN_RETA123 "\001"
|
||||
#if defined(PCBV4)
|
||||
#define TR_RETA123 "RETA123AB"
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define TR_RETA123 "RETA123abcde"
|
||||
#else //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#define TR_RETA123 "RETA123ab"
|
||||
#endif //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#else
|
||||
#define TR_RETA123 "RETA123"
|
||||
#endif
|
||||
|
@ -143,7 +147,11 @@
|
|||
|
||||
#define LEN_VSRCRAW "\004"
|
||||
#if defined(PCBV4)
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REA ""REB "
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REa ""REb ""REc ""REd ""REe "
|
||||
#else
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REa ""REb "
|
||||
#endif
|
||||
#else
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW
|
||||
#endif
|
||||
|
|
|
@ -34,7 +34,11 @@
|
|||
|
||||
#define LEN_RETA123 "\001"
|
||||
#if defined(PCBV4)
|
||||
#define TR_RETA123 "RETA123AB"
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define TR_RETA123 "RETA123abcde"
|
||||
#else //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#define TR_RETA123 "RETA123ab"
|
||||
#endif //MOD_EXTRA_ROTARY_ENCODERS
|
||||
#else
|
||||
#define TR_RETA123 "RETA123"
|
||||
#endif
|
||||
|
@ -142,7 +146,11 @@
|
|||
|
||||
#define LEN_VSRCRAW "\004"
|
||||
#if defined(PCBV4)
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REA ""REB "
|
||||
#if defined(MOD_EXTRA_ROTARY_ENCODERS)
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REa ""REb ""REc ""REd ""REe "
|
||||
#else
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW "REa ""REb "
|
||||
#endif
|
||||
#else
|
||||
#define TR_ROTARY_ENCODERS_VSRCRAW
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue