diff --git a/src/frsky.cpp b/src/frsky.cpp index 587e78908..798b67c93 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -810,7 +810,7 @@ void FrskyValueWithMinMax::set(uint8_t value, uint8_t unit) void frskyEvalCurrentConsumptionBoundary() { currentConsumptionBoundary = 3600; - if (g_model.frsky.currentSource > FRSKY_SOURCE_HUB) { + if (g_model.frsky.currentSource >= FRSKY_SOURCE_A1 && g_model.frsky.currentSource <= FRSKY_SOURCE_A2) { uint16_t divider = (g_model.frsky.channels[g_model.frsky.currentSource-FRSKY_SOURCE_A1].ratio << g_model.frsky.channels[g_model.frsky.currentSource-FRSKY_SOURCE_A1].multiplier); if (divider > 5) { currentConsumptionBoundary = 360000L / divider; @@ -1113,6 +1113,14 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm) return (50 + g_model.frsky.rssiAlarms[alarm].value); } +void displayVoltageScreenLine(uint8_t y, uint8_t index) +{ + putsStrIdx(0, y, STR_A, index+1, 0); + putsTelemetryChannel(3*FW+6*FW+4, y, index+MAX_TIMERS, frskyData.analog[index].value, DBLSIZE); + lcd_putc(12*FW-1, y-FH, '<'); putsTelemetryChannel(17*FW, y-FH, index+MAX_TIMERS, frskyData.analog[index].min, NO_UNIT); + lcd_putc(12*FW, y, '>'); putsTelemetryChannel(17*FW, y, index+MAX_TIMERS, frskyData.analog[index].max, NO_UNIT); +} + void menuProcFrsky(uint8_t event) { switch (event) { @@ -1249,28 +1257,43 @@ void menuProcFrsky(uint8_t event) displayRssiLine(); } else if (s_frsky_view == e_frsky_voltages) { - // Big A1 / A2 with min and max, cells, Amps, mAh - uint8_t blink; - uint8_t y = 2*FH; - for (uint8_t i=0; i<2; i++) { - if (g_model.frsky.channels[i].ratio) { - blink = (FRSKY_alarmRaised(i) ? INVERS : 0); - putsStrIdx(0, y, STR_A, i+1, 0); - putsTelemetryChannel(3*FW+6*FW+4, y, i+MAX_TIMERS, frskyData.analog[i].value, blink|DBLSIZE); - lcd_putc(12*FW-1, y-FH, '<'); putsTelemetryChannel(17*FW, y-FH, i+MAX_TIMERS, frskyData.analog[i].min, NO_UNIT); - lcd_putc(12*FW, y, '>'); putsTelemetryChannel(17*FW, y, i+MAX_TIMERS, frskyData.analog[i].max, NO_UNIT); - y += (g_model.frsky.currentSource == FRSKY_SOURCE_NONE) ? 3*FH : 2*FH; - } - else if (i > 0) { - y += FH; - } + // Volts / Amps / Watts / mAh + uint8_t other = 0; + lcd_putsiAtt(0, 2*FH, STR_VOLTSRC, g_model.frsky.voltsSource+1, 0); + switch(g_model.frsky.voltsSource) { + case 0: + case 1: + displayVoltageScreenLine(2*FH, g_model.frsky.voltsSource); + other = !g_model.frsky.voltsSource; + break; + case 2: + putsTelemetryChannel(3*FW+6*FW+4, 2*FH, TELEM_VFAS-1, frskyData.hub.vfas, DBLSIZE); + break; + case 3: + putsTelemetryChannel(3*FW+6*FW+4, 2*FH, TELEM_CELLS_SUM-1, frskyData.hub.cellsSum, DBLSIZE); + break; } - if (g_model.frsky.currentSource != FRSKY_SOURCE_NONE) { - if (g_model.frsky.currentSource == FRSKY_SOURCE_HUB) - putsTelemetryChannel(2, y, TELEM_CURRENT-1, frskyData.hub.current, LEFT|DBLSIZE); - putsTelemetryChannel(3*FW+4+4*FW+FW, y, TELEM_POWER-1, frskyData.power, DBLSIZE); - putsTelemetryChannel(3*FW+4+4*FW+6*FW+FW, y, TELEM_CONSUMPTION-1, frskyData.currentConsumption, DBLSIZE); + + if (g_model.frsky.currentSource) { + lcd_putsiAtt(0, 4*FH, STR_VOLTSRC, g_model.frsky.currentSource, 0); + switch(g_model.frsky.currentSource) { + case 1: + case 2: + displayVoltageScreenLine(4*FH, g_model.frsky.currentSource-1); + break; + case 3: + putsTelemetryChannel(3*FW+6*FW+4, 4*FH, TELEM_CURRENT-1, frskyData.hub.current, DBLSIZE); + break; + } + + putsTelemetryChannel(4*FW+4, 6*FH, TELEM_POWER-1, frskyData.power, DBLSIZE); + putsTelemetryChannel(3*FW+4+4*FW+6*FW+FW, 6*FH, TELEM_CONSUMPTION-1, frskyData.currentConsumption, DBLSIZE); } + else { + displayVoltageScreenLine(other ? 5*FH : 4*FH, other); + if (!other) displayVoltageScreenLine(6*FH, 1); + } + #ifdef FRSKY_HUB // Cells voltage if (frskyData.hub.cellsCount > 0) { diff --git a/src/model_menus.cpp b/src/model_menus.cpp index dd1f0ec6e..0b11cbf2c 100644 --- a/src/model_menus.cpp +++ b/src/model_menus.cpp @@ -2585,13 +2585,13 @@ void menuProcTelemetry(uint8_t event) case ITEM_TELEMETRY_USR_VOLTAGE_SOURCE: lcd_puts(4, y, STR_VOLTAGE); - lcd_putsiAtt(TELEM_COL2, y, STR_CURRENTSRC, g_model.frsky.voltsSource, attr); + lcd_putsiAtt(TELEM_COL2, y, STR_VOLTSRC, g_model.frsky.voltsSource+1, attr); if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.voltsSource, 0, 3); break; case ITEM_TELEMETRY_USR_CURRENT_SOURCE: lcd_puts(4, y, STR_CURRENT); - lcd_putsiAtt(TELEM_COL2, y, STR_CURRENTSRC, g_model.frsky.currentSource, attr); + lcd_putsiAtt(TELEM_COL2, y, STR_VOLTSRC, g_model.frsky.currentSource, attr); if (attr) CHECK_INCDEC_MODELVAR(event, g_model.frsky.currentSource, 0, 3); break; diff --git a/src/myeeprom.h b/src/myeeprom.h index 7f22b2286..2f44af76a 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -443,9 +443,10 @@ enum FrskyUsrProtocols { enum FrskySource { FRSKY_SOURCE_NONE, - FRSKY_SOURCE_HUB, FRSKY_SOURCE_A1, - FRSKY_SOURCE_A2 + FRSKY_SOURCE_A2, + FRSKY_SOURCE_FAS, + FRSKY_SOURCE_CELLS, }; #if defined(PCBARM) diff --git a/src/translations.cpp b/src/translations.cpp index d8775cda1..d14ab71e4 100644 --- a/src/translations.cpp +++ b/src/translations.cpp @@ -71,7 +71,7 @@ const pm_char STR_OPEN9X[] PROGMEM = ISTR(VALARMFN) ISTR(VTELPROTO) ISTR(GPSFORMAT) - ISTR(CURRENTSRC) + ISTR(VOLTSRC) ISTR(VARIOSRC) #endif #ifdef TEMPLATES diff --git a/src/translations.h b/src/translations.h index d094e4238..ca64d3f91 100644 --- a/src/translations.h +++ b/src/translations.h @@ -98,8 +98,8 @@ extern const pm_char STR_OPEN9X[]; #define OFS_VALARMFN (OFS_VALARM + sizeof(TR_VALARM)) #define OFS_VTELPROTO (OFS_VALARMFN + sizeof(TR_VALARMFN)) #define OFS_GPSFORMAT (OFS_VTELPROTO + sizeof(TR_VTELPROTO)) -#define OFS_CURRENTSRC (OFS_GPSFORMAT + sizeof(TR_GPSFORMAT)) -#define OFS_VARIOSRC (OFS_CURRENTSRC + sizeof(TR_CURRENTSRC)) +#define OFS_VOLTSRC (OFS_GPSFORMAT + sizeof(TR_GPSFORMAT)) +#define OFS_VARIOSRC (OFS_VOLTSRC + sizeof(TR_VOLTSRC)) #define OFS_ENDTELEM (OFS_VARIOSRC + sizeof(TR_VARIOSRC)) #else #define OFS_ENDTELEM (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS)) @@ -166,7 +166,7 @@ extern const pm_char STR_OPEN9X[]; #define STR_VALARMFN (STR_OPEN9X + OFS_VALARMFN) #define STR_VTELPROTO (STR_OPEN9X + OFS_VTELPROTO) #define STR_GPSFORMAT (STR_OPEN9X + OFS_GPSFORMAT) -#define STR_CURRENTSRC (STR_OPEN9X + OFS_CURRENTSRC) +#define STR_VOLTSRC (STR_OPEN9X + OFS_VOLTSRC) #define STR_VARIOSRC (STR_OPEN9X + OFS_VARIOSRC) #define STR_TELEMCHNS (STR_OPEN9X + OFS_TELEMCHNS) #endif diff --git a/src/translations/cz.h b/src/translations/cz.h index d03ac2ebf..056c1ce3e 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -186,8 +186,8 @@ #define TR_VTELPROTO "" #endif -#define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" +#define LEN_VOLTSRC "\003" +#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" diff --git a/src/translations/de.h b/src/translations/de.h index 8fdb04630..ac7a0b273 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -186,8 +186,8 @@ #define TR_VTELPROTO "" #endif -#define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" +#define LEN_VOLTSRC "\003" +#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" diff --git a/src/translations/en.h b/src/translations/en.h index fd77860bb..0eb15f514 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -187,8 +187,8 @@ #define TR_VTELPROTO "" #endif -#define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" +#define LEN_VOLTSRC "\003" +#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" diff --git a/src/translations/fr.h b/src/translations/fr.h index c08c351f8..c70086bd6 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -181,8 +181,8 @@ #define TR_VTELPROTO "" #endif -#define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" +#define LEN_VOLTSRC "\003" +#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" diff --git a/src/translations/it.h b/src/translations/it.h index 3505dd562..0e72d0765 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -186,8 +186,8 @@ #define TR_VTELPROTO "" #endif -#define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" +#define LEN_VOLTSRC "\003" +#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1\0 ""A2\0" diff --git a/src/translations/se.h b/src/translations/se.h index 1b0df60d1..1d75d2513 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -181,8 +181,8 @@ #define TR_VTELPROTO "" #endif -#define LEN_CURRENTSRC "\003" -#define TR_CURRENTSRC "---""Hub""A1\0""A2\0" +#define LEN_VOLTSRC "\003" +#define TR_VOLTSRC "---""A1\0""A2\0""FAS""Cel" #define LEN_VARIOSRC "\006" #define TR_VARIOSRC "BaroV1""BaroV2""A1 ""A2\0"