From a5d0419c3c0cfa171bfbb7078c1f3a7cbad1da78 Mon Sep 17 00:00:00 2001 From: Bertrand Songis Date: Thu, 3 Oct 2019 12:19:31 +0200 Subject: [PATCH] Cosmetics --- radio/src/debug.h | 12 ++---------- radio/src/definitions.h | 14 ++++++++++++-- radio/src/gui/colorlcd/model_inputs.cpp | 8 ++++++-- radio/src/opentx.cpp | 10 +++++----- radio/src/targets/horus/libopenui_config.h | 2 ++ radio/src/targets/nv14/libopenui_config.h | 2 ++ 6 files changed, 29 insertions(+), 19 deletions(-) diff --git a/radio/src/debug.h b/radio/src/debug.h index d85a19b71..9408809cb 100644 --- a/radio/src/debug.h +++ b/radio/src/debug.h @@ -30,16 +30,12 @@ #include "serial.h" #endif -#if defined(__cplusplus) -extern "C" { -#endif - uint8_t auxSerialTracesEnabled(); #if defined(SIMU) - typedef void (*traceCallbackFunc)(const char * text); + EXTERN_C(typedef void (*traceCallbackFunc)(const char * text)); extern traceCallbackFunc traceCallback; - void debugPrintf(const char * format, ...); + EXTERN_C(void debugPrintf(const char * format, ...)); #elif defined(SEMIHOSTING) #include #define debugPrintf(...) printf(__VA_ARGS__) @@ -51,10 +47,6 @@ uint8_t auxSerialTracesEnabled(); #define debugPrintf(...) #endif -#if defined(__cplusplus) -} -#endif - #define TRACE_NOCRLF(...) debugPrintf(__VA_ARGS__) #define TRACE(f_, ...) debugPrintf((f_ "\r\n"), ##__VA_ARGS__) #define DUMP(data, size) dump(data, size) diff --git a/radio/src/definitions.h b/radio/src/definitions.h index bb8a7104a..52b4e2096 100644 --- a/radio/src/definitions.h +++ b/radio/src/definitions.h @@ -70,9 +70,9 @@ #endif #if __GNUC__ - #define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__)) + #define PACK(__Declaration__) __Declaration__ __attribute__((__packed__)) #else - #define PACK( __Declaration__ ) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) ) + #define PACK(__Declaration__) __pragma( pack(push, 1) ) __Declaration__ __pragma( pack(pop) ) #endif #if defined(SIMU) @@ -87,4 +87,14 @@ #define DIM(__arr) (sizeof((__arr)) / sizeof((__arr)[0])) #endif +#if defined(__cplusplus) + #define EXTERN_C(__Declaration__) extern "C" { __Declaration__ ; } + #define EXTERN_C_START extern "C" { + #define EXTERN_C_END } +#else + #define EXTERN_C(__Declaration__) __Declaration__ + #define EXTERN_C_START + #define EXTERN_C_END +#endif + #endif // _DEFINITIONS_H_ diff --git a/radio/src/gui/colorlcd/model_inputs.cpp b/radio/src/gui/colorlcd/model_inputs.cpp index b79d487d5..0e671f018 100644 --- a/radio/src/gui/colorlcd/model_inputs.cpp +++ b/radio/src/gui/colorlcd/model_inputs.cpp @@ -125,7 +125,7 @@ class InputEditWindow: public Page { void updateCurves() { FormGridLayout grid; - grid.setLabelWidth(120); + grid.setLabelWidth(INPUT_EDIT_LABELS_WIDTH); updateCurvesWindow->clear(); @@ -166,7 +166,7 @@ class InputEditWindow: public Page { NumberEdit * edit; FormGridLayout grid; - grid.setLabelWidth(120); + grid.setLabelWidth(INPUT_EDIT_LABELS_WIDTH); grid.spacer(PAGE_PADDING); ExpoData * line = expoAddress(index) ; @@ -196,6 +196,10 @@ class InputEditWindow: public Page { }); grid.nextLine(); +#if LCD_H > LCD_W + grid.setMarginRight(10); +#endif + // Name new StaticText(window, grid.getLabelSlot(), STR_EXPONAME); new TextEdit(window, grid.getFieldSlot(), line->name, sizeof(line->name)); diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 1e40a613e..494095495 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -346,7 +346,7 @@ void generalDefault() uint16_t evalChkSum() { uint16_t sum = 0; - const int16_t *calibValues = (const int16_t *) &g_eeGeneral.calib[0]; + const int16_t * calibValues = (const int16_t *) &g_eeGeneral.calib[0]; for (int i=0; i<12; i++) sum += calibValues[i]; return sum; @@ -370,12 +370,12 @@ void defaultInputs() expo->weight = 100; expo->mode = 3; // TODO constant #if defined(TRANSLATIONS_CZ) - for (int c=0; c<4; c++) { - g_model.inputNames[i][c] = char2zchar(STR_INPUTNAMES[1+4*(stick_index-1)+c]); + for (int c = 0; c < 4; c++) { + g_model.inputNames[i][c] = STR_INPUTNAMES[1+4*(stick_index-1)+c]; } #else - for (int c=0; c<3; c++) { - g_model.inputNames[i][c] = char2zchar(STR_VSRCRAW[2 + 4 * stick_index + c]); + for (int c = 0; c < 3; c++) { + g_model.inputNames[i][c] = STR_VSRCRAW[2 + 4 * stick_index + c]; } #if LEN_INPUT_NAME > 3 g_model.inputNames[i][3] = '\0'; diff --git a/radio/src/targets/horus/libopenui_config.h b/radio/src/targets/horus/libopenui_config.h index 9d753eafb..798298820 100644 --- a/radio/src/targets/horus/libopenui_config.h +++ b/radio/src/targets/horus/libopenui_config.h @@ -130,4 +130,6 @@ enum LcdColorIndex #define FONT_TABLE_SIZE 1 #endif +constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 120; + #endif // _LIBOPENUI_CONFIG_H_ diff --git a/radio/src/targets/nv14/libopenui_config.h b/radio/src/targets/nv14/libopenui_config.h index 6d860e297..4d3eca4c7 100644 --- a/radio/src/targets/nv14/libopenui_config.h +++ b/radio/src/targets/nv14/libopenui_config.h @@ -128,4 +128,6 @@ enum LcdColorIndex #define FONT_TABLE_SIZE 1 #endif +constexpr uint32_t INPUT_EDIT_LABELS_WIDTH = 80; + #endif // _LIBOPENUI_CONFIG_H_