|
|
@ -18,12 +18,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
#define DISPLAY_UPDATE_INTERVAL 1000
|
|
|
|
#define DISPLAY_UPDATE_INTERVAL 1000
|
|
|
|
#define TOUCH_REPEATS_PER_SECOND 4
|
|
|
|
#define TOUCH_REPEATS_PER_SECOND 4
|
|
|
|
|
|
|
|
#define DEBOUNCE_PERIOD 100
|
|
|
|
|
|
|
|
|
|
|
|
// To save MCU RAM, the status message is "baked" in to the status screen
|
|
|
|
// To save MCU RAM, the status message is "baked" in to the status screen
|
|
|
|
// cache, so we reserve a large chunk of memory for the DL cache
|
|
|
|
// cache, so we reserve a large chunk of memory for the DL cache
|
|
|
|
|
|
|
|
|
|
|
|
#define STATUS_SCREEN_DL_SIZE 2048
|
|
|
|
#define STATUS_SCREEN_DL_SIZE 2048
|
|
|
|
#define CONFIRMATION_SCREEN_DL_SIZE 2048
|
|
|
|
#define CONFIRMATION_SCREEN_DL_SIZE 3072
|
|
|
|
|
|
|
|
|
|
|
|
#define N_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
|
|
|
|
#define N_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
|
|
|
|
|
|
|
|
|
|
|
@ -86,6 +87,14 @@
|
|
|
|
#define BTN_TAG(t) cmd.Cmd_Set_Tag(t);
|
|
|
|
#define BTN_TAG(t) cmd.Cmd_Set_Tag(t);
|
|
|
|
#define RGB(rgb) cmd.Cmd_Set_Foreground_Color(rgb);
|
|
|
|
#define RGB(rgb) cmd.Cmd_Set_Foreground_Color(rgb);
|
|
|
|
#define THEME(color) cmd.Cmd_Set_Foreground_Color(Theme::color);
|
|
|
|
#define THEME(color) cmd.Cmd_Set_Foreground_Color(Theme::color);
|
|
|
|
|
|
|
|
#define BTN_ENABLED(en) if(en) { \
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Color(Theme::btn_rgb_enabled); \
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Foreground_Color(Theme::btn_fg_enabled); \
|
|
|
|
|
|
|
|
} else { \
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Color(Theme::btn_rgb_disabled); \
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Foreground_Color(Theme::btn_fg_disabled); \
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Tag(0); \
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define FONT_SML Theme::font_small
|
|
|
|
#define FONT_SML Theme::font_small
|
|
|
|
#define FONT_MED Theme::font_medium
|
|
|
|
#define FONT_MED Theme::font_medium
|
|
|
@ -95,6 +104,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
#define EXEC_GCODE(cmd) Marlin_LCD_API::runGCode(cmd)
|
|
|
|
#define EXEC_GCODE(cmd) Marlin_LCD_API::runGCode(cmd)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************** SCREEN STATIC DATA *************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// To save RAM, store state information related to a particular screen
|
|
|
|
|
|
|
|
// in a union. The values should be initialized in the onEntry method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static union {
|
|
|
|
|
|
|
|
struct {uint8_t increment;} ValueAdjusters;
|
|
|
|
|
|
|
|
struct {uint8_t page, selected;} FilesScreen;
|
|
|
|
|
|
|
|
} screen_data;
|
|
|
|
|
|
|
|
|
|
|
|
/************************* MENU SCREEN DECLARATIONS *************************/
|
|
|
|
/************************* MENU SCREEN DECLARATIONS *************************/
|
|
|
|
|
|
|
|
|
|
|
|
class BootScreen : public UIScreen {
|
|
|
|
class BootScreen : public UIScreen {
|
|
|
@ -117,20 +136,30 @@ class KillScreen {
|
|
|
|
static void show(progmem_str msg);
|
|
|
|
static void show(progmem_str msg);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class ConfirmationScreen : public UIScreen {
|
|
|
|
class DialogBoxBaseClass : public UIScreen {
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
static void onEntry();
|
|
|
|
|
|
|
|
static void show(const progmem_str message[], size_t lines, progmem_str btn1, progmem_str btn2 );
|
|
|
|
static void show(const progmem_str message[], size_t lines, progmem_str btn1, progmem_str btn2 );
|
|
|
|
|
|
|
|
static void onRefresh();
|
|
|
|
|
|
|
|
public:
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AlertBoxScreen : public DialogBoxBaseClass {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
static void onRefresh();
|
|
|
|
static void onRefresh();
|
|
|
|
|
|
|
|
static void show(const progmem_str line1, const progmem_str line2 = 0, const progmem_str line3 = 0);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class RestoreFailsafeScreen : public ConfirmationScreen {
|
|
|
|
class RestoreFailsafeScreen : public DialogBoxBaseClass {
|
|
|
|
protected:
|
|
|
|
|
|
|
|
static void showCompletion();
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
static void onRefresh();
|
|
|
|
|
|
|
|
static void onEntry();
|
|
|
|
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConfirmAbortPrint : public DialogBoxBaseClass {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
static void onRefresh();
|
|
|
|
static void onEntry();
|
|
|
|
static void onEntry();
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -140,12 +169,14 @@ class StatusScreen : public UIScreen {
|
|
|
|
static void static_axis_position();
|
|
|
|
static void static_axis_position();
|
|
|
|
static void static_temperature();
|
|
|
|
static void static_temperature();
|
|
|
|
static void static_progress();
|
|
|
|
static void static_progress();
|
|
|
|
|
|
|
|
static void static_media_button();
|
|
|
|
static void static_interaction_buttons();
|
|
|
|
static void static_interaction_buttons();
|
|
|
|
static void static_status_message(const char * const message);
|
|
|
|
static void static_status_message(const char * const message);
|
|
|
|
|
|
|
|
|
|
|
|
static void dynamic_axis_position();
|
|
|
|
static void dynamic_axis_position();
|
|
|
|
static void dynamic_temperature();
|
|
|
|
static void dynamic_temperature();
|
|
|
|
static void dynamic_progress();
|
|
|
|
static void dynamic_progress();
|
|
|
|
|
|
|
|
static void dynamic_interaction_buttons();
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
static void setStatusMessage(const char * message);
|
|
|
|
static void setStatusMessage(const char * message);
|
|
|
@ -164,6 +195,7 @@ class MenuScreen : public UIScreen {
|
|
|
|
|
|
|
|
|
|
|
|
class CalibrationScreen : public UIScreen {
|
|
|
|
class CalibrationScreen : public UIScreen {
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
static void onEntry();
|
|
|
|
static void onRefresh();
|
|
|
|
static void onRefresh();
|
|
|
|
static void onIdle();
|
|
|
|
static void onIdle();
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -182,7 +214,6 @@ class AdvancedSettingsScreen : public UIScreen {
|
|
|
|
|
|
|
|
|
|
|
|
class ValueAdjusters : public UIScreen {
|
|
|
|
class ValueAdjusters : public UIScreen {
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
static uint8_t increment;
|
|
|
|
|
|
|
|
static void draw_increment_btn(uint8_t line, const uint8_t tag, uint8_t decimals);
|
|
|
|
static void draw_increment_btn(uint8_t line, const uint8_t tag, uint8_t decimals);
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
struct stacker_t {
|
|
|
|
struct stacker_t {
|
|
|
@ -219,6 +250,7 @@ class ValueAdjusters : public UIScreen {
|
|
|
|
|
|
|
|
|
|
|
|
static float getIncrement();
|
|
|
|
static float getIncrement();
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
static void onEntry();
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -247,9 +279,12 @@ class TemperatureScreen : public ValueAdjusters {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class FilesScreen : public UIScreen {
|
|
|
|
class FilesScreen : public UIScreen {
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
static const char *getSelectedShortFilename();
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
static void onEntry();
|
|
|
|
static void onRefresh();
|
|
|
|
static void onRefresh();
|
|
|
|
static bool onTouchHeld(uint8_t tag);
|
|
|
|
static bool onTouchStart(uint8_t tag);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/******************************* MENU SCREEN TABLE ******************************/
|
|
|
|
/******************************* MENU SCREEN TABLE ******************************/
|
|
|
@ -257,7 +292,9 @@ class FilesScreen : public UIScreen {
|
|
|
|
SCREEN_TABLE {
|
|
|
|
SCREEN_TABLE {
|
|
|
|
DECL_SCREEN(BootScreen),
|
|
|
|
DECL_SCREEN(BootScreen),
|
|
|
|
DECL_SCREEN(AboutScreen),
|
|
|
|
DECL_SCREEN(AboutScreen),
|
|
|
|
|
|
|
|
DECL_SCREEN(AlertBoxScreen),
|
|
|
|
DECL_SCREEN(RestoreFailsafeScreen),
|
|
|
|
DECL_SCREEN(RestoreFailsafeScreen),
|
|
|
|
|
|
|
|
DECL_SCREEN(ConfirmAbortPrint),
|
|
|
|
DECL_SCREEN(CalibrationScreen),
|
|
|
|
DECL_SCREEN(CalibrationScreen),
|
|
|
|
DECL_SCREEN(StatusScreen),
|
|
|
|
DECL_SCREEN(StatusScreen),
|
|
|
|
DECL_SCREEN(MenuScreen),
|
|
|
|
DECL_SCREEN(MenuScreen),
|
|
|
@ -293,32 +330,38 @@ enum {
|
|
|
|
/************************************ MENU THEME ********************************/
|
|
|
|
/************************************ MENU THEME ********************************/
|
|
|
|
|
|
|
|
|
|
|
|
namespace Theme {
|
|
|
|
namespace Theme {
|
|
|
|
const uint32_t olive_darkest = 0x2A2F0A;
|
|
|
|
const uint32_t theme_darkest = 0x2A2F0A;
|
|
|
|
const uint32_t olive_dark = 0x495212;
|
|
|
|
const uint32_t theme_dark = 0x495212;
|
|
|
|
const uint32_t olive_light = 0x8C9D22;
|
|
|
|
const uint32_t theme_light = 0x8C9D22;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t background = theme_dark;
|
|
|
|
|
|
|
|
const uint32_t back_btn = theme_light;
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t background = 0x707070;
|
|
|
|
|
|
|
|
const uint32_t x_axis = 0x500000;
|
|
|
|
const uint32_t x_axis = 0x500000;
|
|
|
|
const uint32_t y_axis = 0x005000;
|
|
|
|
const uint32_t y_axis = 0x005000;
|
|
|
|
const uint32_t z_axis = 0x000050;
|
|
|
|
const uint32_t z_axis = 0x000050;
|
|
|
|
const uint32_t e_axis = 0x000000;
|
|
|
|
const uint32_t e_axis = 0x000000;
|
|
|
|
const uint32_t menu_btn = olive_dark;
|
|
|
|
|
|
|
|
const uint32_t navi_btn = olive_light;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t toggle_on = olive_light;
|
|
|
|
const uint32_t toggle_on = theme_light;
|
|
|
|
const uint32_t toggle_off = olive_darkest;
|
|
|
|
const uint32_t toggle_off = theme_darkest;
|
|
|
|
const uint32_t disabled = background;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// About screen
|
|
|
|
// Disabled vs enabled buttons
|
|
|
|
const uint32_t about_bg = olive_dark;
|
|
|
|
const uint32_t btn_rgb_enabled = 0xFFFFFF;
|
|
|
|
const uint32_t about_btn = olive_darkest;
|
|
|
|
const uint32_t btn_fg_enabled = theme_darkest;
|
|
|
|
|
|
|
|
const uint32_t btn_rgb_disabled = theme_dark;
|
|
|
|
|
|
|
|
const uint32_t btn_fg_disabled = theme_dark;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Files screens
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t files_selected = theme_light;
|
|
|
|
|
|
|
|
|
|
|
|
// Adjustment Screens
|
|
|
|
// Adjustment Screens
|
|
|
|
|
|
|
|
|
|
|
|
const uint32_t adjust_bg = olive_dark;
|
|
|
|
const uint32_t incr_btn = theme_darkest;
|
|
|
|
const uint32_t incr_btn = olive_darkest;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Status screen
|
|
|
|
// Status screen
|
|
|
|
|
|
|
|
const uint32_t status_bg = 0x707070;
|
|
|
|
|
|
|
|
const uint32_t status_dark = 0x404040;
|
|
|
|
const uint32_t stop_btn = 0xF02020;
|
|
|
|
const uint32_t stop_btn = 0xF02020;
|
|
|
|
const uint32_t prnt_btn = 0x20D020;
|
|
|
|
const uint32_t prnt_btn = 0x20D020;
|
|
|
|
const uint32_t progress = 0x404040;
|
|
|
|
const uint32_t progress = 0x404040;
|
|
|
@ -371,7 +414,7 @@ namespace Theme {
|
|
|
|
void BootScreen::onRefresh() {
|
|
|
|
void BootScreen::onRefresh() {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
@ -383,7 +426,15 @@ void BootScreen::onRefresh() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void BootScreen::onIdle() {
|
|
|
|
void BootScreen::onIdle() {
|
|
|
|
GOTO_SCREEN(CalibrationScreen);
|
|
|
|
if(CLCD::Is_Touching()) {
|
|
|
|
|
|
|
|
// If the user is touching the screen at startup, then
|
|
|
|
|
|
|
|
// assume the user wants to re-calibrate the screen.
|
|
|
|
|
|
|
|
// This gives the user the ability to recover a
|
|
|
|
|
|
|
|
// miscalibration that has been stored to EEPROM.
|
|
|
|
|
|
|
|
GOTO_SCREEN(CalibrationScreen);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
GOTO_SCREEN(StatusScreen);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************** ABOUT SCREEN ****************************/
|
|
|
|
/******************************** ABOUT SCREEN ****************************/
|
|
|
@ -400,7 +451,7 @@ void AboutScreen::onEntry() {
|
|
|
|
void AboutScreen::onRefresh() {
|
|
|
|
void AboutScreen::onRefresh() {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd_Clear_Color(Theme::about_bg);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
#define GRID_COLS 4
|
|
|
|
#define GRID_COLS 4
|
|
|
@ -412,7 +463,7 @@ void AboutScreen::onRefresh() {
|
|
|
|
|
|
|
|
|
|
|
|
BTX( BTN_POS(1,5), BTN_SIZE(4,1), Marlin_LCD_API::getFirmwareName(), FONT_LRG);
|
|
|
|
BTX( BTN_POS(1,5), BTN_SIZE(4,1), Marlin_LCD_API::getFirmwareName(), FONT_LRG);
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(1) THEME(about_btn) BTN( BTN_POS(2,7), BTN_SIZE(2,1), F("Okay"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) BTN_ENABLED(1) BTN( BTN_POS(2,7), BTN_SIZE(2,1), F("Okay"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
@ -426,21 +477,14 @@ bool AboutScreen::onTouchStart(uint8_t tag) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************** GENERIC CONFIRMATION SCREEN ****************************/
|
|
|
|
/**************************** GENERIC DIALOG BOX SCREEN ****************************/
|
|
|
|
|
|
|
|
|
|
|
|
void ConfirmationScreen::onEntry() {
|
|
|
|
|
|
|
|
progmem_str lines[] = {
|
|
|
|
|
|
|
|
F("Are you sure?")
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
ConfirmationScreen::show(lines, N_ELEMENTS(lines), F("Yes"), F("No"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ConfirmationScreen::show(const progmem_str lines[], size_t n_lines, progmem_str btn1, progmem_str btn2 ) {
|
|
|
|
void DialogBoxBaseClass::show(const progmem_str lines[], size_t n_lines, progmem_str btn1, progmem_str btn2 ) {
|
|
|
|
CLCD::DLCache dlcache(CONFIRMATION_SCREEN_CACHE);
|
|
|
|
CLCD::DLCache dlcache(CONFIRMATION_SCREEN_CACHE);
|
|
|
|
|
|
|
|
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd_Clear_Color(Theme::about_bg);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
#define GRID_COLS 2
|
|
|
|
#define GRID_COLS 2
|
|
|
@ -451,12 +495,12 @@ void ConfirmationScreen::show(const progmem_str lines[], size_t n_lines, progmem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(btn1 && btn2) {
|
|
|
|
if(btn1 && btn2) {
|
|
|
|
BTN_TAG(1) THEME(about_btn) BTN( BTN_POS(1,8), BTN_SIZE(1,1), btn1, MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) BTN_ENABLED(1) BTN( BTN_POS(1,8), BTN_SIZE(1,1), btn1, MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) THEME(about_btn) BTN( BTN_POS(2,8), BTN_SIZE(1,1), btn2, MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) BTN_ENABLED(1) BTN( BTN_POS(2,8), BTN_SIZE(1,1), btn2, MENU_BTN_STYLE);
|
|
|
|
} else if(btn1) {
|
|
|
|
} else if(btn1) {
|
|
|
|
BTN_TAG(1) THEME(about_btn) BTN( BTN_POS(1,8), BTN_SIZE(2,1), btn1, MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) BTN_ENABLED(1) BTN( BTN_POS(1,8), BTN_SIZE(2,1), btn1, MENU_BTN_STYLE);
|
|
|
|
} else if(btn2) {
|
|
|
|
} else if(btn2) {
|
|
|
|
BTN_TAG(2) THEME(about_btn) BTN( BTN_POS(1,8), BTN_SIZE(2,1), btn2, MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) BTN_ENABLED(1) BTN( BTN_POS(1,8), BTN_SIZE(2,1), btn2, MENU_BTN_STYLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
@ -474,7 +518,7 @@ void ConfirmationScreen::show(const progmem_str lines[], size_t n_lines, progmem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ConfirmationScreen::onRefresh() {
|
|
|
|
void DialogBoxBaseClass::onRefresh() {
|
|
|
|
CLCD::DLCache dlcache(CONFIRMATION_SCREEN_CACHE);
|
|
|
|
CLCD::DLCache dlcache(CONFIRMATION_SCREEN_CACHE);
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
@ -488,13 +532,27 @@ void ConfirmationScreen::onRefresh() {
|
|
|
|
cmd.Cmd_Execute();
|
|
|
|
cmd.Cmd_Execute();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ConfirmationScreen::onTouchStart(uint8_t tag) {
|
|
|
|
bool DialogBoxBaseClass::onTouchStart(uint8_t tag) {
|
|
|
|
switch(tag) {
|
|
|
|
switch(tag) {
|
|
|
|
case 1: GOTO_PREVIOUS(); return true;
|
|
|
|
case 1: GOTO_PREVIOUS(); return true;
|
|
|
|
case 2: GOTO_PREVIOUS(); return true;
|
|
|
|
case 2: GOTO_PREVIOUS(); return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/****************************** ALERT BOX SCREEN *****************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AlertBoxScreen::onRefresh() {
|
|
|
|
|
|
|
|
DialogBoxBaseClass::onRefresh();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void AlertBoxScreen::show(const progmem_str line1, const progmem_str line2, const progmem_str line3) {
|
|
|
|
|
|
|
|
progmem_str lines[] = {line1, line2, line3};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DialogBoxBaseClass::show(lines, line3 ? 3 : line2 ? 2 : 1, F("Okay"), 0);
|
|
|
|
|
|
|
|
sound.play(c_maj_arpeggio);
|
|
|
|
|
|
|
|
GOTO_SCREEN(AlertBoxScreen);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**************************** RESTORE FAILSAFE SCREEN ***************************/
|
|
|
|
/**************************** RESTORE FAILSAFE SCREEN ***************************/
|
|
|
|
|
|
|
|
|
|
|
|
void RestoreFailsafeScreen::onEntry() {
|
|
|
|
void RestoreFailsafeScreen::onEntry() {
|
|
|
@ -503,26 +561,57 @@ void RestoreFailsafeScreen::onEntry() {
|
|
|
|
F("Customizations will be lost.")
|
|
|
|
F("Customizations will be lost.")
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
ConfirmationScreen::show(lines, N_ELEMENTS(lines), F("Yes"), F("No"));
|
|
|
|
DialogBoxBaseClass::show(lines, N_ELEMENTS(lines), F("Yes"), F("No"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void RestoreFailsafeScreen::onRefresh() {
|
|
|
|
|
|
|
|
DialogBoxBaseClass::onRefresh();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void RestoreFailsafeScreen::showCompletion() {
|
|
|
|
bool RestoreFailsafeScreen::onTouchStart(uint8_t tag) {
|
|
|
|
|
|
|
|
switch(tag) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
EXEC_GCODE(F("M502\nM500"));
|
|
|
|
|
|
|
|
AlertBoxScreen::show(F("Factory settings restored."));
|
|
|
|
|
|
|
|
// Remove RestoreFailsafeScreen from the stack
|
|
|
|
|
|
|
|
// so the alert box doesn't return to it.
|
|
|
|
|
|
|
|
current_screen.forget();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
return DialogBoxBaseClass::onTouchStart(tag);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**************************** RESTORE FAILSAFE SCREEN ***************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ConfirmAbortPrint::onEntry() {
|
|
|
|
progmem_str lines[] = {
|
|
|
|
progmem_str lines[] = {
|
|
|
|
F("Default settings restored.")
|
|
|
|
F("Are you sure you want"),
|
|
|
|
|
|
|
|
F("to stop the print?")
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
sound.play(c_maj_arpeggio);
|
|
|
|
DialogBoxBaseClass::show(lines, N_ELEMENTS(lines), F("Yes"), F("No"));
|
|
|
|
ConfirmationScreen::show(lines, N_ELEMENTS(lines), 0, F("Okay"));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool RestoreFailsafeScreen::onTouchStart(uint8_t tag) {
|
|
|
|
void ConfirmAbortPrint::onRefresh() {
|
|
|
|
|
|
|
|
DialogBoxBaseClass::onRefresh();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool ConfirmAbortPrint::onTouchStart(uint8_t tag) {
|
|
|
|
switch(tag) {
|
|
|
|
switch(tag) {
|
|
|
|
case 1:
|
|
|
|
case 1:
|
|
|
|
EXEC_GCODE(F("M502\nM500"));
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPAIR)
|
|
|
|
showCompletion();
|
|
|
|
SERIAL_PROTOCOLLN("Abort confirmed");
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
Serial.print(F("Abort confirmed"));
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
GOTO_PREVIOUS();
|
|
|
|
|
|
|
|
Marlin_LCD_API::stopPrint();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
ConfirmationScreen::onTouchStart(tag);
|
|
|
|
return DialogBoxBaseClass::onTouchStart(tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -536,7 +625,7 @@ void KillScreen::show(progmem_str message) {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd_Clear_Color(Theme::about_bg);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
#define GRID_COLS 4
|
|
|
|
#define GRID_COLS 4
|
|
|
@ -769,26 +858,34 @@ void StatusScreen::dynamic_progress() {
|
|
|
|
|
|
|
|
|
|
|
|
#define GRID_COLS 4
|
|
|
|
#define GRID_COLS 4
|
|
|
|
|
|
|
|
|
|
|
|
void StatusScreen::static_interaction_buttons() {
|
|
|
|
void StatusScreen::static_media_button() {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Marlin_LCD_API::isMediaInserted()) {
|
|
|
|
|
|
|
|
BTN_TAG(3)
|
|
|
|
|
|
|
|
BTN_ENABLED(1)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
BTN_TAG(0)
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Color(Theme::status_bg);
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Foreground_Color(Theme::status_bg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTN_TAG(1) THEME(stop_btn) BTN( BTN_POS(1,8), BTN_SIZE(4,1), F("STOP"), MENU_BTN_STYLE);
|
|
|
|
BTN( BTN_POS(1,9), BTN_SIZE(2,1), F(""), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(3) THEME(navi_btn) BTN( BTN_POS(1,9), BTN_SIZE(2,1), F(""), MENU_BTN_STYLE);
|
|
|
|
#else
|
|
|
|
BTN_TAG(4) THEME(navi_btn) BTN( BTN_POS(3,9), BTN_SIZE(2,1), F("MENU"), MENU_BTN_STYLE);
|
|
|
|
BTN( BTN_POS(3,7), BTN_SIZE(1,2), F(""), MENU_BTN_STYLE);
|
|
|
|
#else
|
|
|
|
|
|
|
|
BTN_TAG(1) THEME(stop_btn) BTN( BTN_POS(1,7), BTN_SIZE(2,2), F("STOP"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
BTN_TAG(3) THEME(navi_btn) BTN( BTN_POS(3,7), BTN_SIZE(1,2), F(""), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
BTN_TAG(4) THEME(navi_btn) BTN( BTN_POS(4,7), BTN_SIZE(1,2), F("MENU"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!Marlin_LCD_API::isMediaInserted()) {
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Color(Theme::status_dark);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Draw Thumb Drive Bitmap on USB Button
|
|
|
|
// Draw Thumb Drive Bitmap on USB Button
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd_Bitmap_Source(TD_Icon_Info);
|
|
|
|
cmd.Cmd_Bitmap_Source(TD_Icon_Info);
|
|
|
|
cmd.Cmd_Bitmap_Layout(TD_Icon_Info);
|
|
|
|
cmd.Cmd_Bitmap_Layout(TD_Icon_Info);
|
|
|
|
cmd.Cmd_Bitmap_Size (TD_Icon_Info);
|
|
|
|
cmd.Cmd_Bitmap_Size (TD_Icon_Info);
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(3)
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTI(BTN_POS(1,9), BTN_SIZE(2,1), TD_Icon_Info, Theme::icon_scale);
|
|
|
|
BTI(BTN_POS(1,9), BTN_SIZE(2,1), TD_Icon_Info, Theme::icon_scale);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
@ -796,11 +893,41 @@ void StatusScreen::static_interaction_buttons() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StatusScreen::static_interaction_buttons() {
|
|
|
|
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
|
|
|
|
BTN_TAG(4) BTN_ENABLED(1) BTN( BTN_POS(3,9), BTN_SIZE(2,1), F("MENU"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
BTN_TAG(4) THEME(back_btn) BTN( BTN_POS(4,7), BTN_SIZE(1,2), F("MENU"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void StatusScreen::dynamic_interaction_buttons() {
|
|
|
|
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(Marlin_LCD_API::isPrintingFromMedia()) {
|
|
|
|
|
|
|
|
BTN_TAG(1)
|
|
|
|
|
|
|
|
THEME(stop_btn)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
BTN_TAG(0)
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Color(Theme::status_bg);
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Foreground_Color(Theme::status_bg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
|
|
|
|
BTN( BTN_POS(1,8), BTN_SIZE(4,1), F("STOP"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
BTN( BTN_POS(1,7), BTN_SIZE(2,2), F("STOP"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define GRID_COLS 1
|
|
|
|
#define GRID_COLS 1
|
|
|
|
|
|
|
|
|
|
|
|
void StatusScreen::static_status_message(const char * const message) {
|
|
|
|
void StatusScreen::static_status_message(const char * const message) {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(0)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
THEME(status_msg) BTN( BTN_POS(1,4), BTN_SIZE(1,1), message, FONT_LRG, OPT_FLAT);
|
|
|
|
THEME(status_msg) BTN( BTN_POS(1,4), BTN_SIZE(1,1), message, FONT_LRG, OPT_FLAT);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
@ -814,12 +941,13 @@ void StatusScreen::setStatusMessage(const char * const message) {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::status_bg);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
static_temperature();
|
|
|
|
static_temperature();
|
|
|
|
static_progress();
|
|
|
|
static_progress();
|
|
|
|
static_axis_position();
|
|
|
|
static_axis_position();
|
|
|
|
|
|
|
|
static_media_button();
|
|
|
|
static_interaction_buttons();
|
|
|
|
static_interaction_buttons();
|
|
|
|
static_status_message(message);
|
|
|
|
static_status_message(message);
|
|
|
|
|
|
|
|
|
|
|
@ -833,6 +961,10 @@ void StatusScreen::setStatusMessage(const char * const message) {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(current_screen.getType() == current_screen.lookupScreen(StatusScreen::onRefresh)) {
|
|
|
|
|
|
|
|
onRefresh();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
@ -867,6 +999,7 @@ void StatusScreen::onRefresh() {
|
|
|
|
dynamic_temperature();
|
|
|
|
dynamic_temperature();
|
|
|
|
dynamic_progress();
|
|
|
|
dynamic_progress();
|
|
|
|
dynamic_axis_position();
|
|
|
|
dynamic_axis_position();
|
|
|
|
|
|
|
|
dynamic_interaction_buttons();
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
@ -883,6 +1016,15 @@ void StatusScreen::onIdle() {
|
|
|
|
|
|
|
|
|
|
|
|
bool StatusScreen::onTouchStart(uint8_t tag) {
|
|
|
|
bool StatusScreen::onTouchStart(uint8_t tag) {
|
|
|
|
switch(tag) {
|
|
|
|
switch(tag) {
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPGM)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Aborting print");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
GOTO_SCREEN(ConfirmAbortPrint);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: GOTO_SCREEN(FilesScreen); break;
|
|
|
|
case 4: GOTO_SCREEN(MenuScreen); break;
|
|
|
|
case 4: GOTO_SCREEN(MenuScreen); break;
|
|
|
|
case 5: GOTO_SCREEN(TemperatureScreen); break;
|
|
|
|
case 5: GOTO_SCREEN(TemperatureScreen); break;
|
|
|
|
case 6: GOTO_SCREEN(MoveAxisScreen); break;
|
|
|
|
case 6: GOTO_SCREEN(MoveAxisScreen); break;
|
|
|
@ -908,34 +1050,34 @@ void MenuScreen::onRefresh() {
|
|
|
|
if(dlcache.hasData()) {
|
|
|
|
if(dlcache.hasData()) {
|
|
|
|
dlcache.append();
|
|
|
|
dlcache.append();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
cmd.Cmd_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTN_TAG(2) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Auto Home"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) BTN_ENABLED(1) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Auto Home"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Move Axis"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(3) BTN_ENABLED(1) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Move Axis"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,2), BTN_SIZE(2,1), F("Disable Steppers"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(5) BTN_ENABLED(1) BTN( BTN_POS(1,2), BTN_SIZE(2,1), F("Temperature"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
BTN_TAG(6) BTN_ENABLED(0) BTN( BTN_POS(1,3), BTN_SIZE(2,1), F("Change Filament"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(5) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(2,1), F("Temperature"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) BTN_ENABLED(1) BTN( BTN_POS(1,4), BTN_SIZE(2,1), F("Disable Steppers"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(6) THEME(menu_btn) BTN( BTN_POS(1,4), BTN_SIZE(2,1), F("Advanced Settings"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) BTN_ENABLED(1) BTN( BTN_POS(1,5), BTN_SIZE(2,1), F("Advanced Settings"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(8) THEME(menu_btn) BTN( BTN_POS(1,5), BTN_SIZE(2,1), F("Recalibrate Screen"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(8) BTN_ENABLED(1) BTN( BTN_POS(1,6), BTN_SIZE(2,1), F("About Firmware"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) THEME(menu_btn) BTN( BTN_POS(1,6), BTN_SIZE(2,1), F("About Firmware"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
BTN_TAG(2) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Auto Home"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) BTN_ENABLED(1) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Auto Home"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(1,2), BTN_SIZE(1,1), F("Move Axis"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(3) BTN_ENABLED(1) BTN( BTN_POS(1,2), BTN_SIZE(1,1), F("Move Axis"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(1,1), F("Disable Steppers"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) BTN_ENABLED(1) BTN( BTN_POS(1,3), BTN_SIZE(1,1), F("Disable Steppers"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
BTN_TAG(6) BTN_ENABLED(0) BTN( BTN_POS(1,4), BTN_SIZE(2,1), F("Change Filament"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(5) THEME(menu_btn) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Temperature"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
BTN_TAG(6) THEME(menu_btn) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Configuration"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(5) BTN_ENABLED(1) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Temperature"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) THEME(menu_btn) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("About Firmware"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) BTN_ENABLED(1) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Advanced Settings"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
BTN_TAG(8) BTN_ENABLED(1) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("About Firmware"), MENU_BTN_STYLE);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define MARGIN_T 15
|
|
|
|
#define MARGIN_T 15
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,7), BTN_SIZE(2,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) THEME(back_btn) BTN( BTN_POS(1,7), BTN_SIZE(2,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,4), BTN_SIZE(2,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) THEME(back_btn) BTN( BTN_POS(2,4), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define MARGIN_T 5
|
|
|
|
#define MARGIN_T 5
|
|
|
@ -955,9 +1097,8 @@ bool MenuScreen::onTouchStart(uint8_t tag) {
|
|
|
|
case 3: GOTO_SCREEN(MoveAxisScreen); break;
|
|
|
|
case 3: GOTO_SCREEN(MoveAxisScreen); break;
|
|
|
|
case 4: EXEC_GCODE(F("M84")); break;
|
|
|
|
case 4: EXEC_GCODE(F("M84")); break;
|
|
|
|
case 5: GOTO_SCREEN(TemperatureScreen); break;
|
|
|
|
case 5: GOTO_SCREEN(TemperatureScreen); break;
|
|
|
|
case 6: GOTO_SCREEN(AdvancedSettingsScreen); break;
|
|
|
|
case 7: GOTO_SCREEN(AdvancedSettingsScreen); break;
|
|
|
|
case 7: GOTO_SCREEN(AboutScreen); break;
|
|
|
|
case 8: GOTO_SCREEN(AboutScreen); break;
|
|
|
|
case 8: GOTO_SCREEN(CalibrationScreen); break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -967,7 +1108,7 @@ bool MenuScreen::onTouchStart(uint8_t tag) {
|
|
|
|
/******************************* CONFIGURATION SCREEN ****************************/
|
|
|
|
/******************************* CONFIGURATION SCREEN ****************************/
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#define GRID_ROWS 6
|
|
|
|
#define GRID_ROWS 7
|
|
|
|
#define GRID_COLS 2
|
|
|
|
#define GRID_COLS 2
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
#define GRID_ROWS 4
|
|
|
|
#define GRID_ROWS 4
|
|
|
@ -982,30 +1123,31 @@ void AdvancedSettingsScreen::onRefresh() {
|
|
|
|
if(dlcache.hasData()) {
|
|
|
|
if(dlcache.hasData()) {
|
|
|
|
dlcache.append();
|
|
|
|
dlcache.append();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
cmd.Cmd_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,2), F("Z Offset "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) BTN_ENABLED(1) BTN( BTN_POS(1,1), BTN_SIZE(1,2), F("Z Offset "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(1,2), F("Steps/mm"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(5) BTN_ENABLED(1) BTN( BTN_POS(1,3), BTN_SIZE(1,1), F("Steps/mm"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(5) THEME(disabled) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(6) BTN_ENABLED(0) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(6) THEME(disabled) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) BTN_ENABLED(0) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) THEME(disabled) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(8) BTN_ENABLED(0) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(8) THEME(menu_btn) BTN( BTN_POS(1,5), BTN_SIZE(2,1), F("Restore Failsafe"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(9) BTN_ENABLED(1) BTN( BTN_POS(1,4), BTN_SIZE(2,1), F("Recalibrate Screen"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,6), BTN_SIZE(1,1), F("Save"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(10) BTN_ENABLED(1) BTN( BTN_POS(1,5), BTN_SIZE(2,1), F("Restore Factory Settings"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) THEME(navi_btn) BTN( BTN_POS(2,6), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) BTN_ENABLED(1) BTN( BTN_POS(1,6), BTN_SIZE(2,1), F("Save As Default"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
BTN_TAG(1) THEME(back_btn) BTN( BTN_POS(1,7), BTN_SIZE(2,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
BTN_TAG(3) THEME(menu_btn) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Z Offset "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(3) BTN_ENABLED(1) BTN( BTN_POS(1,1), BTN_SIZE(1,1), F("Z Offset "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) THEME(menu_btn) BTN( BTN_POS(1,2), BTN_SIZE(1,1), F("Steps/mm"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(4) BTN_ENABLED(1) BTN( BTN_POS(1,2), BTN_SIZE(1,1), F("Steps/mm"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(5) THEME(disabled) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(5) BTN_ENABLED(0) BTN( BTN_POS(2,1), BTN_SIZE(1,1), F("Velocity "), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(6) THEME(disabled) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(6) BTN_ENABLED(0) BTN( BTN_POS(2,2), BTN_SIZE(1,1), F("Acceleration"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) THEME(disabled) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(7) BTN_ENABLED(0) BTN( BTN_POS(2,3), BTN_SIZE(1,1), F("Jerk"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(8) THEME(menu_btn) BTN( BTN_POS(1,3), BTN_SIZE(1,1), F("Restore Failsafe"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(8) BTN_ENABLED(1) BTN( BTN_POS(1,3), BTN_SIZE(1,1), F("Restore Failsafe"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,4), BTN_SIZE(1,1), F("Save"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) BTN_ENABLED(1) BTN( BTN_POS(1,4), BTN_SIZE(1,1), F("Save"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(2) THEME(navi_btn) BTN( BTN_POS(2,4), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) THEME(back_btn) BTN( BTN_POS(2,4), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
dlcache.store();
|
|
|
|
dlcache.store();
|
|
|
@ -1019,10 +1161,15 @@ void AdvancedSettingsScreen::onRefresh() {
|
|
|
|
bool AdvancedSettingsScreen::onTouchStart(uint8_t tag) {
|
|
|
|
bool AdvancedSettingsScreen::onTouchStart(uint8_t tag) {
|
|
|
|
switch(tag) {
|
|
|
|
switch(tag) {
|
|
|
|
case 1: GOTO_PREVIOUS(); break;
|
|
|
|
case 1: GOTO_PREVIOUS(); break;
|
|
|
|
case 2: GOTO_PREVIOUS(); break;
|
|
|
|
case 2:
|
|
|
|
case 3: GOTO_SCREEN(ZOffsetScreen); break;
|
|
|
|
current_screen.pop();
|
|
|
|
case 4: GOTO_SCREEN(StepsScreen); break;
|
|
|
|
EXEC_GCODE(F("M500"));
|
|
|
|
case 8: GOTO_SCREEN(RestoreFailsafeScreen); break;
|
|
|
|
AlertBoxScreen::show(F("Settings saved!"));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 4: GOTO_SCREEN(ZOffsetScreen); break;
|
|
|
|
|
|
|
|
case 5: GOTO_SCREEN(StepsScreen); break;
|
|
|
|
|
|
|
|
case 9: GOTO_SCREEN(CalibrationScreen); break;
|
|
|
|
|
|
|
|
case 10: GOTO_SCREEN(RestoreFailsafeScreen); break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1034,10 +1181,33 @@ bool AdvancedSettingsScreen::onTouchStart(uint8_t tag) {
|
|
|
|
#define GRID_COLS 4
|
|
|
|
#define GRID_COLS 4
|
|
|
|
#define GRID_ROWS 16
|
|
|
|
#define GRID_ROWS 16
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void CalibrationScreen::onEntry() {
|
|
|
|
|
|
|
|
// Clear the display
|
|
|
|
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
|
|
|
|
cmd.Cmd_Execute();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Wait for the touch to release before starting,
|
|
|
|
|
|
|
|
// as otherwise the first calibration point could
|
|
|
|
|
|
|
|
// be misinterpreted.
|
|
|
|
|
|
|
|
while(CLCD::Is_Touching()) {
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPGM)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Waiting for touch release");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UIScreen::onEntry();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CalibrationScreen::onRefresh() {
|
|
|
|
void CalibrationScreen::onRefresh() {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
@ -1059,8 +1229,20 @@ void CalibrationScreen::onRefresh() {
|
|
|
|
|
|
|
|
|
|
|
|
void CalibrationScreen::onIdle() {
|
|
|
|
void CalibrationScreen::onIdle() {
|
|
|
|
if(CLCD::CommandFifo::Cmd_Is_Idle()) {
|
|
|
|
if(CLCD::CommandFifo::Cmd_Is_Idle()) {
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPGM)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Calibration finished");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
GOTO_SCREEN(StatusScreen);
|
|
|
|
GOTO_SCREEN(StatusScreen);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPGM)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPGM("Waiting for calibration to finish.");
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************** CALIBRATION REGISTERS SCREEN ****************************/
|
|
|
|
/***************************** CALIBRATION REGISTERS SCREEN ****************************/
|
|
|
@ -1080,7 +1262,7 @@ void CalibrationRegistersScreen::onRefresh() {
|
|
|
|
|
|
|
|
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(0)
|
|
|
|
BTN_TAG(0)
|
|
|
@ -1107,11 +1289,13 @@ void CalibrationRegistersScreen::onRefresh() {
|
|
|
|
|
|
|
|
|
|
|
|
#define GRID_COLS 3
|
|
|
|
#define GRID_COLS 3
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(3,7), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) THEME(back_btn) BTN( BTN_POS(3,7), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
cmd.Cmd_Execute();
|
|
|
|
cmd.Cmd_Execute();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sound.play(js_bach_joy);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CalibrationRegistersScreen::onTouchStart(uint8_t tag) {
|
|
|
|
bool CalibrationRegistersScreen::onTouchStart(uint8_t tag) {
|
|
|
@ -1135,13 +1319,13 @@ bool CalibrationRegistersScreen::onTouchStart(uint8_t tag) {
|
|
|
|
|
|
|
|
|
|
|
|
void ValueAdjusters::stacker_t::static_parts() {
|
|
|
|
void ValueAdjusters::stacker_t::static_parts() {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd_Clear_Color(Theme::adjust_bg);
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(1,10), BTN_SIZE(6,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) THEME(back_btn) BTN( BTN_POS(1,10), BTN_SIZE(6,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
BTN_TAG(1) THEME(navi_btn) BTN( BTN_POS(8,6), BTN_SIZE(2,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
BTN_TAG(1) THEME(back_btn) BTN( BTN_POS(8,6), BTN_SIZE(2,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
line = 1;
|
|
|
|
line = 1;
|
|
|
@ -1193,9 +1377,9 @@ void ValueAdjusters::increment_t::static_parts(stacker_t &s) const {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTN_TAG(0) THEME(adjust_bg) BTN( BTN_POS(1, s.line), BTN_SIZE(6,1), F("Increment:"), FONT_MED, OPT_FLAT);
|
|
|
|
BTN_TAG(0) THEME(background) BTN( BTN_POS(1, s.line), BTN_SIZE(6,1), F("Increment:"), FONT_MED, OPT_FLAT);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
BTN_TAG(0) THEME(adjust_bg) BTN( BTN_POS(8,1), BTN_SIZE(2,1), F("Increment"), FONT_MED, OPT_FLAT);
|
|
|
|
BTN_TAG(0) THEME(background) BTN( BTN_POS(8,1), BTN_SIZE(2,1), F("Increment"), FONT_MED, OPT_FLAT);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// Draw all the buttons in the off state.
|
|
|
|
// Draw all the buttons in the off state.
|
|
|
@ -1205,14 +1389,14 @@ void ValueAdjusters::increment_t::static_parts(stacker_t &s) const {
|
|
|
|
draw_increment_btn(s.line+1, 245 - decimals, decimals);
|
|
|
|
draw_increment_btn(s.line+1, 245 - decimals, decimals);
|
|
|
|
s.line += 2;
|
|
|
|
s.line += 2;
|
|
|
|
|
|
|
|
|
|
|
|
increment = 243 - decimals;
|
|
|
|
screen_data.ValueAdjusters.increment = 243 - decimals;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void ValueAdjusters::increment_t::dynamic_parts(stacker_t &s) const {
|
|
|
|
void ValueAdjusters::increment_t::dynamic_parts(stacker_t &s) const {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
THEME(toggle_on);
|
|
|
|
THEME(toggle_on);
|
|
|
|
draw_increment_btn(s.line+1, increment, decimals);
|
|
|
|
draw_increment_btn(s.line+1, screen_data.ValueAdjusters.increment, decimals);
|
|
|
|
s.line += 2;
|
|
|
|
s.line += 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1220,9 +1404,9 @@ void ValueAdjusters::heading_t::static_parts(stacker_t &s) const {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
BTN_TAG(0) THEME(adjust_bg) BTN( BTN_POS(1, s.line), BTN_SIZE(6,1), (progmem_str) label, FONT_MED, OPT_FLAT);
|
|
|
|
BTN_TAG(0) THEME(background) BTN( BTN_POS(1, s.line), BTN_SIZE(6,1), (progmem_str) label, FONT_MED, OPT_FLAT);
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
BTN_TAG(0) THEME(adjust_bg) BTN( BTN_POS(3, s.line), BTN_SIZE(4,1), (progmem_str) label, FONT_MED, OPT_FLAT);
|
|
|
|
BTN_TAG(0) THEME(background) BTN( BTN_POS(3, s.line), BTN_SIZE(4,1), (progmem_str) label, FONT_MED, OPT_FLAT);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
s.line++;
|
|
|
|
s.line++;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1248,10 +1432,10 @@ void ValueAdjusters::heading_t::dynamic_parts(stacker_t &s) const {
|
|
|
|
void ValueAdjusters::adjuster_t::static_parts(stacker_t &s) const {
|
|
|
|
void ValueAdjusters::adjuster_t::static_parts(stacker_t &s) const {
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
progmem_str str = (progmem_str) label;
|
|
|
|
progmem_str str = (progmem_str) label;
|
|
|
|
BTN_TAG( 0 ) RGB(color) BTN( BTN_POS(3,s.line), BTN_SIZE(2,1), F(""), FONT_SML, OPT_FLAT);
|
|
|
|
BTN_TAG( 0 ) RGB(color) BTN( BTN_POS(3,s.line), BTN_SIZE(2,1), F(""), FONT_SML, OPT_FLAT);
|
|
|
|
BTN_TAG( 0 ) THEME(adjust_bg) BTN( BTN_POS(1,s.line), BTN_SIZE(2,1), str, FONT_SML, OPT_FLAT);
|
|
|
|
BTN_TAG( 0 ) THEME(background) BTN( BTN_POS(1,s.line), BTN_SIZE(2,1), str, FONT_SML, OPT_FLAT);
|
|
|
|
BTN_TAG(tag ) THEME(incr_btn) BTN( BTN_POS(5,s.line), BTN_SIZE(1,1), F("-"), FONT_MED, OPT_3D);
|
|
|
|
BTN_TAG(tag ) BTN_ENABLED(1) BTN( BTN_POS(5,s.line), BTN_SIZE(1,1), F("-"), FONT_MED, OPT_3D);
|
|
|
|
BTN_TAG(tag + 1) THEME(incr_btn) BTN( BTN_POS(6,s.line), BTN_SIZE(1,1), F("+"), FONT_MED, OPT_3D);
|
|
|
|
BTN_TAG(tag + 1) BTN_ENABLED(1) BTN( BTN_POS(6,s.line), BTN_SIZE(1,1), F("+"), FONT_MED, OPT_3D);
|
|
|
|
s.line++;
|
|
|
|
s.line++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1268,10 +1452,15 @@ void ValueAdjusters::adjuster_t::dynamic_parts(stacker_t &s, float value) const
|
|
|
|
s.line++;
|
|
|
|
s.line++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ValueAdjusters::onEntry() {
|
|
|
|
|
|
|
|
screen_data.ValueAdjusters.increment = 242;
|
|
|
|
|
|
|
|
UIScreen::onEntry();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ValueAdjusters::onTouchStart(uint8_t tag) {
|
|
|
|
bool ValueAdjusters::onTouchStart(uint8_t tag) {
|
|
|
|
switch(tag) {
|
|
|
|
switch(tag) {
|
|
|
|
case 1: GOTO_PREVIOUS(); return true;
|
|
|
|
case 1: GOTO_PREVIOUS(); return true;
|
|
|
|
case 240 ... 245: increment = tag; break;
|
|
|
|
case 240 ... 245: screen_data.ValueAdjusters.increment = tag; break;
|
|
|
|
default: return current_screen.onTouchHeld(tag);
|
|
|
|
default: return current_screen.onTouchHeld(tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
current_screen.onRefresh();
|
|
|
|
current_screen.onRefresh();
|
|
|
@ -1279,7 +1468,7 @@ bool ValueAdjusters::onTouchStart(uint8_t tag) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float ValueAdjusters::getIncrement() {
|
|
|
|
float ValueAdjusters::getIncrement() {
|
|
|
|
switch(increment) {
|
|
|
|
switch(screen_data.ValueAdjusters.increment) {
|
|
|
|
case 240: return 0.001;
|
|
|
|
case 240: return 0.001;
|
|
|
|
case 241: return 0.01;
|
|
|
|
case 241: return 0.01;
|
|
|
|
case 242: return 0.1;
|
|
|
|
case 242: return 0.1;
|
|
|
@ -1289,8 +1478,6 @@ float ValueAdjusters::getIncrement() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uint8_t ValueAdjusters::increment = 20;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define EDGE_R 0
|
|
|
|
#define EDGE_R 0
|
|
|
|
|
|
|
|
|
|
|
|
/******************************** MOVE AXIS SCREEN ******************************/
|
|
|
|
/******************************** MOVE AXIS SCREEN ******************************/
|
|
|
@ -1540,20 +1727,111 @@ bool ZOffsetScreen::onTouchHeld(uint8_t tag) {
|
|
|
|
|
|
|
|
|
|
|
|
/***************************** FILES SCREEN ***************************/
|
|
|
|
/***************************** FILES SCREEN ***************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
|
|
|
|
#define GRID_COLS 6
|
|
|
|
|
|
|
|
#define GRID_ROWS 14
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define GRID_COLS 3
|
|
|
|
|
|
|
|
#define GRID_ROWS 6
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint16_t filesPerPage = GRID_ROWS - 4;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FilesScreen::onEntry() {
|
|
|
|
|
|
|
|
screen_data.FilesScreen.page = 0;
|
|
|
|
|
|
|
|
screen_data.FilesScreen.selected = 0xFF;
|
|
|
|
|
|
|
|
UIScreen::onEntry();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const char *FilesScreen::getSelectedShortFilename() {
|
|
|
|
|
|
|
|
Marlin_LCD_API::Marlin_LCD_API::Media_Iterator iterator(screen_data.FilesScreen.page * filesPerPage);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(iterator.hasMore()) {
|
|
|
|
|
|
|
|
if(screen_data.FilesScreen.selected == iterator.value() + 1) {
|
|
|
|
|
|
|
|
return iterator.shortFilename();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
iterator.next();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FilesScreen::onRefresh() {
|
|
|
|
void FilesScreen::onRefresh() {
|
|
|
|
CLCD::DLCache dlcache(FILES_SCREEN_CACHE);
|
|
|
|
CLCD::DLCache dlcache(FILES_SCREEN_CACHE);
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
CLCD::CommandFifo cmd;
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
cmd.Cmd(CMD_DLSTART);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd_Set_Clear_Color(Theme::background);
|
|
|
|
|
|
|
|
cmd.Cmd_Clear(1,1,1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Marlin_LCD_API::Marlin_LCD_API::Media_Iterator iterator(screen_data.FilesScreen.page * filesPerPage);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MARGIN_T 0
|
|
|
|
|
|
|
|
#define MARGIN_B 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while(iterator.hasMore()) {
|
|
|
|
|
|
|
|
const uint16_t tag = iterator.value() + 1;
|
|
|
|
|
|
|
|
BTN_TAG(tag)
|
|
|
|
|
|
|
|
RGB(screen_data.FilesScreen.selected == tag ? Theme::files_selected : Theme::background)
|
|
|
|
|
|
|
|
BTN( BTN_POS(1,tag+2), BTN_SIZE(6,1), F(""), FONT_SML, OPT_FLAT);
|
|
|
|
|
|
|
|
BTX( BTN_POS(1,tag+2), BTN_SIZE(6,1), iterator.filename(), FONT_LRG, OPT_CENTERY);
|
|
|
|
|
|
|
|
iterator.next();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MARGIN_T 5
|
|
|
|
|
|
|
|
#define MARGIN_B 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint16_t pageCount = iterator.count() / filesPerPage + 1;
|
|
|
|
|
|
|
|
const bool prevEnabled = screen_data.FilesScreen.page > 0;
|
|
|
|
|
|
|
|
const bool nextEnabled = screen_data.FilesScreen.page < (pageCount - 1);
|
|
|
|
|
|
|
|
const bool fileSelected = screen_data.FilesScreen.selected != 0xFF;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char page_str[15];
|
|
|
|
|
|
|
|
sprintf_P(page_str, PSTR("Page %d of %d"), screen_data.FilesScreen.page + 1, pageCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(LCD_PORTRAIT)
|
|
|
|
|
|
|
|
BTN_TAG(0)
|
|
|
|
|
|
|
|
BTX( BTN_POS(1,1), BTN_SIZE(6,1), page_str, FONT_LRG, OPT_CENTER);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(prevEnabled) {BTN_TAG(241); BTN( BTN_POS(1,1), BTN_SIZE(1,2), F("<"), MENU_BTN_STYLE);}
|
|
|
|
|
|
|
|
if(nextEnabled) {BTN_TAG(242); BTN( BTN_POS(6,1), BTN_SIZE(1,2), F(">"), MENU_BTN_STYLE);}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MARGIN_T 15
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BTN_TAG(240) THEME(back_btn)
|
|
|
|
|
|
|
|
BTN( BTN_POS(5,13), BTN_SIZE(2,2), F("Back"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BTN_ENABLED(fileSelected)
|
|
|
|
|
|
|
|
BTN_TAG(243); BTN( BTN_POS(1,13), BTN_SIZE(4,2), F("Print"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
BTN_TAG(240) THEME(back_btn) BTN( BTN_POS(1,4), BTN_SIZE(1,1), F("Back"), MENU_BTN_STYLE);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define MARGIN_T 5
|
|
|
|
|
|
|
|
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(DL_DISPLAY);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
cmd.Cmd(CMD_SWAP);
|
|
|
|
cmd.Cmd_Execute();
|
|
|
|
cmd.Cmd_Execute();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FilesScreen::onTouchHeld(uint8_t tag) {
|
|
|
|
bool FilesScreen::onTouchStart(uint8_t tag) {
|
|
|
|
switch(tag) {
|
|
|
|
switch(tag) {
|
|
|
|
|
|
|
|
case 240: GOTO_PREVIOUS(); return true;
|
|
|
|
|
|
|
|
case 241: screen_data.FilesScreen.page--; break;
|
|
|
|
|
|
|
|
case 242: screen_data.FilesScreen.page++; break;
|
|
|
|
|
|
|
|
case 243:
|
|
|
|
|
|
|
|
Marlin_LCD_API::printFromSDCard(getSelectedShortFilename());
|
|
|
|
|
|
|
|
sound.play(start_print);
|
|
|
|
|
|
|
|
lcd_setstatusPGM(PSTR("Print Starting"), 0);
|
|
|
|
|
|
|
|
GOTO_SCREEN(StatusScreen);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
if(tag < 240) {
|
|
|
|
|
|
|
|
if(screen_data.FilesScreen.selected != tag) {
|
|
|
|
|
|
|
|
screen_data.FilesScreen.selected = tag;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Double clicked.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
onRefresh();
|
|
|
|
onRefresh();
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
@ -1566,6 +1844,7 @@ void lcd_setstatusPGM(const char * const message, int8_t level = 0);
|
|
|
|
void lcd_init() {
|
|
|
|
void lcd_init() {
|
|
|
|
CLCD::Init();
|
|
|
|
CLCD::Init();
|
|
|
|
CLCD::DLCache::init();
|
|
|
|
CLCD::DLCache::init();
|
|
|
|
|
|
|
|
Marlin_LCD_API::initMedia();
|
|
|
|
|
|
|
|
|
|
|
|
lcd_setstatusPGM(PSTR(WELCOME_MSG));
|
|
|
|
lcd_setstatusPGM(PSTR(WELCOME_MSG));
|
|
|
|
|
|
|
|
|
|
|
@ -1573,21 +1852,25 @@ void lcd_init() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_update() {
|
|
|
|
void lcd_update() {
|
|
|
|
const uint8_t NONE = 0xFF;
|
|
|
|
enum {
|
|
|
|
const uint8_t IGNORE = 0xFE;
|
|
|
|
UNPRESSED = 0xFF, //255
|
|
|
|
static uint8_t pressed = NONE;
|
|
|
|
IGNORE_UNPRESS = 0xFE, //254
|
|
|
|
static uint8_t last_repeat = 0;
|
|
|
|
DEBOUNCING = 0xFD //253
|
|
|
|
static uint8_t last_update = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
static uint8_t pressed_state = UNPRESSED;
|
|
|
|
|
|
|
|
|
|
|
|
const uint8_t tiny_millis = tiny_interval(millis());
|
|
|
|
static tiny_interval_t touch_timer;
|
|
|
|
|
|
|
|
static tiny_interval_t refresh_timer;
|
|
|
|
|
|
|
|
|
|
|
|
sound.onIdle();
|
|
|
|
sound.onIdle();
|
|
|
|
|
|
|
|
|
|
|
|
if(tiny_millis - last_update > tiny_interval(DISPLAY_UPDATE_INTERVAL)) {
|
|
|
|
if(refresh_timer.elapsed()) {
|
|
|
|
|
|
|
|
refresh_timer.wait_for(DISPLAY_UPDATE_INTERVAL);
|
|
|
|
current_screen.onIdle();
|
|
|
|
current_screen.onIdle();
|
|
|
|
last_update = tiny_millis;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Marlin_LCD_API::checkMedia();
|
|
|
|
|
|
|
|
|
|
|
|
// If the LCD is processing commands, don't check
|
|
|
|
// If the LCD is processing commands, don't check
|
|
|
|
// for tags since they may be changing and could
|
|
|
|
// for tags since they may be changing and could
|
|
|
|
// cause spurious events.
|
|
|
|
// cause spurious events.
|
|
|
@ -1595,72 +1878,93 @@ void lcd_update() {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CLCD::Test_Pulse();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const uint8_t tag = CLCD::Get_Tag();
|
|
|
|
const uint8_t tag = CLCD::Get_Tag();
|
|
|
|
|
|
|
|
|
|
|
|
if(tag == 0) {
|
|
|
|
switch(pressed_state) {
|
|
|
|
// When the user lifts their finger, activate the onTouchEnd handler,
|
|
|
|
case UNPRESSED:
|
|
|
|
// except when pressed is IGNORE.
|
|
|
|
if(tag != 0) {
|
|
|
|
if(pressed == IGNORE) {
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
pressed = NONE;
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPAIR)
|
|
|
|
sound.play(Theme::unpress_sound);
|
|
|
|
SERIAL_PROTOCOLLNPAIR("Touch start: ", tag);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
else if(pressed != NONE) {
|
|
|
|
Serial.print(F("Touch start: "));
|
|
|
|
sound.play(Theme::unpress_sound);
|
|
|
|
Serial.println(tag);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
current_screen.onTouchEnd(pressed);
|
|
|
|
|
|
|
|
pressed = NONE;
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPAIR)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("Touch end: ", tag);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
Serial.print(F("Touch end: "));
|
|
|
|
|
|
|
|
Serial.println(tag);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(pressed == NONE) {
|
|
|
|
|
|
|
|
// When the user taps on a button, activate the onTouchStart handler
|
|
|
|
|
|
|
|
const uint8_t lastScreen = current_screen.getScreen();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(current_screen.onTouchStart(tag)) {
|
|
|
|
|
|
|
|
last_repeat = tiny_millis;
|
|
|
|
|
|
|
|
sound.play(Theme::press_sound);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
// When the user taps on a button, activate the onTouchStart handler
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPAIR)
|
|
|
|
const uint8_t lastScreen = current_screen.getScreen();
|
|
|
|
SERIAL_PROTOCOLLNPAIR("Touch start: ", tag);
|
|
|
|
|
|
|
|
#else
|
|
|
|
if(current_screen.onTouchStart(tag)) {
|
|
|
|
Serial.print(F("Touch start: "));
|
|
|
|
touch_timer.wait_for(1000 / TOUCH_REPEATS_PER_SECOND);
|
|
|
|
Serial.println(tag);
|
|
|
|
sound.play(Theme::press_sound);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(lastScreen != current_screen.getScreen()) {
|
|
|
|
|
|
|
|
// In the case in which a touch event triggered a new screen to be
|
|
|
|
|
|
|
|
// drawn, we don't issue a touchEnd since it would be sent to the
|
|
|
|
|
|
|
|
// wrong screen.
|
|
|
|
|
|
|
|
pressed_state = IGNORE_UNPRESS;
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPAIR)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("Ignoring press", tag);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
Serial.print(F("Ignoring press"));
|
|
|
|
|
|
|
|
Serial.println(tag);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pressed_state = tag;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DEBOUNCING:
|
|
|
|
|
|
|
|
if(tag == 0) {
|
|
|
|
|
|
|
|
if(touch_timer.elapsed()) {
|
|
|
|
|
|
|
|
pressed_state = UNPRESSED;
|
|
|
|
|
|
|
|
sound.play(Theme::unpress_sound);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pressed_state = IGNORE_UNPRESS;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IGNORE_UNPRESS:
|
|
|
|
|
|
|
|
if(tag == 0) {
|
|
|
|
|
|
|
|
// Ignore subsequent presses for a while to avoid bouncing
|
|
|
|
|
|
|
|
touch_timer.wait_for(DEBOUNCE_PERIOD);
|
|
|
|
|
|
|
|
pressed_state = DEBOUNCING;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default: // PRESSED
|
|
|
|
|
|
|
|
if(tag == pressed_state) {
|
|
|
|
|
|
|
|
// The user is holding down a button.
|
|
|
|
|
|
|
|
if(touch_timer.elapsed() && current_screen.onTouchHeld(tag)) {
|
|
|
|
|
|
|
|
sound.play(Theme::repeat_sound);
|
|
|
|
|
|
|
|
touch_timer.wait_for(1000 / TOUCH_REPEATS_PER_SECOND);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(tag == 0) {
|
|
|
|
|
|
|
|
#if defined(UI_FRAMEWORK_DEBUG)
|
|
|
|
|
|
|
|
#if defined (SERIAL_PROTOCOLLNPAIR)
|
|
|
|
|
|
|
|
SERIAL_PROTOCOLLNPAIR("Touch end: ", pressed_state);
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
Serial.print(F("Touch end: "));
|
|
|
|
|
|
|
|
Serial.println(pressed_state);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(lastScreen != current_screen.getScreen()) {
|
|
|
|
current_screen.onTouchEnd(pressed_state);
|
|
|
|
// In the case in which a touch event triggered a new screen to be
|
|
|
|
// Ignore subsequent presses for a while to avoid bouncing
|
|
|
|
// drawn, we don't issue a touchEnd since it would be sent to the
|
|
|
|
touch_timer.wait_for(DEBOUNCE_PERIOD);
|
|
|
|
// wrong screen.
|
|
|
|
pressed_state = DEBOUNCING;
|
|
|
|
pressed = IGNORE;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pressed = tag;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else if(tag == pressed) {
|
|
|
|
|
|
|
|
// The user is holding down a button.
|
|
|
|
|
|
|
|
if((tiny_millis - last_repeat) > tiny_interval(1000 / TOUCH_REPEATS_PER_SECOND)) {
|
|
|
|
|
|
|
|
if(current_screen.onTouchHeld(tag)) {
|
|
|
|
|
|
|
|
sound.play(Theme::repeat_sound);
|
|
|
|
|
|
|
|
last_repeat = tiny_millis;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline bool lcd_hasstatus() { return true; }
|
|
|
|
inline bool lcd_hasstatus() { return true; }
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_setstatus(const char * const message, const bool persist = false) {
|
|
|
|
void lcd_setstatus(const char * const message, const bool persist /* = false */) {
|
|
|
|
StatusScreen::setStatusMessage(message);
|
|
|
|
StatusScreen::setStatusMessage(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1686,9 +1990,18 @@ void lcd_setalertstatusPGM(const char * const message) {
|
|
|
|
|
|
|
|
|
|
|
|
void lcd_buttons_update() {}
|
|
|
|
void lcd_buttons_update() {}
|
|
|
|
inline void lcd_reset_alert_level() {}
|
|
|
|
inline void lcd_reset_alert_level() {}
|
|
|
|
inline bool lcd_detected() { return true; }
|
|
|
|
|
|
|
|
inline void lcd_refresh() {current_screen.onIdle();}
|
|
|
|
inline void lcd_refresh() {current_screen.onIdle();}
|
|
|
|
|
|
|
|
|
|
|
|
void kill_screen(const char* lcd_msg) {
|
|
|
|
void Marlin_LCD_API::onPrinterKilled(const char* lcd_msg) {
|
|
|
|
KillScreen::show(progmem_str(lcd_msg));
|
|
|
|
KillScreen::show(progmem_str(lcd_msg));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Marlin_LCD_API::onCardInserted() {
|
|
|
|
|
|
|
|
lcd_setstatusPGM(PSTR(MSG_SD_INSERTED), 0);
|
|
|
|
|
|
|
|
sound.play(card_inserted);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Marlin_LCD_API::onCardRemoved() {
|
|
|
|
|
|
|
|
lcd_setstatusPGM(PSTR(MSG_SD_REMOVED), 0);
|
|
|
|
|
|
|
|
sound.play(card_removed);
|
|
|
|
|
|
|
|
}
|
|
|
|