diff --git a/src/eeprom_rlc.cpp b/src/eeprom_rlc.cpp index 6b89df08f..a56834186 100644 --- a/src/eeprom_rlc.cpp +++ b/src/eeprom_rlc.cpp @@ -964,6 +964,11 @@ void eeLoadModel(uint8_t id) } #endif +#if defined(CPUARM) + if(g_model.frsky.mAhPersistent) + frskyData.hub.currentConsumption = g_model.frsky.storedMah; +#endif + LOAD_MODEL_CURVES(); resumeMixerCalculations(); diff --git a/src/gui/menu_model.cpp b/src/gui/menu_model.cpp index 419a9dded..d94e42ebf 100644 --- a/src/gui/menu_model.cpp +++ b/src/gui/menu_model.cpp @@ -5167,6 +5167,9 @@ enum menuModelTelemetryItems { #endif ITEM_TELEMETRY_USR_VOLTAGE_SOURCE, ITEM_TELEMETRY_USR_CURRENT_SOURCE, +#if defined(CPUARM) + ITEM_TELEMTETRY_PERSISTENT_MAH, +#endif IF_VARIO(ITEM_TELEMETRY_VARIO_LABEL) #if defined(VARIO) ITEM_TELEMETRY_VARIO_SOURCE, @@ -5246,7 +5249,7 @@ enum menuModelTelemetryItems { void menuModelTelemetry(uint8_t event) { - MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, CHANNEL_ROWS CHANNEL_ROWS RSSI_ROWS USRDATA_LINES 0, 0, IF_VARIO(LABEL(Vario)) IF_VARIO(0) IF_VARIO(VARIO_RANGE_ROWS) CASE_PCBTARANIS(LABEL(TopBar)) CASE_PCBTARANIS(0) SCREEN_TYPE_ROWS, 2, 2, 2, 2, SCREEN_TYPE_ROWS, 2, 2, 2, 2, IF_CPUARM(SCREEN_TYPE_ROWS) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) }); + MENU(STR_MENUTELEMETRY, menuTabModel, e_Telemetry, ITEM_TELEMETRY_MAX+1, {0, CHANNEL_ROWS CHANNEL_ROWS RSSI_ROWS USRDATA_LINES 0, 0, IF_CPUARM(0) IF_VARIO(LABEL(Vario)) IF_VARIO(0) IF_VARIO(VARIO_RANGE_ROWS) CASE_PCBTARANIS(LABEL(TopBar)) CASE_PCBTARANIS(0) SCREEN_TYPE_ROWS, 2, 2, 2, 2, SCREEN_TYPE_ROWS, 2, 2, 2, 2, IF_CPUARM(SCREEN_TYPE_ROWS) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) IF_CPUARM(2) }); uint8_t sub = m_posVert - 1; @@ -5417,6 +5420,12 @@ void menuModelTelemetry(uint8_t event) if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.currentSource, 3); break; +#if defined(CPUARM) + case ITEM_TELEMTETRY_PERSISTENT_MAH: + g_model.frsky.mAhPersistent = onoffMenuItem(g_model.frsky.mAhPersistent, TELEM_COL2, y, STR_PERSISTENT_MAH, attr, event); + break; +#endif + #if defined(VARIO) case ITEM_TELEMETRY_VARIO_LABEL: lcd_putsLeft(y, STR_VARIO); diff --git a/src/myeeprom.h b/src/myeeprom.h index 8c1e5ee97..60238e09d 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -986,6 +986,8 @@ PACK(typedef struct t_FrSkyData { int8_t varioMin; int8_t varioMax; FrSkyRSSIAlarm rssiAlarms[2]; + uint16_t mAhPersistent:1; + uint16_t storedMah:15; }) FrSkyData; #else #define MAX_FRSKY_SCREENS 2 diff --git a/src/opentx.cpp b/src/opentx.cpp index af3e7dd27..c556e3843 100644 --- a/src/opentx.cpp +++ b/src/opentx.cpp @@ -4138,6 +4138,17 @@ void opentxClose() hapticOff(); #endif +#if defined(CPUARM) + if((g_model.frsky.mAhPersistent) && (g_model.frsky.storedMah != frskyData.hub.currentConsumption)) { + g_model.frsky.storedMah = frskyData.hub.currentConsumption; + eeDirty(EE_MODEL); + } + else if((!g_model.frsky.mAhPersistent) && (g_model.frsky.storedMah != 0)){ + g_model.frsky.storedMah = 0; + eeDirty(EE_MODEL); + } +#endif + saveTimers(); #if defined(PCBSKY9X) diff --git a/src/translations.cpp b/src/translations.cpp index 30da30766..98d62ab7b 100644 --- a/src/translations.cpp +++ b/src/translations.cpp @@ -355,6 +355,7 @@ const pm_char STR_BEEP_VOLUME[] PROGMEM = INDENT TR_BEEP_VOLUME; const pm_char STR_WAV_VOLUME[] PROGMEM = INDENT TR_WAV_VOLUME; const pm_char STR_VARIO_VOLUME[] PROGMEM = INDENT TR_VARIO_VOLUME; const pm_char STR_BG_VOLUME[] PROGMEM = INDENT TR_BG_VOLUME; +const pm_char STR_PERSISTENT_MAH[] PROGMEM = TR_PERSISTENT_MAH; #endif #if defined(NAVIGATION_MENUS) diff --git a/src/translations.h b/src/translations.h index 212b1e286..4a3e0600a 100644 --- a/src/translations.h +++ b/src/translations.h @@ -492,6 +492,7 @@ extern const pm_char STR_CURRENT[]; extern const pm_char STR_WAV_VOLUME[]; extern const pm_char STR_VARIO_VOLUME[]; extern const pm_char STR_BG_VOLUME[]; + extern const pm_char STR_PERSISTENT_MAH[]; #else #define LEN_CALIB_FIELDS PSIZE(TR_BATT_CALIB) #endif diff --git a/src/translations/cz.h b/src/translations/cz.h index d8d60db6c..dca96c257 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Rozsah kan\200l\211" #define TR_LOWALARM INDENT "N\204zk\212 Alarm" #define TR_CRITICALALARM INDENT "Kritick\212 Alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/cz.h.txt b/src/translations/cz.h.txt index ce7ede79a..145783ff3 100644 --- a/src/translations/cz.h.txt +++ b/src/translations/cz.h.txt @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Rozsah kanálů" #define TR_LOWALARM INDENT "Nízký Alarm" #define TR_CRITICALALARM INDENT "Kritický Alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/de.h b/src/translations/de.h index ed53dc576..a5ff6746a 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -662,6 +662,7 @@ #define TR_CHANNELRANGE INDENT "Ausgangs Kan\201le" #define TR_LOWALARM INDENT "Low Alarm" #define TR_CRITICALALARM INDENT "Kritisch Alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/de.h.txt b/src/translations/de.h.txt index 19d68b736..3410e2f15 100644 --- a/src/translations/de.h.txt +++ b/src/translations/de.h.txt @@ -662,6 +662,7 @@ #define TR_CHANNELRANGE INDENT "Ausgangs Kan\201le" #define TR_LOWALARM INDENT "Low Alarm" #define TR_CRITICALALARM INDENT "Kritisch Alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/en.h b/src/translations/en.h index b82468e9c..62876daf9 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -666,6 +666,7 @@ #define TR_CHANNELRANGE INDENT "Channel Range" #define TR_LOWALARM INDENT "Low Alarm" #define TR_CRITICALALARM INDENT "Critical Alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/es.h b/src/translations/es.h index 26ac1b433..6efdcf038 100644 --- a/src/translations/es.h +++ b/src/translations/es.h @@ -1,4 +1,4 @@ -/* +/* * Authors (alphabetical order) * - Bertrand Songis * - Bernet Andre @@ -613,7 +613,7 @@ #define TR_SD_TYPE "Tipo:" #define TR_SD_SPEED "Velocidad:" #define TR_SD_SECTORS "Sectores:" -#define TR_SD_SIZE "Tamaño:" +#define TR_SD_SIZE "Tama\201o:" #define TR_TYPE "Tipo" #define TR_GLOBAL_VARS "Global Variables" #define TR_GLOBAL_VAR "Global Variable" @@ -653,12 +653,13 @@ #define TR_RESET_BTN "[Reset]" #define TR_SET "[Ajuste]" #define TR_TRAINER "Aprendiz" -#define TR_ANTENNAPROBLEM CENTER "¡Problema antena TX!" +#define TR_ANTENNAPROBLEM CENTER "¡Problema antena TX!" #define TR_MODELIDUSED TR("ID en uso", "ID modelo en uso") #define TR_MODULE INDENT "Modulo" #define TR_CHANNELRANGE INDENT "Gama de canales" #define TR_LOWALARM INDENT "Alarma baja" #define TR_CRITICALALARM INDENT "Alarma Critica" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/es.h.txt b/src/translations/es.h.txt index 1d536a0cb..49be12fc1 100644 --- a/src/translations/es.h.txt +++ b/src/translations/es.h.txt @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Gama de canales" #define TR_LOWALARM INDENT "Alarma baja" #define TR_CRITICALALARM INDENT "Alarma Critica" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/fr.h b/src/translations/fr.h index bff8e6c19..c2023571f 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Plage de canaux" #define TR_LOWALARM INDENT "Alarme basse" #define TR_CRITICALALARM INDENT "Alarme critique" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/fr.h.txt b/src/translations/fr.h.txt index 8bc89a13c..34604f7a6 100644 --- a/src/translations/fr.h.txt +++ b/src/translations/fr.h.txt @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Plage de canaux" #define TR_LOWALARM INDENT "Alarme basse" #define TR_CRITICALALARM INDENT "Alarme critique" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/it.h b/src/translations/it.h index a815d04ae..2e4945d49 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Numero Canali" #define TR_LOWALARM INDENT "Allarme Basso" #define TR_CRITICALALARM INDENT "Allarme Critico" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/it.h.txt b/src/translations/it.h.txt index a70f04983..3a2c62fca 100644 --- a/src/translations/it.h.txt +++ b/src/translations/it.h.txt @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Numero Canali" #define TR_LOWALARM INDENT "Allarme Basso" #define TR_CRITICALALARM INDENT "Allarme Critico" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/pl.h b/src/translations/pl.h index 58f24cf18..ef4afe289 100644 --- a/src/translations/pl.h +++ b/src/translations/pl.h @@ -660,6 +660,7 @@ #define TR_CHANNELRANGE INDENT "Zakres kana\203u" #define TR_LOWALARM INDENT "Alarm niski" #define TR_CRITICALALARM INDENT "Alarm krytyczny" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/pl.h.txt b/src/translations/pl.h.txt index 832b1cd49..5525754ed 100644 --- a/src/translations/pl.h.txt +++ b/src/translations/pl.h.txt @@ -660,6 +660,7 @@ #define TR_CHANNELRANGE INDENT "Zakres kanału" #define TR_LOWALARM INDENT "Alarm niski" #define TR_CRITICALALARM INDENT "Alarm krytyczny" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/pt.h b/src/translations/pt.h index cd57ce0f5..691c840af 100644 --- a/src/translations/pt.h +++ b/src/translations/pt.h @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Channel Range" #define TR_LOWALARM INDENT "Low Alarm" #define TR_CRITICALALARM INDENT "Critical Alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/pt.h.txt b/src/translations/pt.h.txt index cd57ce0f5..691c840af 100644 --- a/src/translations/pt.h.txt +++ b/src/translations/pt.h.txt @@ -659,6 +659,7 @@ #define TR_CHANNELRANGE INDENT "Channel Range" #define TR_LOWALARM INDENT "Low Alarm" #define TR_CRITICALALARM INDENT "Critical Alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/se.h b/src/translations/se.h index 9f9e10ce5..de22c6599 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -662,6 +662,7 @@ #define TR_CHANNELRANGE INDENT "Kanalomr\200de" #define TR_LOWALARM INDENT "L\200g-alarm" #define TR_CRITICALALARM INDENT "Kritiskt alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI" diff --git a/src/translations/se.h.txt b/src/translations/se.h.txt index 3b0e36086..68de29549 100644 --- a/src/translations/se.h.txt +++ b/src/translations/se.h.txt @@ -662,6 +662,7 @@ #define TR_CHANNELRANGE INDENT "Kanalområde" #define TR_LOWALARM INDENT "Låg-alarm" #define TR_CRITICALALARM INDENT "Kritiskt alarm" +#define TR_PERSISTENT_MAH INDENT "Store mAh" #if defined(MAVLINK) #define TR_MAVLINK_RC_RSSI_SCALE_LABEL "Max RSSI"