[ARM] Negative current values with PREC2, above 200.00A
This commit is contained in:
+4
-4
@@ -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;
|
||||
}
|
||||
|
||||
telvalue_t applyChannelRatio(uint8_t channel, telvalue_t val)
|
||||
lcdint_t applyChannelRatio(uint8_t channel, lcdint_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(xcoord_t x, uint8_t y, uint8_t channel, telvalue_t val, uint8_t att)
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att)
|
||||
{
|
||||
switch (channel) {
|
||||
case TELEM_TM1-1:
|
||||
@@ -1061,12 +1061,12 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, telvalue_t val
|
||||
channel -= TELEM_A1-1;
|
||||
// A1 and A2
|
||||
{
|
||||
telvalue_t converted_value = applyChannelRatio(channel, val);
|
||||
lcdint_t converted_value = applyChannelRatio(channel, val);
|
||||
if (g_model.frsky.channels[channel].type >= UNIT_RAW) {
|
||||
converted_value /= 10;
|
||||
}
|
||||
else {
|
||||
if (converted_value < 1000) {
|
||||
if (abs(converted_value) < 1000) {
|
||||
att |= PREC2;
|
||||
}
|
||||
else {
|
||||
|
||||
+2
-4
@@ -212,15 +212,13 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm);
|
||||
extern const pm_uint8_t bchunit_ar[];
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define telvalue_t int32_t
|
||||
#define FRSKY_MULTIPLIER_MAX 5
|
||||
#else
|
||||
#define telvalue_t int16_t
|
||||
#define 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);
|
||||
lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val);
|
||||
void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, uint8_t att);
|
||||
|
||||
#define IS_BARS_SCREEN(screenIndex) (g_model.frsky.screensType & (1<<(screenIndex)))
|
||||
|
||||
|
||||
+6
-2
@@ -348,12 +348,12 @@ void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val)
|
||||
lcd_outdezAtt(x, y, val);
|
||||
}
|
||||
|
||||
void lcd_outdezAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags flags)
|
||||
void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags)
|
||||
{
|
||||
lcd_outdezNAtt(x, y, val, flags);
|
||||
}
|
||||
|
||||
void lcd_outdezNAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags flags, uint8_t len)
|
||||
void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t len)
|
||||
{
|
||||
uint8_t fw = FWNUM;
|
||||
int8_t mode = MODE(flags);
|
||||
@@ -375,7 +375,11 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags flags, uint8_t
|
||||
|
||||
if (mode != MODE(LEADING0)) {
|
||||
len = 1;
|
||||
#if defined(CPUARM)
|
||||
uint32_t tmp = ((uint32_t)val) / 10;
|
||||
#else
|
||||
uint16_t tmp = ((uint16_t)val) / 10;
|
||||
#endif
|
||||
while (tmp) {
|
||||
len++;
|
||||
tmp /= 10;
|
||||
|
||||
@@ -55,6 +55,12 @@
|
||||
#define CENTER_OFS 0
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#define lcdint_t int32_t
|
||||
#else
|
||||
#define lcdint_t int16_t
|
||||
#endif
|
||||
|
||||
#if LCD_H > 64
|
||||
#define LCD_LINES 9
|
||||
#else
|
||||
@@ -159,8 +165,8 @@ extern void lcd_putsLeft(uint8_t y, const pm_char * s);
|
||||
#define lcd_putsCenter(y, s) lcd_puts((LCD_W-sizeof(TR_##s)*FW+FW-2)/2, y, STR_##s)
|
||||
|
||||
extern void lcd_outhex4(xcoord_t x, uint8_t y, uint16_t val);
|
||||
extern void lcd_outdezAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags mode=0);
|
||||
extern void lcd_outdezNAtt(xcoord_t x, uint8_t y, int16_t val, LcdFlags mode=0, uint8_t len=0);
|
||||
extern void lcd_outdezAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0);
|
||||
extern void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags mode=0, uint8_t len=0);
|
||||
extern void lcd_outdez8(xcoord_t x, uint8_t y, int8_t val);
|
||||
|
||||
extern void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att=0);
|
||||
|
||||
+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(xcoord_t x, uint8_t y, telvalue_t val, uint8_t unit, uint8_t att)
|
||||
void putsTelemetryValue(xcoord_t x, uint8_t y, lcdint_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(xcoord_t x, uint8_t y, telvalue_t val, uint8_t unit, uint8_t att);
|
||||
void putsTelemetryValue(xcoord_t x, uint8_t y, lcdint_t val, uint8_t unit, uint8_t att);
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
|
||||
Reference in New Issue
Block a user