mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-03-02 04:47:20 +00:00
🐛 Fix FTDI Eve Touch UI (#22500)
This commit is contained in:
parent
afca6e7459
commit
092b5942c1
10 changed files with 83 additions and 92 deletions
Marlin/src/lcd/extui/ftdi_eve_touch_ui
|
@ -232,13 +232,11 @@ class CommandProcessor : public CLCD::CommandFifo {
|
||||||
FORCEDINLINE CommandProcessor& toggle(int16_t x, int16_t y, int16_t w, int16_t h, T text, bool state, uint16_t options = FTDI::OPT_3D) {
|
FORCEDINLINE CommandProcessor& toggle(int16_t x, int16_t y, int16_t w, int16_t h, T text, bool state, uint16_t options = FTDI::OPT_3D) {
|
||||||
CLCD::FontMetrics fm(_font);
|
CLCD::FontMetrics fm(_font);
|
||||||
const int16_t widget_h = fm.height * 20.0 / 16;
|
const int16_t widget_h = fm.height * 20.0 / 16;
|
||||||
//const int16_t outer_bar_r = widget_h / 2;
|
|
||||||
//const int16_t knob_r = outer_bar_r - 1.5;
|
|
||||||
// The y coordinate of the toggle is the baseline of the text,
|
// The y coordinate of the toggle is the baseline of the text,
|
||||||
// so we must introduce a fudge factor based on the line height to
|
// so we must introduce a fudge factor based on the line height to
|
||||||
// actually center the control.
|
// actually center the control.
|
||||||
const int16_t fudge_y = fm.height * 5 / 16;
|
const int16_t fudge_y = fm.height * 5 / 16;
|
||||||
CLCD::CommandFifo::toggle(x + h / 2, y + (h - widget_h) / 2 + fudge_y, w - h, _font, options, state);
|
CLCD::CommandFifo::toggle(x + widget_h, y + (h - widget_h) / 2 + fudge_y, w - widget_h, _font, options, state);
|
||||||
CLCD::CommandFifo::str(text);
|
CLCD::CommandFifo::str(text);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,12 +67,12 @@ namespace FTDI {
|
||||||
width = height = 0;
|
width = height = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8);
|
const uint16_t line_width = find_line_break(utf8_fm, clcd_fm, wrap_width, line_start, line_end, use_utf8);
|
||||||
if (line_end == line_start) break;
|
|
||||||
width = max(width, line_width);
|
width = max(width, line_width);
|
||||||
height += utf8_fm.get_height();
|
height += utf8_fm.get_height();
|
||||||
|
if (*line_end == '\n' || *line_end == ' ') line_end++;
|
||||||
|
if (*line_end == '\0') break;
|
||||||
|
if (line_end == line_start) break;
|
||||||
line_start = line_end;
|
line_start = line_end;
|
||||||
if (*line_start == '\n' || *line_start == ' ') line_start++;
|
|
||||||
if (*line_start == '\0') break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,6 @@ namespace FTDI {
|
||||||
const char *line_start = str, *line_end;
|
const char *line_start = str, *line_end;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
find_line_break(utf8_fm, clcd_fm, w, line_start, line_end, use_utf8);
|
find_line_break(utf8_fm, clcd_fm, w, line_start, line_end, use_utf8);
|
||||||
if (line_end == line_start) break;
|
|
||||||
|
|
||||||
const size_t line_len = line_end - line_start;
|
const size_t line_len = line_end - line_start;
|
||||||
if (line_len) {
|
if (line_len) {
|
||||||
|
@ -125,9 +124,10 @@ namespace FTDI {
|
||||||
}
|
}
|
||||||
y += utf8_fm.get_height();
|
y += utf8_fm.get_height();
|
||||||
|
|
||||||
|
if (*line_end == '\n' || *line_end == ' ') line_end++;
|
||||||
|
if (*line_end == '\0') break;
|
||||||
|
if (line_end == line_start) break;
|
||||||
line_start = line_end;
|
line_start = line_end;
|
||||||
if (*line_start == '\n' || *line_start == ' ') line_start++;
|
|
||||||
if (*line_start == '\0') break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,30 +29,30 @@ namespace FTDI {
|
||||||
* Helper function for drawing text with ellipses. The str buffer may be modified and should have space for up to two extra characters.
|
* Helper function for drawing text with ellipses. The str buffer may be modified and should have space for up to two extra characters.
|
||||||
*/
|
*/
|
||||||
static void _draw_text_with_ellipsis(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, char *str, uint16_t options, uint8_t font) {
|
static void _draw_text_with_ellipsis(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, char *str, uint16_t options, uint8_t font) {
|
||||||
FontMetrics fm(font);
|
#if ENABLED(TOUCH_UI_USE_UTF8)
|
||||||
const int16_t ellipsisWidth = fm.get_char_width('.') * 3;
|
const bool use_utf8 = has_utf8_chars(str);
|
||||||
|
#define CHAR_WIDTH(c) use_utf8 ? utf8_fm.get_char_width(c) : clcd_fm.char_widths[(uint8_t)c]
|
||||||
|
#else
|
||||||
|
#define CHAR_WIDTH(c) utf8_fm.get_char_width(c)
|
||||||
|
constexpr bool use_utf8 = false;
|
||||||
|
#endif
|
||||||
|
FontMetrics utf8_fm(font);
|
||||||
|
CLCD::FontMetrics clcd_fm;
|
||||||
|
clcd_fm.load(font);
|
||||||
|
const int16_t ellipsisWidth = utf8_fm.get_char_width('.') * 3;
|
||||||
|
|
||||||
// Compute the total line length, as well as
|
// Compute the total line length, as well as
|
||||||
// the location in the string where it can
|
// the location in the string where it can
|
||||||
// split and still allow the ellipsis to fit.
|
// split and still allow the ellipsis to fit.
|
||||||
int16_t lineWidth = 0;
|
int16_t lineWidth = 0;
|
||||||
char *breakPoint = str;
|
char *breakPoint = str;
|
||||||
#ifdef TOUCH_UI_USE_UTF8
|
char *next = str;
|
||||||
char *tstr = str;
|
while (*next) {
|
||||||
while (*tstr) {
|
const utf8_char_t c = get_utf8_char_and_inc(next);
|
||||||
breakPoint = tstr;
|
lineWidth += CHAR_WIDTH(c);
|
||||||
const utf8_char_t c = get_utf8_char_and_inc(tstr);
|
if (lineWidth + ellipsisWidth < w)
|
||||||
lineWidth += fm.get_char_width(c);
|
breakPoint = next;
|
||||||
if (lineWidth + ellipsisWidth < w)
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
for (char *c = str; *c; c++) {
|
|
||||||
lineWidth += fm.get_char_width(*c);
|
|
||||||
if (lineWidth + ellipsisWidth < w)
|
|
||||||
breakPoint = c;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (lineWidth > w) {
|
if (lineWidth > w) {
|
||||||
*breakPoint = '\0';
|
*breakPoint = '\0';
|
||||||
|
@ -61,7 +61,7 @@ namespace FTDI {
|
||||||
|
|
||||||
cmd.apply_text_alignment(x, y, w, h, options);
|
cmd.apply_text_alignment(x, y, w, h, options);
|
||||||
#if ENABLED(TOUCH_UI_USE_UTF8)
|
#if ENABLED(TOUCH_UI_USE_UTF8)
|
||||||
if (has_utf8_chars(str)) {
|
if (use_utf8) {
|
||||||
draw_utf8_text(cmd, x, y, str, font_size_t::from_romfont(font), options);
|
draw_utf8_text(cmd, x, y, str, font_size_t::from_romfont(font), options);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -39,7 +39,7 @@ void DialogBoxBaseClass::drawMessage(T message, int16_t font) {
|
||||||
.cmd(CLEAR(true,true,true))
|
.cmd(CLEAR(true,true,true))
|
||||||
.cmd(COLOR_RGB(bg_text_enabled))
|
.cmd(COLOR_RGB(bg_text_enabled))
|
||||||
.tag(0);
|
.tag(0);
|
||||||
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,3), message, OPT_CENTER, font ? font : font_large);
|
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,6), message, OPT_CENTER, font ? font : font_large);
|
||||||
cmd.colors(normal_btn);
|
cmd.colors(normal_btn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,12 +69,6 @@ void DialogBoxBaseClass::drawButton(T label) {
|
||||||
template void DialogBoxBaseClass::drawButton(const char *);
|
template void DialogBoxBaseClass::drawButton(const char *);
|
||||||
template void DialogBoxBaseClass::drawButton(progmem_str);
|
template void DialogBoxBaseClass::drawButton(progmem_str);
|
||||||
|
|
||||||
void DialogBoxBaseClass::drawSpinner() {
|
|
||||||
CommandProcessor cmd;
|
|
||||||
cmd.cmd(COLOR_RGB(bg_text_enabled))
|
|
||||||
.spinner(BTN_POS(1,4), BTN_SIZE(2,3)).execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) {
|
bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 1: GOTO_PREVIOUS(); return true;
|
case 1: GOTO_PREVIOUS(); return true;
|
||||||
|
|
|
@ -31,7 +31,6 @@ class DialogBoxBaseClass : public BaseScreen {
|
||||||
template<typename T> static void drawButton(T);
|
template<typename T> static void drawButton(T);
|
||||||
static void drawYesNoButtons(uint8_t default_btn = 0);
|
static void drawYesNoButtons(uint8_t default_btn = 0);
|
||||||
static void drawOkayButton();
|
static void drawOkayButton();
|
||||||
static void drawSpinner();
|
|
||||||
|
|
||||||
static void onRedraw(draw_mode_t) {};
|
static void onRedraw(draw_mode_t) {};
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -104,8 +104,8 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) {
|
||||||
#endif
|
#endif
|
||||||
#undef EDGE_R
|
#undef EDGE_R
|
||||||
#define EDGE_R 0
|
#define EDGE_R 0
|
||||||
#if ENABLED(TOUCH_UI_PORTRAIT)
|
|
||||||
.colors(normal_btn)
|
.colors(normal_btn)
|
||||||
|
#if ENABLED(TOUCH_UI_PORTRAIT)
|
||||||
.tag(6).button (BTN_POS(1,6), BTN_SIZE(4,1), GET_TEXT_F(MSG_SOUNDS))
|
.tag(6).button (BTN_POS(1,6), BTN_SIZE(4,1), GET_TEXT_F(MSG_SOUNDS))
|
||||||
.colors(action_btn)
|
.colors(action_btn)
|
||||||
.tag(1).button (BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE));
|
.tag(1).button (BTN_POS(1,7), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE));
|
||||||
|
|
|
@ -74,8 +74,7 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) {
|
||||||
#undef EDGE_R
|
#undef EDGE_R
|
||||||
#define EDGE_R 30
|
#define EDGE_R 30
|
||||||
.font(font_small)
|
.font(font_small)
|
||||||
.tag(0).text (BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUND_VOLUME), OPT_RIGHTX | OPT_CENTERY)
|
.tag(0).text (BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_CLICK_SOUNDS), OPT_RIGHTX | OPT_CENTERY)
|
||||||
.text (BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_CLICK_SOUNDS), OPT_RIGHTX | OPT_CENTERY)
|
|
||||||
.text (BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_STARTING), OPT_RIGHTX | OPT_CENTERY)
|
.text (BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_STARTING), OPT_RIGHTX | OPT_CENTERY)
|
||||||
.text (BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_FINISHED), OPT_RIGHTX | OPT_CENTERY)
|
.text (BTN_POS(1,6), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_FINISHED), OPT_RIGHTX | OPT_CENTERY)
|
||||||
.text (BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_ERROR), OPT_RIGHTX | OPT_CENTERY);
|
.text (BTN_POS(1,7), BTN_SIZE(2,1), GET_TEXT_F(MSG_PRINT_ERROR), OPT_RIGHTX | OPT_CENTERY);
|
||||||
|
@ -89,18 +88,16 @@ void InterfaceSoundsScreen::onRedraw(draw_mode_t what) {
|
||||||
constexpr uint8_t w = 1;
|
constexpr uint8_t w = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cmd.font(font_medium)
|
cmd.font(font_small)
|
||||||
.colors(ui_slider)
|
|
||||||
#define EDGE_R 30
|
#define EDGE_R 30
|
||||||
.tag(2).slider (BTN_POS(3,2), BTN_SIZE(2,1), screen_data.InterfaceSettingsScreen.volume, 0xFF)
|
|
||||||
.colors(ui_toggle)
|
.colors(ui_toggle)
|
||||||
.tag(3).toggle2 (BTN_POS(3,3), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), UIData::touch_sounds_enabled())
|
.tag(2).toggle2 (BTN_POS(3,3), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), UIData::touch_sounds_enabled())
|
||||||
#undef EDGE_R
|
#undef EDGE_R
|
||||||
.colors(normal_btn)
|
.colors(normal_btn)
|
||||||
#define EDGE_R 0
|
#define EDGE_R 0
|
||||||
.tag(4).button (BTN_POS(3,5), BTN_SIZE(2,1), getSoundSelection(PRINTING_STARTED))
|
.tag(3).button (BTN_POS(3,5), BTN_SIZE(2,1), getSoundSelection(PRINTING_STARTED))
|
||||||
.tag(5).button (BTN_POS(3,6), BTN_SIZE(2,1), getSoundSelection(PRINTING_FINISHED))
|
.tag(4).button (BTN_POS(3,6), BTN_SIZE(2,1), getSoundSelection(PRINTING_FINISHED))
|
||||||
.tag(6).button (BTN_POS(3,7), BTN_SIZE(2,1), getSoundSelection(PRINTING_FAILED))
|
.tag(5).button (BTN_POS(3,7), BTN_SIZE(2,1), getSoundSelection(PRINTING_FAILED))
|
||||||
.colors(action_btn)
|
.colors(action_btn)
|
||||||
.tag(1).button (BTN_POS(1,9), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE));
|
.tag(1).button (BTN_POS(1,9), BTN_SIZE(4,1), GET_TEXT_F(MSG_BUTTON_DONE));
|
||||||
}
|
}
|
||||||
|
@ -114,10 +111,10 @@ void InterfaceSoundsScreen::onEntry() {
|
||||||
bool InterfaceSoundsScreen::onTouchEnd(uint8_t tag) {
|
bool InterfaceSoundsScreen::onTouchEnd(uint8_t tag) {
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case 1: GOTO_PREVIOUS(); return true;
|
case 1: GOTO_PREVIOUS(); return true;
|
||||||
case 3: UIData::enable_touch_sounds(!UIData::touch_sounds_enabled()); break;
|
case 2: UIData::enable_touch_sounds(!UIData::touch_sounds_enabled()); break;
|
||||||
case 4: toggleSoundSelection(PRINTING_STARTED); break;
|
case 3: toggleSoundSelection(PRINTING_STARTED); break;
|
||||||
case 5: toggleSoundSelection(PRINTING_FINISHED); break;
|
case 4: toggleSoundSelection(PRINTING_FINISHED); break;
|
||||||
case 6: toggleSoundSelection(PRINTING_FAILED); break;
|
case 5: toggleSoundSelection(PRINTING_FAILED); break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -125,35 +122,4 @@ bool InterfaceSoundsScreen::onTouchEnd(uint8_t tag) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InterfaceSoundsScreen::onTouchStart(uint8_t tag) {
|
|
||||||
CommandProcessor cmd;
|
|
||||||
#undef EDGE_R
|
|
||||||
#define EDGE_R 30
|
|
||||||
switch (tag) {
|
|
||||||
case 2: cmd.track_linear(BTN_POS(3,2), BTN_SIZE(2,1), 2).execute(); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void InterfaceSoundsScreen::onIdle() {
|
|
||||||
if (refresh_timer.elapsed(TOUCH_UPDATE_INTERVAL)) {
|
|
||||||
refresh_timer.start();
|
|
||||||
|
|
||||||
uint16_t value;
|
|
||||||
CommandProcessor cmd;
|
|
||||||
switch (cmd.track_tag(value)) {
|
|
||||||
case 2:
|
|
||||||
screen_data.InterfaceSettingsScreen.volume = value >> 8;
|
|
||||||
SoundPlayer::set_volume(screen_data.InterfaceSettingsScreen.volume);
|
|
||||||
SaveSettingsDialogBox::settingsChanged();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
onRefresh();
|
|
||||||
}
|
|
||||||
BaseScreen::onIdle();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // FTDI_INTERFACE_SOUNDS_SCREEN
|
#endif // FTDI_INTERFACE_SOUNDS_SCREEN
|
||||||
|
|
|
@ -51,7 +51,5 @@ class InterfaceSoundsScreen : public BaseScreen, public CachedScreen<INTERFACE_S
|
||||||
|
|
||||||
static void onEntry();
|
static void onEntry();
|
||||||
static void onRedraw(draw_mode_t);
|
static void onRedraw(draw_mode_t);
|
||||||
static bool onTouchStart(uint8_t tag);
|
|
||||||
static bool onTouchEnd(uint8_t tag);
|
static bool onTouchEnd(uint8_t tag);
|
||||||
static void onIdle();
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,8 +26,12 @@
|
||||||
|
|
||||||
#ifdef FTDI_SPINNER_DIALOG_BOX
|
#ifdef FTDI_SPINNER_DIALOG_BOX
|
||||||
|
|
||||||
|
#define GRID_COLS 2
|
||||||
|
#define GRID_ROWS 8
|
||||||
|
|
||||||
using namespace FTDI;
|
using namespace FTDI;
|
||||||
using namespace ExtUI;
|
using namespace ExtUI;
|
||||||
|
using namespace Theme;
|
||||||
|
|
||||||
constexpr static SpinnerDialogBoxData &mydata = screen_data.SpinnerDialogBox;
|
constexpr static SpinnerDialogBoxData &mydata = screen_data.SpinnerDialogBox;
|
||||||
|
|
||||||
|
@ -35,35 +39,65 @@ void SpinnerDialogBox::onEntry() {
|
||||||
mydata.auto_hide = true;
|
mydata.auto_hide = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpinnerDialogBox::onExit() {
|
||||||
|
CommandProcessor cmd;
|
||||||
|
cmd.stop().execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpinnerDialogBox::onRefresh() {
|
||||||
|
using namespace FTDI;
|
||||||
|
DLCache dlcache(SPINNER_CACHE);
|
||||||
|
CommandProcessor cmd;
|
||||||
|
cmd.cmd(CMD_DLSTART);
|
||||||
|
if (dlcache.has_data())
|
||||||
|
dlcache.append();
|
||||||
|
else
|
||||||
|
dlcache.store(SPINNER_DL_SIZE);
|
||||||
|
cmd.spinner(BTN_POS(1,4), BTN_SIZE(2,3)).execute();
|
||||||
|
}
|
||||||
|
|
||||||
void SpinnerDialogBox::onRedraw(draw_mode_t) {
|
void SpinnerDialogBox::onRedraw(draw_mode_t) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpinnerDialogBox::show(progmem_str message) {
|
void SpinnerDialogBox::show(progmem_str message) {
|
||||||
drawMessage(message);
|
CommandProcessor cmd;
|
||||||
drawSpinner();
|
if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute();
|
||||||
storeBackground();
|
cmd.cmd(CMD_DLSTART)
|
||||||
GOTO_SCREEN(SpinnerDialogBox);
|
.cmd(CLEAR_COLOR_RGB(bg_color))
|
||||||
|
.cmd(CLEAR(true,true,true))
|
||||||
|
.cmd(COLOR_RGB(bg_text_enabled))
|
||||||
|
.tag(0);
|
||||||
|
draw_text_box(cmd, BTN_POS(1,1), BTN_SIZE(2,3), message, OPT_CENTER, font_large);
|
||||||
|
DLCache dlcache(SPINNER_CACHE);
|
||||||
|
if (!dlcache.store(SPINNER_DL_SIZE)) {
|
||||||
|
SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space");
|
||||||
|
cmd.cmd(CMD_DLSTART).cmd(CLEAR(true,true,true));
|
||||||
|
dlcache.store(SPINNER_DL_SIZE);
|
||||||
|
}
|
||||||
|
if (AT_SCREEN(SpinnerDialogBox))
|
||||||
|
cmd.spinner(BTN_POS(1,4), BTN_SIZE(2,3)).execute();
|
||||||
|
else
|
||||||
|
GOTO_SCREEN(SpinnerDialogBox);
|
||||||
mydata.auto_hide = false;
|
mydata.auto_hide = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpinnerDialogBox::hide() {
|
void SpinnerDialogBox::hide() {
|
||||||
CommandProcessor cmd;
|
|
||||||
cmd.stop().execute();
|
|
||||||
GOTO_PREVIOUS();
|
GOTO_PREVIOUS();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpinnerDialogBox::enqueueAndWait(progmem_str message, progmem_str commands) {
|
void SpinnerDialogBox::enqueueAndWait(progmem_str message, progmem_str commands) {
|
||||||
show(message);
|
show(message);
|
||||||
ExtUI::injectCommands_P((const char*)commands);
|
ExtUI::injectCommands_P((const char*)commands);
|
||||||
|
mydata.auto_hide = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpinnerDialogBox::enqueueAndWait(progmem_str message, char *commands) {
|
void SpinnerDialogBox::enqueueAndWait(progmem_str message, char *commands) {
|
||||||
show(message);
|
show(message);
|
||||||
ExtUI::injectCommands(commands);
|
ExtUI::injectCommands(commands);
|
||||||
|
mydata.auto_hide = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpinnerDialogBox::onIdle() {
|
void SpinnerDialogBox::onIdle() {
|
||||||
reset_menu_timeout();
|
|
||||||
if (mydata.auto_hide && !commandsInQueue()) {
|
if (mydata.auto_hide && !commandsInQueue()) {
|
||||||
mydata.auto_hide = false;
|
mydata.auto_hide = false;
|
||||||
hide();
|
hide();
|
||||||
|
|
|
@ -29,10 +29,12 @@ struct SpinnerDialogBoxData {
|
||||||
bool auto_hide;
|
bool auto_hide;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SpinnerDialogBox : public DialogBoxBaseClass, public CachedScreen<SPINNER_CACHE,SPINNER_DL_SIZE> {
|
class SpinnerDialogBox : public BaseScreen {
|
||||||
public:
|
public:
|
||||||
static void onEntry();
|
static void onEntry();
|
||||||
|
static void onExit();
|
||||||
static void onRedraw(draw_mode_t);
|
static void onRedraw(draw_mode_t);
|
||||||
|
static void onRefresh();
|
||||||
static void onIdle();
|
static void onIdle();
|
||||||
|
|
||||||
static void show(progmem_str);
|
static void show(progmem_str);
|
||||||
|
|
Loading…
Reference in a new issue