diff --git a/radio/src/gui/colorlcd/confirm_dialog.cpp b/radio/src/gui/colorlcd/confirm_dialog.cpp index 9abe37492..2da57d853 100644 --- a/radio/src/gui/colorlcd/confirm_dialog.cpp +++ b/radio/src/gui/colorlcd/confirm_dialog.cpp @@ -29,7 +29,7 @@ ConfirmDialog::ConfirmDialog(const char *title, const char *message, std::functi } #if defined(HARDWARE_KEYS) -void ConfirmDialog::onKeyEvent(event_t event) +void ConfirmDialog::onEvent(event_t event) { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); diff --git a/radio/src/gui/colorlcd/confirm_dialog.h b/radio/src/gui/colorlcd/confirm_dialog.h index ea0e75689..8d6c2b841 100644 --- a/radio/src/gui/colorlcd/confirm_dialog.h +++ b/radio/src/gui/colorlcd/confirm_dialog.h @@ -28,7 +28,7 @@ class ConfirmDialog: public Dialog { ConfirmDialog(const char * title, const char * message, std::function confirmHandler); #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; + void onEvent(event_t event) override; #endif protected: diff --git a/radio/src/gui/colorlcd/curve.h b/radio/src/gui/colorlcd/curve.h index 6805191d3..393d684a3 100644 --- a/radio/src/gui/colorlcd/curve.h +++ b/radio/src/gui/colorlcd/curve.h @@ -22,17 +22,17 @@ #ifndef _CURVE_H_ #define _CURVE_H_ -#include "window.h" +#include "form.h" struct CurvePoint { point_t coords; LcdFlags flags; }; -class Curve: public Window { +class Curve: public FormField { public: Curve(Window * parent, const rect_t & rect, std::function function, std::function position=nullptr): - Window(parent, rect, OPAQUE), + FormField(parent, rect, OPAQUE), function(std::move(function)), position(std::move(position)) { @@ -51,6 +51,8 @@ class Curve: public Window { if (position) { invalidate(); } + + FormField::checkEvents(); } void addPoint(const point_t & point, LcdFlags flags); diff --git a/radio/src/gui/colorlcd/curveedit.cpp b/radio/src/gui/colorlcd/curveedit.cpp index 47b5e62da..6eac55c0c 100644 --- a/radio/src/gui/colorlcd/curveedit.cpp +++ b/radio/src/gui/colorlcd/curveedit.cpp @@ -22,7 +22,7 @@ #include "keyboard_curve.h" #include "opentx.h" // TODO for applyCustomCurve -CurveEdit::CurveEdit(Window * parent, const rect_t &rect, uint8_t index) : +CurveEdit::CurveEdit(Window * parent, const rect_t & rect, uint8_t index) : Curve(parent, rect, [=](int x) -> int { return applyCustomCurve(x, index); }), @@ -54,13 +54,9 @@ bool CurveEdit::onTouchEnd(coord_t x, coord_t y) { if (!hasFocus()) { setFocus(); - update(); } - CurveKeyboard * keyboard = CurveKeyboard::instance(); - if (keyboard->getField() != this) { - keyboard->setField(this); - } + CurveKeyboard::show(this, isCustomCurve()); CurveInfo & curve = g_model.curves[index]; for (int i=0; i<5 + curve.points; i++) { @@ -79,13 +75,13 @@ bool CurveEdit::onTouchEnd(coord_t x, coord_t y) void CurveEdit::onFocusLost() { - CurveKeyboard::instance()->disable(true); + CurveKeyboard::hide(); } #endif void CurveEdit::next() { - if (++current == points.size()) { + if (current++ == points.size()) { current = 0; } update(); @@ -94,7 +90,7 @@ void CurveEdit::next() void CurveEdit::previous() { if (current-- == 0) { - current = points.size() - 1; + current = points.size(); } update(); } @@ -118,7 +114,7 @@ void CurveEdit::down() void CurveEdit::right() { CurveInfo & curve = g_model.curves[index]; - if (curve.type == CURVE_TYPE_CUSTOM && current != 0 && current != curve.points - 1) { + if (curve.type == CURVE_TYPE_CUSTOM && current != 0 && current != curve.points + 5 - 1) { int8_t * points = curveAddress(index); int8_t * point = &points[5 + curve.points + current - 1]; int8_t xmax = (current == (curve.points - 2) ? +100 : *(point + 1)); @@ -131,7 +127,7 @@ void CurveEdit::right() void CurveEdit::left() { CurveInfo & curve = g_model.curves[index]; - if (curve.type == CURVE_TYPE_CUSTOM && current != 0 && current != curve.points - 1) { + if (curve.type == CURVE_TYPE_CUSTOM && current != 0 && current != curve.points + 5 - 1) { int8_t * points = curveAddress(index); int8_t * point = &points[5 + curve.points + current - 1]; int8_t xmin = (current == 1 ? -100 : *(point - 1)); @@ -145,3 +141,40 @@ bool CurveEdit::isCustomCurve() { return g_model.curves[index].type == CURVE_TYPE_CUSTOM; } + +void CurveEdit::onEvent(event_t event) +{ + TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); + + switch (event) { +#if defined(HARDWARE_TOUCH) + case EVT_VIRTUAL_KEY_LEFT: + left(); + break; + + case EVT_VIRTUAL_KEY_RIGHT: + right(); + break; + + case EVT_VIRTUAL_KEY_UP: + up(); + break; + + case EVT_VIRTUAL_KEY_DOWN: + down(); + break; + + case EVT_VIRTUAL_KEY_PREVIOUS: + previous(); + break; + + case EVT_VIRTUAL_KEY_NEXT: + next(); + break; +#endif + + default: + FormField::onEvent(event); + break; + } +} diff --git a/radio/src/gui/colorlcd/curveedit.h b/radio/src/gui/colorlcd/curveedit.h index 98fb76f74..2f05d9aa2 100644 --- a/radio/src/gui/colorlcd/curveedit.h +++ b/radio/src/gui/colorlcd/curveedit.h @@ -24,18 +24,18 @@ #include "curve.h" class CurveEdit: public Curve { - friend class CurveKeyboard; - public: CurveEdit(Window * parent, const rect_t & rect, uint8_t index); void checkEvents() override { - // no permanent refresh + Curve::checkEvents(); } void update(); + void onEvent(event_t event) override; + #if defined(HARDWARE_TOUCH) bool onTouchEnd(coord_t x, coord_t y) override; diff --git a/radio/src/gui/colorlcd/fullscreen_dialog.cpp b/radio/src/gui/colorlcd/fullscreen_dialog.cpp index dc72048dd..e08594fd0 100644 --- a/radio/src/gui/colorlcd/fullscreen_dialog.cpp +++ b/radio/src/gui/colorlcd/fullscreen_dialog.cpp @@ -79,7 +79,7 @@ void FullScreenDialog::paint(BitmapBuffer * dc) } #if defined(HARDWARE_KEYS) -void FullScreenDialog::onKeyEvent(event_t event) +void FullScreenDialog::onEvent(event_t event) { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); diff --git a/radio/src/gui/colorlcd/fullscreen_dialog.h b/radio/src/gui/colorlcd/fullscreen_dialog.h index 127176c45..2c74013b8 100644 --- a/radio/src/gui/colorlcd/fullscreen_dialog.h +++ b/radio/src/gui/colorlcd/fullscreen_dialog.h @@ -53,7 +53,7 @@ class FullScreenDialog : public Dialog { void paint(BitmapBuffer * dc) override; #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; + void onEvent(event_t event) override; #endif #if defined(HARDWARE_TOUCH) diff --git a/radio/src/gui/colorlcd/keyboard_curve.cpp b/radio/src/gui/colorlcd/keyboard_curve.cpp index 5b635a179..3de0ab700 100644 --- a/radio/src/gui/colorlcd/keyboard_curve.cpp +++ b/radio/src/gui/colorlcd/keyboard_curve.cpp @@ -19,7 +19,6 @@ */ #include "keyboard_curve.h" -#include "curveedit.h" #include "button.h" #include "lcd.h" @@ -27,76 +26,65 @@ constexpr coord_t KEYBOARD_HEIGHT = 110; CurveKeyboard * CurveKeyboard::_instance = nullptr; -CurveKeyboard::CurveKeyboard(): - Keyboard(KEYBOARD_HEIGHT) +CurveKeyboard::CurveKeyboard() : + Keyboard(KEYBOARD_HEIGHT) { // up - new TextButton(this, {LCD_W/2 - 20, 5, 40, 40}, "\200", + new TextButton(this, {LCD_W / 2 - 20, 5, 40, 40}, "\200", [=]() -> uint8_t { - if (field) { - field->up(); - } - return 0; + putEvent(EVT_VIRTUAL_KEY_UP); + return 0; }, BUTTON_BACKGROUND | BUTTON_NOFOCUS); // down - new TextButton(this, {LCD_W/2 - 20, 65, 40, 40}, "\201", + new TextButton(this, {LCD_W / 2 - 20, 65, 40, 40}, "\201", [=]() -> uint8_t { - field->down(); - return 0; + putEvent(EVT_VIRTUAL_KEY_DOWN); + return 0; }, BUTTON_BACKGROUND | BUTTON_NOFOCUS); // left left = new TextButton(this, {LCD_W / 2 - 70, 35, 40, 40}, "\177", [=]() -> uint8_t { - if (field) { - field->left(); - } - return 0; + putEvent(EVT_VIRTUAL_KEY_LEFT); + return 0; }, BUTTON_BACKGROUND | BUTTON_NOFOCUS); // right right = new TextButton(this, {LCD_W / 2 + 30, 35, 40, 40}, "\176", [=]() -> uint8_t { - if (field) { - field->right(); - } - return 0; + putEvent(EVT_VIRTUAL_KEY_RIGHT); + return 0; }, BUTTON_BACKGROUND | BUTTON_NOFOCUS); // next - new TextButton(this, {LCD_W/2 + 80, 35, 60, 40}, "Next", + new TextButton(this, {LCD_W / 2 + 80, 35, 60, 40}, "Next", [=]() -> uint8_t { - if (field) { - field->next(); - } - return 0; + putEvent(EVT_VIRTUAL_KEY_NEXT); + return 0; }, BUTTON_BACKGROUND | BUTTON_NOFOCUS); // previous new TextButton(this, {LCD_W / 2 - 140, 35, 60, 40}, "Prev", [=]() -> uint8_t { - if (field) { - field->previous(); - } - return 0; + putEvent(EVT_VIRTUAL_KEY_PREVIOUS); + return 0; }, BUTTON_BACKGROUND | BUTTON_NOFOCUS); } +void CurveKeyboard::enableRightLeft(bool enable) +{ + TRACE("STOP %d", enable); + left->enable(enable); + right->enable(enable); +} + CurveKeyboard::~CurveKeyboard() { _instance = nullptr; } -void CurveKeyboard::setField(CurveEdit * field) -{ - Keyboard::setField(field); - bool custom = field->isCustomCurve(); - left->enable(custom); - right->enable(custom); -} - void CurveKeyboard::paint(BitmapBuffer * dc) { lcdSetColor(RGB(0xE0, 0xE0, 0xE0)); diff --git a/radio/src/gui/colorlcd/keyboard_curve.h b/radio/src/gui/colorlcd/keyboard_curve.h index d7b7d5afd..cfaab401e 100644 --- a/radio/src/gui/colorlcd/keyboard_curve.h +++ b/radio/src/gui/colorlcd/keyboard_curve.h @@ -22,17 +22,14 @@ #define _KEYBOARD_CURVE_H_ #include "keyboard_base.h" -#include "curveedit.h" class Button; -class CurveKeyboard : public Keyboard { - friend class CurveEdit; - +class CurveKeyboard : public Keyboard { public: CurveKeyboard(); - ~CurveKeyboard(); + ~CurveKeyboard() override; #if defined(DEBUG_WINDOWS) std::string getName() override @@ -41,15 +38,16 @@ class CurveKeyboard : public Keyboard { } #endif - static CurveKeyboard * instance() + void enableRightLeft(bool enable); + + static void show(FormField * field, bool enableRightLeft) { if (!_instance) _instance = new CurveKeyboard(); - return _instance; + _instance->setField(field); + _instance->enableRightLeft(enableRightLeft); } - void setField(CurveEdit * field); - void paint(BitmapBuffer * dc) override; protected: @@ -58,4 +56,4 @@ class CurveKeyboard : public Keyboard { Button * right = nullptr; }; -#endif // _KEYBOARD_CURVE_H_ \ No newline at end of file +#endif // _KEYBOARD_CURVE_H_ diff --git a/radio/src/gui/colorlcd/model_setup.cpp b/radio/src/gui/colorlcd/model_setup.cpp index 182fcd95a..3d1640417 100644 --- a/radio/src/gui/colorlcd/model_setup.cpp +++ b/radio/src/gui/colorlcd/model_setup.cpp @@ -249,7 +249,7 @@ class BindWaitDialog: public Dialog { void checkEvents() override; #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override + void onEvent(event_t event) override { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); diff --git a/radio/src/gui/colorlcd/radio_calibration.cpp b/radio/src/gui/colorlcd/radio_calibration.cpp index b01d57b64..031a9550d 100644 --- a/radio/src/gui/colorlcd/radio_calibration.cpp +++ b/radio/src/gui/colorlcd/radio_calibration.cpp @@ -243,7 +243,7 @@ void RadioCalibrationPage::checkEvents() } #if defined(HARDWARE_KEYS) -void RadioCalibrationPage::onKeyEvent(event_t event) +void RadioCalibrationPage::onEvent(event_t event) { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); @@ -257,7 +257,7 @@ void RadioCalibrationPage::onKeyEvent(event_t event) } else { - Page::onKeyEvent(event); + Page::onEvent(event); } } #endif diff --git a/radio/src/gui/colorlcd/radio_calibration.h b/radio/src/gui/colorlcd/radio_calibration.h index 0de41ed25..a8d7f29b0 100644 --- a/radio/src/gui/colorlcd/radio_calibration.h +++ b/radio/src/gui/colorlcd/radio_calibration.h @@ -29,7 +29,7 @@ class RadioCalibrationPage: public Page { void checkEvents() override; #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; + void onEvent(event_t event) override; #endif protected: diff --git a/radio/src/gui/colorlcd/screen_setup.cpp b/radio/src/gui/colorlcd/screen_setup.cpp index 71806c4c7..ea784e423 100644 --- a/radio/src/gui/colorlcd/screen_setup.cpp +++ b/radio/src/gui/colorlcd/screen_setup.cpp @@ -67,7 +67,7 @@ class LayoutChoice: public FormField { } #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override + void onEvent(event_t event) override { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); @@ -77,7 +77,7 @@ class LayoutChoice: public FormField { openMenu(); } else { - FormField::onKeyEvent(event); + FormField::onEvent(event); } } #endif diff --git a/radio/src/gui/colorlcd/sourcechoice.cpp b/radio/src/gui/colorlcd/sourcechoice.cpp index e230d331a..ecf852f43 100644 --- a/radio/src/gui/colorlcd/sourcechoice.cpp +++ b/radio/src/gui/colorlcd/sourcechoice.cpp @@ -113,7 +113,7 @@ void SourceChoice::openMenu() } #if defined(HARDWARE_KEYS) -void SourceChoice::onKeyEvent(event_t event) +void SourceChoice::onEvent(event_t event) { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); @@ -123,7 +123,7 @@ void SourceChoice::onKeyEvent(event_t event) openMenu(); } else { - FormField::onKeyEvent(event); + FormField::onEvent(event); } } #endif @@ -133,6 +133,7 @@ bool SourceChoice::onTouchEnd(coord_t, coord_t) { openMenu(); setFocus(); + setEditMode(true); return true; } #endif diff --git a/radio/src/gui/colorlcd/sourcechoice.h b/radio/src/gui/colorlcd/sourcechoice.h index af98e5732..f8472d60f 100644 --- a/radio/src/gui/colorlcd/sourcechoice.h +++ b/radio/src/gui/colorlcd/sourcechoice.h @@ -50,7 +50,7 @@ class SourceChoice : public FormField { void paint(BitmapBuffer * dc) override; #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; + void onEvent(event_t event) override; #endif #if defined(HARDWARE_TOUCH) diff --git a/radio/src/gui/colorlcd/switchchoice.cpp b/radio/src/gui/colorlcd/switchchoice.cpp index 195d39ffa..7afeeedfb 100644 --- a/radio/src/gui/colorlcd/switchchoice.cpp +++ b/radio/src/gui/colorlcd/switchchoice.cpp @@ -97,7 +97,7 @@ void SwitchChoice::openMenu() } #if defined(HARDWARE_KEYS) -void SwitchChoice::onKeyEvent(event_t event) +void SwitchChoice::onEvent(event_t event) { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); @@ -107,7 +107,7 @@ void SwitchChoice::onKeyEvent(event_t event) openMenu(); } else { - FormField::onKeyEvent(event); + FormField::onEvent(event); } } #endif @@ -117,6 +117,7 @@ bool SwitchChoice::onTouchEnd(coord_t, coord_t) { openMenu(); setFocus(); + setEditMode(true); return true; } #endif diff --git a/radio/src/gui/colorlcd/switchchoice.h b/radio/src/gui/colorlcd/switchchoice.h index b5755c6ae..dc9bb00f7 100644 --- a/radio/src/gui/colorlcd/switchchoice.h +++ b/radio/src/gui/colorlcd/switchchoice.h @@ -49,7 +49,7 @@ class SwitchChoice : public FormField { void paint(BitmapBuffer * dc) override; #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; + void onEvent(event_t event) override; #endif #if defined(HARDWARE_TOUCH) diff --git a/radio/src/gui/colorlcd/timeedit.cpp b/radio/src/gui/colorlcd/timeedit.cpp index 63831cebb..d7f9ce1b0 100644 --- a/radio/src/gui/colorlcd/timeedit.cpp +++ b/radio/src/gui/colorlcd/timeedit.cpp @@ -45,7 +45,7 @@ void TimeEdit::paint(BitmapBuffer * dc) #if defined(HARDWARE_KEYS) // TODO could be moved to BaseNumberEdit -void TimeEdit::onKeyEvent(event_t event) +void TimeEdit::onEvent(event_t event) { TRACE_WINDOWS("%s received event 0x%X", getWindowDebugString().c_str(), event); @@ -70,7 +70,7 @@ void TimeEdit::onKeyEvent(event_t event) } } - FormField::onKeyEvent(event); + FormField::onEvent(event); } #endif @@ -81,16 +81,16 @@ bool TimeEdit::onTouchEnd(coord_t x, coord_t y) setFocus(); } - NumberKeyboard * keyboard = NumberKeyboard::instance(); - if (keyboard->getField() != this) { - keyboard->setField(this); - } +// NumberKeyboard * keyboard = NumberKeyboard::instance(); +// if (keyboard->getField() != this) { +// keyboard->setField(this); +// } return true; } void TimeEdit::onFocusLost() { - NumberKeyboard::instance()->disable(true); +// NumberKeyboard::instance()->disable(true); } #endif diff --git a/radio/src/gui/colorlcd/timeedit.h b/radio/src/gui/colorlcd/timeedit.h index 0158c3eec..7a9a662aa 100644 --- a/radio/src/gui/colorlcd/timeedit.h +++ b/radio/src/gui/colorlcd/timeedit.h @@ -37,7 +37,7 @@ class TimeEdit : public BaseNumberEdit { void paint(BitmapBuffer * dc) override; #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; + void onEvent(event_t event) override; #endif #if defined(HARDWARE_TOUCH) diff --git a/radio/src/gui/colorlcd/view_main.cpp b/radio/src/gui/colorlcd/view_main.cpp index af628d858..3b29f9c63 100644 --- a/radio/src/gui/colorlcd/view_main.cpp +++ b/radio/src/gui/colorlcd/view_main.cpp @@ -165,7 +165,7 @@ ViewMain::~ViewMain() } #if defined(HARDWARE_KEYS) -void ViewMain::onKeyEvent(event_t event) +void ViewMain::onEvent(event_t event) { switch (event) { case EVT_KEY_LONG(KEY_MODEL): diff --git a/radio/src/gui/colorlcd/view_main.h b/radio/src/gui/colorlcd/view_main.h index 5ceba8248..aab82bc83 100644 --- a/radio/src/gui/colorlcd/view_main.h +++ b/radio/src/gui/colorlcd/view_main.h @@ -40,7 +40,7 @@ class ViewMain: public Window { protected: #if defined(HARDWARE_KEYS) - void onKeyEvent(event_t event) override; + void onEvent(event_t event) override; #endif void paint(BitmapBuffer * dc) override; void checkEvents() override; diff --git a/radio/src/keys.cpp b/radio/src/keys.cpp index 7514f3549..d0aaa4690 100644 --- a/radio/src/keys.cpp +++ b/radio/src/keys.cpp @@ -44,13 +44,10 @@ Key keys[NUM_KEYS]; event_t getEvent(bool trim) { - event_t evt = s_evt; - int8_t k = EVT_KEY_MASK(s_evt) - TRM_BASE; - bool trim_evt = (k>=0 && k= TRM_BASE); +} + #define IS_KEY_FIRST(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_FIRST) #define IS_KEY_LONG(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_LONG) #define IS_KEY_REPT(evt) (((evt) & _MSK_KEY_FLAGS) == _MSK_KEY_REPT) @@ -67,22 +102,16 @@ constexpr event_t EVT_KEY_BREAK(event_t key) #if defined(PCBXLITE) #define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER) #define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER) - #define EVT_ROTARY_LEFT 0xDF00 - #define EVT_ROTARY_RIGHT 0xDE00 #define IS_NEXT_EVENT(event) (event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN)) #define IS_PREVIOUS_EVENT(event) (event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)) #elif defined(PCBFRSKY) && defined(ROTARY_ENCODER_NAVIGATION) #define EVT_ROTARY_BREAK EVT_KEY_BREAK(KEY_ENTER) #define EVT_ROTARY_LONG EVT_KEY_LONG(KEY_ENTER) - #define EVT_ROTARY_LEFT 0xDF00 - #define EVT_ROTARY_RIGHT 0xDE00 #define IS_NEXT_EVENT(event) (event==EVT_ROTARY_RIGHT) #define IS_PREVIOUS_EVENT(event) (event==EVT_ROTARY_LEFT) #elif defined(ROTARY_ENCODER_NAVIGATION) #define EVT_ROTARY_BREAK 0xcf #define EVT_ROTARY_LONG 0xce - #define EVT_ROTARY_LEFT 0xdf - #define EVT_ROTARY_RIGHT 0xde #define IS_NEXT_EVENT(event) (event==EVT_ROTARY_RIGHT || event==EVT_KEY_FIRST(KEY_DOWN) || event==EVT_KEY_REPT(KEY_DOWN)) #define IS_PREVIOUS_EVENT(event) (event==EVT_ROTARY_LEFT || event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)) #else @@ -90,10 +119,6 @@ constexpr event_t EVT_KEY_BREAK(event_t key) #define IS_PREVIOUS_EVENT(event) (event==EVT_KEY_FIRST(KEY_UP) || event==EVT_KEY_REPT(KEY_UP)) #endif -#if defined(COLORLCD) - #define EVT_REFRESH 0xDD00 -#endif - class Key { private: diff --git a/radio/src/strhelpers.cpp b/radio/src/strhelpers.cpp index 0d22ec1e1..fa95bc2e0 100644 --- a/radio/src/strhelpers.cpp +++ b/radio/src/strhelpers.cpp @@ -218,8 +218,8 @@ char * getCurveString(char * dest, int idx) idx = -idx; } - if (ZEXIST(g_model.curves[idx - 1].name)) - zchar2str(s, g_model.curves[idx - 1].name, LEN_CURVE_NAME); + if (g_model.curves[idx - 1].name[0]) + strAppend(s, g_model.curves[idx - 1].name, LEN_CURVE_NAME); else strAppendStringWithIndex(s, STR_CV, idx); @@ -234,8 +234,8 @@ char * getGVarString(char * dest, int idx) idx = -idx-1; } - if (ZEXIST(g_model.gvars[idx].name)) - zchar2str(s, g_model.gvars[idx].name, LEN_GVAR_NAME); + if (g_model.gvars[idx].name[0]) + strAppend(s, g_model.gvars[idx].name, LEN_GVAR_NAME); else strAppendStringWithIndex(s, STR_GV, idx+1);