Allow to disable telemetry alarams (#4981)

* Allow to disable telemetry alarams

This mainly useful for cheap transceivers that have telemetry but no power amplifier and very limited range of often 10-20 meters. This includes fishpepper's tinyFISH FC (and its legal/illegal clones) and also Spektrum BNF models.

* Always disable a warning when RSSI Warnings are disabled

* Compile fix

* Fix typos, also mute sensor lost

Refactor the FrskyRSSIAlarm[2] into a EEPROM compatible RssiAlarm struct

* Compile fixes

* Also refactor Companion

* Cleanup unused datastruct on ARM

* Compile fix for AVR

* Change int to uin8_t for avr

* Fix strings
This commit is contained in:
Arne Schwabe
2017-06-14 23:34:27 +02:00
committed by Bertrand Songis
parent 656daa75fa
commit 8e07f9b0f4
32 changed files with 297 additions and 187 deletions
+24 -23
View File
@@ -468,11 +468,22 @@ PACK(struct ScriptData {
/*
* Frsky Telemetry structure
*/
#if defined(CPUARM)
PACK(struct RssiAlarmData {
int8_t disabled:1;
int8_t spare:1;
int8_t warning:6;
int8_t spare2:2;
int8_t critical:6;
inline int8_t getWarningRssi() {return 45 + warning;}
inline int8_t getCriticalRssi() {return 42 + critical;}
});
#else
PACK(struct FrSkyRSSIAlarm {
int8_t level:2;
int8_t value:6;
});
#endif
#if defined(CPUARM)
typedef int16_t ls_telemetry_value_t;
@@ -508,27 +519,15 @@ union FrSkyScreenData {
#endif
#if defined(COLORLCD)
PACK(struct FrSkyTelemetryData {
PACK(struct FrSkyTelemetryData { // TODO EEPROM change, rename to VarioData
uint8_t varioSource:7;
uint8_t varioCenterSilent:1;
int8_t varioCenterMax;
int8_t varioCenterMin;
int8_t varioMin;
int8_t varioMax;
FrSkyRSSIAlarm rssiAlarms[2];
});
#elif defined(CPUARM)
PACK(struct FrSkyChannelData {
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
int16_t offset:12;
uint16_t type:4; // channel unit (0=volts, ...)
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t alarms_level:4;
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
uint8_t spare:2;
uint8_t multiplier; // 0=no multiplier, 1=*2 multiplier
});
// TODO remove this also on Taranis
PACK(struct FrSkyTelemetryData {
uint8_t voltsSource;
@@ -541,7 +540,6 @@ PACK(struct FrSkyTelemetryData {
int8_t varioCenterMin;
int8_t varioMin;
int8_t varioMax;
FrSkyRSSIAlarm rssiAlarms[2];
});
#else
PACK(struct FrSkyChannelData {
@@ -756,7 +754,9 @@ typedef uint8_t swarnenable_t;
#define MODEL_GVARS_DATA GVarData gvars[MAX_GVARS];
#endif
#if defined(TELEMETRY_MAVLINK)
#if defined(CPUARM)
#define TELEMETRY_DATA NOBACKUP(FrSkyTelemetryData frsky); NOBACKUP(RssiAlarmData rssiAlarms);
#elif defined(TELEMETRY_MAVLINK)
#define TELEMETRY_DATA MavlinkTelemetryData mavlink;
#elif defined(TELEMETRY_FRSKY) || !defined(PCBSTD)
#define TELEMETRY_DATA NOBACKUP(FrSkyTelemetryData frsky);
@@ -1082,7 +1082,7 @@ static inline void check_struct()
CHKSIZE(FrSkyBarData, 6);
CHKSIZE(FrSkyLineData, 4);
CHKTYPE(union FrSkyScreenData, 24);
CHKSIZE(FrSkyTelemetryData, 106);
CHKSIZE(FrSkyTelemetryData, 104);
CHKSIZE(ModelHeader, 12);
CHKSIZE(CurveData, 4);
@@ -1101,7 +1101,7 @@ static inline void check_struct()
CHKSIZE(FrSkyBarData, 6);
CHKSIZE(FrSkyLineData, 6);
CHKTYPE(union FrSkyScreenData, 24);
CHKSIZE(FrSkyTelemetryData, 106);
CHKSIZE(FrSkyTelemetryData, 104);
CHKSIZE(ModelHeader, 24);
CHKSIZE(CurveData, 4);
#if defined(PCBX9E)
@@ -1123,7 +1123,7 @@ static inline void check_struct()
CHKSIZE(TimerData, 16);
CHKSIZE(SwashRingData, 8);
CHKSIZE(FrSkyTelemetryData, 7);
CHKSIZE(FrSkyTelemetryData, 5);
CHKSIZE(ModelHeader, 27);
CHKSIZE(CurveData, 4);
CHKSIZE(RadioData, 847);
@@ -1140,7 +1140,7 @@ static inline void check_struct()
CHKSIZE(SwashRingData, 8);
CHKSIZE(FrSkyBarData, 5);
CHKSIZE(FrSkyLineData, 2);
CHKSIZE(FrSkyTelemetryData, 90);
CHKSIZE(FrSkyTelemetryData, 88);
CHKSIZE(ModelHeader, 12);
CHKTYPE(CurveData, 4);
CHKSIZE(RadioData, 727);
@@ -1184,9 +1184,6 @@ static inline void check_struct()
#if defined(CPUARM)
CHKSIZE(LogicalSwitchData, 9);
#if !defined(COLORLCD)
CHKSIZE(FrSkyChannelData, 7);
#endif
CHKSIZE(TelemetrySensor, 13);
CHKSIZE(ModuleData,70);
#else
@@ -1199,7 +1196,11 @@ static inline void check_struct()
CHKSIZE(GVarData, 7);
#endif
#if defined(CPUARM)
CHKSIZE(RssiAlarmData, 2);
#else
CHKSIZE(FrSkyRSSIAlarm, 1);
#endif
CHKSIZE(TrainerData, 16);
#undef CHKSIZE