Issue 189 done (will be there only on ARM as we need 32bits calculations almost everywhere)
This commit is contained in:
+3
-3
@@ -77,7 +77,7 @@ uint16_t getChannelRatio(uint8_t channel)
|
||||
return (uint16_t)g_model.frsky.channels[channel].ratio << g_model.frsky.channels[channel].multiplier;
|
||||
}
|
||||
|
||||
int16_t applyChannelRatio(uint8_t channel, int16_t val)
|
||||
telvalue_t applyChannelRatio(uint8_t channel, telvalue_t val)
|
||||
{
|
||||
return ((int32_t)val+g_model.frsky.channels[channel].offset) * getChannelRatio(channel) * 2 / 51;
|
||||
}
|
||||
@@ -1045,7 +1045,7 @@ const pm_uint8_t bchunit_ar[] PROGMEM = {
|
||||
UNIT_METERS, // GPS Alt
|
||||
};
|
||||
|
||||
void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, int16_t val, uint8_t att)
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, telvalue_t val, uint8_t att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TM1-1:
|
||||
@@ -1061,7 +1061,7 @@ void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, int16_t val, ui
|
||||
channel -= TELEM_A1-1;
|
||||
// A1 and A2
|
||||
{
|
||||
int16_t converted_value = applyChannelRatio(channel, val);
|
||||
telvalue_t converted_value = applyChannelRatio(channel, val);
|
||||
if (g_model.frsky.channels[channel].type >= UNIT_RAW) {
|
||||
converted_value /= 10;
|
||||
}
|
||||
|
||||
+11
-2
@@ -210,8 +210,17 @@ int16_t convertCswTelemValue(CustomSwData * cs);
|
||||
NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm);
|
||||
|
||||
extern const pm_uint8_t bchunit_ar[];
|
||||
int16_t applyChannelRatio(uint8_t channel, int16_t val);
|
||||
void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, int16_t val, uint8_t att);
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define telvalue_t int32_t
|
||||
#define FRSKY_MULTIPLIER_MAX 5
|
||||
#else
|
||||
#define telvalue_t int16_t
|
||||
FRSKY_MULTIPLIER_MAX 3
|
||||
#endif
|
||||
|
||||
telvalue_t applyChannelRatio(uint8_t channel, telvalue_t val);
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, telvalue_t val, uint8_t att);
|
||||
|
||||
#define IS_BARS_SCREEN(screenIndex) (g_model.frsky.screensType & (1<<(screenIndex)))
|
||||
|
||||
|
||||
+1
-1
@@ -3301,7 +3301,7 @@ void menuModelTelemetry(uint8_t event)
|
||||
channel.multiplier--; channel.ratio = 255;
|
||||
}
|
||||
else if (ratio == 256) {
|
||||
if (channel.multiplier < 3) { channel.multiplier++; channel.ratio = 128; }
|
||||
if (channel.multiplier < FRSKY_MULTIPLIER_MAX) { channel.multiplier++; channel.ratio = 128; }
|
||||
}
|
||||
else {
|
||||
channel.ratio = ratio;
|
||||
|
||||
+14
-2
@@ -404,6 +404,18 @@ enum TelemetryUnit {
|
||||
UNIT_G,
|
||||
};
|
||||
|
||||
#if defined(CPUARM)
|
||||
PACK(typedef struct t_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
|
||||
}) FrSkyChannelData;
|
||||
#else
|
||||
PACK(typedef struct t_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;
|
||||
@@ -413,6 +425,7 @@ PACK(typedef struct t_FrSkyChannelData {
|
||||
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
|
||||
uint8_t multiplier:2; // 0=no multiplier, 1=*2 multiplier
|
||||
}) FrSkyChannelData;
|
||||
#endif
|
||||
|
||||
enum TelemetrySource {
|
||||
TELEM_NONE,
|
||||
@@ -503,7 +516,6 @@ enum FrskySource {
|
||||
#define MAX_FRSKY_SCREENS 3
|
||||
PACK(typedef struct t_FrSkyData {
|
||||
FrSkyChannelData channels[2];
|
||||
FrSkyRSSIAlarm rssiAlarms[2];
|
||||
uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh, 3=Halcyon
|
||||
uint8_t voltsSource;
|
||||
uint8_t blades; // How many blades for RPMs, 0=2 blades, 1=3 blades
|
||||
@@ -515,7 +527,7 @@ PACK(typedef struct t_FrSkyData {
|
||||
int8_t varioCenterMin;
|
||||
int8_t varioMin;
|
||||
int8_t varioMax;
|
||||
uint8_t spare[2];
|
||||
FrSkyRSSIAlarm rssiAlarms[2];
|
||||
}) FrSkyData;
|
||||
#else
|
||||
#define MAX_FRSKY_SCREENS 2
|
||||
|
||||
+1
-1
@@ -1140,7 +1140,7 @@ void setGVarValue(uint8_t idx, int8_t value, int8_t phase)
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY) || defined(CPUARM)
|
||||
void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att)
|
||||
void putsTelemetryValue(xcoord_t x, uint8_t y, telvalue_t val, uint8_t unit, uint8_t att)
|
||||
{
|
||||
#ifdef IMPERIAL_UNITS
|
||||
if (unit == UNIT_DEGREES) {
|
||||
|
||||
+1
-1
@@ -1220,7 +1220,7 @@ extern union ReusableBuffer reusableBuffer;
|
||||
void checkFlashOnBeep();
|
||||
|
||||
#if defined(FRSKY) || defined(CPUARM)
|
||||
void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att);
|
||||
void putsTelemetryValue(xcoord_t x, uint8_t y, telvalue_t val, uint8_t unit, uint8_t att);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
Reference in New Issue
Block a user