diff --git a/radio/src/debug.cpp b/radio/src/debug.cpp index c4de32e9f..f7a0bd1f5 100644 --- a/radio/src/debug.cpp +++ b/radio/src/debug.cpp @@ -26,10 +26,6 @@ traceCallbackFunc traceCallback = 0; #endif -#if !defined(SIMU) -uint32_t debugCounter1ms = 0; -#endif - #if defined(SIMU) #define PRINTF_BUFFER_SIZE 1024 void debugPrintf(const char * format, ...) diff --git a/radio/src/debug.h b/radio/src/debug.h index f3dcf5b3a..092c6d625 100644 --- a/radio/src/debug.h +++ b/radio/src/debug.h @@ -54,8 +54,8 @@ uint8_t aux2SerialTracesEnabled(); #define debugPrintf(...) #endif -#define TRACE_TIME_FORMAT "%0.2f " -#define TRACE_TIME_VALUE ((float)g_tmr10ms / 100) +#define TRACE_TIME_FORMAT "%0.2fs: " +#define TRACE_TIME_VALUE ((float)g_tmr10ms / 100.0) #define TRACE_NOCRLF(...) debugPrintf(__VA_ARGS__) #define TRACE(f_, ...) debugPrintf((TRACE_TIME_FORMAT f_ CRLF), TRACE_TIME_VALUE, ##__VA_ARGS__) @@ -432,9 +432,5 @@ extern const char * const debugTimerNames[DEBUG_TIMERS_COUNT]; #endif //#if defined(DEBUG_TIMERS) -#if !defined(SIMU) -extern uint32_t debugCounter1ms; -#endif - #endif // _DEBUG_H_ diff --git a/radio/src/gui/colorlcd/bitmaps.h b/radio/src/gui/colorlcd/bitmaps.h index 60950a707..263138adc 100644 --- a/radio/src/gui/colorlcd/bitmaps.h +++ b/radio/src/gui/colorlcd/bitmaps.h @@ -102,8 +102,8 @@ extern BitmapBuffer * mixerSetupLabelIcon; extern BitmapBuffer * mixerSetupFlightmodeIcon; extern BitmapBuffer * mixerSetupCurveIcon; extern BitmapBuffer * mixerSetupSwitchIcon; -//extern BitmapBuffer * mixerSetupDelayIcon; -//extern BitmapBuffer * mixerSetupSlowIcon; -//extern BitmapBuffer * mixerSetupDelaySlowIcon; +extern BitmapBuffer * mixerSetupDelayIcon; +extern BitmapBuffer * mixerSetupSlowIcon; +extern BitmapBuffer * mixerSetupDelaySlowIcon; #endif // _BITMAPS_H_ diff --git a/radio/src/gui/colorlcd/layouts/layout1+2.cpp b/radio/src/gui/colorlcd/layouts/layout1+2.cpp new file mode 100644 index 000000000..df968e6fd --- /dev/null +++ b/radio/src/gui/colorlcd/layouts/layout1+2.cpp @@ -0,0 +1,66 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "layout.h" +#include "layout_factory_impl.h" + +const uint8_t LBM_LAYOUT_1P2[] = { +#include "mask_layout1+2.lbm" +}; + +const ZoneOption OPTIONS_LAYOUT_1P2[] = { + LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END +}; + +class Layout1P2: public Layout +{ + public: + Layout1P2(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + unsigned int getZonesCount() const override + { + return 3; + } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + if (index == 0) { + return {zone.x, zone.y, zone.w, zone.h / 2}; + } + else if (index == 1) { + return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 4}; + } + else + { + return {zone.x, zone.y + zone.h * 3 / 4, zone.w, zone.h / 4}; + } + + return zone; + } +}; + +BaseLayoutFactory Layout1P2("Layout1P2", "1 + 2", LBM_LAYOUT_1P2, OPTIONS_LAYOUT_1P2); diff --git a/radio/src/gui/colorlcd/layouts/layout1x2.cpp b/radio/src/gui/colorlcd/layouts/layout1x2.cpp new file mode 100644 index 000000000..6c3c728a6 --- /dev/null +++ b/radio/src/gui/colorlcd/layouts/layout1x2.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "layout.h" +#include "layout_factory_impl.h" + +const uint8_t LBM_LAYOUT_1x2[] = { +#include "mask_layout1x2.lbm" +}; + +const ZoneOption OPTIONS_LAYOUT_1x2[] = { + LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END +}; + +class Layout1x2: public Layout +{ + public: + Layout1x2(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + unsigned int getZonesCount() const override + { + return 2; + } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + if (index == 0) { + return {zone.x, zone.y, zone.w, zone.h / 2}; + } + else { + return {zone.x, zone.y + zone.h / 2, zone.w, zone.h / 2}; + } + + return zone; + } +}; + +BaseLayoutFactory Layout1x2("Layout1x2", "1 x 2", LBM_LAYOUT_1x2, OPTIONS_LAYOUT_1x2); diff --git a/radio/src/gui/colorlcd/layouts/layout1x4.cpp b/radio/src/gui/colorlcd/layouts/layout1x4.cpp new file mode 100644 index 000000000..acf4e097e --- /dev/null +++ b/radio/src/gui/colorlcd/layouts/layout1x4.cpp @@ -0,0 +1,61 @@ +/* + * Copyright (C) EdgeTX + * + * Based on code named + * opentx - https://github.com/opentx/opentx + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include "layout.h" +#include "layout_factory_impl.h" + +const uint8_t LBM_LAYOUT_1x4[] = { +#include "mask_layout1x4.lbm" +}; + +const ZoneOption OPTIONS_LAYOUT_1x4[] = { + LAYOUT_COMMON_OPTIONS, + LAYOUT_OPTIONS_END +}; + +class Layout1x4: public Layout +{ + public: + Layout1x4(const LayoutFactory * factory, Layout::PersistentData * persistentData): + Layout(factory, persistentData) + { + } + + unsigned int getZonesCount() const override + { + return 4; + } + + rect_t getZone(unsigned int index) const override + { + rect_t zone = getMainZone(); + + if (index > 3) + { + index = 3; + } + return {zone.x, zone.y + zone.h / 4 * (int)index, zone.w, zone.h / 4}; + + return zone; + } +}; + +BaseLayoutFactory Layout1x4("Layout1x4", "1 x 4", LBM_LAYOUT_1x4, OPTIONS_LAYOUT_1x4); diff --git a/radio/src/gui/colorlcd/layouts/mask_layout1+2.png b/radio/src/gui/colorlcd/layouts/mask_layout1+2.png new file mode 100644 index 000000000..cef79bbbc Binary files /dev/null and b/radio/src/gui/colorlcd/layouts/mask_layout1+2.png differ diff --git a/radio/src/gui/colorlcd/layouts/mask_layout1x1.png b/radio/src/gui/colorlcd/layouts/mask_layout1x1.png index c575226dd..d80c5cf2c 100644 Binary files a/radio/src/gui/colorlcd/layouts/mask_layout1x1.png and b/radio/src/gui/colorlcd/layouts/mask_layout1x1.png differ diff --git a/radio/src/gui/colorlcd/layouts/mask_layout1x2.png b/radio/src/gui/colorlcd/layouts/mask_layout1x2.png new file mode 100644 index 000000000..2dd05cdfa Binary files /dev/null and b/radio/src/gui/colorlcd/layouts/mask_layout1x2.png differ diff --git a/radio/src/gui/colorlcd/layouts/mask_layout1x4.png b/radio/src/gui/colorlcd/layouts/mask_layout1x4.png new file mode 100644 index 000000000..28bb3f3c0 Binary files /dev/null and b/radio/src/gui/colorlcd/layouts/mask_layout1x4.png differ diff --git a/radio/src/gui/colorlcd/layouts/mask_layout2+1.png b/radio/src/gui/colorlcd/layouts/mask_layout2+1.png index 9c9c7a1fe..d69083966 100644 Binary files a/radio/src/gui/colorlcd/layouts/mask_layout2+1.png and b/radio/src/gui/colorlcd/layouts/mask_layout2+1.png differ diff --git a/radio/src/gui/colorlcd/layouts/mask_layout2x1.png b/radio/src/gui/colorlcd/layouts/mask_layout2x1.png index 9bb74c18e..8f6aca64a 100644 Binary files a/radio/src/gui/colorlcd/layouts/mask_layout2x1.png and b/radio/src/gui/colorlcd/layouts/mask_layout2x1.png differ diff --git a/radio/src/gui/colorlcd/layouts/mask_layout2x2.png b/radio/src/gui/colorlcd/layouts/mask_layout2x2.png index bb958745b..3a481c579 100644 Binary files a/radio/src/gui/colorlcd/layouts/mask_layout2x2.png and b/radio/src/gui/colorlcd/layouts/mask_layout2x2.png differ diff --git a/radio/src/gui/colorlcd/layouts/topbar_impl.cpp b/radio/src/gui/colorlcd/layouts/topbar_impl.cpp index 7ba5bfb02..58cfefef9 100644 --- a/radio/src/gui/colorlcd/layouts/topbar_impl.cpp +++ b/radio/src/gui/colorlcd/layouts/topbar_impl.cpp @@ -83,37 +83,39 @@ void TopbarImpl::paint(BitmapBuffer * dc) struct gtm t; gettime(&t); char str[10]; - - sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]); +#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW) + sprintf(str, "%d-%d", t.tm_mon + 1, t.tm_mday); +#else + const char * const STR_MONTHS[] = TR_MONTHS; + sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]); +#endif //dc->drawSolidVerticalLine(DATETIME_SEPARATOR_X, 7, 31, MENU_COLOR); - dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS) | CENTERED| FOCUS_COLOR); - + dc->drawText(DATETIME_MIDDLE, DATETIME_LINE1, str, FONT(XS)|FOCUS_COLOR|CENTERED); getTimerString(str, getValue(MIXSRC_TX_TIME)); - dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS) | CENTERED | FOCUS_COLOR); + dc->drawText(DATETIME_MIDDLE, DATETIME_LINE2, str, FONT(XS)|FOCUS_COLOR|CENTERED); #if defined(INTERNAL_GPS) if (gpsData.fix) { char s[10]; sprintf(s, "%d", gpsData.numSat); - dc->drawText(LCD_W-148, 4, s, FONT(XS) | CENTERED | FOCUS_COLOR); + dc->drawText(GPS_X, 4, s, FONT(XS) | CENTERED | FOCUS_COLOR); } - dc->drawBitmapPattern(LCD_W - 158, 22, LBM_TOPMENU_GPS, + dc->drawBitmapPattern(GPS_X - 10, 22, LBM_TOPMENU_GPS, (gpsData.fix) ? FOCUS_COLOR : MENU_TITLE_DISABLE_COLOR); #endif // USB icon if (usbPlugged()) { - LcdFlags flags = FOCUS_COLOR; if (getSelectedUsbMode() == USB_UNSELECTED_MODE) { flags = MENU_TITLE_DISABLE_COLOR; } - dc->drawBitmapPattern(LCD_W - 98, 8, LBM_TOPMENU_USB, flags); + dc->drawBitmapPattern(USB_X, 8, LBM_TOPMENU_USB, flags); } // Logs else if (isFunctionActive(FUNCTION_LOGS) && BLINK_ON_PHASE) { - dc->drawBitmapPattern(LCD_W - 98, 6, LBM_DOT, FOCUS_COLOR); + dc->drawBitmapPattern(LOG_X, 6, LBM_DOT, FOCUS_COLOR); } // RSSI @@ -121,7 +123,7 @@ void TopbarImpl::paint(BitmapBuffer * dc) const uint8_t rssiBarsHeight[] = {5, 10, 15, 21, 31}; for (unsigned int i = 0; i < DIM(rssiBarsHeight); i++) { uint8_t height = rssiBarsHeight[i]; - dc->drawSolidFilledRect(LCD_W - 90 + i * 6, 38 - height, 4, height, + dc->drawSolidFilledRect(RSSI_X + i * 6, 38 - height, 4, height, TELEMETRY_RSSI() >= rssiBarsValue[i] ? FOCUS_COLOR : MENU_TITLE_DISABLE_COLOR); @@ -129,37 +131,37 @@ void TopbarImpl::paint(BitmapBuffer * dc) #if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA) if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) { - dc->drawBitmapPattern(LCD_W-94, 4, LBM_TOPMENU_ANTENNA, FOCUS_COLOR); + dc->drawBitmapPattern(RSSI_X - 4, 4, LBM_TOPMENU_ANTENNA, FOCUS_COLOR); } #endif /* Audio volume */ - dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR); + dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_SCALE, MENU_TITLE_DISABLE_COLOR); if (requiredSpeakerVolume == 0 || g_eeGeneral.beepMode == e_mode_quiet) - dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_0, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_0, FOCUS_COLOR); else if (requiredSpeakerVolume < 7) - dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_1, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_1, FOCUS_COLOR); else if (requiredSpeakerVolume < 13) - dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_2, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_2, FOCUS_COLOR); else if (requiredSpeakerVolume < 19) - dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_3, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_3, FOCUS_COLOR); else - dc->drawBitmapPattern(LCD_W - 130, 4, LBM_TOPMENU_VOLUME_4, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 4, LBM_TOPMENU_VOLUME_4, FOCUS_COLOR); /* Tx battery */ uint8_t bars = GET_TXBATT_BARS(5); #if defined(USB_CHARGER) if (usbChargerLed()) { - dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT_CHARGING, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT_CHARGING, FOCUS_COLOR); } else { - dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR); } #else - dc->drawBitmapPattern(LCD_W - 130, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR); + dc->drawBitmapPattern(AUDIO_X, 25, LBM_TOPMENU_TXBATT, FOCUS_COLOR); #endif for (unsigned int i = 0; i < 5; i++) { - dc->drawSolidFilledRect(LCD_W - 128 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : FOCUS_COLOR); + dc->drawSolidFilledRect(AUDIO_X - 2 + 4 * i, 30, 2, 8, i >= bars ? MENU_TITLE_DISABLE_COLOR : FOCUS_COLOR); } #if 0 diff --git a/radio/src/gui/colorlcd/model_logical_switches.cpp b/radio/src/gui/colorlcd/model_logical_switches.cpp index 3860d3981..994f6bb09 100644 --- a/radio/src/gui/colorlcd/model_logical_switches.cpp +++ b/radio/src/gui/colorlcd/model_logical_switches.cpp @@ -145,14 +145,14 @@ class LogicalSwitchEditPage: public Page new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V1); auto timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v1)); timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { - drawTimer(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags); + dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1); }); grid.nextLine(); new StaticText(logicalSwitchOneWindow, grid.getLabelSlot(), STR_V2); timer = new NumberEdit(logicalSwitchOneWindow, grid.getFieldSlot(), -128, 122, GET_SET_DEFAULT(cs->v2)); timer->setDisplayHandler([](BitmapBuffer * dc, LcdFlags flags, int32_t value) { - drawTimer(dc, FIELD_PADDING_LEFT, FIELD_PADDING_TOP, value, flags); + dc->drawNumber(FIELD_PADDING_LEFT, FIELD_PADDING_TOP, lswTimerValue(value), flags | PREC1); }); grid.nextLine(); } diff --git a/radio/src/gui/colorlcd/model_mixes.cpp b/radio/src/gui/colorlcd/model_mixes.cpp index 1e67b5656..1434d1d19 100644 --- a/radio/src/gui/colorlcd/model_mixes.cpp +++ b/radio/src/gui/colorlcd/model_mixes.cpp @@ -286,6 +286,15 @@ class MixLineButton : public CommonInputOrMixButton if (line.flightModes) { drawFlightModes(dc, line.flightModes, textColor); } + + // Put this icon on the first line, since we jave more space there + uint8_t delayslow = 0; + if (line.speedDown || line.speedUp) delayslow = 1; + if (line.delayUp || line.delayDown) delayslow += 2; + if (delayslow) { + BitmapBuffer *delayslowbmp[] = {mixerSetupSlowIcon, mixerSetupDelayIcon, mixerSetupDelaySlowIcon}; + dc->drawMask(width() - 16, FIELD_PADDING_TOP, delayslowbmp[delayslow - 1], textColor); + } } }; diff --git a/radio/src/gui/colorlcd/model_setup.cpp b/radio/src/gui/colorlcd/model_setup.cpp index e7bec9ba7..74fd43d10 100644 --- a/radio/src/gui/colorlcd/model_setup.cpp +++ b/radio/src/gui/colorlcd/model_setup.cpp @@ -567,6 +567,7 @@ class ModuleWindow : public FormGroup { channelStart->setMax(MAX_OUTPUT_CHANNELS - sentModuleChannels(moduleIdx) + 1); }); channelEnd->enable(minModuleChannels(moduleIdx) < maxModuleChannels(moduleIdx)); + if (channelEnd->getValue() > channelEnd->getMax()) channelEnd->setValue(channelEnd->getMax()); } void update() @@ -640,10 +641,12 @@ class ModuleWindow : public FormGroup { // Multi type (CUSTOM, brand A, brand B,...) int multiRfProto = g_model.moduleData[moduleIdx].getMultiProtocol(); + + // Grid count for narrow/wide screen + int count = LCD_W < LCD_H ? 1 : (g_model.moduleData[moduleIdx].multi.customProto ? 3 : 2); rfChoice = new Choice( this, - grid.getFieldSlot( - g_model.moduleData[moduleIdx].multi.customProto ? 3 : 2, 0), + grid.getFieldSlot(count, 0), STR_MULTI_PROTOCOLS, MODULE_SUBTYPE_MULTI_FIRST, MODULE_SUBTYPE_MULTI_LAST, GET_DEFAULT(multiRfProto), [=](int32_t newValue) { @@ -658,11 +661,20 @@ class ModuleWindow : public FormGroup { if (MULTIMODULE_HAS_SUBTYPE(moduleIdx)) { // Subtype (D16, DSMX,...) + + // Grid count for narrow/wide screen + count = LCD_W < LCD_H ? 1 : 2; + int index = 1; + if (count == 1) + { + grid.nextLine(); + index = 0; + } const mm_protocol_definition *pdef = getMultiProtocolDefinition( g_model.moduleData[moduleIdx].getMultiProtocol()); if (pdef->maxSubtype > 0) { mmSubProtocol = new Choice( - this, grid.getFieldSlot(2, 1), pdef->subTypeString, 0, + this, grid.getFieldSlot(count, index), pdef->subTypeString, 0, pdef->maxSubtype, [=]() { return g_model.moduleData[moduleIdx].subType; }, [=](int16_t newValue) { diff --git a/radio/src/gui/colorlcd/radio_diaganas.cpp b/radio/src/gui/colorlcd/radio_diaganas.cpp index 9539bfb36..9e3547fe6 100644 --- a/radio/src/gui/colorlcd/radio_diaganas.cpp +++ b/radio/src/gui/colorlcd/radio_diaganas.cpp @@ -40,8 +40,13 @@ class RadioAnalogsDiagsWindow: public Window { void paint(BitmapBuffer * dc) override { for (uint8_t i = 0; i < NUM_STICKS + NUM_POTS + NUM_SLIDERS; i++) { - coord_t y = 1 + (i / 2) * FH; - uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10; +#if LCD_W > LCD_H + coord_t y = 1 + (i / 2) * FH; + uint8_t x = i & 1 ? LCD_W / 2 + 10 : 10; +#else + coord_t y = 1 + i * FH; + uint8_t x = 10; +#endif dc->drawNumber(x, y, i + 1, LEADING0 | LEFT, 2); dc->drawText(x + 2 * 15 - 2, y, ":"); drawHexNumber(dc, x + 3 * 15 - 1, y, anaIn(i)); diff --git a/radio/src/gui/colorlcd/radio_sdmanager.cpp b/radio/src/gui/colorlcd/radio_sdmanager.cpp index 217d44612..b6508458e 100644 --- a/radio/src/gui/colorlcd/radio_sdmanager.cpp +++ b/radio/src/gui/colorlcd/radio_sdmanager.cpp @@ -211,6 +211,28 @@ class FlashDialog: public FullScreenDialog Progress progress; }; +class SDmanagerButton : public TextButton +{ + public: + SDmanagerButton(FormGroup* parent, const rect_t& rect, std::string text, + std::function pressHandler = nullptr, + WindowFlags windowFlags = BUTTON_BACKGROUND | OPAQUE, + LcdFlags textFlags = 0 ) : TextButton(parent, rect, text, pressHandler, windowFlags, textFlags) + { + }; +#if defined(HARDWARE_TOUCH) + bool onTouchStart(coord_t x, coord_t y) override + { + if (enabled) { + if (!(windowFlags & NO_FOCUS)) { + setFocus(SET_FOCUS_DEFAULT); + } + } + return true; + } +#endif +}; + void RadioSdManagerPage::build(FormWindow * window) { FormGridLayout grid; @@ -250,7 +272,7 @@ void RadioSdManagerPage::build(FormWindow * window) files.sort(compare_nocase); for (auto name: directories) { - auto b = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { + auto b = new SDmanagerButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { std::string fullpath = currentPath + "/" + name; f_chdir((TCHAR*)fullpath.c_str()); window->clear(); @@ -262,7 +284,7 @@ void RadioSdManagerPage::build(FormWindow * window) } for (auto name: files) { - auto button = new TextButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { + auto button = new SDmanagerButton(window, grid.getLabelSlot(), name, [=]() -> uint8_t { auto menu = new Menu(window); f_chdir(currentPath.c_str()); const char *ext = getFileExtension(name.data()); diff --git a/radio/src/gui/colorlcd/themes/480_default.cpp b/radio/src/gui/colorlcd/themes/480_default.cpp index c45ae3762..282e84a92 100644 --- a/radio/src/gui/colorlcd/themes/480_default.cpp +++ b/radio/src/gui/colorlcd/themes/480_default.cpp @@ -296,14 +296,14 @@ class Theme480: public OpenTxTheme delete mixerSetupFlightmodeIcon; mixerSetupFlightmodeIcon = BitmapBuffer::load8bitMask(mask_textline_fm); -// delete mixerSetupSlowIcon; -// mixerSetupSlowIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_slow.png")); -// -// delete mixerSetupDelayIcon; -// mixerSetupDelayIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_delay.png")); -// -// delete mixerSetupDelaySlowIcon; -// mixerSetupDelaySlowIcon = BitmapBuffer::loadMask(getFilePath("mask_textline_delayslow.png")); + delete mixerSetupSlowIcon; + mixerSetupSlowIcon = BitmapBuffer::load8bitMask(mask_textline_slow); + + delete mixerSetupDelayIcon; + mixerSetupDelayIcon = BitmapBuffer::load8bitMask(mask_textline_delay); + + delete mixerSetupDelaySlowIcon; + mixerSetupDelaySlowIcon = BitmapBuffer::load8bitMask(mask_textline_delayslow); } void load() const override @@ -424,8 +424,8 @@ class Theme480: public OpenTxTheme struct gtm t; gettime(&t); char str[10]; -#if defined(TRANSLATIONS_CN) - sprintf(str, "%d" TR_MONTH "%d", t.tm_mon + 1, t.tm_mday); +#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW) + sprintf(str, "%d-%d", t.tm_mon + 1, t.tm_mday); #else const char * const STR_MONTHS[] = TR_MONTHS; sprintf(str, "%d %s", t.tm_mday, STR_MONTHS[t.tm_mon]); diff --git a/radio/src/gui/colorlcd/themes/flysky.cpp b/radio/src/gui/colorlcd/themes/flysky.cpp index 618a988ad..92dd227c3 100644 --- a/radio/src/gui/colorlcd/themes/flysky.cpp +++ b/radio/src/gui/colorlcd/themes/flysky.cpp @@ -416,7 +416,7 @@ class FlyskyTheme: public OpenTxTheme gettime(&t); char str[10]; -#if defined(TRANSLATIONS_CN) +#if defined(TRANSLATIONS_CN) || defined(TRANSLATIONS_TW) sprintf(str, "%d" TR_MONTH "%d", t.tm_mon + 1, t.tm_mday); #else const char * const STR_MONTHS[] = TR_MONTHS; diff --git a/radio/src/gui/colorlcd/view_main.cpp b/radio/src/gui/colorlcd/view_main.cpp index b9c1721e4..86c79f8e3 100644 --- a/radio/src/gui/colorlcd/view_main.cpp +++ b/radio/src/gui/colorlcd/view_main.cpp @@ -96,7 +96,7 @@ void ViewMain::setCurrentMainView(unsigned view) { if (view < getMainViewsCount()) { setScrollPositionX(view * pageWidth); - TRACE("### switched to view #%i", g_model.view); + TRACE("### switched to view #%u", g_model.view); } } diff --git a/radio/src/pulses/modules_helpers.h b/radio/src/pulses/modules_helpers.h index 23eca3f9f..2f23dccde 100644 --- a/radio/src/pulses/modules_helpers.h +++ b/radio/src/pulses/modules_helpers.h @@ -367,6 +367,16 @@ inline int8_t maxModuleChannels_M8(uint8_t moduleIdx) else if (isModuleAFHDS3(moduleIdx)) { return 10; } + else if (isModuleDSM2(moduleIdx)) { + return -2; // 6 channels + } + else if (isModuleMultimoduleDSM2(moduleIdx)) { + return 4; // 12 channels + } + //TODO: This should be based on the selected protocol + else if(isModuleMultimodule(moduleIdx)) { + return 8; // 16 channels + } else { return maxChannelsModules_M8[g_model.moduleData[moduleIdx].type]; } diff --git a/radio/src/pulses/multi.cpp b/radio/src/pulses/multi.cpp index f7c4d89a0..1e4c4fcd9 100644 --- a/radio/src/pulses/multi.cpp +++ b/radio/src/pulses/multi.cpp @@ -134,7 +134,7 @@ void setupPulsesMulti(uint8_t moduleIdx) { static int counter[2] = {0,0}; //TODO static uint8_t invert[2] = {0x00, //internal -#if defined(PCBTARANIS) || defined(PCBHORUS) || defined(NV14) +#if defined(PCBTARANIS) || defined(PCBHORUS) || defined(PCBNV14) 0x08 //external #else 0x00 //external diff --git a/radio/src/pulses/pulses.cpp b/radio/src/pulses/pulses.cpp index a6888270f..9086367ad 100755 --- a/radio/src/pulses/pulses.cpp +++ b/radio/src/pulses/pulses.cpp @@ -111,7 +111,7 @@ uint8_t getModuleType(uint8_t module) uint8_t getRequiredProtocol(uint8_t module) { - uint8_t protocol; + uint8_t protocol = PROTOCOL_CHANNELS_UNINITIALIZED; switch (getModuleType(module)) { case MODULE_TYPE_PPM: diff --git a/radio/src/serial.cpp b/radio/src/serial.cpp index ff89bb52f..c83b2fd92 100644 --- a/radio/src/serial.cpp +++ b/radio/src/serial.cpp @@ -45,9 +45,8 @@ void serialPrintf(const char * format, ...) va_list arglist; char tmp[PRINTF_BUFFER_SIZE+1]; - snprintf(tmp, PRINTF_BUFFER_SIZE, "+%05lums: ", debugCounter1ms); va_start(arglist, format); - vsnprintf(tmp+strlen(tmp), PRINTF_BUFFER_SIZE-strlen(tmp), format, arglist); + vsnprintf(tmp, PRINTF_BUFFER_SIZE, format, arglist); tmp[PRINTF_BUFFER_SIZE] = '\0'; va_end(arglist); @@ -55,7 +54,6 @@ void serialPrintf(const char * format, ...) while (*t) { serialPutc(*t++); } - debugCounter1ms = 0; } void serialCrlf() diff --git a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp index fd7c36a6d..0d6383752 100644 --- a/radio/src/targets/common/arm/stm32/bootloader/boot.cpp +++ b/radio/src/targets/common/arm/stm32/bootloader/boot.cpp @@ -57,7 +57,6 @@ volatile rotenc_t rotencValue = 0; #if defined(DEBUG) volatile tmr10ms_t g_tmr10ms; -uint32_t debugCounter1ms = 0; #endif uint32_t firmwareSize; diff --git a/radio/src/targets/common/arm/stm32/stm32_hal_adc.cpp b/radio/src/targets/common/arm/stm32/stm32_hal_adc.cpp index f7482e2ba..94ecabb2a 100644 --- a/radio/src/targets/common/arm/stm32/stm32_hal_adc.cpp +++ b/radio/src/targets/common/arm/stm32/stm32_hal_adc.cpp @@ -389,7 +389,7 @@ static void stm32_hal_adc_wait_completion() // Wait for all ADCs to complete for (unsigned int i=0; i<10000; i++) { if (DMA_GetFlagStatus(ADC_DMA_Stream, ADC_DMA_TC_Flag) != RESET && - DMA_GetFlagStatus(ADC_EXT_DMA_Stream, ADC_EXT_DMA_TC_Flag) != RESET) { + DMA_GetFlagStatus(ADC_EXT_DMA_Stream, ADC_EXT_TC_Flag) != RESET) { break; } } diff --git a/radio/src/targets/horus/CMakeLists.txt b/radio/src/targets/horus/CMakeLists.txt index 591b37270..e6d35ee6e 100644 --- a/radio/src/targets/horus/CMakeLists.txt +++ b/radio/src/targets/horus/CMakeLists.txt @@ -185,7 +185,6 @@ endif() if(FLYSKY_HALL_STICKS) add_definitions(-DFLYSKY_HALL_STICKS) add_definitions(-DFLYSKY_HALL_STICKS_REVERSE) - set(AUX_SERIAL OFF) set(FLYSKY_HALL_STICKS_DRIVER flyskyHallStick_driver.cpp) endif() diff --git a/radio/src/targets/horus/libopenui_config.h b/radio/src/targets/horus/libopenui_config.h index 2e89621f3..1ed9d0001 100644 --- a/radio/src/targets/horus/libopenui_config.h +++ b/radio/src/targets/horus/libopenui_config.h @@ -84,6 +84,12 @@ constexpr uint32_t DATETIME_LINE1 = 7; constexpr uint32_t DATETIME_LINE2 = 22; constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 1) / 2; +constexpr uint32_t RSSI_X = LCD_W - 90; +constexpr uint32_t AUDIO_X = LCD_W - 130; +constexpr uint32_t USB_X = LCD_W - 98; +constexpr uint32_t LOG_X = LCD_W - 98; +constexpr uint32_t GPS_X = LCD_W - 148; + constexpr uint32_t MENUS_TOOLBAR_BUTTON_WIDTH = 30; constexpr uint32_t MENUS_TOOLBAR_BUTTON_PADDING = 3; constexpr rect_t MENUS_TOOLBAR_RECT = { 100, 51, 30, 209 }; diff --git a/radio/src/targets/nv14/hal.h b/radio/src/targets/nv14/hal.h index 5dfbfaeca..c7c04d858 100644 --- a/radio/src/targets/nv14/hal.h +++ b/radio/src/targets/nv14/hal.h @@ -162,7 +162,7 @@ #define ADC_EXT_DMA_Channel DMA_Channel_2 #define ADC_EXT_DMA_Stream DMA2_Stream0 -#define ADC_EXT_DMA_TC_Flag DMA_FLAG_TCIF0 +#define ADC_EXT_TC_Flag DMA_FLAG_TCIF0 // Power #define PWR_RCC_AHB1Periph RCC_AHB1Periph_GPIOI @@ -180,7 +180,7 @@ #define BLUETOOTH_ON_GPIO_PIN GPIO_Pin_8 // PI.8 // S.Port update connector -#define SPORT_MAX_BAUDRATE 250000 // < 400000 +#define SPORT_MAX_BAUDRATE 400000 #define SPORT_UPDATE_RCC_AHB1Periph 0 #define HAS_SPORT_UPDATE_CONNECTOR() (false) diff --git a/radio/src/targets/nv14/libopenui_config.h b/radio/src/targets/nv14/libopenui_config.h index 72773a4e4..a8e7f9380 100644 --- a/radio/src/targets/nv14/libopenui_config.h +++ b/radio/src/targets/nv14/libopenui_config.h @@ -39,6 +39,7 @@ enum FontIndex FONT_XXL_INDEX, #endif + // this one MUST be last FONTS_COUNT }; @@ -47,12 +48,12 @@ typedef uint16_t pixel_t; constexpr bool WRAP_FORM_FIELDS_WITHIN_PAGE = true; constexpr short SLIDE_SPEED_REDUCTION = 5; -constexpr uint32_t MENU_HEADER_BUTTON_WIDTH = 60; -constexpr uint32_t MENU_HEADER_BUTTONS_LEFT = MENU_HEADER_BUTTON_WIDTH; +constexpr uint32_t MENU_HEADER_BUTTON_WIDTH = 33; +constexpr uint32_t MENU_HEADER_BUTTONS_LEFT = 47; -constexpr uint32_t MENU_HEADER_HEIGHT = 60; -constexpr uint32_t MENU_TITLE_TOP = 61; -constexpr uint32_t MENU_TITLE_HEIGHT = 22; +constexpr uint32_t MENU_HEADER_HEIGHT = 45; +constexpr uint32_t MENU_TITLE_TOP = 48; +constexpr uint32_t MENU_TITLE_HEIGHT = 21; constexpr uint32_t MENU_BODY_TOP = MENU_TITLE_TOP + MENU_TITLE_HEIGHT; constexpr uint32_t MENU_CONTENT_TOP = MENU_BODY_TOP + 1; constexpr uint32_t MENU_FOOTER_HEIGHT = 0; @@ -60,9 +61,9 @@ constexpr uint32_t MENU_FOOTER_TOP = LCD_H - MENU_FOOTER_HEIGHT; constexpr uint32_t MENU_BODY_HEIGHT = MENU_FOOTER_TOP - MENU_BODY_TOP; constexpr uint32_t MENUS_MARGIN_LEFT = 6; -constexpr coord_t PAGE_PADDING = 8; -constexpr uint32_t PAGE_LINE_HEIGHT = 26; -constexpr uint32_t PAGE_LINE_SPACING = 6; +constexpr coord_t PAGE_PADDING = 6; +constexpr uint32_t PAGE_LINE_HEIGHT = 20; +constexpr uint32_t PAGE_LINE_SPACING = 2; constexpr uint32_t PAGE_INDENT_WIDTH = 10; constexpr uint32_t PAGE_LABEL_WIDTH = 140; constexpr uint32_t FH = PAGE_LINE_HEIGHT; @@ -70,7 +71,7 @@ constexpr uint32_t NUM_BODY_LINES = MENU_BODY_HEIGHT / PAGE_LINE_ constexpr uint32_t TEXT_VIEWER_LINES = (MENU_FOOTER_TOP - MENU_HEADER_HEIGHT) / FH; constexpr uint32_t FIELD_PADDING_LEFT = 3; -constexpr uint32_t FIELD_PADDING_TOP = 4; +constexpr uint32_t FIELD_PADDING_TOP = 2; constexpr uint32_t CURVE_SIDE_WIDTH = 100; constexpr uint32_t CURVE_CENTER_X = LCD_W - CURVE_SIDE_WIDTH - 7; @@ -79,12 +80,18 @@ constexpr uint32_t CURVE_COORD_WIDTH = 36; constexpr uint32_t CURVE_COORD_HEIGHT = 17; constexpr uint32_t DATETIME_SEPARATOR_X = LCD_W - 53; -constexpr uint32_t DATETIME_LINE1 = 9; -constexpr uint32_t DATETIME_LINE2 = 23; -constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 4) / 2; +constexpr uint32_t DATETIME_LINE1 = 7; +constexpr uint32_t DATETIME_LINE2 = 22; +constexpr uint32_t DATETIME_MIDDLE = (LCD_W + DATETIME_SEPARATOR_X + 1) / 2; -constexpr uint32_t MENUS_TOOLBAR_BUTTON_WIDTH = 50; -constexpr uint32_t MENUS_TOOLBAR_BUTTON_PADDING = 11; +constexpr uint32_t RSSI_X = LCD_W - 80; +constexpr uint32_t AUDIO_X = LCD_W - 115; +constexpr uint32_t USB_X = LCD_W - 82; +constexpr uint32_t LOG_X = LCD_W - 82; +constexpr uint32_t GPS_X = LCD_W - 130; + +constexpr uint32_t MENUS_TOOLBAR_BUTTON_WIDTH = 30; +constexpr uint32_t MENUS_TOOLBAR_BUTTON_PADDING = 3; constexpr uint32_t ALERT_FRAME_TOP = 70; constexpr uint32_t ALERT_FRAME_HEIGHT = (LCD_H - 2 * ALERT_FRAME_TOP); @@ -98,8 +105,8 @@ constexpr uint32_t ALERT_MESSAGE_LEFT = 15; constexpr uint32_t ALERT_ACTION_TOP = 240; constexpr uint32_t ALERT_BUTTON_TOP = 300; -constexpr uint32_t PAGE_TITLE_TOP = 4; -constexpr uint32_t PAGE_TITLE_LEFT = 70; +constexpr uint32_t PAGE_TITLE_TOP = 2; +constexpr uint32_t PAGE_TITLE_LEFT = 50; /*enum LcdColorIndex { @@ -156,9 +163,9 @@ constexpr coord_t INPUT_EDIT_CURVE_TOP = MENU_HEADER_HEIGHT; constexpr coord_t MENUS_LINE_HEIGHT = 40; constexpr coord_t MENUS_WIDTH = 200; constexpr coord_t MENUS_OFFSET_TOP = 20; -constexpr coord_t POPUP_HEADER_HEIGHT = 40; +constexpr coord_t POPUP_HEADER_HEIGHT = 30; constexpr coord_t MENUS_MIN_HEIGHT = 2 * MENUS_LINE_HEIGHT - 1; -constexpr coord_t MENUS_MAX_HEIGHT = 8 * MENUS_LINE_HEIGHT - 1; +constexpr coord_t MENUS_MAX_HEIGHT = 7 * MENUS_LINE_HEIGHT - 1; constexpr rect_t MENUS_TOOLBAR_RECT = { 35, (LCD_H - MENUS_MAX_HEIGHT) / 2, 50, MENUS_MAX_HEIGHT }; diff --git a/radio/src/targets/nv14/telemetry_driver.cpp b/radio/src/targets/nv14/telemetry_driver.cpp index 3e89f0c05..d2fa496ed 100644 --- a/radio/src/targets/nv14/telemetry_driver.cpp +++ b/radio/src/targets/nv14/telemetry_driver.cpp @@ -65,17 +65,14 @@ void telemetryPortInitCommon(uint32_t baudrate, uint8_t mode, uint8_t noinv = 0) GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; GPIO_Init(TELEMETRY_REV_GPIO, &GPIO_InitStructure); - - if (noinv == 0) - { - TELEMETRY_TX_POL_NORM(); - TELEMETRY_RX_POL_NORM(); - } - else - { - TELEMETRY_TX_POL_INV(); - TELEMETRY_RX_POL_INV(); - } + + if (noinv != 0) { + TELEMETRY_TX_POL_NORM(); + TELEMETRY_RX_POL_NORM(); + } else { + TELEMETRY_TX_POL_INV(); + TELEMETRY_RX_POL_INV(); + } USART_InitStructure.USART_BaudRate = baudrate; if (mode & TELEMETRY_SERIAL_8E2) { @@ -100,12 +97,12 @@ void telemetryPortInitCommon(uint32_t baudrate, uint8_t mode, uint8_t noinv = 0) void telemetryPortInit(uint32_t baudrate, uint8_t mode) { - telemetryPortInitCommon(baudrate, mode, 0); + telemetryPortInitCommon(baudrate, mode, 0); } void telemetryPortInvertedInit(uint32_t baudrate) { - telemetryPortInitCommon(baudrate, TELEMETRY_SERIAL_DEFAULT, 1); + telemetryPortInitCommon(baudrate, TELEMETRY_SERIAL_DEFAULT, 1); } /*void extmoduleSendInvertedByte(uint8_t byte)