|
@ -58,11 +58,7 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { |
|
|
if (what & BACKGROUND) { |
|
|
if (what & BACKGROUND) { |
|
|
|
|
|
|
|
|
#define GRID_COLS 4 |
|
|
#define GRID_COLS 4 |
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
#define GRID_ROWS TERN(TOUCH_UI_PORTRAIT, 7, 6) |
|
|
#define GRID_ROWS 7 |
|
|
|
|
|
#else |
|
|
|
|
|
#define GRID_ROWS 6 |
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
cmd.cmd(CLEAR_COLOR_RGB(bg_color)) |
|
|
cmd.cmd(CLEAR_COLOR_RGB(bg_color)) |
|
|
.cmd(CLEAR(true,true,true)) |
|
|
.cmd(CLEAR(true,true,true)) |
|
@ -77,21 +73,19 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { |
|
|
#if DISABLED(LCD_FYSETC_TFT81050) |
|
|
#if DISABLED(LCD_FYSETC_TFT81050) |
|
|
.text(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_LCD_BRIGHTNESS), OPT_RIGHTX | OPT_CENTERY) |
|
|
.text(BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_LCD_BRIGHTNESS), OPT_RIGHTX | OPT_CENTERY) |
|
|
#endif |
|
|
#endif |
|
|
.text(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUND_VOLUME), OPT_RIGHTX | OPT_CENTERY) |
|
|
.text(BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_SOUND_VOLUME), OPT_RIGHTX | OPT_CENTERY); |
|
|
.text(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_SCREEN_LOCK), OPT_RIGHTX | OPT_CENTERY); |
|
|
#if ENABLED(FTDI_LOCK_SCREEN) |
|
|
|
|
|
cmd.text(BTN_POS(1,4), BTN_SIZE(2,1), GET_TEXT_F(MSG_SCREEN_LOCK), OPT_RIGHTX | OPT_CENTERY); |
|
|
|
|
|
#endif |
|
|
#if DISABLED(TOUCH_UI_NO_BOOTSCREEN) |
|
|
#if DISABLED(TOUCH_UI_NO_BOOTSCREEN) |
|
|
cmd.text(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BOOT_SCREEN), OPT_RIGHTX | OPT_CENTERY); |
|
|
cmd.text(BTN_POS(1,5), BTN_SIZE(2,1), GET_TEXT_F(MSG_BOOT_SCREEN), OPT_RIGHTX | OPT_CENTERY); |
|
|
#endif |
|
|
#endif |
|
|
#undef EDGE_R |
|
|
#undef EDGE_R |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (what & FOREGROUND) { |
|
|
if (what & FOREGROUND) { |
|
|
#if defined(FTDI_LOCK_SCREEN) || DISABLED(TOUCH_UI_NO_BOOTSCREEN) |
|
|
#if ENABLED(FTDI_LOCK_SCREEN) || DISABLED(TOUCH_UI_NO_BOOTSCREEN) |
|
|
#if ENABLED(TOUCH_UI_PORTRAIT) |
|
|
constexpr uint8_t w = TERN(TOUCH_UI_PORTRAIT, 2, 1); |
|
|
constexpr uint8_t w = 2; |
|
|
|
|
|
#else |
|
|
|
|
|
constexpr uint8_t w = 1; |
|
|
|
|
|
#endif |
|
|
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
cmd.font(font_medium) |
|
|
cmd.font(font_medium) |
|
@ -101,7 +95,7 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { |
|
|
.tag(2).slider(BTN_POS(3,2), BTN_SIZE(2,1), mydata.brightness, 128) |
|
|
.tag(2).slider(BTN_POS(3,2), BTN_SIZE(2,1), mydata.brightness, 128) |
|
|
#endif |
|
|
#endif |
|
|
.tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), mydata.volume, 0xFF) |
|
|
.tag(3).slider(BTN_POS(3,3), BTN_SIZE(2,1), mydata.volume, 0xFF) |
|
|
#ifdef FTDI_LOCK_SCREEN |
|
|
#if ENABLED(FTDI_LOCK_SCREEN) |
|
|
.colors(ui_toggle) |
|
|
.colors(ui_toggle) |
|
|
.tag(4).toggle2(BTN_POS(3,4), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), LockScreen::is_enabled()) |
|
|
.tag(4).toggle2(BTN_POS(3,4), BTN_SIZE(w,1), GET_TEXT_F(MSG_NO), GET_TEXT_F(MSG_YES), LockScreen::is_enabled()) |
|
|
#endif |
|
|
#endif |
|
@ -126,7 +120,7 @@ void InterfaceSettingsScreen::onRedraw(draw_mode_t what) { |
|
|
bool InterfaceSettingsScreen::onTouchEnd(uint8_t tag) { |
|
|
bool InterfaceSettingsScreen::onTouchEnd(uint8_t tag) { |
|
|
switch (tag) { |
|
|
switch (tag) { |
|
|
case 1: GOTO_PREVIOUS(); return true; |
|
|
case 1: GOTO_PREVIOUS(); return true; |
|
|
#ifdef FTDI_LOCK_SCREEN |
|
|
#if ENABLED(FTDI_LOCK_SCREEN) |
|
|
case 4: |
|
|
case 4: |
|
|
if (!LockScreen::is_enabled()) |
|
|
if (!LockScreen::is_enabled()) |
|
|
LockScreen::enable(); |
|
|
LockScreen::enable(); |
|
@ -185,8 +179,7 @@ void InterfaceSettingsScreen::onIdle() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void InterfaceSettingsScreen::failSafeSettings() { |
|
|
void InterfaceSettingsScreen::failSafeSettings() { |
|
|
// Reset settings that may make the printer interface
|
|
|
// Reset settings that may make the printer interface unusable.
|
|
|
// unusable.
|
|
|
|
|
|
CLCD::mem_write_32(CLCD::REG::ROTATE, 0); |
|
|
CLCD::mem_write_32(CLCD::REG::ROTATE, 0); |
|
|
CLCD::default_touch_transform(); |
|
|
CLCD::default_touch_transform(); |
|
|
CLCD::default_display_orientation(); |
|
|
CLCD::default_display_orientation(); |
|
@ -197,9 +190,7 @@ void InterfaceSettingsScreen::failSafeSettings() { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void InterfaceSettingsScreen::defaultSettings() { |
|
|
void InterfaceSettingsScreen::defaultSettings() { |
|
|
#ifdef FTDI_LOCK_SCREEN |
|
|
TERN_(FTDI_LOCK_SCREEN, LockScreen::passcode = 0); |
|
|
LockScreen::passcode = 0; |
|
|
|
|
|
#endif |
|
|
|
|
|
SoundPlayer::set_volume(255); |
|
|
SoundPlayer::set_volume(255); |
|
|
CLCD::set_brightness(255); |
|
|
CLCD::set_brightness(255); |
|
|
UIData::reset_persistent_data(); |
|
|
UIData::reset_persistent_data(); |
|
@ -218,11 +209,7 @@ void InterfaceSettingsScreen::saveSettings(char *buff) { |
|
|
|
|
|
|
|
|
persistent_data_t eeprom; |
|
|
persistent_data_t eeprom; |
|
|
|
|
|
|
|
|
#ifdef FTDI_LOCK_SCREEN |
|
|
eeprom.passcode = TERN0(FTDI_LOCK_SCREEN, LockScreen::passcode); |
|
|
eeprom.passcode = LockScreen::passcode; |
|
|
|
|
|
#else |
|
|
|
|
|
eeprom.passcode = 0; |
|
|
|
|
|
#endif |
|
|
|
|
|
eeprom.sound_volume = SoundPlayer::get_volume(); |
|
|
eeprom.sound_volume = SoundPlayer::get_volume(); |
|
|
eeprom.display_brightness = CLCD::get_brightness(); |
|
|
eeprom.display_brightness = CLCD::get_brightness(); |
|
|
eeprom.bit_flags = UIData::get_persistent_data(); |
|
|
eeprom.bit_flags = UIData::get_persistent_data(); |
|
@ -251,7 +238,7 @@ void InterfaceSettingsScreen::loadSettings(const char *buff) { |
|
|
|
|
|
|
|
|
SERIAL_ECHOLNPGM("Loading setting from EEPROM"); |
|
|
SERIAL_ECHOLNPGM("Loading setting from EEPROM"); |
|
|
|
|
|
|
|
|
#ifdef FTDI_LOCK_SCREEN |
|
|
#if ENABLED(FTDI_LOCK_SCREEN) |
|
|
LockScreen::passcode = eeprom.passcode; |
|
|
LockScreen::passcode = eeprom.passcode; |
|
|
#endif |
|
|
#endif |
|
|
SoundPlayer::set_volume(eeprom.sound_volume); |
|
|
SoundPlayer::set_volume(eeprom.sound_volume); |
|
@ -282,10 +269,7 @@ void InterfaceSettingsScreen::loadSettings(const char *buff) { |
|
|
if (success) |
|
|
if (success) |
|
|
success = persistentStore.write_data(0, data, ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE) == PERSISTENT_STORE_SUCCESS; |
|
|
success = persistentStore.write_data(0, data, ARCHIM2_SPI_FLASH_EEPROM_BACKUP_SIZE) == PERSISTENT_STORE_SUCCESS; |
|
|
|
|
|
|
|
|
if (success) |
|
|
StatusScreen::setStatusMessage(success ? GET_TEXT_F(MSG_EEPROM_RESTORED) : GET_TEXT_F(MSG_EEPROM_RESET)); |
|
|
StatusScreen::setStatusMessage(GET_TEXT_F(MSG_EEPROM_RESTORED)); |
|
|
|
|
|
else |
|
|
|
|
|
StatusScreen::setStatusMessage(GET_TEXT_F(MSG_EEPROM_RESET)); |
|
|
|
|
|
|
|
|
|
|
|
return success; |
|
|
return success; |
|
|
} |
|
|
} |
|
|