From 9deddaaecdbe25d98c703bf20d7abf4948f0a800 Mon Sep 17 00:00:00 2001 From: bsongis Date: Fri, 20 Apr 2012 06:16:22 +0000 Subject: [PATCH] Small corrections --- src/frsky.cpp | 21 +-------------------- src/frsky.h | 1 - src/o9xstrings.cpp | 2 +- src/o9xstrings.h | 4 ++-- src/open9x.cpp | 21 +++++++++++++++++++++ src/open9x.h | 4 ++++ src/translations/en.h | 2 ++ src/translations/fr.h | 2 ++ src/translations/se.h | 2 ++ 9 files changed, 35 insertions(+), 24 deletions(-) diff --git a/src/frsky.cpp b/src/frsky.cpp index 736bd1236..f5d5c0cdb 100644 --- a/src/frsky.cpp +++ b/src/frsky.cpp @@ -826,6 +826,7 @@ int16_t convertTelemValue(uint8_t channel, uint8_t value) result = value * 3; break; case TELEM_ALT: + case TELEM_GPSALT: result = value * 4; break; case TELEM_RPM: @@ -849,26 +850,6 @@ int16_t convertTelemValue(uint8_t channel, uint8_t value) return result; } -void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att) -{ -#ifdef IMPERIAL_UNITS - if (unit == UNIT_DEGREES) { - val += 18 ; - val *= 115 ; - val >>= 6 ; - } - if (unit == UNIT_METERS) { - // m to ft *105/32 - val = val * 3 + ( val >> 2 ) + (val >> 5) ; - unit = UNIT_MAX; - } -#endif - - lcd_outdezAtt(x, (att & DBLSIZE ? y - FH : y), val, att & (~NO_UNIT)); // TODO we could add this test inside lcd_outdezAtt! - if (~att & NO_UNIT && unit != UNIT_RAW) - lcd_putsiAtt(lcd_lastPos/*+1*/, y, STR_VTELEMUNIT, unit, 0); -} - static const pm_uint8_t bchunit_ar[] PROGMEM = { UNIT_METERS, // Alt UNIT_RAW, // Rpm diff --git a/src/frsky.h b/src/frsky.h index cd5b96f1d..e4eb716f6 100644 --- a/src/frsky.h +++ b/src/frsky.h @@ -177,7 +177,6 @@ int16_t convertTelemValue(uint8_t channel, uint8_t value); NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm); void putsTelemetryChannel(uint8_t x, uint8_t y, uint8_t channel, int16_t val, uint8_t att); -void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att); #endif diff --git a/src/o9xstrings.cpp b/src/o9xstrings.cpp index c95ea2ef8..acf52df26 100644 --- a/src/o9xstrings.cpp +++ b/src/o9xstrings.cpp @@ -61,7 +61,7 @@ const pm_char STR_OPEN9X[] PROGMEM = ISTR(VFSWRESET) ISTR(FUNCSOUNDS) ISTR(VTELEMCHNS) -#ifdef FRSKY +#if defined(FRSKY) || defined(PCBARM) ISTR(VTELEMUNIT) ISTR(VALARM) ISTR(VALARMFN) diff --git a/src/o9xstrings.h b/src/o9xstrings.h index 4c4bd2313..92367776b 100644 --- a/src/o9xstrings.h +++ b/src/o9xstrings.h @@ -78,7 +78,7 @@ extern const pm_char STR_OPEN9X[]; #define OFS_VFSWRESET (OFS_VFSWFUNC + sizeof(TR_VFSWFUNC)) #define OFS_FUNCSOUNDS (OFS_VFSWRESET + sizeof(TR_VFSWRESET)) #define OFS_VTELEMCHNS (OFS_FUNCSOUNDS + sizeof(TR_FUNCSOUNDS)) -#ifdef FRSKY +#if defined(FRSKY) || defined(PCBARM) #define OFS_VTELEMUNIT (OFS_VTELEMCHNS + sizeof(TR_VTELEMCHNS)) #define OFS_VALARM (OFS_VTELEMUNIT + sizeof(TR_VTELEMUNIT)) #define OFS_VALARMFN (OFS_VALARM + sizeof(TR_VALARM)) @@ -142,7 +142,7 @@ extern const pm_char STR_OPEN9X[]; #define STR_FUNCSOUNDS (STR_OPEN9X + OFS_FUNCSOUNDS) #define STR_VTELEMCHNS (STR_OPEN9X + OFS_VTELEMCHNS) -#ifdef FRSKY +#if defined(FRSKY) || defined(PCBARM) #define STR_VTELEMUNIT (STR_OPEN9X + OFS_VTELEMUNIT) #define STR_VALARM (STR_OPEN9X + OFS_VALARM) #define STR_VALARMFN (STR_OPEN9X + OFS_VALARMFN) diff --git a/src/open9x.cpp b/src/open9x.cpp index f3a978e9b..cc9bb928d 100644 --- a/src/open9x.cpp +++ b/src/open9x.cpp @@ -655,6 +655,27 @@ void incRotaryEncoder(uint8_t idx, int8_t inc) #endif +#if defined(FRSKY) || defined(PCBARM) +void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att) +{ +#ifdef IMPERIAL_UNITS + if (unit == UNIT_DEGREES) { + val += 18 ; + val *= 115 ; + val >>= 6 ; + } + if (unit == UNIT_METERS) { + // m to ft *105/32 + val = val * 3 + ( val >> 2 ) + (val >> 5) ; + } +#endif + + lcd_outdezAtt(x, (att & DBLSIZE ? y - FH : y), val, att & (~NO_UNIT)); // TODO we could add this test inside lcd_outdezAtt! + if (~att & NO_UNIT && unit != UNIT_RAW) + lcd_putsiAtt(lcd_lastPos/*+1*/, y, STR_VTELEMUNIT, unit, 0); +} +#endif + void clearKeyEvents() { #ifdef SIMU diff --git a/src/open9x.h b/src/open9x.h index 95648f238..083b33237 100644 --- a/src/open9x.h +++ b/src/open9x.h @@ -847,5 +847,9 @@ extern union ReusableBuffer reusableBuffer; void checkFlashOnBeep(); +#if defined(FRSKY) || defined(PCBARM) +void putsTelemetryValue(uint8_t x, uint8_t y, int16_t val, uint8_t unit, uint8_t att); +#endif + #endif // gruvin9x_h /*eof*/ diff --git a/src/translations/en.h b/src/translations/en.h index d2f77c90c..4d7b978b5 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -134,6 +134,8 @@ #define TR_VTELPROTO "NoneHub WSHH" #elif defined(FRSKY_HUB) #define TR_VTELPROTO "NoneHub " +#else +#define TR_VTELPROTO "" #endif #define LEN_GPSFORMAT "\004" diff --git a/src/translations/fr.h b/src/translations/fr.h index 12e450f82..fc6134f0e 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -129,6 +129,8 @@ #define TR_VTELPROTO "NoneHub WSHH" #elif defined(FRSKY_HUB) #define TR_VTELPROTO "NoneHub " +#else +#define TR_VTELPROTO "" #endif #define LEN_GPSFORMAT "\004" diff --git a/src/translations/se.h b/src/translations/se.h index d90121f02..3d969b3e6 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -128,6 +128,8 @@ #define TR_VTELPROTO "--- Hub WSHH" #elif defined(FRSKY_HUB) #define TR_VTELPROTO "--- Hub " +#else +#define TR_VTELPROTO "" #endif #define LEN_GPSFORMAT "\004"