diff --git a/radio/src/gui/128x64/lcd.cpp b/radio/src/gui/128x64/lcd.cpp index 9702e594d..2b0b44ed3 100644 --- a/radio/src/gui/128x64/lcd.cpp +++ b/radio/src/gui/128x64/lcd.cpp @@ -21,12 +21,22 @@ #include #include -#include + #include "lcd.h" #include "thirdparty/libopenui/src/bitfield.h" #include "gui/common/stdlcd/fonts.h" #include "gui/common/stdlcd/utf8.h" +#if !defined(SIMU) + #define assert(x) +#else + #include +#endif + +#if !defined(BOOT) + #include "opentx.h" +#endif + pixel_t displayBuf[DISPLAY_BUFFER_SIZE] __DMA; void lcdClear() diff --git a/radio/src/gui/128x64/model_gvars.cpp b/radio/src/gui/128x64/model_gvars.cpp index f8cc64616..acb73ef81 100644 --- a/radio/src/gui/128x64/model_gvars.cpp +++ b/radio/src/gui/128x64/model_gvars.cpp @@ -63,6 +63,8 @@ enum GVarFields { #define GVAR_2ND_COLUMN (12*FW) +static const char* _str_units[] = { "-", "%" }; + void menuModelGVarOne(event_t event) { GVarData * gvar = &g_model.gvars[s_currIdxSubMenu]; @@ -87,7 +89,7 @@ void menuModelGVarOne(event_t event) break; case GVAR_FIELD_UNIT: - gvar->unit = editChoice(GVAR_2ND_COLUMN, y, STR_UNIT, "\001-%", gvar->unit, 0, 1, attr, event); + gvar->unit = editChoice(GVAR_2ND_COLUMN, y, STR_UNIT, _str_units, gvar->unit, 0, 1, attr, event); break; case GVAR_FIELD_PREC: diff --git a/radio/src/gui/128x64/model_setup.cpp b/radio/src/gui/128x64/model_setup.cpp index d60020613..b35b070e4 100644 --- a/radio/src/gui/128x64/model_setup.cpp +++ b/radio/src/gui/128x64/model_setup.cpp @@ -424,6 +424,8 @@ void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event) NUM_SWITCHES - 1, /* Switch warning */ #endif +static const char* _pots_warn_modes[] = { "OFF", "Man", "Auto" }; + void menuModelSetup(event_t event) { int8_t old_editMode = s_editMode; @@ -781,9 +783,9 @@ void menuModelSetup(event_t event) case ITEM_MODEL_SETUP_SWITCHES_WARNING1: { - #define FIRSTSW_STR STR_VSRCRAW+(MIXSRC_FIRST_SWITCH-MIXSRC_Rud+1)*length + #define FIRSTSW_STR (&STR_VSRCRAW[MIXSRC_FIRST_SWITCH-MIXSRC_FIRST_STICK+1]) uint8_t switchWarningsCount = getSwitchWarningsCount(); - uint8_t length = STR_VSRCRAW[0]; + //uint8_t length = STR_VSRCRAW[0]; horzpos_t l_posHorz = menuHorizontalPosition; if (i>=NUM_BODY_LINES-2 && getSwitchWarningsCount() > MAX_SWITCH_PER_LINE*(NUM_BODY_LINES-i)) { @@ -856,7 +858,7 @@ void menuModelSetup(event_t event) c = (" " STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03]; lcdDrawSizedText( MODEL_SETUP_2ND_COLUMN + qr.rem * ((2 * FW) + 1), - y + FH * qr.quot, FIRSTSW_STR + (i * length) + 3, 1, + y + FH * qr.quot, FIRSTSW_STR[i] + sizeof(STR_CHAR_SWITCH) - 1, 1, attr && (menuHorizontalPosition == current) ? INVERS : 0); lcdDrawChar(lcdNextPos, y + FH * qr.quot, c); ++current; @@ -873,7 +875,7 @@ void menuModelSetup(event_t event) case ITEM_MODEL_SETUP_POTS_WARNING: lcdDrawTextAlignedLeft(y, STR_POTWARNING); - lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, "\004""OFF\0""Man\0""Auto", g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0); + lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, _pots_warn_modes, g_model.potsWarnMode, (menuHorizontalPosition == 0) ? attr : 0); if (attr && (menuHorizontalPosition == 0)) { CHECK_INCDEC_MODELVAR(event, g_model.potsWarnMode, POTS_WARN_OFF, POTS_WARN_AUTO); storageDirty(EE_MODEL); @@ -910,8 +912,9 @@ void menuModelSetup(event_t event) flags |= INVERS; } - // TODO add a new function - lcdDrawSizedText(x, y, STR_VSRCRAW+2+STR_VSRCRAW[0]*(NUM_STICKS+1+i), STR_VSRCRAW[0]-1, flags); + // skip "---" (+1) and source symbol (+2) + const char* source = STR_VSRCRAW[NUM_STICKS + 1 + i] + 2; + lcdDrawSizedText(x, y, source, UINT8_MAX, flags); x = lcdNextPos+3; } } diff --git a/radio/src/strhelpers.cpp b/radio/src/strhelpers.cpp index 52ef35b8b..7cb0432a3 100644 --- a/radio/src/strhelpers.cpp +++ b/radio/src/strhelpers.cpp @@ -571,7 +571,9 @@ char *getSourceString(char (&dest)[L], mixsrc_t idx) char* pos = strAppend(dest, STR_CHAR_INPUT, sizeof(STR_CHAR_INPUT) - 1); if (g_model.inputNames[idx][0] != '\0' && (dest_len > sizeof(g_model.inputNames[idx]))) { memset(pos, 0, sizeof(g_model.inputNames[idx]) + 1); - strncpy(pos, g_model.inputNames[idx], sizeof(g_model.inputNames[idx])); + size_t input_len = std::min(dest_len - 1, sizeof(g_model.inputNames[idx])); + strncpy(pos, g_model.inputNames[idx], input_len); + pos[input_len] = '\0'; } else { strAppendUnsigned(pos, idx + 1, 2); } diff --git a/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp b/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp index 7fa525bda..7282d94a4 100644 --- a/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp +++ b/radio/src/targets/common/arm/stm32/bluetooth_driver.cpp @@ -20,6 +20,7 @@ */ #include "board.h" +#include "debug.h" #if !defined(BOOT) Fifo btTxFifo; @@ -123,7 +124,6 @@ extern "C" void BT_USART_IRQHandler(void) USART_ClearITPendingBit(BT_USART, USART_IT_RXNE); uint8_t byte = USART_ReceiveData(BT_USART); btRxFifo.push(byte); - BLUETOOTH_TRACE_VERBOSE("BT %02X" CRLF, byte); #if defined(BLUETOOTH_PROBE) if (!btChipPresent) { // This is to differentiate X7 and X7S and X-Lite with/without BT diff --git a/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp b/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp index 6dbb0021f..25ee92dfc 100644 --- a/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp +++ b/radio/src/targets/common/arm/stm32/rotary_encoder_driver.cpp @@ -22,6 +22,11 @@ #include "board.h" #include "hal.h" #include "board_common.h" +#include "heartbeat_driver.h" + +#if !defined(BOOT) + #include "opentx.h" +#endif static uint8_t rotencPosition; volatile rotenc_t rotencValue; diff --git a/radio/src/targets/taranis/board.cpp b/radio/src/targets/taranis/board.cpp index dfbd9e37c..c83c3d67f 100644 --- a/radio/src/targets/taranis/board.cpp +++ b/radio/src/targets/taranis/board.cpp @@ -30,6 +30,10 @@ #include "dataconstants.h" +#if !defined(BOOT) + #include "opentx.h" +#endif + #if defined(AUX_SERIAL) #include "aux_serial_driver.h" #endif diff --git a/radio/src/translations/untranslated.h b/radio/src/translations/untranslated.h index 39d49e308..a7c73e8a3 100644 --- a/radio/src/translations/untranslated.h +++ b/radio/src/translations/untranslated.h @@ -54,7 +54,7 @@ STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH "SG", STR_CHAR_SWITCH "SH", \ STR_CHAR_SWITCH "SI", STR_CHAR_SWITCH "SJ", #elif defined(RADIO_TX12) - #define TR_POTS_VSRCRAW STR_CHAR_POT "S1", STR_CHAR_POT "S2", + #define TR_POTS_VSRCRAW STR_CHAR_POT "S1", STR_CHAR_POT "S2" #define TR_SW_VSRCRAW \ STR_CHAR_SWITCH "SA", STR_CHAR_SWITCH "SB", STR_CHAR_SWITCH \ "SC", STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH \ @@ -64,7 +64,7 @@ #define TR_POTS_VSRCRAW STR_CHAR_POT"S1", STR_CHAR_POT"S2" #define TR_SW_VSRCRAW STR_CHAR_SWITCH "SA", STR_CHAR_SWITCH "SB", STR_CHAR_SWITCH "SC", STR_CHAR_SWITCH "SD", STR_CHAR_SWITCH "SE", STR_CHAR_SWITCH "SF", STR_CHAR_SWITCH "SG", STR_CHAR_SWITCH "SH" #elif defined(PCBX7) - #define TR_POTS_VSRCRAW STR_CHAR_POT"S1", STR_CHAR_POT"S2", + #define TR_POTS_VSRCRAW STR_CHAR_POT"S1", STR_CHAR_POT"S2" #define TR_SW_VSRCRAW STR_CHAR_SWITCH"SA", STR_CHAR_SWITCH"SB", STR_CHAR_SWITCH"SC", STR_CHAR_SWITCH"SD", STR_CHAR_SWITCH"SF", STR_CHAR_SWITCH"SH", STR_CHAR_SWITCH"SI", STR_CHAR_SWITCH"SJ" #elif defined(PCBX9LITES) #define TR_POTS_VSRCRAW STR_CHAR_POT"S1"