1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Re #3454: sensor persistent fixes (ported from master)

* Only clear sensor.persistentValue when the sensor.persistent is disabled and not on every shutdown.
* Only show persistent option for calculated type sensors (only these actually get saved in EEPROM)
This commit is contained in:
Damjan Adamic 2016-05-02 19:38:57 +02:00
parent 97cc58e323
commit 3fb853c8b8
5 changed files with 10 additions and 13 deletions

View file

@ -156,7 +156,7 @@ enum SensorFields {
#define SENSOR_AUTOOFFSET_ROWS (sensor->unit != UNIT_RPMS && sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
#define SENSOR_ONLYPOS_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
#define SENSOR_FILTER_ROWS (sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
#define SENSOR_PERSISTENT_ROWS ((sensor->type == TELEM_TYPE_CALCULATED && sensor->formula == TELEM_FORMULA_CONSUMPTION) || sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW)
#define SENSOR_PERSISTENT_ROWS (sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : HIDDEN_ROW)
void menuModelSensor(uint8_t event)
{
@ -376,6 +376,9 @@ void menuModelSensor(uint8_t event)
case SENSOR_FIELD_PERSISTENT:
ON_OFF_MENU_ITEM(sensor->persistent, SENSOR_2ND_COLUMN, y, NO_INDENT(STR_PERSISTENT), attr, event);
if (checkIncDec_Ret && !sensor->persistent) {
sensor->persistentValue = 0;
}
break;
case SENSOR_FIELD_LOGS: