mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Fixes #2382: new atribute onlyPositive for telemetry sensor
Conflicts: radio/src/translations/it.h.txt
This commit is contained in:
parent
add90b3a88
commit
7312bd2655
17 changed files with 72 additions and 46 deletions
|
@ -193,6 +193,7 @@ enum SensorFields {
|
|||
SENSOR_FIELD_PARAM3,
|
||||
SENSOR_FIELD_PARAM4,
|
||||
SENSOR_FIELD_AUTOOFFSET,
|
||||
SENSOR_FIELD_ONLYPOSITIVE,
|
||||
SENSOR_FIELD_FILTER,
|
||||
SENSOR_FIELD_PERSISTENT,
|
||||
SENSOR_FIELD_LOGS,
|
||||
|
@ -445,6 +446,10 @@ void menuModelSensor(uint8_t event)
|
|||
ON_OFF_MENU_ITEM(sensor->autoOffset, SENSOR_2ND_COLUMN, y, STR_AUTOOFFSET, attr, event);
|
||||
break;
|
||||
|
||||
case SENSOR_FIELD_ONLYPOSITIVE:
|
||||
ON_OFF_MENU_ITEM(sensor->onlyPositive, SENSOR_2ND_COLUMN, y, STR_ONLYPOSITIVE, attr, event);
|
||||
break;
|
||||
|
||||
case SENSOR_FIELD_FILTER:
|
||||
ON_OFF_MENU_ITEM(sensor->filter, SENSOR_2ND_COLUMN, y, STR_FILTER, attr, event);
|
||||
break;
|
||||
|
|
|
@ -155,6 +155,7 @@ enum SensorFields {
|
|||
SENSOR_FIELD_PARAM3,
|
||||
SENSOR_FIELD_PARAM4,
|
||||
SENSOR_FIELD_AUTOOFFSET,
|
||||
SENSOR_FIELD_ONLYPOSITIVE,
|
||||
SENSOR_FIELD_FILTER,
|
||||
SENSOR_FIELD_PERSISTENT,
|
||||
SENSOR_FIELD_LOGS,
|
||||
|
@ -424,6 +425,10 @@ void menuModelSensor(uint8_t event)
|
|||
ON_OFF_MENU_ITEM(sensor->autoOffset, SENSOR_2ND_COLUMN, y, STR_AUTOOFFSET, attr, event);
|
||||
break;
|
||||
|
||||
case SENSOR_FIELD_ONLYPOSITIVE:
|
||||
ON_OFF_MENU_ITEM(sensor->onlyPositive, SENSOR_2ND_COLUMN, y, STR_ONLYPOSITIVE, attr, event);
|
||||
break;
|
||||
|
||||
case SENSOR_FIELD_FILTER:
|
||||
ON_OFF_MENU_ITEM(sensor->filter, SENSOR_2ND_COLUMN, y, STR_FILTER, attr, event);
|
||||
break;
|
||||
|
|
|
@ -1276,7 +1276,8 @@ PACK(typedef struct {
|
|||
uint8_t filter:1;
|
||||
uint8_t logs:1;
|
||||
uint8_t persistent:1;
|
||||
uint8_t spare:4;
|
||||
uint8_t onlyPositive:1;
|
||||
uint8_t spare:3;
|
||||
union {
|
||||
PACK(struct {
|
||||
uint16_t ratio;
|
||||
|
|
|
@ -273,6 +273,10 @@ void frskySportSetDefault(int index, uint16_t id, uint8_t instance)
|
|||
telemetrySensor.custom.ratio = 132;
|
||||
telemetrySensor.filter = 1;
|
||||
}
|
||||
else if (id >= CURR_FIRST_ID && id <= CURR_LAST_ID) {
|
||||
telemetrySensor.onlyPositive = 1;
|
||||
}
|
||||
// TODO set telemetrySensor.onlyPositive for other sensors that need it
|
||||
else if (unit == UNIT_RPMS) {
|
||||
telemetrySensor.custom.ratio = 1;
|
||||
telemetrySensor.custom.offset = 1;
|
||||
|
|
|
@ -599,10 +599,9 @@ int32_t TelemetrySensor::getValue(int32_t value, uint8_t unit, uint8_t prec) con
|
|||
|
||||
if (type == TELEM_TYPE_CUSTOM) {
|
||||
value += custom.offset;
|
||||
if (value < 0 && unit >= UNIT_VOLTS && unit <= UNIT_MPH) {
|
||||
if (value < 0 && onlyPositive) {
|
||||
value = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return value;
|
||||
|
|
|
@ -567,6 +567,7 @@ const pm_char STR_BLCOLOR[] PROGMEM = TR_BLCOLOR;
|
|||
const pm_char STR_GPSSENSOR[] PROGMEM = TR_GPSSENSOR;
|
||||
const pm_char STR_CURRENTSENSOR[] PROGMEM = TR_CURRENTSENSOR;
|
||||
const pm_char STR_AUTOOFFSET[] PROGMEM = TR_AUTOOFFSET;
|
||||
const pm_char STR_ONLYPOSITIVE[] PROGMEM = TR_ONLYPOSITIVE;
|
||||
const pm_char STR_FILTER[] PROGMEM = TR_FILTER;
|
||||
const pm_char STR_TELEMETRYFULL[] PROGMEM = TR_TELEMETRYFULL;
|
||||
#endif
|
||||
|
|
|
@ -783,6 +783,7 @@ extern const pm_char STR_BLCOLOR[];
|
|||
extern const pm_char STR_GPSSENSOR[];
|
||||
extern const pm_char STR_CURRENTSENSOR[];
|
||||
extern const pm_char STR_AUTOOFFSET[];
|
||||
extern const pm_char STR_ONLYPOSITIVE[];
|
||||
extern const pm_char STR_FILTER[];
|
||||
extern const pm_char STR_TELEMETRYFULL[];
|
||||
#endif
|
||||
|
|
|
@ -1076,6 +1076,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1080,6 +1080,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1075,6 +1075,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Curr. sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1030,6 +1030,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1030,6 +1030,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1067,6 +1067,7 @@
|
|||
#define TR_GPSSENSOR "Capteur GPS"
|
||||
#define TR_CURRENTSENSOR "Capt courant"
|
||||
#define TR_AUTOOFFSET "Offset auto"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filtrage"
|
||||
#define TR_TELEMETRYFULL "Plus de capteurs libres!"
|
||||
|
||||
|
|
|
@ -1030,6 +1030,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1079,6 +1079,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Curr. sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1030,6 +1030,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
|
@ -1030,6 +1030,7 @@
|
|||
#define TR_GPSSENSOR "GPS sensor"
|
||||
#define TR_CURRENTSENSOR "Current sensor"
|
||||
#define TR_AUTOOFFSET "Auto Offset"
|
||||
#define TR_ONLYPOSITIVE "Positive"
|
||||
#define TR_FILTER "Filter"
|
||||
#define TR_TELEMETRYFULL "All telemetry slots full!"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue