From a1a18aae5776324cecb74c25c6a36c64df9ab414 Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Thu, 4 Apr 2013 20:50:19 +0000 Subject: [PATCH] [Taranis] Default Batt range / alarm [Taranis] No USR Protocol selection --- src/logs.cpp | 8 ++++---- src/menu_model.cpp | 12 +++++++++--- src/opentx.cpp | 13 ++++++++++++- src/opentx.h | 7 +++++++ src/telemetry_frsky.cpp | 4 ++-- src/view_telemetry.cpp | 4 ++-- 6 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/logs.cpp b/src/logs.cpp index 4fa427cfd..417c96451 100644 --- a/src/logs.cpp +++ b/src/logs.cpp @@ -104,12 +104,12 @@ const pm_char * openLogs() #endif #if defined(FRSKY_HUB) - if (g_model.frsky.usrProto == USR_PROTO_FRSKY) + if (IS_USR_PROTO_FRSKY_HUB()) f_puts("GPS Date,GPS Time,Long,Lat,Course,GPS Speed,GPS Alt,Baro Alt,Temp1,Temp2,RPM,Fuel,Volts,AccelX,AccelY,AccelZ,", &g_oLogFile); #endif #if defined(WS_HOW_HIGH) - if (g_model.frsky.usrProto == USR_PROTO_WS_HOW_HIGH) + if (IS_USR_PROTO_WS_HOW_HIGH()) f_puts("WSHH Alt,", &g_oLogFile); #endif @@ -173,7 +173,7 @@ void writeLogs() #endif #if defined(FRSKY_HUB) - if (g_model.frsky.usrProto == USR_PROTO_FRSKY) { + if (IS_USR_PROTO_FRSKY_HUB()) { f_printf(&g_oLogFile, "%4d-%02d-%02d,", frskyData.hub.year+2000, frskyData.hub.month, frskyData.hub.day); f_printf(&g_oLogFile, "%02d:%02d:%02d,", frskyData.hub.hour, frskyData.hub.min, frskyData.hub.sec); f_printf(&g_oLogFile, "%03d.%04d%c,", frskyData.hub.gpsLongitude_bp, frskyData.hub.gpsLongitude_ap, @@ -193,7 +193,7 @@ void writeLogs() #endif #if defined(WS_HOW_HIGH) - if (g_model.frsky.usrProto == USR_PROTO_WS_HOW_HIGH) { + if (IS_USR_PROTO_WS_HOW_HIGH()) { f_printf(&g_oLogFile, "%d,", TELEMETRY_GPS_ALT_BP); } #endif diff --git a/src/menu_model.cpp b/src/menu_model.cpp index 148d8a4b7..b5cd27b11 100644 --- a/src/menu_model.cpp +++ b/src/menu_model.cpp @@ -3808,7 +3808,9 @@ enum menuModelTelemetryItems { ITEM_TELEMETRY_RSSI_ALARM2, #if defined(FRSKY_HUB) || defined(WS_HOW_HIGH) ITEM_TELEMETRY_USR_LABEL, +#if !defined(PCBTARANIS) ITEM_TELEMETRY_USR_PROTO, +#endif ITEM_TELEMETRY_USR_BLADES, #endif ITEM_TELEMETRY_USR_VOLTAGE_SOURCE, @@ -3836,10 +3838,12 @@ enum menuModelTelemetryItems { ITEM_TELEMETRY_MAX }; -#if defined(FRSKY_HUB) || defined(WS_HOW_HIGH) -#define USRDATA_LINES (uint8_t)-1, 0, 0, +#if defined(PCBTARANIS) + #define USRDATA_LINES (uint8_t)-1, 0, +#elif defined(FRSKY_HUB) || defined(WS_HOW_HIGH) + #define USRDATA_LINES (uint8_t)-1, 0, 0, #else -#define USRDATA_LINES + #define USRDATA_LINES #endif #if defined(FRSKY) @@ -3990,11 +3994,13 @@ void menuModelTelemetry(uint8_t event) lcd_putsLeft(y, STR_USRDATA); break; +#if !defined(PCBTARANIS) case ITEM_TELEMETRY_USR_PROTO: lcd_putsLeft(y, STR_PROTO); lcd_putsiAtt(TELEM_COL2, y, STR_VTELPROTO, g_model.frsky.usrProto, attr); if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.frsky.usrProto, USR_PROTO_LAST); break; +#endif case ITEM_TELEMETRY_USR_BLADES: lcd_putsLeft(y, STR_BLADES); diff --git a/src/opentx.cpp b/src/opentx.cpp index d13230643..0ef8c12fe 100644 --- a/src/opentx.cpp +++ b/src/opentx.cpp @@ -361,7 +361,14 @@ void generalDefault() g_eeGeneral.version = EEPROM_VER; g_eeGeneral.variant = EEPROM_VARIANT; g_eeGeneral.contrast = 25; + +#if defined(PCBTARANIS) + g_eeGeneral.vBatWarn = 65; + g_eeGeneral.vBatMin = -30; + g_eeGeneral.vBatMax = -40; +#else g_eeGeneral.vBatWarn = 90; +#endif for (int i = 0; i < NUM_STICKS+NUM_POTS; ++i) { g_eeGeneral.calibMid[i] = 0x200; @@ -414,6 +421,10 @@ void modelDefault(uint8_t id) modelIds[id] = g_model.modelId = id+1; checkModelIdUnique(id); #endif + +#if defined(PCBTARANIS) + g_model.frsky.channels[0].ratio = 132; +#endif } int16_t intpol(int16_t x, uint8_t idx) // -100, -75, -50, -25, 0, 25 ,50, 75, 100 @@ -2269,7 +2280,7 @@ PLAY_FUNCTION(playValue, uint8_t idx) case MIXSRC_FIRST_TELEM-1+TELEM_MIN_ALT-1: case MIXSRC_FIRST_TELEM-1+TELEM_MAX_ALT-1: #if defined(WS_HOW_HIGH) - if (IS_IMPERIAL_ENABLE() && g_model.frsky.usrProto == USR_PROTO_WS_HOW_HIGH) + if (IS_IMPERIAL_ENABLE() && IS_USR_PROTO_WS_HOW_HIGH()) PLAY_NUMBER(val, 1+UNIT_FEET, 0); else #endif diff --git a/src/opentx.h b/src/opentx.h index 6ee53bb1d..78bee828e 100644 --- a/src/opentx.h +++ b/src/opentx.h @@ -1390,5 +1390,12 @@ void varioWakeup(); #define IS_IMPERIAL_ENABLE() (0) #endif +#if defined(PCBTARANIS) + #define IS_USR_PROTO_FRSKY_HUB() (1) + #define IS_USR_PROTO_WS_HOW_HIGH() (0) +#else + #define IS_USR_PROTO_FRSKY_HUB() (g_model.frsky.usrProto == USR_PROTO_FRSKY) + #define IS_USR_PROTO_WS_HOW_HIGH() (g_model.frsky.usrProto == USR_PROTO_WS_HOW_HIGH) #endif +#endif diff --git a/src/telemetry_frsky.cpp b/src/telemetry_frsky.cpp index fa9a2eecd..044d497c0 100644 --- a/src/telemetry_frsky.cpp +++ b/src/telemetry_frsky.cpp @@ -319,11 +319,11 @@ void processFrskyPacket(uint8_t *packet) uint8_t numBytes = 3 + (packet[1] & 0x07); // sanitize in case of data corruption leading to buffer overflow for (uint8_t i=3; i