diff --git a/src/frsky.cpp b/src/frsky.cpp index 9c49d941d..98a5d48a2 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -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); diff --git a/src/frsky.h b/src/frsky.h index 433409347..9da0a0e8d 100644 --- a/src/frsky.h +++ b/src/frsky.h @@ -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); diff --git a/src/lcd.cpp b/src/lcd.cpp index a2da09f1f..3b111d155 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -530,7 +530,10 @@ 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; } - putsStrIdx(x, y, STR_FP, idx-1, att); + if (att & CONDENSED) + lcd_outdezNAtt(x+FW*1, y, idx-1, (att & ~CONDENSED), 1); + else + putsStrIdx(x, y, STR_FP, idx-1, att); } void putsCurve(uint8_t x, uint8_t y, int8_t idx, uint8_t 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 diff --git a/src/main_views.cpp b/src/main_views.cpp index bda7b471d..dca7f2f4d 100644 --- a/src/main_views.cpp +++ b/src/main_views.cpp @@ -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; iname)-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 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))) { /* draw a border around the raw on selection mode (copy/move) */ @@ -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) { diff --git a/src/myeeprom.h b/src/myeeprom.h index 98768ab36..ddeb65d29 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -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 { diff --git a/src/translations/en.h b/src/translations/en.h index b930b55eb..7897f690b 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -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 diff --git a/src/translations/fr.h b/src/translations/fr.h index 95404ed8e..37e2efe89 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -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 diff --git a/src/translations/se.h b/src/translations/se.h index d8eec0da9..cae2a4799 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -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