From aef84e0063b39d7522aa58ce88fab9b39a098d45 Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Mon, 25 Mar 2013 19:36:55 +0000 Subject: [PATCH] [stock] Compilation error with EXT=JETI [all] Font changes for the Custom Switches screen [Taranis] Channel name in Mixes screen [sky9x/Taranis] Negative AND switches in Custom Switches screen [Taranis] Altitude displayed with PREC1 [Taranis] Correct SD size in massstorage [Taranis] Unmount / Mount SD in massstorage [Taranis] A1 / A2 displayed in Top Bar depending on Voltage source selected in Telemetry menu [Taranis] No RSSI / Voltage in Top Bar if no RSSI --- src/Makefile | 3 +- src/font.lbm | 2 +- src/font.xbm | 20 +- src/lcd.cpp | 3 +- src/menu_model.cpp | 59 +++--- src/myeeprom.h | 4 +- src/opentx.cpp | 21 +- src/opentx.h | 85 ++++---- .../Class/msc/src/usbd_storage_template.c | 185 ------------------ src/taranis/diskio.cpp | 4 - ...sbd_storage_msd.c => usbd_storage_msd.cpp} | 28 +-- src/taranis/{usbd_usr.c => usbd_usr.cpp} | 17 +- src/{nmea.cpp => telemetry_nmea.cpp} | 2 +- src/{nmea.h => telemetry_nmea.h} | 0 src/translations.cpp | 1 - src/translations.h | 4 +- src/translations/cz.h | 3 - src/translations/de.h | 3 - src/translations/en.h | 7 +- src/translations/es.h | 5 +- src/translations/fr.h | 5 +- src/translations/it.h | 5 +- src/translations/pt.h | 5 +- src/translations/se.h | 5 +- src/view_main.cpp | 24 ++- src/view_telemetry.cpp | 22 ++- 26 files changed, 177 insertions(+), 345 deletions(-) delete mode 100644 src/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_storage_template.c rename src/taranis/{usbd_storage_msd.c => usbd_storage_msd.cpp} (90%) rename src/taranis/{usbd_usr.c => usbd_usr.cpp} (90%) rename src/{nmea.cpp => telemetry_nmea.cpp} (96%) rename src/{nmea.h => telemetry_nmea.h} (100%) diff --git a/src/Makefile b/src/Makefile index 2dd7773b8..31b2796ef 100644 --- a/src/Makefile +++ b/src/Makefile @@ -499,7 +499,7 @@ ifeq ($(PCB), TARANIS) SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_pwr.c SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s - SRC += taranis/usb_bsp.c taranis/usbd_desc.c taranis/usbd_usr.c taranis/usbd_storage_msd.c + SRC += taranis/usb_bsp.c taranis/usbd_desc.c SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_core.c SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd_int.c @@ -511,6 +511,7 @@ ifeq ($(PCB), TARANIS) SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c # SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/src/usbd_hid_core.c + EXTRABOARDSRC += taranis/usbd_usr.cpp taranis/usbd_storage_msd.cpp ifeq ($(SDCARD), YES) EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c taranis/diskio.cpp diff --git a/src/font.lbm b/src/font.lbm index fcdd7d148..f6df4bd17 100644 --- a/src/font.lbm +++ b/src/font.lbm @@ -3,4 +3,4 @@ 0x06,0x09,0x09,0x06,0x00,0x7e,0x09,0x09,0x09,0x7e,0x7f,0x49,0x49,0x49,0x36,0x3e,0x41,0x41,0x41,0x22,0x7f,0x41,0x41,0x22,0x1c,0x7f,0x49,0x49,0x49,0x41,0x7f,0x09,0x09,0x09,0x01,0x3e,0x41,0x49,0x49,0x7a,0x7f,0x08,0x08,0x08,0x7f,0x00,0x41,0x7f,0x41,0x00,0x20,0x40,0x41,0x3f,0x01,0x7f,0x08,0x14,0x22,0x41,0x7f,0x40,0x40,0x40,0x40,0x7f,0x02,0x0c,0x02,0x7f,0x7f,0x04,0x08,0x10,0x7f,0x3e,0x41,0x41,0x41,0x3e, 0x7f,0x09,0x09,0x09,0x06,0x3e,0x41,0x51,0x21,0x5e,0x7f,0x09,0x19,0x29,0x46,0x26,0x49,0x49,0x49,0x32,0x01,0x01,0x7f,0x01,0x01,0x3f,0x40,0x40,0x40,0x3f,0x1f,0x20,0x40,0x20,0x1f,0x3f,0x40,0x30,0x40,0x3f,0x63,0x14,0x08,0x14,0x63,0x07,0x08,0x70,0x08,0x07,0x61,0x51,0x49,0x45,0x43,0x00,0x7f,0x41,0x41,0x00,0x02,0x04,0x08,0x10,0x20,0x00,0x41,0x41,0x7f,0x00,0x04,0x02,0x01,0x02,0x04,0x40,0x40,0x40,0x40,0x40, 0x00,0x01,0x02,0x04,0x00,0x20,0x54,0x54,0x54,0x78,0x7f,0x48,0x44,0x44,0x38,0x38,0x44,0x44,0x44,0x20,0x38,0x44,0x44,0x48,0x7f,0x38,0x54,0x54,0x54,0x18,0x08,0x7e,0x09,0x01,0x02,0x0c,0x52,0x52,0x52,0x3e,0x7f,0x08,0x04,0x04,0x78,0x00,0x44,0x7d,0x40,0x00,0x20,0x40,0x44,0x3d,0x00,0x7f,0x10,0x28,0x44,0x00,0x00,0x41,0x7f,0x40,0x00,0x7c,0x04,0x18,0x04,0x78,0x7c,0x08,0x04,0x04,0x78,0x38,0x44,0x44,0x44,0x38, -0x7c,0x14,0x14,0x14,0x08,0x08,0x14,0x14,0x18,0x7c,0x7c,0x08,0x04,0x04,0x08,0x48,0x54,0x54,0x54,0x20,0x04,0x3f,0x44,0x40,0x20,0x3c,0x40,0x40,0x20,0x7c,0x1c,0x20,0x40,0x20,0x1c,0x3c,0x40,0x20,0x40,0x3c,0x44,0x28,0x10,0x28,0x44,0x0c,0x50,0x50,0x50,0x3c,0x44,0x64,0x54,0x4c,0x44,0x00,0x08,0x36,0x41,0x00,0x00,0x00,0x7f,0x00,0x00,0x00,0x41,0x36,0x08,0x00,0x08,0x08,0x22,0x1c,0x08,0x08,0x1c,0x22,0x08,0x08, +0x7c,0x14,0x14,0x14,0x08,0x08,0x14,0x14,0x18,0x7c,0x7c,0x08,0x04,0x04,0x08,0x48,0x54,0x54,0x54,0x20,0x04,0x3f,0x44,0x40,0x20,0x3c,0x40,0x40,0x20,0x7c,0x1c,0x20,0x40,0x20,0x1c,0x3c,0x40,0x20,0x40,0x3c,0x44,0x28,0x10,0x28,0x44,0x0c,0x50,0x50,0x50,0x3c,0x44,0x64,0x54,0x4c,0x44,0x10,0x08,0x10,0x08,0x00,0x7f,0x00,0x00,0x00,0x00,0x41,0x22,0x54,0x28,0x00,0x08,0x08,0x22,0x1c,0x08,0x08,0x1c,0x22,0x08,0x08, diff --git a/src/font.xbm b/src/font.xbm index cb92f4c9f..13ed5c88b 100644 --- a/src/font.xbm +++ b/src/font.xbm @@ -1,6 +1,6 @@ -#define font_6x1_width 80 -#define font_6x1_height 48 -static unsigned char font_6x1_bits[] = { +#define font_width 80 +#define font_height 48 +static unsigned char font_bits[] = { 0x00, 0x29, 0xe0, 0x86, 0x31, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0xe8, 0x66, 0x22, 0x84, 0x10, 0x02, 0x00, 0x80, 0x00, 0x29, 0xec, 0x50, 0x11, 0x02, 0x55, 0x02, 0x00, 0x40, 0x00, 0x81, 0xf6, 0x89, 0x00, 0x02, @@ -34,10 +34,10 @@ static unsigned char font_6x1_bits[] = { 0xc0, 0xc7, 0x10, 0xbf, 0xf0, 0x91, 0xa0, 0x41, 0x6a, 0x8c, 0x20, 0xc6, 0x18, 0x83, 0x80, 0x91, 0xa4, 0x42, 0x62, 0x8c, 0xc0, 0x3f, 0xe7, 0x9d, 0x70, 0xd1, 0x99, 0xe4, 0x62, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x44, - 0x04, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x42, 0x08, 0x21, - 0xcf, 0x36, 0x77, 0x62, 0x8c, 0x31, 0x7e, 0x42, 0x08, 0x12, 0x31, 0xcf, - 0x20, 0x62, 0x8c, 0x2a, 0x22, 0x41, 0xd0, 0xde, 0xcf, 0x07, 0x27, 0x62, - 0x8c, 0xc4, 0x13, 0x42, 0x08, 0x12, 0x01, 0x06, 0x28, 0xb3, 0xaa, 0x0a, - 0x0a, 0x42, 0x08, 0x21, 0x01, 0x86, 0xc7, 0x2c, 0x51, 0xd1, 0x7d, 0x44, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x02, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x10, 0x04, 0x21, + 0xcf, 0x36, 0x77, 0x62, 0x8c, 0x31, 0x7e, 0x10, 0x08, 0x12, 0x31, 0xcf, + 0x20, 0x62, 0x8c, 0x2a, 0x22, 0x15, 0xd0, 0xde, 0xcf, 0x07, 0x27, 0x62, + 0x8c, 0xc4, 0x93, 0x12, 0x08, 0x12, 0x01, 0x06, 0x28, 0xb3, 0xaa, 0x0a, + 0x0a, 0x10, 0x14, 0x21, 0x01, 0x86, 0xc7, 0x2c, 0x51, 0xd1, 0x7d, 0x10, + 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/src/lcd.cpp b/src/lcd.cpp index 327b54225..cd632c7c0 100644 --- a/src/lcd.cpp +++ b/src/lcd.cpp @@ -279,6 +279,7 @@ void lcd_putsnAtt(xcoord_t x, uint8_t y, const pm_char * s, uint8_t len, LcdFlag #endif lcd_putcAtt(x, y, c, mode); x += FW; + if (c == '|') x -= 4; if (mode&DBLSIZE) x += FW-1; else if (mode&MIDSIZE) x += FW-3; else if (mode&SMLSIZE) x -= 1; @@ -777,7 +778,7 @@ void putsTime(xcoord_t x, uint8_t y, putstime_t tme, LcdFlags att, LcdFlags att2 void putsVolts(xcoord_t x, uint8_t y, uint16_t volts, LcdFlags att) { lcd_outdezAtt(x, y, (int16_t)volts, (~NO_UNIT) & (att | ((att&PREC2)==PREC2 ? 0 : PREC1))); - if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'v', att&(~INVERS)); + if (~att & NO_UNIT) lcd_putcAtt(lcdLastPos, y, 'v', att); } void putsVBat(xcoord_t x, uint8_t y, LcdFlags att) diff --git a/src/menu_model.cpp b/src/menu_model.cpp index 24a320a53..94bab4e18 100644 --- a/src/menu_model.cpp +++ b/src/menu_model.cpp @@ -2673,6 +2673,17 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) } } else { +#if LCD_W >= 212 + if (attr) { + uint8_t len = zlen(g_model.limitData[ch-1].name, sizeof(g_model.limitData[ch-1].name)); + if (len) { + lcd_putc(17*FW, 0, ' '); + lcd_putsnAtt(18*FW, 0, g_model.limitData[ch-1].name, len, ZCHAR); + lcd_putc(18*FW+len*FW, 0, ' '); + } + } +#endif + if (mixCnt > 0) lcd_putsiAtt(1*FW+0, y, STR_VMLTPX2, md->mltpx, 0); @@ -2693,7 +2704,7 @@ void menuModelExpoMix(uint8_t expo, uint8_t event) if (md->curveMode == MODE_CURVE) putsCurve(12*FW+2, y, md->curveParam); else - displayGVar(15*FW+2, y, md->curveParam, -100, 100); // open.20.fsguruh + displayGVar(15*FW+2, y, md->curveParam, -100, 100); // open.20.fsguruh // displayGVar(15*FW+2, y, md->curveParam, -125, 125); // only -100 to +100 is allowed now // could be increased now, but is it useful? differentiate with more the +-100% is a fault, correct? } @@ -3134,6 +3145,20 @@ enum CustomSwitchFields { CSW_FIELD_LAST = CSW_FIELD_COUNT-1 }; +#if LCD_W >= 212 + #define CSW_1ST_COLUMN (4*FW-3) + #define CSW_2ND_COLUMN (10*FW+1) + #define CSW_3RD_COLUMN (18*FW+2) + #define CSW_4TH_COLUMN (20*FW+1) + #define CSW_5TH_COLUMN (26*FW+1) + #define CSW_6TH_COLUMN (31*FW+1) +#else + #define CSW_1ST_COLUMN (4*FW-3) + #define CSW_2ND_COLUMN (8*FW-3) + #define CSW_3RD_COLUMN (16*FW-6) + #define CSW_4TH_COLUMN (18*FW+2) +#endif + #if defined(CPUARM) && LCD_W < 212 #define CSWONE_2ND_COLUMN (11*FW) @@ -3226,8 +3251,8 @@ void menuModelCustomSwitchOne(uint8_t event) } case CSW_FIELD_ANDSW: lcd_putsLeft(y, PSTR("AND Switch")); - lcd_putsiAtt(CSWONE_2ND_COLUMN, y, STR_VSWITCHES_SHORT, cs->andsw, attr); - if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, 15); + putsSwitches(CSWONE_2ND_COLUMN, y, cs->andsw, attr); + if (attr) CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_SWITCH, MAX_SWITCH); break; case CSW_FIELD_DURATION: lcd_putsLeft(y, STR_DURATION); @@ -3249,11 +3274,6 @@ void menuModelCustomSwitchOne(uint8_t event) } } -#define CSW_1ST_COLUMN (4*FW-3) -#define CSW_2ND_COLUMN (10*FW+1) -#define CSW_3RD_COLUMN (18*FW+2) -#define CSW_4TH_COLUMN (20*FW+1) - void menuModelCustomSwitches(uint8_t event) { SIMPLE_MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1); @@ -3317,19 +3337,12 @@ void menuModelCustomSwitches(uint8_t event) } // CSW and switch - lcd_putsiAtt(CSW_4TH_COLUMN, y, STR_VSWITCHES_SHORT, cs->andsw, 0); + putsSwitches(CSW_4TH_COLUMN, y, cs->andsw, 0); } } } #else -#define CSW_1ST_COLUMN (4*FW-3) -#define CSW_2ND_COLUMN (10*FW+1) -#define CSW_3RD_COLUMN (18*FW+2) -#define CSW_4TH_COLUMN (20*FW+1) -#define CSW_5TH_COLUMN (26*FW+1) -#define CSW_6TH_COLUMN (31*FW+1) - void menuModelCustomSwitches(uint8_t event) { MENU(STR_MENUCUSTOMSWITCHES, menuTabModel, e_CustomSwitches, NUM_CSW+1, {0, NAVIGATION_LINE_BY_LINE|CSW_FIELD_LAST/*repeated...*/}); @@ -3400,11 +3413,7 @@ void menuModelCustomSwitches(uint8_t event) } // CSW and switch -#if defined(PCBTARANIS) putsSwitches(CSW_4TH_COLUMN, y, cs->andsw, m_posHorz==3 ? attr : 0); -#else - lcd_putsiAtt(CSW_4TH_COLUMN, y, STR_VSWITCHES_SHORT, cs->andsw, m_posHorz==3 ? attr : 0); -#endif #if defined(CPUARM) // CSW duration @@ -3437,9 +3446,9 @@ void menuModelCustomSwitches(uint8_t event) break; case CSW_FIELD_ANDSW: #if defined(PCBTARANIS) - CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, SWSRC_ON-1); + CHECK_INCDEC_MODELVAR(event, cs->andsw, -MAX_CSW_ANDSW, MAX_CSW_ANDSW); #else - CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, 15); + CHECK_INCDEC_MODELVAR_ZERO(event, cs->andsw, MAX_CSW_ANDSW); #endif break; #if defined(CPUARM) @@ -3629,7 +3638,7 @@ void menuModelCustomFunctions(uint8_t event) #endif } else if (CFN_FUNC(sd) == FUNC_PLAY_BOTH) { - lcd_putcAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN-2+3*FWNUM, y, '|', attr); + lcd_putcAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, '|', attr); lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+3*FWNUM, y, val_displayed+PROMPT_CUSTOM_BASE, attr); lcd_outdezAtt(MODEL_CUSTOM_FUNC_3RD_COLUMN+2+3*FWNUM, y, (val_displayed+PROMPT_CUSTOM_BASE+1)%10, attr|LEFT); } @@ -4101,7 +4110,7 @@ void menuModelTelemetry(uint8_t event) if (attr && (s_editMode>0 || p1valdiff)) { switch (m_posHorz) { case 0: - bar.source = checkIncDecModel(event, barSource, 0, g_model.frsky.usrProto ? TELEM_DISPLAY_MAX : TELEM_NOUSR_MAX); + bar.source = checkIncDecModel(event, barSource, 0, TELEM_DISPLAY_MAX); if (checkIncDec_Ret) { bar.barMin = 0; bar.barMax = 255-maxTelemValue(bar.source); @@ -4127,7 +4136,7 @@ void menuModelTelemetry(uint8_t event) #endif lcd_putsiAtt(pos[c], y, STR_VTELEMCHNS, value, cellAttr); if (cellAttr && (s_editMode>0 || p1valdiff)) { - CHECK_INCDEC_MODELVAR_ZERO(event, value, g_model.frsky.usrProto ? ((lineIndex==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX) : TELEM_NOUSR_MAX); + CHECK_INCDEC_MODELVAR_ZERO(event, value, (lineIndex==3 && c==0) ? TELEM_STATUS_MAX : TELEM_DISPLAY_MAX); } } if (attr && m_posHorz == NUM_LINE_ITEMS) { diff --git a/src/myeeprom.h b/src/myeeprom.h index 2f77690a3..d34e79889 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -439,15 +439,17 @@ PACK( union u_int8int16_t { #if defined(CPUARM) #define MAX_CSW_DURATION 120 /*60s*/ #define MAX_CSW_DELAY 120 /*60s*/ +#define MAX_CSW_ANDSW MAX_SWITCH PACK(typedef struct t_CustomSwData { // Custom Switches data int8_t v1; //input int8_t v2; //offset uint8_t func; uint8_t delay; uint8_t duration; - uint8_t andsw; + int8_t andsw; }) CustomSwData; #else +#define MAX_CSW_ANDSW 15 PACK(typedef struct t_CustomSwData { // Custom Switches data int8_t v1; //input int8_t v2; //offset diff --git a/src/opentx.cpp b/src/opentx.cpp index e56419b34..19cc8ec7a 100644 --- a/src/opentx.cpp +++ b/src/opentx.cpp @@ -842,7 +842,7 @@ int16_t cyc_anas[3] = {0}; bool __getSwitch(int8_t swtch); -int16_t getValue(uint8_t i) +getvalue_t getValue(uint8_t i) { /*srcRaw is shifted +1!*/ @@ -884,10 +884,12 @@ int16_t getValue(uint8_t i) else if (iandsw; -#if !defined(PCBTARANIS) - if (s >= SWSRC_TRN) s += SWSRC_SW3-SWSRC_TRN; -#endif if (cs->func == CS_OFF || (s && !__getSwitch(s))) { result = false; } @@ -2236,6 +2235,10 @@ PLAY_FUNCTION(playValue, uint8_t idx) break; case MIXSRC_FIRST_TELEM-1+TELEM_ALT-1: +#if defined(PCBTARANIS) + PLAY_NUMBER(val/100, 1+UNIT_METERS, 0); + break; +#endif case MIXSRC_FIRST_TELEM-1+TELEM_MIN_ALT-1: case MIXSRC_FIRST_TELEM-1+TELEM_MAX_ALT-1: #if defined(IMPERIAL_UNITS) @@ -2551,7 +2554,7 @@ void evalFunctions() } #endif else { - SET_GVAR(CFN_FUNC(sd)-FUNC_ADJUST_GV1, limit((int16_t)-1250, getValue(CFN_PARAM(sd)), (int16_t)1250) / 10, s_perout_flight_phase); + SET_GVAR(CFN_FUNC(sd)-FUNC_ADJUST_GV1, limit((getvalue_t)-1250, getValue(CFN_PARAM(sd)), (getvalue_t)1250) / 10, s_perout_flight_phase); } } else { diff --git a/src/opentx.h b/src/opentx.h index 1ea5035b3..a4e646cda 100644 --- a/src/opentx.h +++ b/src/opentx.h @@ -355,66 +355,71 @@ enum EnumKeys { #include "myeeprom.h" #if ROTARY_ENCODERS > 0 -#define IF_ROTARY_ENCODERS(x) x, + #define IF_ROTARY_ENCODERS(x) x, #else -#define IF_ROTARY_ENCODERS(x) + #define IF_ROTARY_ENCODERS(x) #endif #define PPM_CENTER 1500 #if defined(PPM_CENTER_ADJUSTABLE) -#define PPM_CH_CENTER(ch) (PPM_CENTER+limitaddress(ch)->ppmCenter) + #define PPM_CH_CENTER(ch) (PPM_CENTER+limitaddress(ch)->ppmCenter) #else -#define PPM_CH_CENTER(ch) (PPM_CENTER) + #define PPM_CH_CENTER(ch) (PPM_CENTER) #endif #if defined(CPUARM) -// This doesn't need protection on this processor -#define tmr10ms_t uint32_t -extern volatile tmr10ms_t g_tmr10ms; -#define get_tmr10ms() g_tmr10ms + // This doesn't need protection on this processor + #define tmr10ms_t uint32_t + extern volatile tmr10ms_t g_tmr10ms; + #define get_tmr10ms() g_tmr10ms + typedef int32_t rotenc_t; + typedef int32_t getvalue_t; #else -#define tmr10ms_t uint16_t -extern volatile tmr10ms_t g_tmr10ms; -extern inline uint16_t get_tmr10ms() -{ - uint16_t time ; - cli(); - time = g_tmr10ms ; - sei(); - return time ; -} + #define tmr10ms_t uint16_t + extern volatile tmr10ms_t g_tmr10ms; + extern inline uint16_t get_tmr10ms() + { + uint16_t time ; + cli(); + time = g_tmr10ms ; + sei(); + return time ; + } + typedef int8_t rotenc_t; + typedef int16_t getvalue_t; #endif #include "eeprom_common.h" + #if defined(PCBSKY9X) -#include "eeprom_raw.h" + #include "eeprom_raw.h" #else -#include "eeprom_rlc.h" + #include "eeprom_rlc.h" #endif #if defined(CPUARM) -#include "pulses_arm.h" + #include "pulses_arm.h" #else -#include "pulses_avr.h" + #include "pulses_avr.h" #endif #if defined(PCBTARANIS) -#define MODEL_BITMAP_WIDTH 64 -#define MODEL_BITMAP_HEIGHT 32 -#define MODEL_BITMAP_SIZE (2+4*(MODEL_BITMAP_WIDTH*MODEL_BITMAP_HEIGHT/8)) -extern uint8_t modelBitmap[MODEL_BITMAP_SIZE]; -extern pm_char * modelBitmapLoaded; -void loadModelBitmap(); -#define LOAD_MODEL_BITMAP() loadModelBitmap() + #define MODEL_BITMAP_WIDTH 64 + #define MODEL_BITMAP_HEIGHT 32 + #define MODEL_BITMAP_SIZE (2+4*(MODEL_BITMAP_WIDTH*MODEL_BITMAP_HEIGHT/8)) + extern uint8_t modelBitmap[MODEL_BITMAP_SIZE]; + extern pm_char * modelBitmapLoaded; + void loadModelBitmap(); + #define LOAD_MODEL_BITMAP() loadModelBitmap() #else -#define LOAD_MODEL_BITMAP() + #define LOAD_MODEL_BITMAP() #endif #if defined(DSM2) -extern bool s_bind_mode; -extern bool s_rangecheck_mode; -extern uint8_t s_bind_allowed; + extern bool s_bind_mode; + extern bool s_rangecheck_mode; + extern uint8_t s_bind_allowed; #endif #if defined(CPUARM) @@ -722,8 +727,8 @@ void perOut(uint8_t mode, uint8_t tick10ms); void perMain(); NOINLINE void per10ms(); -int16_t getValue(uint8_t i); -bool getSwitch(int8_t swtch, bool nc); +getvalue_t getValue(uint8_t i); +bool getSwitch(int8_t swtch, bool nc); extern swstate_t switches_states; int8_t getMovedSwitch(); @@ -1117,12 +1122,6 @@ inline bool isFunctionActive(uint8_t func) return activeFunctions & ((MASK_FUNC_TYPE)1 << (func-FUNC_TRAINER)); } -#if defined(CPUARM) - typedef int32_t rotenc_t; -#else - typedef int8_t rotenc_t; -#endif - #if defined(ROTARY_ENCODERS) // Global rotary encoder registers extern volatile rotenc_t g_rotenc[ROTARY_ENCODERS]; @@ -1332,8 +1331,8 @@ extern uint8_t barsThresholds[THLD_MAX]; #if defined(FRSKY) uint8_t maxTelemValue(uint8_t channel); -int16_t convertTelemValue(uint8_t channel, uint8_t value); -int16_t convertCswTelemValue(CustomSwData * cs); +getvalue_t convertTelemValue(uint8_t channel, uint8_t value); +getvalue_t convertCswTelemValue(CustomSwData * cs); NOINLINE uint8_t getRssiAlarmValue(uint8_t alarm); extern const pm_uint8_t bchunit_ar[]; diff --git a/src/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_storage_template.c b/src/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_storage_template.c deleted file mode 100644 index 28cff223c..000000000 --- a/src/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_storage_template.c +++ /dev/null @@ -1,185 +0,0 @@ -/** - ****************************************************************************** - * @file usbd_storage_template.c - * @author MCD Application Team - * @version V1.1.0 - * @date 19-March-2012 - * @brief Memory management layer - ****************************************************************************** - * @attention - * - *

© COPYRIGHT 2012 STMicroelectronics

- * - * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); - * You may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.st.com/software_license_agreement_liberty_v2 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ****************************************************************************** - */ - - -/* Includes ------------------------------------------------------------------*/ -#include "usbd_msc_mem.h" - -/* Private typedef -----------------------------------------------------------*/ -/* Private define ------------------------------------------------------------*/ -/* Private macro -------------------------------------------------------------*/ -/* Private variables ---------------------------------------------------------*/ -/* Private function prototypes -----------------------------------------------*/ -/* Extern function prototypes ------------------------------------------------*/ -/* Private functions ---------------------------------------------------------*/ - -#define STORAGE_LUN_NBR 1 - -int8_t STORAGE_Init (uint8_t lun); - -int8_t STORAGE_GetCapacity (uint8_t lun, - uint32_t *block_num, - uint16_t *block_size); - -int8_t STORAGE_IsReady (uint8_t lun); - -int8_t STORAGE_IsWriteProtected (uint8_t lun); - -int8_t STORAGE_Read (uint8_t lun, - uint8_t *buf, - uint32_t blk_addr, - uint16_t blk_len); - -int8_t STORAGE_Write (uint8_t lun, - uint8_t *buf, - uint32_t blk_addr, - uint16_t blk_len); - -int8_t STORAGE_GetMaxLun (void); - -/* USB Mass storage Standard Inquiry Data */ -const int8_t STORAGE_Inquirydata[] = {//36 - - /* LUN 0 */ - 0x00, - 0x80, - 0x02, - 0x02, - (USBD_STD_INQUIRY_LENGTH - 5), - 0x00, - 0x00, - 0x00, - 'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */ - 'P', 'r', 'o', 'd', 'u', 't', ' ', ' ', /* Product : 16 Bytes */ - ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', - '0', '.', '0' ,'1', /* Version : 4 Bytes */ -}; - -USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops = -{ - STORAGE_Init, - STORAGE_GetCapacity, - STORAGE_IsReady, - STORAGE_IsWriteProtected, - STORAGE_Read, - STORAGE_Write, - STORAGE_GetMaxLun, - STORAGE_Inquirydata, - -}; - -USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops; -/******************************************************************************* -* Function Name : Read_Memory -* Description : Handle the Read operation from the microSD card. -* Input : None. -* Output : None. -* Return : None. -*******************************************************************************/ -int8_t STORAGE_Init (uint8_t lun) -{ - return (0); -} - -/******************************************************************************* -* Function Name : Read_Memory -* Description : Handle the Read operation from the STORAGE card. -* Input : None. -* Output : None. -* Return : None. -*******************************************************************************/ -int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint16_t *block_size) -{ - return (0); -} - -/******************************************************************************* -* Function Name : Read_Memory -* Description : Handle the Read operation from the STORAGE card. -* Input : None. -* Output : None. -* Return : None. -*******************************************************************************/ -int8_t STORAGE_IsReady (uint8_t lun) -{ - return (0); -} - -/******************************************************************************* -* Function Name : Read_Memory -* Description : Handle the Read operation from the STORAGE card. -* Input : None. -* Output : None. -* Return : None. -*******************************************************************************/ -int8_t STORAGE_IsWriteProtected (uint8_t lun) -{ - return 0; -} - -/******************************************************************************* -* Function Name : Read_Memory -* Description : Handle the Read operation from the STORAGE card. -* Input : None. -* Output : None. -* Return : None. -*******************************************************************************/ -int8_t STORAGE_Read (uint8_t lun, - uint8_t *buf, - uint32_t blk_addr, - uint16_t blk_len) -{ - return 0; -} -/******************************************************************************* -* Function Name : Write_Memory -* Description : Handle the Write operation to the STORAGE card. -* Input : None. -* Output : None. -* Return : None. -*******************************************************************************/ -int8_t STORAGE_Write (uint8_t lun, - uint8_t *buf, - uint32_t blk_addr, - uint16_t blk_len) -{ - return (0); -} -/******************************************************************************* -* Function Name : Write_Memory -* Description : Handle the Write operation to the STORAGE card. -* Input : None. -* Output : None. -* Return : None. -*******************************************************************************/ -int8_t STORAGE_GetMaxLun (void) -{ - return (STORAGE_LUN_NBR - 1); -} - -/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ - diff --git a/src/taranis/diskio.cpp b/src/taranis/diskio.cpp index 89291aac7..5f65be3a8 100644 --- a/src/taranis/diskio.cpp +++ b/src/taranis/diskio.cpp @@ -662,7 +662,6 @@ DSTATUS disk_status ( /* Read Sector(s) */ /*-----------------------------------------------------------------------*/ -extern "C" { // TODO quick & dirty int8_t SD_ReadSectors(uint8_t *buff, uint32_t sector, uint32_t count) { @@ -682,7 +681,6 @@ int8_t SD_ReadSectors(uint8_t *buff, uint32_t sector, uint32_t count) return 0; } -} DRESULT disk_read ( BYTE drv, /* Physical drive number (0) */ @@ -727,7 +725,6 @@ DRESULT disk_read ( #if _FS_READONLY == 0 -extern "C" { // TODO quick & dirty int8_t SD_WriteSectors(uint8_t *buff, uint32_t sector, uint32_t count) { @@ -746,7 +743,6 @@ int8_t SD_WriteSectors(uint8_t *buff, uint32_t sector, uint32_t count) return 0; } -} DRESULT disk_write ( BYTE drv, /* Physical drive number (0) */ diff --git a/src/taranis/usbd_storage_msd.c b/src/taranis/usbd_storage_msd.cpp similarity index 90% rename from src/taranis/usbd_storage_msd.c rename to src/taranis/usbd_storage_msd.cpp index c48190ea3..d4d826bf6 100644 --- a/src/taranis/usbd_storage_msd.c +++ b/src/taranis/usbd_storage_msd.cpp @@ -26,6 +26,10 @@ */ /* Includes ------------------------------------------------------------------*/ +#include "../opentx.h" +#include "../FatFs/diskio.h" + +extern "C" { #include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/misc.h" #include "usbd_msc_mem.h" #include "usb_conf.h" @@ -36,7 +40,7 @@ #define SD_GetStatus() (0) /* USB Mass storage Standard Inquiry Data */ -const char STORAGE_Inquirydata[] = {//36 +const unsigned char STORAGE_Inquirydata[] = {//36 /* LUN 0 */ 0x00, @@ -50,7 +54,7 @@ const char STORAGE_Inquirydata[] = {//36 'F', 'r', 'S', 'k', 'y', ' ', ' ', ' ', /* Manufacturer : 8 bytes */ 'T', 'a', 'r', 'a', 'n', 'i', 's', ' ', /* Product : 16 Bytes */ 'R', 'a', 'd', 'i', 'o', ' ', ' ', ' ', - '1', '.', '0' ,'0', /* Version : 4 Bytes */ + '1', '.', '0', '0', /* Version : 4 Bytes */ }; @@ -76,7 +80,6 @@ int8_t STORAGE_Write (uint8_t lun, int8_t STORAGE_GetMaxLun (void); - USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops = { STORAGE_Init, @@ -92,6 +95,7 @@ USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops = USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops; __IO uint32_t count = 0; +} int8_t STORAGE_Init (uint8_t lun) { @@ -119,17 +123,17 @@ int8_t STORAGE_Init (uint8_t lun) */ int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint32_t *block_size) { - if(SD_GetStatus() != 0 ) - { - return (-1); - } + if (SD_GetStatus() != 0 ) + return -1; *block_size = 512; - *block_num = 2*1024*1024; /* TEMP: 1GB */ - // TODO check that lock on SD is taken - // TODO disk_ioctl(pdrv, GET_SECTOR_COUNT, block_num); - - return (0); + + BYTE sector_count = 0; + if (disk_ioctl(g_FATFS_Obj.drv, GET_SECTOR_COUNT, block_num) != RES_OK) + return -1; + + *block_num = sector_count; + return 0; } /** diff --git a/src/taranis/usbd_usr.c b/src/taranis/usbd_usr.cpp similarity index 90% rename from src/taranis/usbd_usr.c rename to src/taranis/usbd_usr.cpp index 9af985ab9..d8880620b 100644 --- a/src/taranis/usbd_usr.c +++ b/src/taranis/usbd_usr.cpp @@ -26,13 +26,17 @@ */ /* Includes ------------------------------------------------------------------*/ -#include "usbd_usr.h" +#include "../opentx.h" extern uint8_t usb_connected; +extern "C" { +#include "usbd_usr.h" + /* Points to the DEVICE_PROP structure of current device */ /* The purpose of this register is to speed up the execution */ + USBD_Usr_cb_TypeDef USR_cb = { USBD_USR_Init, @@ -44,6 +48,7 @@ USBD_Usr_cb_TypeDef USR_cb = USBD_USR_DeviceConnected, USBD_USR_DeviceDisconnected, }; +} /** * @brief Whatever the user application needs to do when USB is initialised @@ -52,7 +57,7 @@ USBD_Usr_cb_TypeDef USR_cb = */ void USBD_USR_Init(void) { - + } /** @@ -104,6 +109,12 @@ void USBD_USR_DeviceResumed(void) */ void USBD_USR_DeviceConnected (void) { + if (sdMounted()) { + audioQueue.stopSD(); + closeLogs(); + f_mount(0, 0); // unmount SD + } + usb_connected = 1; } @@ -117,6 +128,8 @@ void USBD_USR_DeviceConnected (void) void USBD_USR_DeviceDisconnected (void) { usb_connected = 0; + + sdInit(); } diff --git a/src/nmea.cpp b/src/telemetry_nmea.cpp similarity index 96% rename from src/nmea.cpp rename to src/telemetry_nmea.cpp index 4162d58c1..aa7964f08 100644 --- a/src/nmea.cpp +++ b/src/telemetry_nmea.cpp @@ -477,7 +477,7 @@ void menuTelemetryNMEA1(uint8_t event) if ((show_timer == 1) && rbuf[0][0]) { // show the Timer when data have been received lcd_puts ( 2*FW, 4*FH, PSTR("Timer")); // display "Timer" - putsTime+5*FWNUM+1 ( 5*FW, 5*FH, (gpstime-gpstimer), DBLSIZE, DBLSIZE); // display difference as mm:ss + putsTime ( 5*FW, 5*FH, (gpstime-gpstimer), DBLSIZE, DBLSIZE); // display difference as mm:ss } else { diff --git a/src/nmea.h b/src/telemetry_nmea.h similarity index 100% rename from src/nmea.h rename to src/telemetry_nmea.h diff --git a/src/translations.cpp b/src/translations.cpp index 77ca6d0d7..a6156f2b5 100644 --- a/src/translations.cpp +++ b/src/translations.cpp @@ -87,7 +87,6 @@ const pm_char STR_OPEN9X[] PROGMEM = #endif ISTR(VKEYS) ISTR(VSWITCHES) - ISTR(VSWITCHES_SHORT) ISTR(VSRCRAW) ISTR(VTMRMODES) #if defined(PCBGRUVIN9X) || defined (CPUARM) diff --git a/src/translations.h b/src/translations.h index f75c6e28b..60e00b9ef 100644 --- a/src/translations.h +++ b/src/translations.h @@ -134,8 +134,7 @@ extern const pm_char STR_OPEN9X[]; #define OFS_VKEYS (OFS_VSWASHTYPE) #endif #define OFS_VSWITCHES (OFS_VKEYS + sizeof(TR_VKEYS)) -#define OFS_VSWITCHES_SHORT (OFS_VSWITCHES + sizeof(TR_VSWITCHES)) -#define OFS_VSRCRAW (OFS_VSWITCHES_SHORT + sizeof(TR_VSWITCHES_SHORT)) +#define OFS_VSRCRAW (OFS_VSWITCHES + sizeof(TR_VSWITCHES)) #define OFS_VTMRMODES (OFS_VSRCRAW + sizeof(TR_VSRCRAW)) #define OFS_DATETIME (OFS_VTMRMODES + sizeof(TR_VTMRMODES)) #if defined(PCBGRUVIN9X) || defined(CPUARM) @@ -202,7 +201,6 @@ extern const pm_char STR_OPEN9X[]; #define STR_VKEYS (STR_OPEN9X + OFS_VKEYS) #define STR_VSWITCHES (STR_OPEN9X + OFS_VSWITCHES) -#define STR_VSWITCHES_SHORT (STR_OPEN9X + OFS_VSWITCHES_SHORT) #define STR_VSRCRAW (STR_OPEN9X + OFS_VSRCRAW) #define STR_VTMRMODES (STR_OPEN9X + OFS_VTMRMODES) diff --git a/src/translations/cz.h b/src/translations/cz.h index 53002c6a1..65458d347 100644 --- a/src/translations/cz.h +++ b/src/translations/cz.h @@ -286,9 +286,6 @@ #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW "ZAP" #endif -#define LEN_VSWITCHES_SHORT "\001" -#define TR_VSWITCHES_SHORT "-012TREAG3456789" - #if defined(PCBSKY9X) #define TR_ROTARY_ENCODERS_VSRCRAW "REnc" #elif defined(PCBGRUVIN9X) && ROTARY_ENCODERS > 2 diff --git a/src/translations/de.h b/src/translations/de.h index 67f04e323..a6d1d0038 100644 --- a/src/translations/de.h +++ b/src/translations/de.h @@ -288,9 +288,6 @@ #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW " ON" #endif -#define LEN_VSWITCHES_SHORT "\001" -#define TR_VSWITCHES_SHORT "-012TREAG3456789" - #if defined(PCBSKY9X) #define TR_ROTARY_ENCODERS_VSRCRAW "Dreh" #elif defined(PCBGRUVIN9X) && ROTARY_ENCODERS > 2 diff --git a/src/translations/en.h b/src/translations/en.h index 3e224be65..62feff7fd 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -135,8 +135,8 @@ #define LEN_VMIXTRIMS "\003" #define TR_VMIXTRIMS "OFF""ON\0""Rud""Ele""Thr""Ail" -#define LEN_VCSWFUNC "\006" -#define TR_VCSWFUNC "---\0 ""v1==x\0""v1>x\0 ""v1x""|v1|v2\0""v1=x\0 ""|d|>=x" +#define LEN_VCSWFUNC "\005" +#define TR_VCSWFUNC "---\0 ""a{x\0 ""a>x\0 ""ax""|a|b\0 ""a 2 diff --git a/src/translations/es.h b/src/translations/es.h index 98bf9bba9..80050811e 100644 --- a/src/translations/es.h +++ b/src/translations/es.h @@ -286,9 +286,6 @@ #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW " ON" #endif -#define LEN_VSWITCHES_SHORT "\001" -#define TR_VSWITCHES_SHORT "-012TREAG3456789" - #if defined(PCBSKY9X) #define TR_ROTARY_ENCODERS_VSRCRAW "REnc" #elif defined(PCBGRUVIN9X) && ROTARY_ENCODERS > 2 @@ -576,4 +573,4 @@ #define TR_EXTERNALRF "External RF" #define TR_FAILSAFE "Failsafe mode" #define TR_FAILSAFESET "FAILSAFE SETTINGS" -#define TR_COUNTRYCODE "Country Code" \ No newline at end of file +#define TR_COUNTRYCODE "Country Code" diff --git a/src/translations/fr.h b/src/translations/fr.h index db0604b1e..e311000a2 100644 --- a/src/translations/fr.h +++ b/src/translations/fr.h @@ -300,9 +300,6 @@ #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW " ON" #endif -#define LEN_VSWITCHES_SHORT "\001" -#define TR_VSWITCHES_SHORT "-012TREAG3456789" - #if defined(PCBSKY9X) #define TR_ROTARY_ENCODERS_VSRCRAW "REnc" #elif defined(PCBGRUVIN9X) && ROTARY_ENCODERS > 2 @@ -590,4 +587,4 @@ #define TR_EXTERNALRF "HF externe" #define TR_FAILSAFE "Type failsafe" #define TR_FAILSAFESET "REGLAGES FAILSAFE" -#define TR_COUNTRYCODE "Zone g\200o." \ No newline at end of file +#define TR_COUNTRYCODE "Zone g\200o." diff --git a/src/translations/it.h b/src/translations/it.h index 94987ed70..01cb5148e 100644 --- a/src/translations/it.h +++ b/src/translations/it.h @@ -285,9 +285,6 @@ #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW " ON" #endif -#define LEN_VSWITCHES_SHORT "\001" -#define TR_VSWITCHES_SHORT "-012TREAG3456789" - #if defined(PCBSKY9X) #define TR_ROTARY_ENCODERS_VSRCRAW "REa " #elif defined(PCBGRUVIN9X) && ROTARY_ENCODERS > 2 @@ -575,4 +572,4 @@ #define TR_EXTERNALRF "External RF" #define TR_FAILSAFE "Failsafe mode" #define TR_FAILSAFESET "FAILSAFE SETTINGS" -#define TR_COUNTRYCODE "Country Code" \ No newline at end of file +#define TR_COUNTRYCODE "Country Code" diff --git a/src/translations/pt.h b/src/translations/pt.h index 0cc64f8fc..787b9f4fb 100644 --- a/src/translations/pt.h +++ b/src/translations/pt.h @@ -264,9 +264,6 @@ #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW " ON" #endif -#define LEN_VSWITCHES_SHORT "\001" -#define TR_VSWITCHES_SHORT "-012TREAG3456789" - #if defined(PCBSKY9X) #define TR_ROTARY_ENCODERS_VSRCRAW "REnc" #elif defined(PCBGRUVIN9X) && ROTARY_ENCODERS > 2 @@ -554,4 +551,4 @@ #define TR_EXTERNALRF "External RF" #define TR_FAILSAFE "Failsafe mode" #define TR_FAILSAFESET "FAILSAFE SETTINGS" -#define TR_COUNTRYCODE "Country Code" \ No newline at end of file +#define TR_COUNTRYCODE "Country Code" diff --git a/src/translations/se.h b/src/translations/se.h index cd5a97078..618884e91 100644 --- a/src/translations/se.h +++ b/src/translations/se.h @@ -286,9 +286,6 @@ #define TR_VSWITCHES TR_9X_3POS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN" TR_CUSTOMSW " ON" #endif -#define LEN_VSWITCHES_SHORT "\001" -#define TR_VSWITCHES_SHORT "-012TREAG3456789" - #if defined(PCBSKY9X) #define TR_ROTARY_ENCODERS_VSRCRAW "REnc" #elif defined(PCBGRUVIN9X) && ROTARY_ENCODERS > 2 @@ -576,4 +573,4 @@ #define TR_EXTERNALRF "External RF" #define TR_FAILSAFE "Failsafe mode" #define TR_FAILSAFESET "FAILSAFE SETTINGS" -#define TR_COUNTRYCODE "Country Code" \ No newline at end of file +#define TR_COUNTRYCODE "Country Code" diff --git a/src/view_main.cpp b/src/view_main.cpp index dc8c76562..640022db0 100644 --- a/src/view_main.cpp +++ b/src/view_main.cpp @@ -44,7 +44,7 @@ #define RBOX_CENTERX (LCD_W-LBOX_CENTERX) #define RBOX_CENTERY LBOX_CENTERY #define MODELNAME_X (15) -#define MODELNAME_Y (10) +#define MODELNAME_Y (11) #define VBATT_X (MODELNAME_X+26) #define VBATT_Y (FH+3) #define VBATTUNIT_X (VBATT_X-2) @@ -237,12 +237,19 @@ void displayTopBar() lcd_rect(BAR_BATT_X+FW, BAR_Y+1, 13, 7); lcd_vline(BAR_BATT_X+FW+13, BAR_Y+2, 5); - /* RSSI */ - LCD_ICON(BAR_RSSI_X, BAR_Y, ICON_RSSI); - lcd_rect(BAR_RSSI_X+10, BAR_Y+1, 13, 7); + if (frskyData.rssi[0].value > 0) { + /* RSSI */ + LCD_ICON(BAR_RSSI_X, BAR_Y, ICON_RSSI); + lcd_rect(BAR_RSSI_X+10, BAR_Y+1, 13, 7); - /* Rx voltage */ - putsTelemetryChannel(BAR_A1_X, BAR_Y+1, TELEM_A1-1, frskyData.analog[0].value, LEFT); + /* Rx voltage */ + if (g_model.frsky.voltsSource <= 1) { + uint8_t value = frskyData.analog[g_model.frsky.voltsSource].value; + if (value > 0) { + putsTelemetryChannel(BAR_A1_X, BAR_Y+1, TELEM_A1+g_model.frsky.voltsSource-1, value, LEFT); + } + } + } /* Notifs icons */ xcoord_t x = BAR_NOTIFS_X; @@ -299,8 +306,9 @@ void displayTopBar() displayTopBarGauge(BAR_BATT_X+FW, count, g_vbat100mV <= g_eeGeneral.vBatWarn); /* The inside of the RSSI gauge */ - count = min(frskyData.rssi[0].value, frskyData.rssi[1].value) / 10; - displayTopBarGauge(BAR_RSSI_X+10, count, (frskyData.rssi[0].value < getRssiAlarmValue(0)) || (frskyData.rssi[1].value < getRssiAlarmValue(1))); + if (frskyData.rssi[0].value > 0) { + displayTopBarGauge(BAR_RSSI_X+10, frskyData.rssi[0].value / 10, frskyData.rssi[0].value < getRssiAlarmValue(0)); + } } #endif diff --git a/src/view_telemetry.cpp b/src/view_telemetry.cpp index 5d37af76c..4d218ebbd 100644 --- a/src/view_telemetry.cpp +++ b/src/view_telemetry.cpp @@ -55,15 +55,19 @@ uint8_t maxTelemValue(uint8_t channel) } } -int16_t convertTelemValue(uint8_t channel, uint8_t value) +getvalue_t convertTelemValue(uint8_t channel, uint8_t value) { - int16_t result; + getvalue_t result; switch (channel) { case TELEM_TM1: case TELEM_TM2: result = value * 3; break; case TELEM_ALT: +#if defined(PCBTARANIS) + result = value * 80 - 5000; + break; +#endif case TELEM_GPSALT: case TELEM_MAX_ALT: case TELEM_MIN_ALT: @@ -77,7 +81,7 @@ int16_t convertTelemValue(uint8_t channel, uint8_t value) case TELEM_T2: case TELEM_MAX_T1: case TELEM_MAX_T2: - result = (int16_t)value - 30; + result = (getvalue_t)value - 30; break; case TELEM_CELL: case TELEM_HDG: @@ -101,9 +105,9 @@ int16_t convertTelemValue(uint8_t channel, uint8_t value) return result; } -int16_t convertCswTelemValue(CustomSwData * cs) +getvalue_t convertCswTelemValue(CustomSwData * cs) { - int16_t val; + getvalue_t val; if (CS_STATE(cs->func)==CS_VOFS) val = convertTelemValue(cs->v1 - MIXSRC_FIRST_TELEM + 1, 128+cs->v2); else @@ -195,7 +199,11 @@ void putsTelemetryChannel(xcoord_t x, uint8_t y, uint8_t channel, lcdint_t val, putsTelemetryValue(x, y, val, UNIT_RAW, att); break; -#if defined(IMPERIAL_UNITS) +#if LCD_W >= 212 + case TELEM_ALT-1: + putsTelemetryValue(x, y, val/10, UNIT_METERS, att|PREC1); + break; +#elif defined(IMPERIAL_UNITS) case TELEM_ALT-1: case TELEM_MIN_ALT-1: case TELEM_MAX_ALT-1: @@ -457,7 +465,7 @@ void menuTelemetryFrsky(uint8_t event) } if (field) { fields_count++; - int16_t value = getValue(MIXSRC_FIRST_TELEM+field-2); + getvalue_t value = getValue(MIXSRC_FIRST_TELEM+field-2); uint8_t att = (i==3 ? NO_UNIT : DBLSIZE|NO_UNIT); #if LCD_W >= 212 xcoord_t pos[] = {0, 71, 143, 214};