1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 07:17:59 +00:00

🎨 Updated string macros

This commit is contained in:
Scott Lahteine 2021-09-25 02:27:07 -05:00
parent e1ac3ede0d
commit a7fdaabd54
51 changed files with 237 additions and 234 deletions

View File

@ -78,7 +78,7 @@ typedef const char Language_Str[];
#define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG #define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG
#define MAX_LANG_CHARSIZE LANG_CHARSIZE #define MAX_LANG_CHARSIZE LANG_CHARSIZE
#endif #endif
#define GET_TEXT_F(MSG) (const __FlashStringHelper*)GET_TEXT(MSG) #define GET_TEXT_F(MSG) FPSTR(GET_TEXT(MSG))
#define GET_LANGUAGE_NAME(INDEX) GET_LANG(LCD_LANGUAGE_##INDEX)::LANGUAGE #define GET_LANGUAGE_NAME(INDEX) GET_LANG(LCD_LANGUAGE_##INDEX)::LANGUAGE
#define LANG_CHARSIZE GET_TEXT(CHARSIZE) #define LANG_CHARSIZE GET_TEXT(CHARSIZE)

View File

@ -27,7 +27,11 @@
#include "../inc/MarlinConfigPre.h" #include "../inc/MarlinConfigPre.h"
class __FlashStringHelper; class __FlashStringHelper;
typedef const __FlashStringHelper *progmem_str; typedef const __FlashStringHelper* FSTR_P;
#ifndef FPSTR
#define FPSTR(S) (reinterpret_cast<FSTR_P>(S))
#endif
#define FTOP(S) (reinterpret_cast<const char*>(S))
// //
// Conditional type assignment magic. For example... // Conditional type assignment magic. For example...

View File

@ -21,10 +21,7 @@
*/ */
#pragma once #pragma once
#include <stddef.h> #include "../../../inc/MarlinConfig.h"
#include <stdint.h>
#include "../../../HAL/shared/Marduino.h"
#ifndef DWIN_WIDTH #ifndef DWIN_WIDTH
#define DWIN_WIDTH 272 #define DWIN_WIDTH 272
@ -74,7 +71,7 @@ inline void DWIN_Text(size_t &i, const char * const string, uint16_t rlimit=0xFF
i += len; i += len;
} }
inline void DWIN_Text(size_t &i, const __FlashStringHelper * string, uint16_t rlimit=0xFFFF) { inline void DWIN_Text(size_t &i, FSTR_P string, uint16_t rlimit=0xFFFF) {
if (!string) return; if (!string) return;
const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, _MIN(rlimit, strlen_P((PGM_P)string))); // cast to PGM_P (const char*) measure with strlen_P. const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, _MIN(rlimit, strlen_P((PGM_P)string))); // cast to PGM_P (const char*) measure with strlen_P.
if (len == 0) return; if (len == 0) return;
@ -175,9 +172,9 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
// rlimit: For draw less chars than string length use rlimit // rlimit: For draw less chars than string length use rlimit
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF); void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF);
inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) { inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P title) {
// Note that this won't work on AVR, only 32-bit systems! // Note that this won't work on AVR, only 32-bit systems!
DWIN_Draw_String(bShow, size, color, bColor, x, y, reinterpret_cast<const char*>(title)); DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(title));
} }
// Draw a positive integer // Draw a positive integer

View File

@ -363,7 +363,7 @@ void Draw_Title(const char * const title) {
DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title); DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
} }
void Draw_Title(const __FlashStringHelper * title) { void Draw_Title(FSTR_P title) {
DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title); DWIN_Draw_String(false, DWIN_FONT_HEAD, Color_White, Color_Bg_Blue, 14, 4, (char*)title);
} }
@ -439,7 +439,7 @@ void Draw_Menu_Line(const uint8_t line, const uint8_t icon=0, const char * const
DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34); DWIN_Draw_Line(Line_Color, 16, MBASE(line) + 33, 256, MBASE(line) + 34);
} }
void Draw_Menu_LineF(const uint8_t line, const uint8_t icon=0, const __FlashStringHelper *label=nullptr, bool more=false) { void Draw_Menu_LineF(const uint8_t line, const uint8_t icon=0, FSTR_P label=nullptr, bool more=false) {
Draw_Menu_Line(line, icon, (char*)label, more); Draw_Menu_Line(line, icon, (char*)label, more);
} }
@ -589,7 +589,7 @@ void say_steps_per_mm_en(const uint8_t row) {
void DWIN_Draw_Label(const uint8_t row, char *string) { void DWIN_Draw_Label(const uint8_t row, char *string) {
DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(row), string); DWIN_Draw_String(true, font8x16, Color_White, Color_Bg_Black, LBLX, MBASE(row), string);
} }
void DWIN_Draw_Label(const uint8_t row, const __FlashStringHelper *title) { void DWIN_Draw_Label(const uint8_t row, FSTR_P title) {
DWIN_Draw_Label(row, (char*)title); DWIN_Draw_Label(row, (char*)title);
} }

View File

@ -3078,31 +3078,31 @@ void Draw_Prepare_Menu() {
CurrentMenu = PrepareMenu; CurrentMenu = PrepareMenu;
SetMenuTitle({133, 1, 28, 13}, {179, 0, 48, 14}, GET_TEXT_F(MSG_PREPARE)); SetMenuTitle({133, 1, 28, 13}, {179, 0, 48, 14}, GET_TEXT_F(MSG_PREPARE));
DWINUI::MenuItemsPrepare(13); DWINUI::MenuItemsPrepare(13);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
ADDMENUITEM(ICON_FilMan, GET_TEXT(MSG_FILAMENT_MAN), onDrawSubMenu, Draw_FilamentMan_Menu); ADDMENUITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENT_MAN), onDrawSubMenu, Draw_FilamentMan_Menu);
#endif #endif
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_MOVE_AXIS), onDrawMoveSubMenu, Draw_Move_Menu); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_MOVE_AXIS), onDrawMoveSubMenu, Draw_Move_Menu);
ADDMENUITEM(ICON_LevBed, GET_TEXT(MSG_BED_LEVELING), onDrawSubMenu, Draw_LevBedCorners_Menu); ADDMENUITEM(ICON_LevBed, GET_TEXT_F(MSG_BED_LEVELING), onDrawSubMenu, Draw_LevBedCorners_Menu);
ADDMENUITEM(ICON_CloseMotor, GET_TEXT(MSG_DISABLE_STEPPERS), onDrawDisableMotors, DisableMotors); ADDMENUITEM(ICON_CloseMotor, GET_TEXT_F(MSG_DISABLE_STEPPERS), onDrawDisableMotors, DisableMotors);
ADDMENUITEM(ICON_Homing, GET_TEXT(MSG_AUTO_HOME), onDrawAutoHome, AutoHome); ADDMENUITEM(ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME), onDrawAutoHome, AutoHome);
#if ENABLED(MESH_BED_LEVELING) #if ENABLED(MESH_BED_LEVELING)
ADDMENUITEM(ICON_ManualMesh, GET_TEXT(MSG_MANUAL_MESH), onDrawSubMenu, Draw_ManualMesh_Menu); ADDMENUITEM(ICON_ManualMesh, GET_TEXT_F(MSG_MANUAL_MESH), onDrawSubMenu, Draw_ManualMesh_Menu);
#endif #endif
#if HAS_ZOFFSET_ITEM #if HAS_ZOFFSET_ITEM
#if EITHER(HAS_BED_PROBE, BABYSTEPPING) #if EITHER(HAS_BED_PROBE, BABYSTEPPING)
ADDMENUITEM(ICON_SetZOffset, GET_TEXT(MSG_PROBE_WIZARD), onDrawSubMenu, Draw_ZOffsetWiz_Menu); ADDMENUITEM(ICON_SetZOffset, GET_TEXT_F(MSG_PROBE_WIZARD), onDrawSubMenu, Draw_ZOffsetWiz_Menu);
#else #else
ADDMENUITEM(ICON_SetHome, GET_TEXT(MSG_SET_HOME_OFFSETS), onDrawHomeOffset, SetHome); ADDMENUITEM(ICON_SetHome, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawHomeOffset, SetHome);
#endif #endif
#endif #endif
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM(ICON_PLAPreheat, GET_TEXT(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0); ADDMENUITEM(ICON_PLAPreheat, GET_TEXT_F(MSG_PREHEAT_1), onDrawPreheat1, SetPreheat0);
ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1); ADDMENUITEM(ICON_ABSPreheat, PSTR("Preheat " PREHEAT_2_LABEL), onDrawPreheat2, SetPreheat1);
ADDMENUITEM(ICON_CustomPreheat, GET_TEXT(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2); ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2);
#endif #endif
#if HAS_PREHEAT #if HAS_PREHEAT
ADDMENUITEM(ICON_Cool, GET_TEXT(MSG_COOLDOWN), onDrawCooldown, SetCoolDown); ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown);
#endif #endif
ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage); ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage);
} }
@ -3117,12 +3117,12 @@ void Draw_LevBedCorners_Menu() {
CurrentMenu = LevBedMenu; CurrentMenu = LevBedMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG
DWINUI::MenuItemsPrepare(6); DWINUI::MenuItemsPrepare(6);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_FL), onDrawMenuItem, LevBedFL); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FL), onDrawMenuItem, LevBedFL);
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_FR), onDrawMenuItem, LevBedFR); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FR), onDrawMenuItem, LevBedFR);
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_BR), onDrawMenuItem, LevBedBR); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_BR), onDrawMenuItem, LevBedBR);
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_BL), onDrawMenuItem, LevBedBL); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_BL), onDrawMenuItem, LevBedBL);
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_C ), onDrawMenuItem, LevBedC ); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_C ), onDrawMenuItem, LevBedC );
} }
CurrentMenu->draw(); CurrentMenu->draw();
} }
@ -3134,17 +3134,17 @@ void Draw_Control_Menu() {
CurrentMenu = ControlMenu; CurrentMenu = ControlMenu;
SetMenuTitle({103, 1, 28, 14}, {128, 2, 49, 11}, GET_TEXT_F(MSG_CONTROL)); SetMenuTitle({103, 1, 28, 14}, {128, 2, 49, 11}, GET_TEXT_F(MSG_CONTROL));
DWINUI::MenuItemsPrepare(9); DWINUI::MenuItemsPrepare(9);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
ADDMENUITEM(ICON_Temperature, GET_TEXT(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu); ADDMENUITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu);
ADDMENUITEM(ICON_Motion, GET_TEXT(MSG_MOTION), onDrawMotionSubMenu, Draw_Motion_Menu); ADDMENUITEM(ICON_Motion, GET_TEXT_F(MSG_MOTION), onDrawMotionSubMenu, Draw_Motion_Menu);
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom); ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom);
ADDMENUITEM(ICON_ReadEEPROM, GET_TEXT(MSG_LOAD_EEPROM), onDrawReadEeprom, ReadEeprom); ADDMENUITEM(ICON_ReadEEPROM, GET_TEXT_F(MSG_LOAD_EEPROM), onDrawReadEeprom, ReadEeprom);
ADDMENUITEM(ICON_ResumeEEPROM, GET_TEXT(MSG_RESTORE_DEFAULTS), onDrawResetEeprom, ResetEeprom); ADDMENUITEM(ICON_ResumeEEPROM, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawResetEeprom, ResetEeprom);
#endif #endif
ADDMENUITEM(ICON_Reboot, GET_TEXT(MSG_RESET_PRINTER), onDrawMenuItem, RebootPrinter); ADDMENUITEM(ICON_Reboot, GET_TEXT_F(MSG_RESET_PRINTER), onDrawMenuItem, RebootPrinter);
ADDMENUITEM(ICON_AdvSet, GET_TEXT(MSG_ADVANCED_SETTINGS), onDrawSubMenu, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_AdvSet, GET_TEXT_F(MSG_ADVANCED_SETTINGS), onDrawSubMenu, Draw_AdvancedSettings_Menu);
ADDMENUITEM(ICON_Info, GET_TEXT(MSG_INFO_SCREEN), onDrawInfoSubMenu, Goto_InfoMenu); ADDMENUITEM(ICON_Info, GET_TEXT_F(MSG_INFO_SCREEN), onDrawInfoSubMenu, Goto_InfoMenu);
} }
CurrentMenu->draw(); CurrentMenu->draw();
} }
@ -3156,12 +3156,12 @@ void Draw_AdvancedSettings_Menu() {
CurrentMenu = AdvancedSettings; CurrentMenu = AdvancedSettings;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG
DWINUI::MenuItemsPrepare(11); DWINUI::MenuItemsPrepare(11);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
#if HAS_HOME_OFFSET #if HAS_HOME_OFFSET
ADDMENUITEM(ICON_HomeOffset, GET_TEXT(MSG_SET_HOME_OFFSETS), onDrawSubMenu, Draw_HomeOffset_Menu); ADDMENUITEM(ICON_HomeOffset, GET_TEXT_F(MSG_SET_HOME_OFFSETS), onDrawSubMenu, Draw_HomeOffset_Menu);
#endif #endif
#if HAS_BED_PROBE #if HAS_BED_PROBE
ADDMENUITEM(ICON_ProbeSet, GET_TEXT(MSG_ZPROBE_SETTINGS), onDrawSubMenu, Draw_ProbeSet_Menu); ADDMENUITEM(ICON_ProbeSet, GET_TEXT_F(MSG_ZPROBE_SETTINGS), onDrawSubMenu, Draw_ProbeSet_Menu);
#endif #endif
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM(ICON_PIDNozzle, F("Hotend PID Settings"), onDrawSubMenu, Draw_HotendPID_Menu); ADDMENUITEM(ICON_PIDNozzle, F("Hotend PID Settings"), onDrawSubMenu, Draw_HotendPID_Menu);
@ -3170,13 +3170,13 @@ void Draw_AdvancedSettings_Menu() {
ADDMENUITEM(ICON_PIDbed, F("Bed PID Settings"), onDrawSubMenu, Draw_BedPID_Menu); ADDMENUITEM(ICON_PIDbed, F("Bed PID Settings"), onDrawSubMenu, Draw_BedPID_Menu);
#endif #endif
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
ADDMENUITEM(ICON_FilSet, GET_TEXT(MSG_FILAMENT_SET), onDrawSubMenu, Draw_FilSet_Menu); ADDMENUITEM(ICON_FilSet, GET_TEXT_F(MSG_FILAMENT_SET), onDrawSubMenu, Draw_FilSet_Menu);
#endif #endif
#if ENABLED(POWER_LOSS_RECOVERY) #if ENABLED(POWER_LOSS_RECOVERY)
ADDMENUITEM(ICON_Pwrlossr, F("Power-loss recovery"), onDrawPwrLossR, SetPwrLossr); ADDMENUITEM(ICON_Pwrlossr, GET_TEXT_F(MSG_OUTAGE_RECOVERY), onDrawPwrLossR, SetPwrLossr);
#endif #endif
#if HAS_LCD_BRIGHTNESS #if HAS_LCD_BRIGHTNESS
ADDMENUITEM_P(ICON_Brightness, F("LCD Brightness"), onDrawPInt8Menu, SetBrightness, &ui.brightness); ADDMENUITEM_P(ICON_Brightness, GET_TEXT_F(MSG_BRIGHTNESS), onDrawPInt8Menu, SetBrightness, &ui.brightness);
#endif #endif
ADDMENUITEM(ICON_Scolor, F("Select Colors"), onDrawSubMenu, Draw_SelectColors_Menu); ADDMENUITEM(ICON_Scolor, F("Select Colors"), onDrawSubMenu, Draw_SelectColors_Menu);
#if ENABLED(SOUND_MENU_ITEM) #if ENABLED(SOUND_MENU_ITEM)
@ -3194,12 +3194,12 @@ void Draw_Move_Menu() {
CurrentMenu = MoveMenu; CurrentMenu = MoveMenu;
SetMenuTitle({192, 1, 42, 14}, {231, 2, 35, 11}, GET_TEXT_F(MSG_MOVE_AXIS)); SetMenuTitle({192, 1, 42, 14}, {231, 2, 35, 11}, GET_TEXT_F(MSG_MOVE_AXIS));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM_P(ICON_MoveX, GET_TEXT(MSG_MOVE_X), onDrawMoveX, SetMoveX, &current_position.x); ADDMENUITEM_P(ICON_MoveX, GET_TEXT_F(MSG_MOVE_X), onDrawMoveX, SetMoveX, &current_position.x);
ADDMENUITEM_P(ICON_MoveY, GET_TEXT(MSG_MOVE_Y), onDrawMoveY, SetMoveY, &current_position.y); ADDMENUITEM_P(ICON_MoveY, GET_TEXT_F(MSG_MOVE_Y), onDrawMoveY, SetMoveY, &current_position.y);
ADDMENUITEM_P(ICON_MoveZ, GET_TEXT(MSG_MOVE_Z), onDrawMoveZ, SetMoveZ, &current_position.z); ADDMENUITEM_P(ICON_MoveZ, GET_TEXT_F(MSG_MOVE_Z), onDrawMoveZ, SetMoveZ, &current_position.z);
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM_P(ICON_Extruder, GET_TEXT(MSG_MOVE_E), onDrawMoveE, SetMoveE, &current_position.e); ADDMENUITEM_P(ICON_Extruder, GET_TEXT_F(MSG_MOVE_E), onDrawMoveE, SetMoveE, &current_position.e);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3214,10 +3214,10 @@ void Draw_Move_Menu() {
CurrentMenu = HomeOffMenu; CurrentMenu = HomeOffMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG
DWINUI::MenuItemsPrepare(4); DWINUI::MenuItemsPrepare(4);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
ADDMENUITEM_P(ICON_HomeOffsetX, GET_TEXT(MSG_HOME_OFFSET_X), onDrawPFloatMenu, SetHomeOffsetX, &home_offset[X_AXIS]); ADDMENUITEM_P(ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X), onDrawPFloatMenu, SetHomeOffsetX, &home_offset[X_AXIS]);
ADDMENUITEM_P(ICON_HomeOffsetY, GET_TEXT(MSG_HOME_OFFSET_Y), onDrawPFloatMenu, SetHomeOffsetY, &home_offset[Y_AXIS]); ADDMENUITEM_P(ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y), onDrawPFloatMenu, SetHomeOffsetY, &home_offset[Y_AXIS]);
ADDMENUITEM_P(ICON_HomeOffsetZ, GET_TEXT(MSG_HOME_OFFSET_Z), onDrawPFloatMenu, SetHomeOffsetZ, &home_offset[Z_AXIS]); ADDMENUITEM_P(ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z), onDrawPFloatMenu, SetHomeOffsetZ, &home_offset[Z_AXIS]);
} }
CurrentMenu->draw(); CurrentMenu->draw();
} }
@ -3231,11 +3231,11 @@ void Draw_Move_Menu() {
CurrentMenu = ProbeSetMenu; CurrentMenu = ProbeSetMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
ADDMENUITEM_P(ICON_ProbeOffsetX, GET_TEXT(MSG_ZPROBE_XOFFSET), onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x); ADDMENUITEM_P(ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET), onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x);
ADDMENUITEM_P(ICON_ProbeOffsetY, GET_TEXT(MSG_ZPROBE_YOFFSET), onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y); ADDMENUITEM_P(ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET), onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y);
ADDMENUITEM_P(ICON_ProbeOffsetZ, GET_TEXT(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z); ADDMENUITEM_P(ICON_ProbeOffsetZ, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z);
ADDMENUITEM(ICON_ProbeTest, GET_TEXT(MSG_M48_TEST), onDrawMenuItem, ProbeTest); ADDMENUITEM(ICON_ProbeTest, GET_TEXT_F(MSG_M48_TEST), onDrawMenuItem, ProbeTest);
} }
CurrentMenu->draw(); CurrentMenu->draw();
} }
@ -3249,9 +3249,9 @@ void Draw_Move_Menu() {
CurrentMenu = FilSetMenu; CurrentMenu = FilSetMenu;
CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_FILAMENT_SET)); CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_FILAMENT_SET));
DWINUI::MenuItemsPrepare(6); DWINUI::MenuItemsPrepare(6);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu);
#if HAS_FILAMENT_SENSOR #if HAS_FILAMENT_SENSOR
ADDMENUITEM(ICON_Runout, GET_TEXT(MSG_RUNOUT_ENABLE), onDrawRunoutEnable, SetRunoutEnable); ADDMENUITEM(ICON_Runout, GET_TEXT_F(MSG_RUNOUT_ENABLE), onDrawRunoutEnable, SetRunoutEnable);
#endif #endif
#if HAS_FILAMENT_RUNOUT_DISTANCE #if HAS_FILAMENT_RUNOUT_DISTANCE
ADDMENUITEM_P(ICON_Runout, F("Runout Distance"), onDrawPFloatMenu, SetRunoutDistance, &runout.runout_distance()); ADDMENUITEM_P(ICON_Runout, F("Runout Distance"), onDrawPFloatMenu, SetRunoutDistance, &runout.runout_distance());
@ -3260,8 +3260,8 @@ void Draw_Move_Menu() {
ADDMENUITEM_P(ICON_ExtrudeMinT, F("Extrude Min Temp."), onDrawPIntMenu, SetExtMinT, &HMI_data.ExtMinT); ADDMENUITEM_P(ICON_ExtrudeMinT, F("Extrude Min Temp."), onDrawPIntMenu, SetExtMinT, &HMI_data.ExtMinT);
#endif #endif
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
ADDMENUITEM_P(ICON_FilLoad, GET_TEXT(MSG_FILAMENT_LOAD), onDrawPFloatMenu, SetFilLoad, &fc_settings[0].load_length); ADDMENUITEM_P(ICON_FilLoad, GET_TEXT_F(MSG_FILAMENT_LOAD), onDrawPFloatMenu, SetFilLoad, &fc_settings[0].load_length);
ADDMENUITEM_P(ICON_FilUnload, GET_TEXT(MSG_FILAMENT_UNLOAD), onDrawPFloatMenu, SetFilUnload, &fc_settings[0].unload_length); ADDMENUITEM_P(ICON_FilUnload, GET_TEXT_F(MSG_FILAMENT_UNLOAD), onDrawPFloatMenu, SetFilUnload, &fc_settings[0].unload_length);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3275,8 +3275,8 @@ void Draw_SelectColors_Menu() {
CurrentMenu = SelectColorMenu; CurrentMenu = SelectColorMenu;
SetMenuTitle({0}, {0}, F("Select Colors")); // TODO: Chinese, English "Select Color" JPG SetMenuTitle({0}, {0}, F("Select Colors")); // TODO: Chinese, English "Select Color" JPG
DWINUI::MenuItemsPrepare(20); DWINUI::MenuItemsPrepare(20);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
ADDMENUITEM(ICON_StockConfiguration, GET_TEXT(MSG_RESTORE_DEFAULTS), onDrawMenuItem, RestoreDefaultsColors); ADDMENUITEM(ICON_StockConfiguration, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawMenuItem, RestoreDefaultsColors);
ADDMENUITEM_P(0, "Screen Background", onDrawSelColorItem, SelColor, &HMI_data.Background_Color); ADDMENUITEM_P(0, "Screen Background", onDrawSelColorItem, SelColor, &HMI_data.Background_Color);
ADDMENUITEM_P(0, "Cursor", onDrawSelColorItem, SelColor, &HMI_data.Cursor_color); ADDMENUITEM_P(0, "Cursor", onDrawSelColorItem, SelColor, &HMI_data.Cursor_color);
ADDMENUITEM_P(0, "Title Background", onDrawSelColorItem, SelColor, &HMI_data.TitleBg_color); ADDMENUITEM_P(0, "Title Background", onDrawSelColorItem, SelColor, &HMI_data.TitleBg_color);
@ -3306,8 +3306,8 @@ void Draw_GetColor_Menu() {
CurrentMenu = GetColorMenu; CurrentMenu = GetColorMenu;
SetMenuTitle({0}, {0}, F("Get Color")); // TODO: Chinese, English "Get Color" JPG SetMenuTitle({0}, {0}, F("Get Color")); // TODO: Chinese, English "Get Color" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor);
ADDMENUITEM(ICON_Cancel, GET_TEXT(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu); ADDMENUITEM(ICON_Cancel, GET_TEXT_F(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu);
ADDMENUITEM(0, "Red", onDrawGetColorItem, SetRGBColor); ADDMENUITEM(0, "Red", onDrawGetColorItem, SetRGBColor);
ADDMENUITEM(1, "Green", onDrawGetColorItem, SetRGBColor); ADDMENUITEM(1, "Green", onDrawGetColorItem, SetRGBColor);
ADDMENUITEM(2, "Blue", onDrawGetColorItem, SetRGBColor); ADDMENUITEM(2, "Blue", onDrawGetColorItem, SetRGBColor);
@ -3323,23 +3323,23 @@ void Draw_Tune_Menu() {
CurrentMenu = TuneMenu; CurrentMenu = TuneMenu;
SetMenuTitle({73, 2, 28, 12}, {94, 2, 33, 11}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG SetMenuTitle({73, 2, 28, 12}, {94, 2, 33, 11}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG
DWINUI::MenuItemsPrepare(10); DWINUI::MenuItemsPrepare(10);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess);
ADDMENUITEM_P(ICON_Speed, GET_TEXT(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage); ADDMENUITEM_P(ICON_Speed, GET_TEXT_F(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage);
#if HAS_HOTEND #if HAS_HOTEND
HotendTargetItem = ADDMENUITEM_P(ICON_HotendTemp, GET_TEXT(MSG_UBL_SET_TEMP_HOTEND), onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); HotendTargetItem = ADDMENUITEM_P(ICON_HotendTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND), onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
BedTargetItem = ADDMENUITEM_P(ICON_BedTemp, GET_TEXT(MSG_UBL_SET_TEMP_BED), onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); BedTargetItem = ADDMENUITEM_P(ICON_BedTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_BED), onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target);
#endif #endif
#if HAS_FAN #if HAS_FAN
FanSpeedItem = ADDMENUITEM_P(ICON_FanSpeed, GET_TEXT(MSG_FAN_SPEED), onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); FanSpeedItem = ADDMENUITEM_P(ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED), onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]);
#endif #endif
#if HAS_ZOFFSET_ITEM && EITHER(HAS_BED_PROBE, BABYSTEPPING) #if HAS_ZOFFSET_ITEM && EITHER(HAS_BED_PROBE, BABYSTEPPING)
ADDMENUITEM_P(ICON_Zoffset, GET_TEXT(MSG_ZPROBE_ZOFFSET), onDrawZOffset, SetZOffset, &BABY_Z_VAR); ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawZOffset, SetZOffset, &BABY_Z_VAR);
#endif #endif
ADDMENUITEM_P(ICON_Flow, GET_TEXT(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); ADDMENUITEM_P(ICON_Flow, GET_TEXT_F(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]);
#if ENABLED(ADVANCED_PAUSE_FEATURE) #if ENABLED(ADVANCED_PAUSE_FEATURE)
ADDMENUITEM(ICON_FilMan, GET_TEXT(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament); ADDMENUITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament);
#endif #endif
ADDMENUITEM(ICON_Lock, F("Lock Screen"), onDrawMenuItem, Goto_LockScreen); ADDMENUITEM(ICON_Lock, F("Lock Screen"), onDrawMenuItem, Goto_LockScreen);
#if HAS_LCD_BRIGHTNESS #if HAS_LCD_BRIGHTNESS
@ -3356,14 +3356,14 @@ void Draw_Motion_Menu() {
CurrentMenu = MotionMenu; CurrentMenu = MotionMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG
DWINUI::MenuItemsPrepare(6); DWINUI::MenuItemsPrepare(6);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
ADDMENUITEM(ICON_MaxSpeed, GET_TEXT(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu); ADDMENUITEM(ICON_MaxSpeed, GET_TEXT_F(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu);
ADDMENUITEM(ICON_MaxAccelerated, GET_TEXT(MSG_ACCELERATION), onDrawAcc, Draw_MaxAccel_Menu); ADDMENUITEM(ICON_MaxAccelerated, GET_TEXT_F(MSG_ACCELERATION), onDrawAcc, Draw_MaxAccel_Menu);
#if HAS_CLASSIC_JERK #if HAS_CLASSIC_JERK
ADDMENUITEM(ICON_MaxJerk, GET_TEXT(MSG_JERK), onDrawJerk, Draw_MaxJerk_Menu); ADDMENUITEM(ICON_MaxJerk, GET_TEXT_F(MSG_JERK), onDrawJerk, Draw_MaxJerk_Menu);
#endif #endif
ADDMENUITEM(ICON_Step, GET_TEXT(MSG_STEPS_PER_MM), onDrawSteps, Draw_Steps_Menu); ADDMENUITEM(ICON_Step, GET_TEXT_F(MSG_STEPS_PER_MM), onDrawSteps, Draw_Steps_Menu);
ADDMENUITEM_P(ICON_Flow, GET_TEXT(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]); ADDMENUITEM_P(ICON_Flow, GET_TEXT_F(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]);
} }
CurrentMenu->draw(); CurrentMenu->draw();
} }
@ -3376,12 +3376,12 @@ void Draw_Motion_Menu() {
CurrentMenu = FilamentMenu; CurrentMenu = FilamentMenu;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM(ICON_Park, GET_TEXT(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead); ADDMENUITEM(ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead);
ADDMENUITEM(ICON_FilMan, GET_TEXT(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament); ADDMENUITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament);
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES) #if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
ADDMENUITEM(ICON_FilUnload, GET_TEXT(MSG_FILAMENTUNLOAD), onDrawMenuItem, UnloadFilament); ADDMENUITEM(ICON_FilUnload, GET_TEXT_F(MSG_FILAMENTUNLOAD), onDrawMenuItem, UnloadFilament);
ADDMENUITEM(ICON_FilLoad, GET_TEXT(MSG_FILAMENTLOAD), onDrawMenuItem, LoadFilament); ADDMENUITEM(ICON_FilLoad, GET_TEXT_F(MSG_FILAMENTLOAD), onDrawMenuItem, LoadFilament);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3396,11 +3396,11 @@ void Draw_Motion_Menu() {
CurrentMenu = ManualMesh; CurrentMenu = ManualMesh;
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
ADDMENUITEM(ICON_ManualMesh, GET_TEXT(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart); ADDMENUITEM(ICON_ManualMesh, GET_TEXT_F(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart);
MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, &current_position.z); MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, &current_position.z);
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_UBL_CONTINUE_MESH), onDrawMenuItem, ManualMeshContinue); ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_UBL_CONTINUE_MESH), onDrawMenuItem, ManualMeshContinue);
ADDMENUITEM(ICON_MeshSave, GET_TEXT(MSG_UBL_SAVE_MESH), onDrawMenuItem, ManualMeshSave); ADDMENUITEM(ICON_MeshSave, GET_TEXT_F(MSG_UBL_SAVE_MESH), onDrawMenuItem, ManualMeshSave);
} }
CurrentMenu->draw(); CurrentMenu->draw();
} }
@ -3414,18 +3414,18 @@ void Draw_Motion_Menu() {
CurrentMenu = PreheatMenu; CurrentMenu = PreheatMenu;
SetMenuTitle(cn, en, text); SetMenuTitle(cn, en, text);
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Temperature_Menu);
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM_P(ICON_SetEndTemp, GET_TEXT(MSG_UBL_SET_TEMP_HOTEND), onDrawSetPreheatHotend, SetPreheatEndTemp, &ui.material_preset[HMI_value.Preheat].hotend_temp); ADDMENUITEM_P(ICON_SetEndTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND), onDrawSetPreheatHotend, SetPreheatEndTemp, &ui.material_preset[HMI_value.Preheat].hotend_temp);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
ADDMENUITEM_P(ICON_SetBedTemp, GET_TEXT(MSG_UBL_SET_TEMP_BED), onDrawSetPreheatBed, SetPreheatBedTemp, &ui.material_preset[HMI_value.Preheat].bed_temp); ADDMENUITEM_P(ICON_SetBedTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_BED), onDrawSetPreheatBed, SetPreheatBedTemp, &ui.material_preset[HMI_value.Preheat].bed_temp);
#endif #endif
#if HAS_FAN #if HAS_FAN
ADDMENUITEM_P(ICON_FanSpeed, GET_TEXT(MSG_FAN_SPEED), onDrawSetPreheatFan, SetPreheatFanSpeed, &ui.material_preset[HMI_value.Preheat].fan_speed); ADDMENUITEM_P(ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED), onDrawSetPreheatFan, SetPreheatFanSpeed, &ui.material_preset[HMI_value.Preheat].fan_speed);
#endif #endif
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom); ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3461,15 +3461,15 @@ void Draw_Temperature_Menu() {
CurrentMenu = TemperatureMenu; CurrentMenu = TemperatureMenu;
SetMenuTitle({236, 2, 28, 12}, {56, 15, 85, 14}, GET_TEXT_F(MSG_TEMPERATURE)); SetMenuTitle({236, 2, 28, 12}, {56, 15, 85, 14}, GET_TEXT_F(MSG_TEMPERATURE));
DWINUI::MenuItemsPrepare(7); DWINUI::MenuItemsPrepare(7);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
#if HAS_HOTEND #if HAS_HOTEND
HotendTargetItem = ADDMENUITEM_P(ICON_SetEndTemp, GET_TEXT(MSG_UBL_SET_TEMP_HOTEND), onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target); HotendTargetItem = ADDMENUITEM_P(ICON_SetEndTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND), onDrawHotendTemp, SetHotendTemp, &thermalManager.temp_hotend[0].target);
#endif #endif
#if HAS_HEATED_BED #if HAS_HEATED_BED
BedTargetItem = ADDMENUITEM_P(ICON_SetBedTemp, GET_TEXT(MSG_UBL_SET_TEMP_BED), onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target); BedTargetItem = ADDMENUITEM_P(ICON_SetBedTemp, GET_TEXT_F(MSG_UBL_SET_TEMP_BED), onDrawBedTemp, SetBedTemp, &thermalManager.temp_bed.target);
#endif #endif
#if HAS_FAN #if HAS_FAN
FanSpeedItem = ADDMENUITEM_P(ICON_FanSpeed, GET_TEXT(MSG_FAN_SPEED), onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]); FanSpeedItem = ADDMENUITEM_P(ICON_FanSpeed, GET_TEXT_F(MSG_FAN_SPEED), onDrawFanSpeed, SetFanSpeed, &thermalManager.fan_speed[0]);
#endif #endif
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM(ICON_SetPLAPreheat, F(PREHEAT_1_LABEL " Preheat Settings"), onDrawPLAPreheatSubMenu, Draw_Preheat1_Menu); ADDMENUITEM(ICON_SetPLAPreheat, F(PREHEAT_1_LABEL " Preheat Settings"), onDrawPLAPreheatSubMenu, Draw_Preheat1_Menu);
@ -3489,12 +3489,12 @@ void Draw_MaxSpeed_Menu() {
CurrentMenu = MaxSpeedMenu; CurrentMenu = MaxSpeedMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MAXSPEED)); SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MAXSPEED));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_MaxSpeedX, GET_TEXT(MSG_MAXSPEED_X), onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedX, GET_TEXT_F(MSG_MAXSPEED_X), onDrawMaxSpeedX, SetMaxSpeedX, &planner.settings.max_feedrate_mm_s[X_AXIS]);
ADDMENUITEM_P(ICON_MaxSpeedY, GET_TEXT(MSG_MAXSPEED_Y), onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedY, GET_TEXT_F(MSG_MAXSPEED_Y), onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]);
ADDMENUITEM_P(ICON_MaxSpeedZ, GET_TEXT(MSG_MAXSPEED_Z), onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedZ, GET_TEXT_F(MSG_MAXSPEED_Z), onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]);
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM_P(ICON_MaxSpeedE, GET_TEXT(MSG_MAXSPEED_E), onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[Z_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedE, GET_TEXT_F(MSG_MAXSPEED_E), onDrawMaxSpeedE, SetMaxSpeedE, &planner.settings.max_feedrate_mm_s[Z_AXIS]);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3507,12 +3507,12 @@ void Draw_MaxAccel_Menu() {
CurrentMenu = MaxAccelMenu; CurrentMenu = MaxAccelMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_ACCELERATION)); SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_ACCELERATION));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_MaxAccX, GET_TEXT(MSG_AMAX_A), onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]); ADDMENUITEM_P(ICON_MaxAccX, GET_TEXT_F(MSG_AMAX_A), onDrawMaxAccelX, SetMaxAccelX, &planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
ADDMENUITEM_P(ICON_MaxAccY, GET_TEXT(MSG_AMAX_B), onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]); ADDMENUITEM_P(ICON_MaxAccY, GET_TEXT_F(MSG_AMAX_B), onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
ADDMENUITEM_P(ICON_MaxAccZ, GET_TEXT(MSG_AMAX_C), onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]); ADDMENUITEM_P(ICON_MaxAccZ, GET_TEXT_F(MSG_AMAX_C), onDrawMaxAccelZ, SetMaxAccelZ, &planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM_P(ICON_MaxAccE, GET_TEXT(MSG_AMAX_E), onDrawMaxAccelE, SetMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]); ADDMENUITEM_P(ICON_MaxAccE, GET_TEXT_F(MSG_AMAX_E), onDrawMaxAccelE, SetMaxAccelE, &planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3526,12 +3526,12 @@ void Draw_MaxAccel_Menu() {
CurrentMenu = MaxJerkMenu; CurrentMenu = MaxJerkMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_JERK)); SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_JERK));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_MaxSpeedJerkX, GET_TEXT(MSG_VA_JERK), onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK), onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]);
ADDMENUITEM_P(ICON_MaxSpeedJerkY, GET_TEXT(MSG_VB_JERK), onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk[Y_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedJerkY, GET_TEXT_F(MSG_VB_JERK), onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk[Y_AXIS]);
ADDMENUITEM_P(ICON_MaxSpeedJerkZ, GET_TEXT(MSG_VC_JERK), onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk[Z_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedJerkZ, GET_TEXT_F(MSG_VC_JERK), onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk[Z_AXIS]);
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM_P(ICON_MaxSpeedJerkE, GET_TEXT(MSG_VE_JERK), onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk[E_AXIS]); ADDMENUITEM_P(ICON_MaxSpeedJerkE, GET_TEXT_F(MSG_VE_JERK), onDrawMaxJerkE, SetMaxJerkE, &planner.max_jerk[E_AXIS]);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3545,12 +3545,12 @@ void Draw_Steps_Menu() {
CurrentMenu = StepsMenu; CurrentMenu = StepsMenu;
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_STEPS_PER_MM)); SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_STEPS_PER_MM));
DWINUI::MenuItemsPrepare(5); DWINUI::MenuItemsPrepare(5);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
ADDMENUITEM_P(ICON_StepX, GET_TEXT(MSG_A_STEPS), onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]); ADDMENUITEM_P(ICON_StepX, GET_TEXT_F(MSG_A_STEPS), onDrawStepsX, SetStepsX, &planner.settings.axis_steps_per_mm[X_AXIS]);
ADDMENUITEM_P(ICON_StepY, GET_TEXT(MSG_B_STEPS), onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]); ADDMENUITEM_P(ICON_StepY, GET_TEXT_F(MSG_B_STEPS), onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]);
ADDMENUITEM_P(ICON_StepZ, GET_TEXT(MSG_C_STEPS), onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]); ADDMENUITEM_P(ICON_StepZ, GET_TEXT_F(MSG_C_STEPS), onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]);
#if HAS_HOTEND #if HAS_HOTEND
ADDMENUITEM_P(ICON_StepE, GET_TEXT(MSG_E_STEPS), onDrawStepsE, SetStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]); ADDMENUITEM_P(ICON_StepE, GET_TEXT_F(MSG_E_STEPS), onDrawStepsE, SetStepsE, &planner.settings.axis_steps_per_mm[E_AXIS]);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3564,15 +3564,15 @@ void Draw_Steps_Menu() {
CurrentMenu = HotendPIDMenu; CurrentMenu = HotendPIDMenu;
CurrentMenu->MenuTitle.SetCaption(F("Hotend PID Settings")); CurrentMenu->MenuTitle.SetCaption(F("Hotend PID Settings"));
DWINUI::MenuItemsPrepare(8); DWINUI::MenuItemsPrepare(8);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu);
ADDMENUITEM(ICON_PIDNozzle, F("Hotend PID"), onDrawMenuItem, HotendPID); ADDMENUITEM(ICON_PIDNozzle, F("Hotend PID"), onDrawMenuItem, HotendPID);
ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KP), onDrawPFloat2Menu, SetKp, &thermalManager.temp_hotend[0].pid.Kp); ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KP), onDrawPFloat2Menu, SetKp, &thermalManager.temp_hotend[0].pid.Kp);
ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KI), onDrawPIDi, SetKi, &thermalManager.temp_hotend[0].pid.Ki); ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KI), onDrawPIDi, SetKi, &thermalManager.temp_hotend[0].pid.Ki);
ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KD), onDrawPIDd, SetKd, &thermalManager.temp_hotend[0].pid.Kd); ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KD), onDrawPIDd, SetKd, &thermalManager.temp_hotend[0].pid.Kd);
ADDMENUITEM_P(ICON_Temperature, GET_TEXT(MSG_TEMPERATURE), onDrawPIntMenu, SetHotendPidT, &HMI_data.HotendPidT); ADDMENUITEM_P(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawPIntMenu, SetHotendPidT, &HMI_data.HotendPidT);
ADDMENUITEM_P(ICON_PIDcycles, GET_TEXT(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); ADDMENUITEM_P(ICON_PIDcycles, GET_TEXT_F(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles);
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT(MSG_STORE_EEPROM), onDrawMenuItem, WriteEeprom); ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawMenuItem, WriteEeprom);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3587,15 +3587,15 @@ void Draw_Steps_Menu() {
CurrentMenu = BedPIDMenu; CurrentMenu = BedPIDMenu;
CurrentMenu->MenuTitle.SetCaption(F("Bed PID Settings")); CurrentMenu->MenuTitle.SetCaption(F("Bed PID Settings"));
DWINUI::MenuItemsPrepare(8); DWINUI::MenuItemsPrepare(8);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_AdvancedSettings_Menu);
ADDMENUITEM(ICON_PIDNozzle, F("Bed PID"), onDrawMenuItem,BedPID); ADDMENUITEM(ICON_PIDNozzle, F("Bed PID"), onDrawMenuItem,BedPID);
ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KP), onDrawPFloat2Menu, SetKp, &thermalManager.temp_bed.pid.Kp); ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KP), onDrawPFloat2Menu, SetKp, &thermalManager.temp_bed.pid.Kp);
ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KI), onDrawPIDi, SetKi, &thermalManager.temp_bed.pid.Ki); ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KI), onDrawPIDi, SetKi, &thermalManager.temp_bed.pid.Ki);
ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KD), onDrawPIDd, SetKd, &thermalManager.temp_bed.pid.Kd); ADDMENUITEM_P(ICON_PIDValue, F("Set" STR_KD), onDrawPIDd, SetKd, &thermalManager.temp_bed.pid.Kd);
ADDMENUITEM_P(ICON_Temperature, GET_TEXT(MSG_TEMPERATURE), onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT); ADDMENUITEM_P(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT);
ADDMENUITEM_P(ICON_PIDcycles, GET_TEXT(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles); ADDMENUITEM_P(ICON_PIDcycles, GET_TEXT_F(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles);
#if ENABLED(EEPROM_SETTINGS) #if ENABLED(EEPROM_SETTINGS)
ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT(MSG_STORE_EEPROM), onDrawMenuItem, WriteEeprom); ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawMenuItem, WriteEeprom);
#endif #endif
} }
CurrentMenu->draw(); CurrentMenu->draw();
@ -3610,10 +3610,10 @@ void Draw_Steps_Menu() {
CurrentMenu = ZOffsetWizMenu; CurrentMenu = ZOffsetWizMenu;
CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_PROBE_WIZARD)); CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_PROBE_WIZARD));
DWINUI::MenuItemsPrepare(4); DWINUI::MenuItemsPrepare(4);
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawMenuItem, Draw_Prepare_Menu); ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_Prepare_Menu);
ADDMENUITEM(ICON_Homing, GET_TEXT(MSG_AUTO_HOME), onDrawMenuItem, AutoHome); ADDMENUITEM(ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME), onDrawMenuItem, AutoHome);
ADDMENUITEM(ICON_MoveZ0, F("Move Z to Home"), onDrawMenuItem, SetMoveZto0); ADDMENUITEM(ICON_MoveZ0, F("Move Z to Home"), onDrawMenuItem, SetMoveZto0);
ADDMENUITEM_P(ICON_Zoffset, GET_TEXT(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR); ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetZOffset, &BABY_Z_VAR);
} }
CurrentMenu->draw(); CurrentMenu->draw();
if (!axis_is_trusted(Z_AXIS)) ui.set_status_P(PSTR("WARNING: Z position is unknow, move Z to home")); if (!axis_is_trusted(Z_AXIS)) ui.set_status_P(PSTR("WARNING: Z position is unknow, move Z to home"));

View File

@ -37,7 +37,7 @@
// str: multi-bit data // str: multi-bit data
void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string); void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, char *string);
inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, const __FlashStringHelper *title) { inline void DWIN_Draw_QR(uint8_t QR_Pixel, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_QR(QR_Pixel, x, y, (char *)title); DWIN_Draw_QR(QR_Pixel, x, y, (char *)title);
} }

View File

@ -32,7 +32,6 @@
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED) #if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
#include "../../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#include "../../../core/macros.h"
#include "dwin_lcd.h" #include "dwin_lcd.h"
#include "dwinui.h" #include "dwinui.h"

View File

@ -124,9 +124,9 @@ public:
rect_t frame = {0}; rect_t frame = {0};
void draw(); void draw();
void SetCaption(const char * const title); void SetCaption(const char * const title);
inline void SetCaption(const __FlashStringHelper * title) { SetCaption((char *)title); } inline void SetCaption(FSTR_P title) { SetCaption((char *)title); }
void ShowCaption(const char * const title); void ShowCaption(const char * const title);
inline void ShowCaption(const __FlashStringHelper * title) { ShowCaption((char *)title); } inline void ShowCaption(FSTR_P title) { ShowCaption((char *)title); }
void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
void SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h); void SetFrame(uint16_t x, uint16_t y, uint16_t w, uint16_t h);
void FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); void FrameCopy(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
@ -146,7 +146,7 @@ public:
void (*onClick)() = nullptr; void (*onClick)() = nullptr;
MenuItemClass() {}; MenuItemClass() {};
MenuItemClass(uint8_t cicon, const char * const text=nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); MenuItemClass(uint8_t cicon, const char * const text=nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr);
MenuItemClass(uint8_t cicon, const __FlashStringHelper * text = nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr) : MenuItemClass(cicon, (char*)text, ondraw, onclick){} MenuItemClass(uint8_t cicon, FSTR_P text = nullptr, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr) : MenuItemClass(cicon, FTOP(text), ondraw, onclick){}
MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr); MenuItemClass(uint8_t cicon, uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, void (*ondraw)(MenuItemClass* menuitem, int8_t line)=nullptr, void (*onclick)()=nullptr);
void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2); void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
virtual ~MenuItemClass(){}; virtual ~MenuItemClass(){};
@ -158,7 +158,7 @@ public:
void *value = nullptr; void *value = nullptr;
using MenuItemClass::MenuItemClass; using MenuItemClass::MenuItemClass;
MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val); MenuItemPtrClass(uint8_t cicon, const char * const text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val);
MenuItemPtrClass(uint8_t cicon, const __FlashStringHelper * text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemPtrClass(cicon, (char*)text, ondraw, onclick, val){} MenuItemPtrClass(uint8_t cicon, FSTR_P text, void (*ondraw)(MenuItemClass* menuitem, int8_t line), void (*onclick)(), void* val) : MenuItemPtrClass(cicon, FTOP(text), ondraw, onclick, val){}
}; };
class MenuClass { class MenuClass {
@ -351,25 +351,25 @@ namespace DWINUI {
inline void Draw_String(uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string); DWIN_Draw_String(false, font, textcolor, backcolor, x, y, string);
} }
inline void Draw_String(uint16_t x, uint16_t y, const __FlashStringHelper *title) { inline void Draw_String(uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(false, font, textcolor, backcolor, x, y, (char *)title); DWIN_Draw_String(false, font, textcolor, backcolor, x, y, (char *)title);
} }
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(false, font, color, backcolor, x, y, string); DWIN_Draw_String(false, font, color, backcolor, x, y, string);
} }
inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, const __FlashStringHelper *title) { inline void Draw_String(uint16_t color, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(false, font, color, backcolor, x, y, (char *)title); DWIN_Draw_String(false, font, color, backcolor, x, y, (char *)title);
} }
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(true, font, color, bgcolor, x, y, string); DWIN_Draw_String(true, font, color, bgcolor, x, y, string);
} }
inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const __FlashStringHelper *title) { inline void Draw_String(uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(true, font, color, bgcolor, x, y, (char *)title); DWIN_Draw_String(true, font, color, bgcolor, x, y, (char *)title);
} }
inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) { inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const char * const string) {
DWIN_Draw_String(true, size, color, bgcolor, x, y, string); DWIN_Draw_String(true, size, color, bgcolor, x, y, string);
} }
inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, const __FlashStringHelper *title) { inline void Draw_String(uint8_t size, uint16_t color, uint16_t bgcolor, uint16_t x, uint16_t y, FSTR_P title) {
DWIN_Draw_String(true, size, color, bgcolor, x, y, (char *)title); DWIN_Draw_String(true, size, color, bgcolor, x, y, (char *)title);
} }
@ -381,7 +381,7 @@ namespace DWINUI {
// y: Upper coordinate of the string // y: Upper coordinate of the string
// *string: The string // *string: The string
void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string); void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const char * const string);
inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, const __FlashStringHelper *title) { inline void Draw_CenteredString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t y, FSTR_P title) {
Draw_CenteredString(bShow, size, color, bColor, y, (char *)title); Draw_CenteredString(bShow, size, color, bColor, y, (char *)title);
} }
inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) { inline void Draw_CenteredString(uint16_t color, uint16_t bcolor, uint16_t y, const char * const string) {
@ -390,19 +390,19 @@ namespace DWINUI {
inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const char * const string) { inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const char * const string) {
Draw_CenteredString(false, size, color, backcolor, y, string); Draw_CenteredString(false, size, color, backcolor, y, string);
} }
inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, const __FlashStringHelper *title) { inline void Draw_CenteredString(uint8_t size, uint16_t color, uint16_t y, FSTR_P title) {
Draw_CenteredString(false, size, color, backcolor, y, (char *)title); Draw_CenteredString(false, size, color, backcolor, y, (char *)title);
} }
inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) { inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const string) {
Draw_CenteredString(false, font, color, backcolor, y, string); Draw_CenteredString(false, font, color, backcolor, y, string);
} }
inline void Draw_CenteredString(uint16_t color, uint16_t y, const __FlashStringHelper *title) { inline void Draw_CenteredString(uint16_t color, uint16_t y, FSTR_P title) {
Draw_CenteredString(false, font, color, backcolor, y, (char *)title); Draw_CenteredString(false, font, color, backcolor, y, (char *)title);
} }
inline void Draw_CenteredString(uint16_t y, const char * const string) { inline void Draw_CenteredString(uint16_t y, const char * const string) {
Draw_CenteredString(false, font, textcolor, backcolor, y, string); Draw_CenteredString(false, font, textcolor, backcolor, y, string);
} }
inline void Draw_CenteredString(uint16_t y, const __FlashStringHelper *title) { inline void Draw_CenteredString(uint16_t y, FSTR_P title) {
Draw_CenteredString(false, font, textcolor, backcolor, y, (char *)title); Draw_CenteredString(false, font, textcolor, backcolor, y, (char *)title);
} }

View File

@ -26,6 +26,8 @@
* @brief DWIN screen control functions * @brief DWIN screen control functions
********************************************************************************/ ********************************************************************************/
#include "../../../inc/MarlinConfigPre.h"
#if ENABLED(DWIN_MARLINUI_LANDSCAPE) #if ENABLED(DWIN_MARLINUI_LANDSCAPE)
#define DWIN_WIDTH 480 #define DWIN_WIDTH 480
#define DWIN_HEIGHT 272 #define DWIN_HEIGHT 272

View File

@ -65,7 +65,7 @@ class DWIN_String {
static void set(uint8_t *string) { set(); add(string); } static void set(uint8_t *string) { set(); add(string); }
static void set(wchar_t character) { set(); add(character); } static void set(wchar_t character) { set(); add(character); }
static void set(uint8_t *string, int8_t index, const char *itemString=nullptr) { set(); add(string, index, (uint8_t *)itemString); } static void set(uint8_t *string, int8_t index, const char *itemString=nullptr) { set(); add(string, index, (uint8_t *)itemString); }
static inline void set(const __FlashStringHelper *fstring) { set((uint8_t *)fstring); } static inline void set(FSTR_P fstring) { set((uint8_t *)fstring); }
static inline void set(const char *string) { set((uint8_t *)string); } static inline void set(const char *string) { set((uint8_t *)string); }
static inline void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); } static inline void set(const char *string, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); }
static inline void add(const char *string) { add((uint8_t *)string); } static inline void add(const char *string) { add((uint8_t *)string); }

View File

@ -416,7 +416,7 @@ bool UIFlashStorage::is_present = false;
/* Writes a media file from the SD card/USB flash drive into a slot on the SPI Flash. Media /* Writes a media file from the SD card/USB flash drive into a slot on the SPI Flash. Media
* files must be written sequentially following by a chip erase and it is not possible to * files must be written sequentially following by a chip erase and it is not possible to
* overwrite files. */ * overwrite files. */
UIFlashStorage::error_t UIFlashStorage::write_media_file(progmem_str filename, uint8_t slot) { UIFlashStorage::error_t UIFlashStorage::write_media_file(FSTR_P filename, uint8_t slot) {
#if ENABLED(SDSUPPORT) #if ENABLED(SDSUPPORT)
uint32_t addr; uint32_t addr;
uint8_t buff[write_page_size]; uint8_t buff[write_page_size];
@ -543,7 +543,7 @@ bool UIFlashStorage::is_present = false;
void UIFlashStorage::write_config_data(const void *, size_t) {} void UIFlashStorage::write_config_data(const void *, size_t) {}
bool UIFlashStorage::verify_config_data(const void *, size_t) {return false;} bool UIFlashStorage::verify_config_data(const void *, size_t) {return false;}
bool UIFlashStorage::read_config_data(void *, size_t ) {return false;} bool UIFlashStorage::read_config_data(void *, size_t ) {return false;}
UIFlashStorage::error_t UIFlashStorage::write_media_file(progmem_str, uint8_t) {return FILE_NOT_FOUND;} UIFlashStorage::error_t UIFlashStorage::write_media_file(FSTR_P, uint8_t) {return FILE_NOT_FOUND;}
void UIFlashStorage::format_flash() {} void UIFlashStorage::format_flash() {}
bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t) {return false;} bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t) {return false;}

View File

@ -88,7 +88,7 @@ class UIFlashStorage : private SPIFlash {
static void write_config_data (const void *data, size_t size); static void write_config_data (const void *data, size_t size);
static bool verify_config_data (const void *data, size_t size); static bool verify_config_data (const void *data, size_t size);
static bool read_config_data (void *data, size_t size); static bool read_config_data (void *data, size_t size);
static error_t write_media_file (progmem_str filename, uint8_t slot = 0); static error_t write_media_file (FSTR_P filename, uint8_t slot = 0);
class BootMediaReader; class BootMediaReader;
}; };

View File

@ -105,7 +105,7 @@ bool BioPrintingDialogBox::onTouchEnd(uint8_t tag) {
return true; return true;
} }
void BioPrintingDialogBox::setStatusMessage(progmem_str message) { void BioPrintingDialogBox::setStatusMessage(FSTR_P message) {
char buff[strlen_P((const char*)message)+1]; char buff[strlen_P((const char*)message)+1];
strcpy_P(buff, (const char*) message); strcpy_P(buff, (const char*) message);
setStatusMessage(buff); setStatusMessage(buff);

View File

@ -37,7 +37,7 @@ class BioPrintingDialogBox : public BaseScreen, public CachedScreen<PRINTING_SCR
static void show(); static void show();
static void setStatusMessage(const char *); static void setStatusMessage(const char *);
static void setStatusMessage(progmem_str); static void setStatusMessage(FSTR_P);
static void onIdle(); static void onIdle();
static bool onTouchEnd(uint8_t tag); static bool onTouchEnd(uint8_t tag);

View File

@ -354,7 +354,7 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
return false; return false;
} }
void StatusScreen::setStatusMessage(progmem_str pstr) { void StatusScreen::setStatusMessage(FSTR_P pstr) {
BioPrintingDialogBox::setStatusMessage(pstr); BioPrintingDialogBox::setStatusMessage(pstr);
} }

View File

@ -44,7 +44,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE>
static void unlockMotors(); static void unlockMotors();
static void setStatusMessage(const char *); static void setStatusMessage(const char *);
static void setStatusMessage(progmem_str); static void setStatusMessage(FSTR_P);
static void onRedraw(draw_mode_t); static void onRedraw(draw_mode_t);

View File

@ -81,7 +81,7 @@ void PreheatTimerScreen::draw_interaction_buttons(draw_mode_t what) {
} }
} }
void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, progmem_str label, float value, int16_t x, int16_t y, int16_t w, int16_t h) { void PreheatTimerScreen::draw_adjuster(draw_mode_t what, uint8_t tag, FSTR_P label, float value, int16_t x, int16_t y, int16_t w, int16_t h) {
#define SUB_COLS 9 #define SUB_COLS 9
#define SUB_ROWS 2 #define SUB_ROWS 2

View File

@ -35,7 +35,7 @@ class PreheatTimerScreen : public BaseScreen, public CachedScreen<PREHEAT_TIMER_
static void draw_message(draw_mode_t); static void draw_message(draw_mode_t);
static void draw_time_remaining(draw_mode_t); static void draw_time_remaining(draw_mode_t);
static void draw_interaction_buttons(draw_mode_t); static void draw_interaction_buttons(draw_mode_t);
static void draw_adjuster(draw_mode_t, uint8_t tag, progmem_str label, float value, int16_t x, int16_t y, int16_t w, int16_t h); static void draw_adjuster(draw_mode_t, uint8_t tag, FSTR_P label, float value, int16_t x, int16_t y, int16_t w, int16_t h);
public: public:
static void onRedraw(draw_mode_t); static void onRedraw(draw_mode_t);

View File

@ -279,7 +279,7 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
return false; return false;
} }
void StatusScreen::setStatusMessage(progmem_str) { void StatusScreen::setStatusMessage(FSTR_P) {
} }
void StatusScreen::setStatusMessage(const char * const) { void StatusScreen::setStatusMessage(const char * const) {

View File

@ -44,7 +44,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE>
static void unlockMotors(); static void unlockMotors();
static void setStatusMessage(const char *); static void setStatusMessage(const char *);
static void setStatusMessage(progmem_str); static void setStatusMessage(FSTR_P);
static void onRedraw(draw_mode_t); static void onRedraw(draw_mode_t);

View File

@ -49,5 +49,5 @@
#endif #endif
class __FlashStringHelper; class __FlashStringHelper;
typedef const __FlashStringHelper *progmem_str; typedef const __FlashStringHelper *FSTR_P;
extern const char G28_STR[]; extern const char G28_STR[];

View File

@ -71,7 +71,7 @@ namespace ExtUI {
} }
void onStatusChanged(const char *lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); } void onStatusChanged(const char *lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); }
void onStatusChanged(progmem_str lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); } void onStatusChanged(FSTR_P lcd_msg) { StatusScreen::setStatusMessage(lcd_msg); }
void onPrintTimerStarted() { void onPrintTimerStarted() {
InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_STARTED); InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_STARTED);

View File

@ -66,7 +66,7 @@ uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const {
return width; return width;
} }
uint16_t CLCD::FontMetrics::get_text_width(progmem_str str, size_t n) const { uint16_t CLCD::FontMetrics::get_text_width(FSTR_P str, size_t n) const {
uint16_t width = 0; uint16_t width = 0;
const uint8_t *p = (const uint8_t *) str; const uint8_t *p = (const uint8_t *) str;
for (;;) { for (;;) {
@ -162,7 +162,7 @@ void CLCD::mem_write_bulk(uint32_t reg_address, const void *data, uint16_t len,
} }
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM // Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM
void CLCD::mem_write_bulk(uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding) { void CLCD::mem_write_bulk(uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding) {
spi_ftdi_select(); spi_ftdi_select();
spi_write_addr(reg_address); spi_write_addr(reg_address);
spi_write_bulk<pgm_write>(str, len, padding); spi_write_bulk<pgm_write>(str, len, padding);
@ -178,7 +178,7 @@ void CLCD::mem_write_pgm(uint32_t reg_address, const void *data, uint16_t len, u
} }
// Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM, reversing bytes (suitable for loading XBM images) // Write 3-Byte Address, Multiple Bytes, plus padding bytes, from PROGMEM, reversing bytes (suitable for loading XBM images)
void CLCD::mem_write_xbm(uint32_t reg_address, progmem_str data, uint16_t len, uint8_t padding) { void CLCD::mem_write_xbm(uint32_t reg_address, FSTR_P data, uint16_t len, uint8_t padding) {
spi_ftdi_select(); spi_ftdi_select();
spi_write_addr(reg_address); spi_write_addr(reg_address);
spi_write_bulk<xbm_write>(data, len, padding); spi_write_bulk<xbm_write>(data, len, padding);
@ -1048,7 +1048,7 @@ template <class T> bool CLCD::CommandFifo::write(T data, uint16_t len) {
#endif // ... FTDI_API_LEVEL != 800 #endif // ... FTDI_API_LEVEL != 800
template bool CLCD::CommandFifo::write(const void*, uint16_t); template bool CLCD::CommandFifo::write(const void*, uint16_t);
template bool CLCD::CommandFifo::write(progmem_str, uint16_t); template bool CLCD::CommandFifo::write(FSTR_P, uint16_t);
// CO_PROCESSOR COMMANDS // CO_PROCESSOR COMMANDS
@ -1071,7 +1071,7 @@ void CLCD::CommandFifo::str(const char * data) {
write(data, strlen(data)+1); write(data, strlen(data)+1);
} }
void CLCD::CommandFifo::str(progmem_str data) { void CLCD::CommandFifo::str(FSTR_P data) {
write(data, strlen_P((const char*)data)+1); write(data, strlen_P((const char*)data)+1);
} }

View File

@ -93,7 +93,7 @@
#pragma once #pragma once
typedef const __FlashStringHelper *progmem_str; typedef const __FlashStringHelper *FSTR_P;
class UIStorage; class UIStorage;
@ -118,8 +118,8 @@ class CLCD {
static void mem_write_fill (uint32_t reg_address, uint8_t w_data, uint16_t len); static void mem_write_fill (uint32_t reg_address, uint8_t w_data, uint16_t len);
static void mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0); static void mem_write_bulk (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0);
static void mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0); static void mem_write_pgm (uint32_t reg_address, const void *data, uint16_t len, uint8_t padding = 0);
static void mem_write_bulk (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding = 0); static void mem_write_bulk (uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding = 0);
static void mem_write_xbm (uint32_t reg_address, progmem_str str, uint16_t len, uint8_t padding = 0); static void mem_write_xbm (uint32_t reg_address, FSTR_P str, uint16_t len, uint8_t padding = 0);
public: public:
class CommandFifo; class CommandFifo;
@ -168,7 +168,7 @@ class CLCD::FontMetrics {
// Returns width of string, up to a maximum of n characters. // Returns width of string, up to a maximum of n characters.
uint16_t get_text_width(const char *str, size_t n = SIZE_MAX) const; uint16_t get_text_width(const char *str, size_t n = SIZE_MAX) const;
uint16_t get_text_width(progmem_str str, size_t n = SIZE_MAX) const; uint16_t get_text_width(FSTR_P str, size_t n = SIZE_MAX) const;
}; };
/******************* FT800/810 Graphic Commands *********************************/ /******************* FT800/810 Graphic Commands *********************************/
@ -250,7 +250,7 @@ class CLCD::CommandFifo {
// Sends the string portion of text, button, toggle and keys. // Sends the string portion of text, button, toggle and keys.
void str (const char * data, size_t maxlen); void str (const char * data, size_t maxlen);
void str (const char * data); void str (const char * data);
void str (progmem_str data); void str (FSTR_P data);
void memzero (uint32_t ptr, uint32_t size); void memzero (uint32_t ptr, uint32_t size);
void memset (uint32_t ptr, uint32_t value, uint32_t size); void memset (uint32_t ptr, uint32_t value, uint32_t size);

View File

@ -30,7 +30,7 @@
#define DEC_POS SUB_POS(8,1), SUB_SIZE(2,1) #define DEC_POS SUB_POS(8,1), SUB_SIZE(2,1)
namespace FTDI { namespace FTDI {
void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, progmem_str units, int8_t width, uint8_t precision) { void draw_adjuster_value(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, float value, FSTR_P units, int8_t width, uint8_t precision) {
char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)]; char str[width + precision + 10 + (units ? strlen_P((const char*) units) : 0)];
if (isnan(value)) if (isnan(value))
strcpy_P(str, PSTR("-")); strcpy_P(str, PSTR("-"));
@ -45,7 +45,7 @@ namespace FTDI {
cmd.tag(0).text(VAL_POS, str); cmd.tag(0).text(VAL_POS, str);
} }
void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, progmem_str units, int8_t width, uint8_t precision, draw_mode_t what) { void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, FSTR_P units, int8_t width, uint8_t precision, draw_mode_t what) {
if (what & BACKGROUND) if (what & BACKGROUND)
cmd.tag(0).button(VAL_POS, F(""), FTDI::OPT_FLAT); cmd.tag(0).button(VAL_POS, F(""), FTDI::OPT_FLAT);

View File

@ -25,7 +25,7 @@ namespace FTDI {
void draw_adjuster_value( void draw_adjuster_value(
CommandProcessor& cmd, CommandProcessor& cmd,
int16_t x, int16_t y, int16_t w, int16_t h, int16_t x, int16_t y, int16_t w, int16_t h,
float value, progmem_str units = nullptr, float value, FSTR_P units = nullptr,
int8_t width = 5, uint8_t precision = 1 int8_t width = 5, uint8_t precision = 1
); );
@ -33,7 +33,7 @@ namespace FTDI {
CommandProcessor& cmd, CommandProcessor& cmd,
int16_t x, int16_t y, int16_t w, int16_t h, int16_t x, int16_t y, int16_t w, int16_t h,
uint8_t tag, uint8_t tag,
float value, progmem_str units = nullptr, float value, FSTR_P units = nullptr,
int8_t width = 5, uint8_t precision = 1, int8_t width = 5, uint8_t precision = 1,
draw_mode_t what = BOTH draw_mode_t what = BOTH
); );

View File

@ -241,7 +241,7 @@ class CommandProcessor : public CLCD::CommandFifo {
return *this; return *this;
} }
CommandProcessor& toggle2(int16_t x, int16_t y, int16_t w, int16_t h, progmem_str no, progmem_str yes, bool state, uint16_t options = FTDI::OPT_3D) { CommandProcessor& toggle2(int16_t x, int16_t y, int16_t w, int16_t h, FSTR_P no, FSTR_P yes, bool state, uint16_t options = FTDI::OPT_3D) {
char text[strlen_P((const char *)no) + strlen_P((const char *)yes) + 2]; char text[strlen_P((const char *)no) + strlen_P((const char *)yes) + 2];
strcpy_P(text, (const char *)no); strcpy_P(text, (const char *)no);
strcat(text, "\xFF"); strcat(text, "\xFF");

View File

@ -135,7 +135,7 @@ namespace FTDI {
} }
} }
void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, progmem_str pstr, uint16_t options, uint8_t font) { void draw_text_box(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P pstr, uint16_t options, uint8_t font) {
char str[strlen_P((const char*)pstr) + 1]; char str[strlen_P((const char*)pstr) + 1];
strcpy_P(str, (const char*)pstr); strcpy_P(str, (const char*)pstr);
draw_text_box(cmd, x, y, w, h, (const char*) str, options, font); draw_text_box(cmd, x, y, w, h, (const char*) str, options, font);

View File

@ -27,6 +27,6 @@
namespace FTDI { namespace FTDI {
constexpr uint16_t OPT_BOTTOMY = 0x1000; // Non-standard constexpr uint16_t OPT_BOTTOMY = 0x1000; // Non-standard
void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, progmem_str str, uint16_t options = 0, uint8_t font = 31); void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P str, uint16_t options = 0, uint8_t font = 31);
void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31); void draw_text_box(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31);
} }

View File

@ -80,7 +80,7 @@ namespace FTDI {
_draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font); _draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font);
} }
void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, progmem_str pstr, uint16_t options, uint8_t font) { void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P pstr, uint16_t options, uint8_t font) {
char tmp[strlen_P((const char*)pstr) + 3]; char tmp[strlen_P((const char*)pstr) + 3];
strcpy_P(tmp, (const char*)pstr); strcpy_P(tmp, (const char*)pstr);
_draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font); _draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font);

View File

@ -26,6 +26,6 @@
* showing ellipsis if it does not fit. * showing ellipsis if it does not fit.
*/ */
namespace FTDI { namespace FTDI {
void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, progmem_str str, uint16_t options = 0, uint8_t font = 31); void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, FSTR_P str, uint16_t options = 0, uint8_t font = 31);
void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31); void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31);
} }

View File

@ -44,7 +44,7 @@
return false; return false;
} }
bool FTDI::has_utf8_chars(progmem_str _str) { bool FTDI::has_utf8_chars(FSTR_P _str) {
const char *str = (const char *) _str; const char *str = (const char *) _str;
for (;;) { for (;;) {
const char c = pgm_read_byte(str++); const char c = pgm_read_byte(str++);
@ -191,7 +191,7 @@
return render_utf8_text(nullptr, 0, 0, str, fs, maxlen); return render_utf8_text(nullptr, 0, 0, str, fs, maxlen);
} }
uint16_t FTDI::get_utf8_text_width(progmem_str pstr, font_size_t fs) { uint16_t FTDI::get_utf8_text_width(FSTR_P pstr, font_size_t fs) {
char str[strlen_P((const char*)pstr) + 1]; char str[strlen_P((const char*)pstr) + 1];
strcpy_P(str, (const char*)pstr); strcpy_P(str, (const char*)pstr);
return get_utf8_text_width(str, fs); return get_utf8_text_width(str, fs);
@ -234,7 +234,7 @@
cmd.cmd(RESTORE_CONTEXT()); cmd.cmd(RESTORE_CONTEXT());
} }
void FTDI::draw_utf8_text(CommandProcessor& cmd, int x, int y, progmem_str pstr, font_size_t fs, uint16_t options) { void FTDI::draw_utf8_text(CommandProcessor& cmd, int x, int y, FSTR_P pstr, font_size_t fs, uint16_t options) {
char str[strlen_P((const char*)pstr) + 1]; char str[strlen_P((const char*)pstr) + 1];
strcpy_P(str, (const char*)pstr); strcpy_P(str, (const char*)pstr);
draw_utf8_text(cmd, x, y, (const char*) str, fs, options); draw_utf8_text(cmd, x, y, (const char*) str, fs, options);

View File

@ -40,7 +40,7 @@ namespace FTDI {
/* Returns true if the string has UTF8 string characters */ /* Returns true if the string has UTF8 string characters */
bool has_utf8_chars(progmem_str str); bool has_utf8_chars(FSTR_P str);
bool has_utf8_chars(const char *str); bool has_utf8_chars(const char *str);
/* Returns the next character in a UTF8 string and increments the /* Returns the next character in a UTF8 string and increments the
@ -66,10 +66,10 @@ namespace FTDI {
void load_utf8_bitmaps(CommandProcessor& cmd); void load_utf8_bitmaps(CommandProcessor& cmd);
uint16_t get_utf8_char_width(utf8_char_t, font_size_t); uint16_t get_utf8_char_width(utf8_char_t, font_size_t);
uint16_t get_utf8_text_width(progmem_str, font_size_t); uint16_t get_utf8_text_width(FSTR_P, font_size_t);
uint16_t get_utf8_text_width(const char *, font_size_t, size_t maxlen=SIZE_MAX); uint16_t get_utf8_text_width(const char *, font_size_t, size_t maxlen=SIZE_MAX);
void draw_utf8_text(CommandProcessor&, int x, int y, progmem_str, font_size_t, uint16_t options = 0); void draw_utf8_text(CommandProcessor&, int x, int y, FSTR_P, font_size_t, uint16_t options = 0);
void draw_utf8_text(CommandProcessor&, int x, int y, const char *, font_size_t, uint16_t options = 0, size_t maxlen=SIZE_MAX); void draw_utf8_text(CommandProcessor&, int x, int y, const char *, font_size_t, uint16_t options = 0, size_t maxlen=SIZE_MAX);
// Similar to CLCD::FontMetrics, but can be used with UTF8 encoded strings. // Similar to CLCD::FontMetrics, but can be used with UTF8 encoded strings.

View File

@ -83,7 +83,7 @@ void AboutScreen::onRedraw(draw_mode_t) {
#ifdef TOUCH_UI_VERSION #ifdef TOUCH_UI_VERSION
F(TOUCH_UI_VERSION) F(TOUCH_UI_VERSION)
#else #else
progmem_str(getFirmwareName_str()) FPSTR(getFirmwareName_str())
#endif #endif
, OPT_CENTER, font_medium); , OPT_CENTER, font_medium);
cmd.tag(0); cmd.tag(0);

View File

@ -64,8 +64,8 @@ void AlertDialogBox::hide() {
} }
template void AlertDialogBox::show(const char *); template void AlertDialogBox::show(const char *);
template void AlertDialogBox::show(progmem_str); template void AlertDialogBox::show(FSTR_P);
template void AlertDialogBox::showError(const char *); template void AlertDialogBox::showError(const char *);
template void AlertDialogBox::showError(progmem_str); template void AlertDialogBox::showError(FSTR_P);
#endif // FTDI_ALERT_DIALOG_BOX #endif // FTDI_ALERT_DIALOG_BOX

View File

@ -109,7 +109,7 @@ void BaseNumericAdjustmentScreen::widgets_t::_button_style(CommandProcessor &cmd
* Speed optimization for drawing buttons. Draw all unpressed buttons in the * Speed optimization for drawing buttons. Draw all unpressed buttons in the
* background layer and draw only the pressed button in the foreground layer. * background layer and draw only the pressed button in the foreground layer.
*/ */
void BaseNumericAdjustmentScreen::widgets_t::_button(CommandProcessor &cmd, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, progmem_str text, bool enabled, bool highlight) { void BaseNumericAdjustmentScreen::widgets_t::_button(CommandProcessor &cmd, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, FSTR_P text, bool enabled, bool highlight) {
if (_what & BACKGROUND) enabled = true; if (_what & BACKGROUND) enabled = true;
if ((_what & BACKGROUND) || buttonIsPressed(tag) || highlight || !enabled) { if ((_what & BACKGROUND) || buttonIsPressed(tag) || highlight || !enabled) {
_button_style(cmd, (!enabled) ? BTN_DISABLED : (highlight ? BTN_ACTION : BTN_NORMAL)); _button_style(cmd, (!enabled) ? BTN_DISABLED : (highlight ? BTN_ACTION : BTN_NORMAL));
@ -125,7 +125,7 @@ BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::
return *this; return *this;
} }
void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) { void BaseNumericAdjustmentScreen::widgets_t::heading(FSTR_P label) {
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
CommandProcessor cmd; CommandProcessor cmd;
_button_style(cmd, TEXT_LABEL); _button_style(cmd, TEXT_LABEL);
@ -176,13 +176,13 @@ void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcesso
switch (pos) { switch (pos) {
#if ENABLED(TOUCH_UI_PORTRAIT) #if ENABLED(TOUCH_UI_PORTRAIT)
case 0: _button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break; case 0: _button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(2,1), FPSTR(label), true, highlight); break;
case 1: _button(cmd, tag, BTN_POS(7,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break; case 1: _button(cmd, tag, BTN_POS(7,_line), BTN_SIZE(2,1), FPSTR(label), true, highlight); break;
case 2: _button(cmd, tag, BTN_POS(9,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break; case 2: _button(cmd, tag, BTN_POS(9,_line), BTN_SIZE(2,1), FPSTR(label), true, highlight); break;
#else #else
case 0: _button(cmd, tag, BTN_POS(15,2), BTN_SIZE(4,1), progmem_str(label), true, highlight); break; case 0: _button(cmd, tag, BTN_POS(15,2), BTN_SIZE(4,1), FPSTR(label), true, highlight); break;
case 1: _button(cmd, tag, BTN_POS(15,3), BTN_SIZE(4,1), progmem_str(label), true, highlight); break; case 1: _button(cmd, tag, BTN_POS(15,3), BTN_SIZE(4,1), FPSTR(label), true, highlight); break;
case 2: _button(cmd, tag, BTN_POS(15,4), BTN_SIZE(4,1), progmem_str(label), true, highlight); break; case 2: _button(cmd, tag, BTN_POS(15,4), BTN_SIZE(4,1), FPSTR(label), true, highlight); break;
#endif #endif
} }
} }
@ -213,7 +213,7 @@ void BaseNumericAdjustmentScreen::widgets_t::increments() {
#endif #endif
} }
void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, progmem_str label, const char *value, bool is_enabled) { void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, FSTR_P label, const char *value, bool is_enabled) {
CommandProcessor cmd; CommandProcessor cmd;
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
@ -239,7 +239,7 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, prog
_line++; _line++;
} }
void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str label, const char *value, bool is_enabled) { void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, FSTR_P label, const char *value, bool is_enabled) {
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
adjuster_sram_val(tag, label, nullptr); adjuster_sram_val(tag, label, nullptr);
} }
@ -251,7 +251,7 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str l
} }
} }
void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str label, float value, bool is_enabled) { void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, FSTR_P label, float value, bool is_enabled) {
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
adjuster_sram_val(tag, label, nullptr); adjuster_sram_val(tag, label, nullptr);
} }
@ -265,7 +265,7 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster(uint8_t tag, progmem_str l
} }
} }
void BaseNumericAdjustmentScreen::widgets_t::button(uint8_t tag, progmem_str label, bool is_enabled) { void BaseNumericAdjustmentScreen::widgets_t::button(uint8_t tag, FSTR_P label, bool is_enabled) {
CommandProcessor cmd; CommandProcessor cmd;
cmd.font(LAYOUT_FONT); cmd.font(LAYOUT_FONT);
_button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(9,1), label, is_enabled); _button(cmd, tag, BTN_POS(5,_line), BTN_SIZE(9,1), label, is_enabled);
@ -273,7 +273,7 @@ void BaseNumericAdjustmentScreen::widgets_t::button(uint8_t tag, progmem_str lab
_line++; _line++;
} }
void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, progmem_str label, const char *value, bool is_enabled) { void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, FSTR_P label, const char *value, bool is_enabled) {
CommandProcessor cmd; CommandProcessor cmd;
if (_what & BACKGROUND) { if (_what & BACKGROUND) {
@ -295,7 +295,7 @@ void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, progmem_str
_line++; _line++;
} }
void BaseNumericAdjustmentScreen::widgets_t::two_buttons(uint8_t tag1, progmem_str label1, uint8_t tag2, progmem_str label2, bool is_enabled) { void BaseNumericAdjustmentScreen::widgets_t::two_buttons(uint8_t tag1, FSTR_P label1, uint8_t tag2, FSTR_P label2, bool is_enabled) {
CommandProcessor cmd; CommandProcessor cmd;
cmd.font(LAYOUT_FONT); cmd.font(LAYOUT_FONT);
_button(cmd, tag1, BTN_POS(5,_line), BTN_SIZE(4.5,1), label1, is_enabled); _button(cmd, tag1, BTN_POS(5,_line), BTN_SIZE(4.5,1), label1, is_enabled);
@ -304,7 +304,7 @@ void BaseNumericAdjustmentScreen::widgets_t::two_buttons(uint8_t tag1, progmem_s
_line++; _line++;
} }
void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, progmem_str label, bool value, bool is_enabled) { void BaseNumericAdjustmentScreen::widgets_t::toggle(uint8_t tag, FSTR_P label, bool value, bool is_enabled) {
CommandProcessor cmd; CommandProcessor cmd;
if (_what & BACKGROUND) { if (_what & BACKGROUND) {

View File

@ -44,7 +44,7 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
uint8_t _line; uint8_t _line;
uint32_t _color; uint32_t _color;
uint8_t _decimals; uint8_t _decimals;
progmem_str _units; FSTR_P _units;
enum style_t { enum style_t {
BTN_NORMAL, BTN_NORMAL,
BTN_ACTION, BTN_ACTION,
@ -56,25 +56,25 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
protected: protected:
void _draw_increment_btn(CommandProcessor &, uint8_t line, const uint8_t tag); void _draw_increment_btn(CommandProcessor &, uint8_t line, const uint8_t tag);
void _button(CommandProcessor &, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, progmem_str, bool enabled = true, bool highlight = false); void _button(CommandProcessor &, uint8_t tag, int16_t x, int16_t y, int16_t w, int16_t h, FSTR_P, bool enabled = true, bool highlight = false);
void _button_style(CommandProcessor &cmd, style_t style); void _button_style(CommandProcessor &cmd, style_t style);
public: public:
widgets_t(draw_mode_t); widgets_t(draw_mode_t);
widgets_t &color(uint32_t color) {_color = color; return *this;} widgets_t &color(uint32_t color) {_color = color; return *this;}
widgets_t &units(progmem_str units) {_units = units; return *this;} widgets_t &units(FSTR_P units) {_units = units; return *this;}
widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;} widgets_t &draw_mode(draw_mode_t what) {_what = what; return *this;}
widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST); widgets_t &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST);
void heading (progmem_str label); void heading (FSTR_P label);
void adjuster_sram_val (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); void adjuster_sram_val (uint8_t tag, FSTR_P label, const char *value, bool is_enabled = true);
void adjuster (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); void adjuster (uint8_t tag, FSTR_P label, const char *value, bool is_enabled = true);
void adjuster (uint8_t tag, progmem_str label, float value=0, bool is_enabled = true); void adjuster (uint8_t tag, FSTR_P label, float value=0, bool is_enabled = true);
void button (uint8_t tag, progmem_str label, bool is_enabled = true); void button (uint8_t tag, FSTR_P label, bool is_enabled = true);
void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true); void text_field (uint8_t tag, FSTR_P label, const char *value, bool is_enabled = true);
void two_buttons (uint8_t tag1, progmem_str label1, void two_buttons (uint8_t tag1, FSTR_P label1,
uint8_t tag2, progmem_str label2, bool is_enabled = true); uint8_t tag2, FSTR_P label2, bool is_enabled = true);
void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true); void toggle (uint8_t tag, FSTR_P label, bool value, bool is_enabled = true);
void home_buttons (uint8_t tag); void home_buttons (uint8_t tag);
void increments (); void increments ();
}; };

View File

@ -25,7 +25,7 @@
#define FTDI_BED_MESH_VIEW_SCREEN_CLASS BedMeshViewScreen #define FTDI_BED_MESH_VIEW_SCREEN_CLASS BedMeshViewScreen
struct BedMeshViewScreenData { struct BedMeshViewScreenData {
progmem_str message; FSTR_P message;
uint8_t count; uint8_t count;
xy_uint8_t highlight; xy_uint8_t highlight;
}; };

View File

@ -44,7 +44,7 @@ void DialogBoxBaseClass::drawMessage(T message, int16_t font) {
} }
template void DialogBoxBaseClass::drawMessage(const char *, int16_t font); template void DialogBoxBaseClass::drawMessage(const char *, int16_t font);
template void DialogBoxBaseClass::drawMessage(progmem_str, int16_t font); template void DialogBoxBaseClass::drawMessage(FSTR_P, int16_t font);
void DialogBoxBaseClass::drawYesNoButtons(uint8_t default_btn) { void DialogBoxBaseClass::drawYesNoButtons(uint8_t default_btn) {
CommandProcessor cmd; CommandProcessor cmd;
@ -67,7 +67,7 @@ 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(FSTR_P);
bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) { bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) {
switch (tag) { switch (tag) {

View File

@ -39,7 +39,7 @@ void FilamentRunoutScreen::onRedraw(draw_mode_t what) {
w.units(GET_TEXT_F(MSG_UNITS_MM)); w.units(GET_TEXT_F(MSG_UNITS_MM));
w.precision(0); w.precision(0);
w.color(e_axis); w.color(e_axis);
w.adjuster( 10, progmem_str(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled()); w.adjuster( 10, FPSTR(NUL_STR), getFilamentRunoutDistance_mm(), getFilamentRunoutEnabled());
w.increments(); w.increments();
#endif #endif
} }

View File

@ -63,7 +63,7 @@ void LockScreen::onRedraw(draw_mode_t what) {
#define MARGIN_T 3 #define MARGIN_T 3
#define MARGIN_B 3 #define MARGIN_B 3
progmem_str message; FSTR_P message;
switch (message_style()) { switch (message_style()) {
case 'w': case 'w':
message = GET_TEXT_F(MSG_PASSCODE_REJECTED); message = GET_TEXT_F(MSG_PASSCODE_REJECTED);

View File

@ -60,7 +60,7 @@ void SpinnerDialogBox::onRefresh() {
void SpinnerDialogBox::onRedraw(draw_mode_t) { void SpinnerDialogBox::onRedraw(draw_mode_t) {
} }
void SpinnerDialogBox::show(progmem_str message) { void SpinnerDialogBox::show(FSTR_P message) {
CommandProcessor cmd; CommandProcessor cmd;
if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute(); if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute();
cmd.cmd(CMD_DLSTART) cmd.cmd(CMD_DLSTART)
@ -86,13 +86,13 @@ void SpinnerDialogBox::hide() {
GOTO_PREVIOUS(); GOTO_PREVIOUS();
} }
void SpinnerDialogBox::enqueueAndWait(progmem_str message, progmem_str commands) { void SpinnerDialogBox::enqueueAndWait(FSTR_P message, FSTR_P commands) {
show(message); show(message);
ExtUI::injectCommands_P((const char*)commands); ExtUI::injectCommands_P((const char*)commands);
mydata.auto_hide = true; mydata.auto_hide = true;
} }
void SpinnerDialogBox::enqueueAndWait(progmem_str message, char *commands) { void SpinnerDialogBox::enqueueAndWait(FSTR_P message, char *commands) {
show(message); show(message);
ExtUI::injectCommands(commands); ExtUI::injectCommands(commands);
mydata.auto_hide = true; mydata.auto_hide = true;

View File

@ -37,12 +37,12 @@ class SpinnerDialogBox : public UIScreen {
static void onRefresh(); static void onRefresh();
static void onIdle(); static void onIdle();
static void show(progmem_str); static void show(FSTR_P);
static void hide(); static void hide();
template<typename T> template<typename T>
static void enqueueAndWait(T commands) {enqueueAndWait(GET_TEXT_F(MSG_PLEASE_WAIT), commands);} static void enqueueAndWait(T commands) {enqueueAndWait(GET_TEXT_F(MSG_PLEASE_WAIT), commands);}
static void enqueueAndWait(progmem_str message, char *commands); static void enqueueAndWait(FSTR_P message, char *commands);
static void enqueueAndWait(progmem_str message, progmem_str commands); static void enqueueAndWait(FSTR_P message, FSTR_P commands);
}; };

View File

@ -344,7 +344,7 @@ void StatusScreen::draw_status_message(draw_mode_t what, const char *message) {
#undef GRID_COLS #undef GRID_COLS
} }
void StatusScreen::setStatusMessage(progmem_str message) { void StatusScreen::setStatusMessage(FSTR_P message) {
char buff[strlen_P((const char * const)message)+1]; char buff[strlen_P((const char * const)message)+1];
strcpy_P(buff, (const char * const) message); strcpy_P(buff, (const char * const) message);
setStatusMessage((const char *) buff); setStatusMessage((const char *) buff);

View File

@ -36,7 +36,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,
public: public:
static void loadBitmaps(); static void loadBitmaps();
static void setStatusMessage(const char *); static void setStatusMessage(const char *);
static void setStatusMessage(progmem_str); static void setStatusMessage(FSTR_P);
static void onRedraw(draw_mode_t); static void onRedraw(draw_mode_t);
static void onStartup(); static void onStartup();
static void onEntry(); static void onEntry();

View File

@ -59,7 +59,7 @@ void StressTestScreen::onRedraw(draw_mode_t) {
.cmd(CLEAR(true,true,true)) .cmd(CLEAR(true,true,true))
.cmd(COLOR_RGB(bg_text_enabled)) .cmd(COLOR_RGB(bg_text_enabled))
.font(font_medium) .font(font_medium)
.text(BTN_POS(1,1), BTN_SIZE(4,1), progmem_str(mydata.message)); .text(BTN_POS(1,1), BTN_SIZE(4,1), FPSTR(mydata.message));
drawDots(BTN_POS(1,3), BTN_SIZE(4,4)); drawDots(BTN_POS(1,3), BTN_SIZE(4,4));

View File

@ -397,6 +397,7 @@ namespace Language_en {
LSTR MSG_ADVANCE_K = _UxGT("Advance K"); LSTR MSG_ADVANCE_K = _UxGT("Advance K");
LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *"); LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *");
LSTR MSG_CONTRAST = _UxGT("LCD Contrast"); LSTR MSG_CONTRAST = _UxGT("LCD Contrast");
LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness");
LSTR MSG_STORE_EEPROM = _UxGT("Store Settings"); LSTR MSG_STORE_EEPROM = _UxGT("Store Settings");
LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings"); LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings");
LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults"); LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults");

View File

@ -50,8 +50,8 @@ inline void reset_bricks(const uint16_t v) {
void reset_ball() { void reset_ball() {
constexpr uint8_t ball_dist = 24; constexpr uint8_t ball_dist = 24;
bdat.bally = BTOF(PADDLE_Y - ball_dist); bdat.bally = BTOF(PADDLE_Y - ball_dist);
bdat.ballv = FTOP(1.3f); bdat.ballv = FTOF(1.3f);
bdat.ballh = -FTOP(1.25f); bdat.ballh = -FTOF(1.25f);
uint8_t bx = bdat.paddle_x + (PADDLE_W) / 2 + ball_dist; uint8_t bx = bdat.paddle_x + (PADDLE_W) / 2 + ball_dist;
if (bx >= LCD_PIXEL_WIDTH - 10) { bx -= ball_dist * 2; bdat.ballh = -bdat.ballh; } if (bx >= LCD_PIXEL_WIDTH - 10) { bx -= ball_dist * 2; bdat.ballh = -bdat.ballh; }
bdat.ballx = BTOF(bx); bdat.ballx = BTOF(bx);

View File

@ -63,7 +63,7 @@
#define SNAKE_SIZ SNAKE_BOX #define SNAKE_SIZ SNAKE_BOX
#endif #endif
constexpr fixed_t snakev = FTOP(0.20); constexpr fixed_t snakev = FTOF(0.20);
snake_data_t &sdat = marlin_game_data.snake; snake_data_t &sdat = marlin_game_data.snake;
@ -125,7 +125,7 @@ void snake_reset() {
// Init the head and velocity // Init the head and velocity
sdat.snakex = BTOF(1); sdat.snakex = BTOF(1);
sdat.snakey = BTOF(GAME_H / 2); sdat.snakey = BTOF(GAME_H / 2);
//snakev = FTOP(0.25); //snakev = FTOF(0.25);
// Init the tail with a cw turn // Init the tail with a cw turn
sdat.snake_dir = 0; sdat.snake_dir = 0;

View File

@ -27,7 +27,7 @@ typedef struct { int8_t x, y; } pos_t;
// Simple 8:8 fixed-point // Simple 8:8 fixed-point
typedef int16_t fixed_t; typedef int16_t fixed_t;
#define FTOP(F) fixed_t((F)*256.0f) #define FTOF(F) fixed_t((F)*256.0f)
#define PTOF(P) (float(P)*(1.0f/256.0f)) #define PTOF(P) (float(P)*(1.0f/256.0f))
#define BTOF(X) (fixed_t(X)<<8) #define BTOF(X) (fixed_t(X)<<8)
#define FTOB(X) int8_t(fixed_t(X)>>8) #define FTOB(X) int8_t(fixed_t(X)>>8)

View File

@ -114,7 +114,7 @@ class MenuItem_confirm : public MenuItemBase {
static inline void select_screen( static inline void select_screen(
PGM_P const yes, PGM_P const no, PGM_P const yes, PGM_P const no,
selectFunc_t yesFunc, selectFunc_t noFunc, selectFunc_t yesFunc, selectFunc_t noFunc,
PGM_P const pref, const progmem_str string, PGM_P const suff=nullptr PGM_P const pref, FSTR_P const string, PGM_P const suff=nullptr
) { ) {
char str[strlen_P((PGM_P)string) + 1]; char str[strlen_P((PGM_P)string) + 1];
strcpy_P(str, (PGM_P)string); strcpy_P(str, (PGM_P)string);