[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;
|
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;
|
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
|
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) {
|
switch (channel) {
|
||||||
case TELEM_TM1-1:
|
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;
|
channel -= TELEM_A1-1;
|
||||||
// A1 and A2
|
// 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) {
|
if (g_model.frsky.channels[channel].type >= UNIT_RAW) {
|
||||||
converted_value /= 10;
|
converted_value /= 10;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (converted_value < 1000) {
|
if (abs(converted_value) < 1000) {
|
||||||
att |= PREC2;
|
att |= PREC2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
+2
-4
@@ -212,15 +212,13 @@ NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm);
|
|||||||
extern const pm_uint8_t bchunit_ar[];
|
extern const pm_uint8_t bchunit_ar[];
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
#define telvalue_t int32_t
|
|
||||||
#define FRSKY_MULTIPLIER_MAX 5
|
#define FRSKY_MULTIPLIER_MAX 5
|
||||||
#else
|
#else
|
||||||
#define telvalue_t int16_t
|
|
||||||
#define FRSKY_MULTIPLIER_MAX 3
|
#define FRSKY_MULTIPLIER_MAX 3
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
telvalue_t applyChannelRatio(uint8_t channel, telvalue_t val);
|
lcdint_t applyChannelRatio(uint8_t channel, lcdint_t val);
|
||||||
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);
|
||||||
|
|
||||||
#define IS_BARS_SCREEN(screenIndex) (g_model.frsky.screensType & (1<<(screenIndex)))
|
#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);
|
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);
|
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;
|
uint8_t fw = FWNUM;
|
||||||
int8_t mode = MODE(flags);
|
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)) {
|
if (mode != MODE(LEADING0)) {
|
||||||
len = 1;
|
len = 1;
|
||||||
|
#if defined(CPUARM)
|
||||||
|
uint32_t tmp = ((uint32_t)val) / 10;
|
||||||
|
#else
|
||||||
uint16_t tmp = ((uint16_t)val) / 10;
|
uint16_t tmp = ((uint16_t)val) / 10;
|
||||||
|
#endif
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
len++;
|
len++;
|
||||||
tmp /= 10;
|
tmp /= 10;
|
||||||
|
|||||||
@@ -55,6 +55,12 @@
|
|||||||
#define CENTER_OFS 0
|
#define CENTER_OFS 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(CPUARM)
|
||||||
|
#define lcdint_t int32_t
|
||||||
|
#else
|
||||||
|
#define lcdint_t int16_t
|
||||||
|
#endif
|
||||||
|
|
||||||
#if LCD_H > 64
|
#if LCD_H > 64
|
||||||
#define LCD_LINES 9
|
#define LCD_LINES 9
|
||||||
#else
|
#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)
|
#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_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_outdezAtt(xcoord_t x, uint8_t y, lcdint_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_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 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);
|
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
|
#endif
|
||||||
|
|
||||||
#if defined(FRSKY) || defined(CPUARM)
|
#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
|
#ifdef IMPERIAL_UNITS
|
||||||
if (unit == UNIT_DEGREES) {
|
if (unit == UNIT_DEGREES) {
|
||||||
|
|||||||
+1
-1
@@ -1220,7 +1220,7 @@ extern union ReusableBuffer reusableBuffer;
|
|||||||
void checkFlashOnBeep();
|
void checkFlashOnBeep();
|
||||||
|
|
||||||
#if defined(FRSKY) || defined(CPUARM)
|
#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
|
#endif
|
||||||
|
|
||||||
#if defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
|
|||||||
Reference in New Issue
Block a user