mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-27 05:48:43 +00:00
🎨 Updated string macros
This commit is contained in:
parent
dc4d2165f2
commit
262cd757fc
@ -78,7 +78,7 @@ typedef const char Language_Str[];
|
||||
#define GET_TEXT(MSG) GET_LANG(LCD_LANGUAGE)::MSG
|
||||
#define MAX_LANG_CHARSIZE LANG_CHARSIZE
|
||||
#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 LANG_CHARSIZE GET_TEXT(CHARSIZE)
|
||||
|
@ -27,7 +27,11 @@
|
||||
#include "../inc/MarlinConfigPre.h"
|
||||
|
||||
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...
|
||||
|
@ -21,10 +21,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "../../../HAL/shared/Marduino.h"
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#ifndef DWIN_WIDTH
|
||||
#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;
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
@ -177,9 +174,9 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
|
||||
// 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);
|
||||
|
||||
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!
|
||||
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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -589,7 +589,7 @@ void say_steps_per_mm_en(const uint8_t row) {
|
||||
void DWIN_Draw_Label(const uint8_t row, char *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);
|
||||
}
|
||||
|
||||
|
@ -3081,31 +3081,31 @@ void Draw_Prepare_Menu() {
|
||||
CurrentMenu = PrepareMenu;
|
||||
SetMenuTitle({133, 1, 28, 13}, {179, 0, 48, 14}, GET_TEXT_F(MSG_PREPARE));
|
||||
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)
|
||||
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
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_MOVE_AXIS), onDrawMoveSubMenu, Draw_Move_Menu);
|
||||
ADDMENUITEM(ICON_LevBed, GET_TEXT(MSG_BED_LEVELING), onDrawSubMenu, Draw_LevBedCorners_Menu);
|
||||
ADDMENUITEM(ICON_CloseMotor, GET_TEXT(MSG_DISABLE_STEPPERS), onDrawDisableMotors, DisableMotors);
|
||||
ADDMENUITEM(ICON_Homing, GET_TEXT(MSG_AUTO_HOME), onDrawAutoHome, AutoHome);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_MOVE_AXIS), onDrawMoveSubMenu, Draw_Move_Menu);
|
||||
ADDMENUITEM(ICON_LevBed, GET_TEXT_F(MSG_BED_LEVELING), onDrawSubMenu, Draw_LevBedCorners_Menu);
|
||||
ADDMENUITEM(ICON_CloseMotor, GET_TEXT_F(MSG_DISABLE_STEPPERS), onDrawDisableMotors, DisableMotors);
|
||||
ADDMENUITEM(ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME), onDrawAutoHome, AutoHome);
|
||||
#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
|
||||
#if HAS_ZOFFSET_ITEM
|
||||
#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
|
||||
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
|
||||
#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_CustomPreheat, GET_TEXT(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2);
|
||||
ADDMENUITEM(ICON_CustomPreheat, GET_TEXT_F(MSG_PREHEAT_CUSTOM), onDrawMenuItem, SetPreheat2);
|
||||
#endif
|
||||
#if HAS_PREHEAT
|
||||
ADDMENUITEM(ICON_Cool, GET_TEXT(MSG_COOLDOWN), onDrawCooldown, SetCoolDown);
|
||||
ADDMENUITEM(ICON_Cool, GET_TEXT_F(MSG_COOLDOWN), onDrawCooldown, SetCoolDown);
|
||||
#endif
|
||||
ADDMENUITEM(ICON_Language, PSTR("UI Language"), onDrawLanguage, SetLanguage);
|
||||
}
|
||||
@ -3120,12 +3120,12 @@ void Draw_LevBedCorners_Menu() {
|
||||
CurrentMenu = LevBedMenu;
|
||||
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_BED_TRAMMING)); // TODO: Chinese, English "Bed Tramming" JPG
|
||||
DWINUI::MenuItemsPrepare(6);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_FL), onDrawMenuItem, LevBedFL);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_FR), onDrawMenuItem, LevBedFR);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_BR), onDrawMenuItem, LevBedBR);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_BL), onDrawMenuItem, LevBedBL);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_LEVBED_C ), onDrawMenuItem, LevBedC );
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FL), onDrawMenuItem, LevBedFL);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_FR), onDrawMenuItem, LevBedFR);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_BR), onDrawMenuItem, LevBedBR);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_BL), onDrawMenuItem, LevBedBL);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_LEVBED_C ), onDrawMenuItem, LevBedC );
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
}
|
||||
@ -3137,17 +3137,17 @@ void Draw_Control_Menu() {
|
||||
CurrentMenu = ControlMenu;
|
||||
SetMenuTitle({103, 1, 28, 14}, {128, 2, 49, 11}, GET_TEXT_F(MSG_CONTROL));
|
||||
DWINUI::MenuItemsPrepare(9);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
|
||||
ADDMENUITEM(ICON_Temperature, GET_TEXT(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu);
|
||||
ADDMENUITEM(ICON_Motion, GET_TEXT(MSG_MOTION), onDrawMotionSubMenu, Draw_Motion_Menu);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_Main_Menu);
|
||||
ADDMENUITEM(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawTempSubMenu, Draw_Temperature_Menu);
|
||||
ADDMENUITEM(ICON_Motion, GET_TEXT_F(MSG_MOTION), onDrawMotionSubMenu, Draw_Motion_Menu);
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom);
|
||||
ADDMENUITEM(ICON_ReadEEPROM, GET_TEXT(MSG_LOAD_EEPROM), onDrawReadEeprom, ReadEeprom);
|
||||
ADDMENUITEM(ICON_ResumeEEPROM, GET_TEXT(MSG_RESTORE_DEFAULTS), onDrawResetEeprom, ResetEeprom);
|
||||
ADDMENUITEM(ICON_WriteEEPROM, GET_TEXT_F(MSG_STORE_EEPROM), onDrawWriteEeprom, WriteEeprom);
|
||||
ADDMENUITEM(ICON_ReadEEPROM, GET_TEXT_F(MSG_LOAD_EEPROM), onDrawReadEeprom, ReadEeprom);
|
||||
ADDMENUITEM(ICON_ResumeEEPROM, GET_TEXT_F(MSG_RESTORE_DEFAULTS), onDrawResetEeprom, ResetEeprom);
|
||||
#endif
|
||||
ADDMENUITEM(ICON_Reboot, GET_TEXT(MSG_RESET_PRINTER), onDrawMenuItem, RebootPrinter);
|
||||
ADDMENUITEM(ICON_AdvSet, GET_TEXT(MSG_ADVANCED_SETTINGS), onDrawSubMenu, Draw_AdvancedSettings_Menu);
|
||||
ADDMENUITEM(ICON_Info, GET_TEXT(MSG_INFO_SCREEN), onDrawInfoSubMenu, Goto_InfoMenu);
|
||||
ADDMENUITEM(ICON_Reboot, GET_TEXT_F(MSG_RESET_PRINTER), onDrawMenuItem, RebootPrinter);
|
||||
ADDMENUITEM(ICON_AdvSet, GET_TEXT_F(MSG_ADVANCED_SETTINGS), onDrawSubMenu, Draw_AdvancedSettings_Menu);
|
||||
ADDMENUITEM(ICON_Info, GET_TEXT_F(MSG_INFO_SCREEN), onDrawInfoSubMenu, Goto_InfoMenu);
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
}
|
||||
@ -3159,12 +3159,12 @@ void Draw_AdvancedSettings_Menu() {
|
||||
CurrentMenu = AdvancedSettings;
|
||||
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ADVANCED_SETTINGS)); // TODO: Chinese, English "Advanced Settings" JPG
|
||||
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
|
||||
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
|
||||
#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
|
||||
#if HAS_HOTEND
|
||||
ADDMENUITEM(ICON_PIDNozzle, F("Hotend PID Settings"), onDrawSubMenu, Draw_HotendPID_Menu);
|
||||
@ -3173,13 +3173,13 @@ void Draw_AdvancedSettings_Menu() {
|
||||
ADDMENUITEM(ICON_PIDbed, F("Bed PID Settings"), onDrawSubMenu, Draw_BedPID_Menu);
|
||||
#endif
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
ADDMENUITEM(ICON_Scolor, F("Select Colors"), onDrawSubMenu, Draw_SelectColors_Menu);
|
||||
#if ENABLED(SOUND_MENU_ITEM)
|
||||
@ -3197,12 +3197,12 @@ void Draw_Move_Menu() {
|
||||
CurrentMenu = MoveMenu;
|
||||
SetMenuTitle({192, 1, 42, 14}, {231, 2, 35, 11}, GET_TEXT_F(MSG_MOVE_AXIS));
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM_P(ICON_MoveX, GET_TEXT(MSG_MOVE_X), onDrawMoveX, SetMoveX, ¤t_position.x);
|
||||
ADDMENUITEM_P(ICON_MoveY, GET_TEXT(MSG_MOVE_Y), onDrawMoveY, SetMoveY, ¤t_position.y);
|
||||
ADDMENUITEM_P(ICON_MoveZ, GET_TEXT(MSG_MOVE_Z), onDrawMoveZ, SetMoveZ, ¤t_position.z);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM_P(ICON_MoveX, GET_TEXT_F(MSG_MOVE_X), onDrawMoveX, SetMoveX, ¤t_position.x);
|
||||
ADDMENUITEM_P(ICON_MoveY, GET_TEXT_F(MSG_MOVE_Y), onDrawMoveY, SetMoveY, ¤t_position.y);
|
||||
ADDMENUITEM_P(ICON_MoveZ, GET_TEXT_F(MSG_MOVE_Z), onDrawMoveZ, SetMoveZ, ¤t_position.z);
|
||||
#if HAS_HOTEND
|
||||
ADDMENUITEM_P(ICON_Extruder, GET_TEXT(MSG_MOVE_E), onDrawMoveE, SetMoveE, ¤t_position.e);
|
||||
ADDMENUITEM_P(ICON_Extruder, GET_TEXT_F(MSG_MOVE_E), onDrawMoveE, SetMoveE, ¤t_position.e);
|
||||
#endif
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3217,10 +3217,10 @@ void Draw_Move_Menu() {
|
||||
CurrentMenu = HomeOffMenu;
|
||||
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_SET_HOME_OFFSETS)); // TODO: Chinese, English "Set Home Offsets" JPG
|
||||
DWINUI::MenuItemsPrepare(4);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(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_HomeOffsetY, GET_TEXT(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(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
|
||||
ADDMENUITEM_P(ICON_HomeOffsetX, GET_TEXT_F(MSG_HOME_OFFSET_X), onDrawPFloatMenu, SetHomeOffsetX, &home_offset[X_AXIS]);
|
||||
ADDMENUITEM_P(ICON_HomeOffsetY, GET_TEXT_F(MSG_HOME_OFFSET_Y), onDrawPFloatMenu, SetHomeOffsetY, &home_offset[Y_AXIS]);
|
||||
ADDMENUITEM_P(ICON_HomeOffsetZ, GET_TEXT_F(MSG_HOME_OFFSET_Z), onDrawPFloatMenu, SetHomeOffsetZ, &home_offset[Z_AXIS]);
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
}
|
||||
@ -3234,11 +3234,11 @@ void Draw_Move_Menu() {
|
||||
CurrentMenu = ProbeSetMenu;
|
||||
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_ZPROBE_SETTINGS)); // TODO: Chinese, English "Probe Settings" JPG
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
|
||||
ADDMENUITEM_P(ICON_ProbeOffsetX, GET_TEXT(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_ProbeOffsetZ, GET_TEXT(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z);
|
||||
ADDMENUITEM(ICON_ProbeTest, GET_TEXT(MSG_M48_TEST), onDrawMenuItem, ProbeTest);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
|
||||
ADDMENUITEM_P(ICON_ProbeOffsetX, GET_TEXT_F(MSG_ZPROBE_XOFFSET), onDrawPFloatMenu, SetProbeOffsetX, &probe.offset.x);
|
||||
ADDMENUITEM_P(ICON_ProbeOffsetY, GET_TEXT_F(MSG_ZPROBE_YOFFSET), onDrawPFloatMenu, SetProbeOffsetY, &probe.offset.y);
|
||||
ADDMENUITEM_P(ICON_ProbeOffsetZ, GET_TEXT_F(MSG_ZPROBE_ZOFFSET), onDrawPFloat2Menu, SetProbeOffsetZ, &probe.offset.z);
|
||||
ADDMENUITEM(ICON_ProbeTest, GET_TEXT_F(MSG_M48_TEST), onDrawMenuItem, ProbeTest);
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
}
|
||||
@ -3252,9 +3252,9 @@ void Draw_Move_Menu() {
|
||||
CurrentMenu = FilSetMenu;
|
||||
CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_FILAMENT_SET));
|
||||
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
|
||||
ADDMENUITEM(ICON_Runout, GET_TEXT(MSG_RUNOUT_ENABLE), onDrawRunoutEnable, SetRunoutEnable);
|
||||
ADDMENUITEM(ICON_Runout, GET_TEXT_F(MSG_RUNOUT_ENABLE), onDrawRunoutEnable, SetRunoutEnable);
|
||||
#endif
|
||||
#if HAS_FILAMENT_RUNOUT_DISTANCE
|
||||
ADDMENUITEM_P(ICON_Runout, F("Runout Distance"), onDrawPFloatMenu, SetRunoutDistance, &runout.runout_distance());
|
||||
@ -3263,8 +3263,8 @@ void Draw_Move_Menu() {
|
||||
ADDMENUITEM_P(ICON_ExtrudeMinT, F("Extrude Min Temp."), onDrawPIntMenu, SetExtMinT, &HMI_data.ExtMinT);
|
||||
#endif
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
ADDMENUITEM_P(ICON_FilLoad, GET_TEXT(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_FilLoad, GET_TEXT_F(MSG_FILAMENT_LOAD), onDrawPFloatMenu, SetFilLoad, &fc_settings[0].load_length);
|
||||
ADDMENUITEM_P(ICON_FilUnload, GET_TEXT_F(MSG_FILAMENT_UNLOAD), onDrawPFloatMenu, SetFilUnload, &fc_settings[0].unload_length);
|
||||
#endif
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3278,8 +3278,8 @@ void Draw_SelectColors_Menu() {
|
||||
CurrentMenu = SelectColorMenu;
|
||||
SetMenuTitle({0}, {0}, F("Select Colors")); // TODO: Chinese, English "Select Color" JPG
|
||||
DWINUI::MenuItemsPrepare(20);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
|
||||
ADDMENUITEM(ICON_StockConfiguration, GET_TEXT(MSG_RESTORE_DEFAULTS), onDrawMenuItem, RestoreDefaultsColors);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_AdvancedSettings_Menu);
|
||||
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, "Cursor", onDrawSelColorItem, SelColor, &HMI_data.Cursor_color);
|
||||
ADDMENUITEM_P(0, "Title Background", onDrawSelColorItem, SelColor, &HMI_data.TitleBg_color);
|
||||
@ -3309,8 +3309,8 @@ void Draw_GetColor_Menu() {
|
||||
CurrentMenu = GetColorMenu;
|
||||
SetMenuTitle({0}, {0}, F("Get Color")); // TODO: Chinese, English "Get Color" JPG
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor);
|
||||
ADDMENUITEM(ICON_Cancel, GET_TEXT(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, DWIN_ApplyColor);
|
||||
ADDMENUITEM(ICON_Cancel, GET_TEXT_F(MSG_BUTTON_CANCEL), onDrawMenuItem, Draw_SelectColors_Menu);
|
||||
ADDMENUITEM(0, "Red", onDrawGetColorItem, SetRGBColor);
|
||||
ADDMENUITEM(1, "Green", onDrawGetColorItem, SetRGBColor);
|
||||
ADDMENUITEM(2, "Blue", onDrawGetColorItem, SetRGBColor);
|
||||
@ -3326,23 +3326,23 @@ void Draw_Tune_Menu() {
|
||||
CurrentMenu = TuneMenu;
|
||||
SetMenuTitle({73, 2, 28, 12}, {94, 2, 33, 11}, GET_TEXT_F(MSG_TUNE)); // TODO: Chinese, English "Tune" JPG
|
||||
DWINUI::MenuItemsPrepare(10);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess);
|
||||
ADDMENUITEM_P(ICON_Speed, GET_TEXT(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Goto_PrintProcess);
|
||||
ADDMENUITEM_P(ICON_Speed, GET_TEXT_F(MSG_SPEED), onDrawSpeedItem, SetSpeed, &feedrate_percentage);
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
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)
|
||||
ADDMENUITEM(ICON_FilMan, GET_TEXT(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament);
|
||||
ADDMENUITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament);
|
||||
#endif
|
||||
ADDMENUITEM(ICON_Lock, F("Lock Screen"), onDrawMenuItem, Goto_LockScreen);
|
||||
#if HAS_LCD_BRIGHTNESS
|
||||
@ -3359,14 +3359,14 @@ void Draw_Motion_Menu() {
|
||||
CurrentMenu = MotionMenu;
|
||||
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MOTION)); // TODO: Chinese, English "Motion" JPG
|
||||
DWINUI::MenuItemsPrepare(6);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
|
||||
ADDMENUITEM(ICON_MaxSpeed, GET_TEXT(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu);
|
||||
ADDMENUITEM(ICON_MaxAccelerated, GET_TEXT(MSG_ACCELERATION), onDrawAcc, Draw_MaxAccel_Menu);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Control_Menu);
|
||||
ADDMENUITEM(ICON_MaxSpeed, GET_TEXT_F(MSG_SPEED), onDrawSpeed, Draw_MaxSpeed_Menu);
|
||||
ADDMENUITEM(ICON_MaxAccelerated, GET_TEXT_F(MSG_ACCELERATION), onDrawAcc, Draw_MaxAccel_Menu);
|
||||
#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
|
||||
ADDMENUITEM(ICON_Step, GET_TEXT(MSG_STEPS_PER_MM), onDrawSteps, Draw_Steps_Menu);
|
||||
ADDMENUITEM_P(ICON_Flow, GET_TEXT(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]);
|
||||
ADDMENUITEM(ICON_Step, GET_TEXT_F(MSG_STEPS_PER_MM), onDrawSteps, Draw_Steps_Menu);
|
||||
ADDMENUITEM_P(ICON_Flow, GET_TEXT_F(MSG_FLOW), onDrawPIntMenu, SetFlow, &planner.flow_percentage[0]);
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
}
|
||||
@ -3379,12 +3379,12 @@ void Draw_Motion_Menu() {
|
||||
CurrentMenu = FilamentMenu;
|
||||
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_FILAMENT_MAN)); // TODO: Chinese, English "Filament Management" JPG
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_Park, GET_TEXT(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead);
|
||||
ADDMENUITEM(ICON_FilMan, GET_TEXT(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_Park, GET_TEXT_F(MSG_FILAMENT_PARK_ENABLED), onDrawMenuItem, ParkHead);
|
||||
ADDMENUITEM(ICON_FilMan, GET_TEXT_F(MSG_FILAMENTCHANGE), onDrawMenuItem, ChangeFilament);
|
||||
#if ENABLED(FILAMENT_LOAD_UNLOAD_GCODES)
|
||||
ADDMENUITEM(ICON_FilUnload, GET_TEXT(MSG_FILAMENTUNLOAD), onDrawMenuItem, UnloadFilament);
|
||||
ADDMENUITEM(ICON_FilLoad, GET_TEXT(MSG_FILAMENTLOAD), onDrawMenuItem, LoadFilament);
|
||||
ADDMENUITEM(ICON_FilUnload, GET_TEXT_F(MSG_FILAMENTUNLOAD), onDrawMenuItem, UnloadFilament);
|
||||
ADDMENUITEM(ICON_FilLoad, GET_TEXT_F(MSG_FILAMENTLOAD), onDrawMenuItem, LoadFilament);
|
||||
#endif
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3399,11 +3399,11 @@ void Draw_Motion_Menu() {
|
||||
CurrentMenu = ManualMesh;
|
||||
SetMenuTitle({0}, {0}, GET_TEXT_F(MSG_MANUAL_MESH)); // TODO: Chinese, English "Manual Mesh Leveling" JPG
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_ManualMesh, GET_TEXT(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart);
|
||||
MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, ¤t_position.z);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT(MSG_UBL_CONTINUE_MESH), onDrawMenuItem, ManualMeshContinue);
|
||||
ADDMENUITEM(ICON_MeshSave, GET_TEXT(MSG_UBL_SAVE_MESH), onDrawMenuItem, ManualMeshSave);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_ManualMesh, GET_TEXT_F(MSG_LEVEL_BED), onDrawMenuItem, ManualMeshStart);
|
||||
MMeshMoveZItem = ADDMENUITEM_P(ICON_Zoffset, GET_TEXT_F(MSG_MOVE_Z), onDrawMMeshMoveZ, SetMMeshMoveZ, ¤t_position.z);
|
||||
ADDMENUITEM(ICON_Axis, GET_TEXT_F(MSG_UBL_CONTINUE_MESH), onDrawMenuItem, ManualMeshContinue);
|
||||
ADDMENUITEM(ICON_MeshSave, GET_TEXT_F(MSG_UBL_SAVE_MESH), onDrawMenuItem, ManualMeshSave);
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
}
|
||||
@ -3417,18 +3417,18 @@ void Draw_Motion_Menu() {
|
||||
CurrentMenu = PreheatMenu;
|
||||
SetMenuTitle(cn, en, text);
|
||||
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
|
||||
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
|
||||
#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
|
||||
#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
|
||||
#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
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3464,15 +3464,15 @@ void Draw_Temperature_Menu() {
|
||||
CurrentMenu = TemperatureMenu;
|
||||
SetMenuTitle({236, 2, 28, 12}, {56, 15, 85, 14}, GET_TEXT_F(MSG_TEMPERATURE));
|
||||
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
|
||||
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
|
||||
#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
|
||||
#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
|
||||
#if HAS_HOTEND
|
||||
ADDMENUITEM(ICON_SetPLAPreheat, F(PREHEAT_1_LABEL " Preheat Settings"), onDrawPLAPreheatSubMenu, Draw_Preheat1_Menu);
|
||||
@ -3492,12 +3492,12 @@ void Draw_MaxSpeed_Menu() {
|
||||
CurrentMenu = MaxSpeedMenu;
|
||||
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_MAXSPEED));
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(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_MaxSpeedY, GET_TEXT(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(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
|
||||
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_F(MSG_MAXSPEED_Y), onDrawMaxSpeedY, SetMaxSpeedY, &planner.settings.max_feedrate_mm_s[Y_AXIS]);
|
||||
ADDMENUITEM_P(ICON_MaxSpeedZ, GET_TEXT_F(MSG_MAXSPEED_Z), onDrawMaxSpeedZ, SetMaxSpeedZ, &planner.settings.max_feedrate_mm_s[Z_AXIS]);
|
||||
#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
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3510,12 +3510,12 @@ void Draw_MaxAccel_Menu() {
|
||||
CurrentMenu = MaxAccelMenu;
|
||||
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_ACCELERATION));
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(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_MaxAccY, GET_TEXT(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(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
|
||||
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_F(MSG_AMAX_B), onDrawMaxAccelY, SetMaxAccelY, &planner.settings.max_acceleration_mm_per_s2[Y_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
|
||||
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
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3529,12 +3529,12 @@ void Draw_MaxAccel_Menu() {
|
||||
CurrentMenu = MaxJerkMenu;
|
||||
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_JERK));
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(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_MaxSpeedJerkY, GET_TEXT(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(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
|
||||
ADDMENUITEM_P(ICON_MaxSpeedJerkX, GET_TEXT_F(MSG_VA_JERK), onDrawMaxJerkX, SetMaxJerkX, &planner.max_jerk[X_AXIS]);
|
||||
ADDMENUITEM_P(ICON_MaxSpeedJerkY, GET_TEXT_F(MSG_VB_JERK), onDrawMaxJerkY, SetMaxJerkY, &planner.max_jerk[Y_AXIS]);
|
||||
ADDMENUITEM_P(ICON_MaxSpeedJerkZ, GET_TEXT_F(MSG_VC_JERK), onDrawMaxJerkZ, SetMaxJerkZ, &planner.max_jerk[Z_AXIS]);
|
||||
#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
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3548,12 +3548,12 @@ void Draw_Steps_Menu() {
|
||||
CurrentMenu = StepsMenu;
|
||||
SetMenuTitle({1, 16, 28, 13}, {144, 16, 46, 11}, GET_TEXT_F(MSG_STEPS_PER_MM));
|
||||
DWINUI::MenuItemsPrepare(5);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(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_StepY, GET_TEXT(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(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawBack, Draw_Motion_Menu);
|
||||
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_F(MSG_B_STEPS), onDrawStepsY, SetStepsY, &planner.settings.axis_steps_per_mm[Y_AXIS]);
|
||||
ADDMENUITEM_P(ICON_StepZ, GET_TEXT_F(MSG_C_STEPS), onDrawStepsZ, SetStepsZ, &planner.settings.axis_steps_per_mm[Z_AXIS]);
|
||||
#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
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3567,15 +3567,15 @@ void Draw_Steps_Menu() {
|
||||
CurrentMenu = HotendPIDMenu;
|
||||
CurrentMenu->MenuTitle.SetCaption(F("Hotend PID Settings"));
|
||||
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_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_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_PIDcycles, GET_TEXT(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles);
|
||||
ADDMENUITEM_P(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawPIntMenu, SetHotendPidT, &HMI_data.HotendPidT);
|
||||
ADDMENUITEM_P(ICON_PIDcycles, GET_TEXT_F(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles);
|
||||
#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
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3590,15 +3590,15 @@ void Draw_Steps_Menu() {
|
||||
CurrentMenu = BedPIDMenu;
|
||||
CurrentMenu->MenuTitle.SetCaption(F("Bed PID Settings"));
|
||||
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_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_KD), onDrawPIDd, SetKd, &thermalManager.temp_bed.pid.Kd);
|
||||
ADDMENUITEM_P(ICON_Temperature, GET_TEXT(MSG_TEMPERATURE), onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT);
|
||||
ADDMENUITEM_P(ICON_PIDcycles, GET_TEXT(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles);
|
||||
ADDMENUITEM_P(ICON_Temperature, GET_TEXT_F(MSG_TEMPERATURE), onDrawPIntMenu, SetBedPidT, &HMI_data.BedPidT);
|
||||
ADDMENUITEM_P(ICON_PIDcycles, GET_TEXT_F(MSG_PID_CYCLE), onDrawPIntMenu, SetPidCycles, &HMI_data.PidCycles);
|
||||
#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
|
||||
}
|
||||
CurrentMenu->draw();
|
||||
@ -3613,10 +3613,10 @@ void Draw_Steps_Menu() {
|
||||
CurrentMenu = ZOffsetWizMenu;
|
||||
CurrentMenu->MenuTitle.SetCaption(GET_TEXT_F(MSG_PROBE_WIZARD));
|
||||
DWINUI::MenuItemsPrepare(4);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT(MSG_BUTTON_BACK), onDrawMenuItem, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_Homing, GET_TEXT(MSG_AUTO_HOME), onDrawMenuItem, AutoHome);
|
||||
ADDMENUITEM(ICON_Back, GET_TEXT_F(MSG_BUTTON_BACK), onDrawMenuItem, Draw_Prepare_Menu);
|
||||
ADDMENUITEM(ICON_Homing, GET_TEXT_F(MSG_AUTO_HOME), onDrawMenuItem, AutoHome);
|
||||
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();
|
||||
if (!axis_is_trusted(Z_AXIS)) ui.set_status_P(PSTR("WARNING: Z position is unknow, move Z to home"));
|
||||
|
@ -37,7 +37,7 @@
|
||||
// str: multi-bit data
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#if ENABLED(DWIN_CREALITY_LCD_ENHANCED)
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
#include "../../../core/macros.h"
|
||||
#include "dwin_lcd.h"
|
||||
#include "dwinui.h"
|
||||
|
||||
|
@ -124,9 +124,9 @@ public:
|
||||
rect_t frame = {0};
|
||||
void draw();
|
||||
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);
|
||||
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(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);
|
||||
@ -146,7 +146,7 @@ public:
|
||||
void (*onClick)() = nullptr;
|
||||
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 __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);
|
||||
void SetFrame(uint8_t id, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2);
|
||||
virtual ~MenuItemClass(){};
|
||||
@ -158,7 +158,7 @@ public:
|
||||
void *value = nullptr;
|
||||
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 __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 {
|
||||
@ -351,25 +351,25 @@ namespace DWINUI {
|
||||
inline void Draw_String(uint16_t x, uint16_t y, const char * const 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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ namespace DWINUI {
|
||||
// y: Upper coordinate of 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);
|
||||
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);
|
||||
}
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
inline void Draw_CenteredString(uint16_t color, uint16_t y, const char * const 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);
|
||||
}
|
||||
inline void Draw_CenteredString(uint16_t y, const char * const 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);
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,8 @@
|
||||
* @brief DWIN screen control functions
|
||||
********************************************************************************/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if ENABLED(DWIN_MARLINUI_LANDSCAPE)
|
||||
#define DWIN_WIDTH 480
|
||||
#define DWIN_HEIGHT 272
|
||||
|
@ -65,7 +65,7 @@ class DWIN_String {
|
||||
static void set(uint8_t *string) { set(); add(string); }
|
||||
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 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, int8_t index, const char *itemString=nullptr) { set((uint8_t *)string, index, itemString); }
|
||||
static inline void add(const char *string) { add((uint8_t *)string); }
|
||||
|
@ -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
|
||||
* files must be written sequentially following by a chip erase and it is not possible to
|
||||
* 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)
|
||||
uint32_t addr;
|
||||
uint8_t buff[write_page_size];
|
||||
@ -543,7 +543,7 @@ bool UIFlashStorage::is_present = false;
|
||||
void UIFlashStorage::write_config_data(const void *, size_t) {}
|
||||
bool UIFlashStorage::verify_config_data(const 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() {}
|
||||
|
||||
bool UIFlashStorage::BootMediaReader::isAvailable(uint32_t) {return false;}
|
||||
|
@ -88,7 +88,7 @@ class UIFlashStorage : private SPIFlash {
|
||||
static void write_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 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;
|
||||
};
|
||||
|
@ -105,7 +105,7 @@ bool BioPrintingDialogBox::onTouchEnd(uint8_t tag) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void BioPrintingDialogBox::setStatusMessage(progmem_str message) {
|
||||
void BioPrintingDialogBox::setStatusMessage(FSTR_P message) {
|
||||
char buff[strlen_P((const char*)message)+1];
|
||||
strcpy_P(buff, (const char*) message);
|
||||
setStatusMessage(buff);
|
||||
|
@ -37,7 +37,7 @@ class BioPrintingDialogBox : public BaseScreen, public CachedScreen<PRINTING_SCR
|
||||
static void show();
|
||||
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
|
||||
static void onIdle();
|
||||
static bool onTouchEnd(uint8_t tag);
|
||||
|
@ -354,7 +354,7 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(progmem_str pstr) {
|
||||
void StatusScreen::setStatusMessage(FSTR_P pstr) {
|
||||
BioPrintingDialogBox::setStatusMessage(pstr);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE>
|
||||
static void unlockMotors();
|
||||
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
||||
|
@ -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_ROWS 2
|
||||
|
||||
|
@ -35,7 +35,7 @@ class PreheatTimerScreen : public BaseScreen, public CachedScreen<PREHEAT_TIMER_
|
||||
static void draw_message(draw_mode_t);
|
||||
static void draw_time_remaining(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:
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
||||
|
@ -279,7 +279,7 @@ bool StatusScreen::onTouchHeld(uint8_t tag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(progmem_str) {
|
||||
void StatusScreen::setStatusMessage(FSTR_P) {
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(const char * const) {
|
||||
|
@ -44,7 +44,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE>
|
||||
static void unlockMotors();
|
||||
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
|
||||
static void onRedraw(draw_mode_t);
|
||||
|
||||
|
@ -49,5 +49,5 @@
|
||||
#endif
|
||||
|
||||
class __FlashStringHelper;
|
||||
typedef const __FlashStringHelper *progmem_str;
|
||||
typedef const __FlashStringHelper *FSTR_P;
|
||||
extern const char G28_STR[];
|
||||
|
@ -71,7 +71,7 @@ namespace ExtUI {
|
||||
}
|
||||
|
||||
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() {
|
||||
InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_STARTED);
|
||||
|
@ -66,7 +66,7 @@ uint16_t CLCD::FontMetrics::get_text_width(const char *str, size_t n) const {
|
||||
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;
|
||||
const uint8_t *p = (const uint8_t *) str;
|
||||
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
|
||||
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_write_addr(reg_address);
|
||||
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)
|
||||
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_write_addr(reg_address);
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
@ -1071,7 +1071,7 @@ void CLCD::CommandFifo::str(const char * data) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
typedef const __FlashStringHelper *progmem_str;
|
||||
typedef const __FlashStringHelper *FSTR_P;
|
||||
|
||||
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_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_bulk (uint32_t reg_address, progmem_str 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_bulk (uint32_t reg_address, FSTR_P 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:
|
||||
class CommandFifo;
|
||||
@ -168,7 +168,7 @@ class CLCD::FontMetrics {
|
||||
|
||||
// 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(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 *********************************/
|
||||
@ -250,7 +250,7 @@ class CLCD::CommandFifo {
|
||||
// Sends the string portion of text, button, toggle and keys.
|
||||
void str (const char * data, size_t maxlen);
|
||||
void str (const char * data);
|
||||
void str (progmem_str data);
|
||||
void str (FSTR_P data);
|
||||
|
||||
void memzero (uint32_t ptr, uint32_t size);
|
||||
void memset (uint32_t ptr, uint32_t value, uint32_t size);
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define DEC_POS SUB_POS(8,1), SUB_SIZE(2,1)
|
||||
|
||||
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)];
|
||||
if (isnan(value))
|
||||
strcpy_P(str, PSTR("-"));
|
||||
@ -45,7 +45,7 @@ namespace FTDI {
|
||||
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)
|
||||
cmd.tag(0).button(VAL_POS, F(""), FTDI::OPT_FLAT);
|
||||
|
||||
|
@ -25,7 +25,7 @@ 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 = nullptr,
|
||||
float value, FSTR_P units = nullptr,
|
||||
int8_t width = 5, uint8_t precision = 1
|
||||
);
|
||||
|
||||
@ -33,7 +33,7 @@ namespace FTDI {
|
||||
CommandProcessor& cmd,
|
||||
int16_t x, int16_t y, int16_t w, int16_t h,
|
||||
uint8_t tag,
|
||||
float value, progmem_str units = nullptr,
|
||||
float value, FSTR_P units = nullptr,
|
||||
int8_t width = 5, uint8_t precision = 1,
|
||||
draw_mode_t what = BOTH
|
||||
);
|
||||
|
@ -241,7 +241,7 @@ class CommandProcessor : public CLCD::CommandFifo {
|
||||
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];
|
||||
strcpy_P(text, (const char *)no);
|
||||
strcat(text, "\xFF");
|
||||
|
@ -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];
|
||||
strcpy_P(str, (const char*)pstr);
|
||||
draw_text_box(cmd, x, y, w, h, (const char*) str, options, font);
|
||||
|
@ -27,6 +27,6 @@
|
||||
namespace FTDI {
|
||||
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);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ namespace FTDI {
|
||||
_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];
|
||||
strcpy_P(tmp, (const char*)pstr);
|
||||
_draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font);
|
||||
|
@ -26,6 +26,6 @@
|
||||
* showing ellipsis if it does not fit.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FTDI::has_utf8_chars(progmem_str _str) {
|
||||
bool FTDI::has_utf8_chars(FSTR_P _str) {
|
||||
const char *str = (const char *) _str;
|
||||
for (;;) {
|
||||
const char c = pgm_read_byte(str++);
|
||||
@ -191,7 +191,7 @@
|
||||
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];
|
||||
strcpy_P(str, (const char*)pstr);
|
||||
return get_utf8_text_width(str, fs);
|
||||
@ -234,7 +234,7 @@
|
||||
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];
|
||||
strcpy_P(str, (const char*)pstr);
|
||||
draw_utf8_text(cmd, x, y, (const char*) str, fs, options);
|
||||
|
@ -40,7 +40,7 @@ namespace FTDI {
|
||||
|
||||
/* 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);
|
||||
|
||||
/* Returns the next character in a UTF8 string and increments the
|
||||
@ -66,10 +66,10 @@ namespace FTDI {
|
||||
void load_utf8_bitmaps(CommandProcessor& cmd);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
// Similar to CLCD::FontMetrics, but can be used with UTF8 encoded strings.
|
||||
|
@ -83,7 +83,7 @@ void AboutScreen::onRedraw(draw_mode_t) {
|
||||
#ifdef TOUCH_UI_VERSION
|
||||
F(TOUCH_UI_VERSION)
|
||||
#else
|
||||
progmem_str(getFirmwareName_str())
|
||||
FPSTR(getFirmwareName_str())
|
||||
#endif
|
||||
, OPT_CENTER, font_medium);
|
||||
cmd.tag(0);
|
||||
|
@ -64,8 +64,8 @@ void AlertDialogBox::hide() {
|
||||
}
|
||||
|
||||
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(progmem_str);
|
||||
template void AlertDialogBox::showError(FSTR_P);
|
||||
|
||||
#endif // FTDI_ALERT_DIALOG_BOX
|
||||
|
@ -109,7 +109,7 @@ void BaseNumericAdjustmentScreen::widgets_t::_button_style(CommandProcessor &cmd
|
||||
* Speed optimization for drawing buttons. Draw all unpressed buttons in the
|
||||
* 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) || buttonIsPressed(tag) || highlight || !enabled) {
|
||||
_button_style(cmd, (!enabled) ? BTN_DISABLED : (highlight ? BTN_ACTION : BTN_NORMAL));
|
||||
@ -125,7 +125,7 @@ BaseNumericAdjustmentScreen::widgets_t &BaseNumericAdjustmentScreen::widgets_t::
|
||||
return *this;
|
||||
}
|
||||
|
||||
void BaseNumericAdjustmentScreen::widgets_t::heading(progmem_str label) {
|
||||
void BaseNumericAdjustmentScreen::widgets_t::heading(FSTR_P label) {
|
||||
if (_what & BACKGROUND) {
|
||||
CommandProcessor cmd;
|
||||
_button_style(cmd, TEXT_LABEL);
|
||||
@ -176,13 +176,13 @@ void BaseNumericAdjustmentScreen::widgets_t::_draw_increment_btn(CommandProcesso
|
||||
|
||||
switch (pos) {
|
||||
#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 1: _button(cmd, tag, BTN_POS(7,_line), BTN_SIZE(2,1), progmem_str(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(9,_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), FPSTR(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(9,_line), BTN_SIZE(2,1), FPSTR(label), true, highlight); break;
|
||||
#else
|
||||
case 0: _button(cmd, tag, BTN_POS(15,2), BTN_SIZE(4,1), progmem_str(label), true, highlight); break;
|
||||
case 1: _button(cmd, tag, BTN_POS(15,3), BTN_SIZE(4,1), progmem_str(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(15,4), 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), FPSTR(label), true, highlight); break;
|
||||
case 2: _button(cmd, tag, BTN_POS(15,4), BTN_SIZE(4,1), FPSTR(label), true, highlight); break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ void BaseNumericAdjustmentScreen::widgets_t::increments() {
|
||||
#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;
|
||||
|
||||
if (_what & BACKGROUND) {
|
||||
@ -239,7 +239,7 @@ void BaseNumericAdjustmentScreen::widgets_t::adjuster_sram_val(uint8_t tag, prog
|
||||
_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) {
|
||||
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) {
|
||||
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;
|
||||
cmd.font(LAYOUT_FONT);
|
||||
_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++;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (_what & BACKGROUND) {
|
||||
@ -295,7 +295,7 @@ void BaseNumericAdjustmentScreen::widgets_t::text_field(uint8_t tag, progmem_str
|
||||
_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;
|
||||
cmd.font(LAYOUT_FONT);
|
||||
_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++;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (_what & BACKGROUND) {
|
||||
|
@ -44,7 +44,7 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
|
||||
uint8_t _line;
|
||||
uint32_t _color;
|
||||
uint8_t _decimals;
|
||||
progmem_str _units;
|
||||
FSTR_P _units;
|
||||
enum style_t {
|
||||
BTN_NORMAL,
|
||||
BTN_ACTION,
|
||||
@ -56,25 +56,25 @@ class BaseNumericAdjustmentScreen : public BaseScreen {
|
||||
|
||||
protected:
|
||||
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);
|
||||
public:
|
||||
widgets_t(draw_mode_t);
|
||||
|
||||
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 &precision(uint8_t decimals, precision_default_t = DEFAULT_HIGHEST);
|
||||
|
||||
void heading (progmem_str label);
|
||||
void adjuster_sram_val (uint8_t tag, progmem_str 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, progmem_str label, float value=0, bool is_enabled = true);
|
||||
void button (uint8_t tag, progmem_str label, bool is_enabled = true);
|
||||
void text_field (uint8_t tag, progmem_str label, const char *value, bool is_enabled = true);
|
||||
void two_buttons (uint8_t tag1, progmem_str label1,
|
||||
uint8_t tag2, progmem_str label2, bool is_enabled = true);
|
||||
void toggle (uint8_t tag, progmem_str label, bool value, bool is_enabled = true);
|
||||
void heading (FSTR_P label);
|
||||
void adjuster_sram_val (uint8_t tag, FSTR_P 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, FSTR_P label, float value=0, bool is_enabled = true);
|
||||
void button (uint8_t tag, FSTR_P label, 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, FSTR_P label1,
|
||||
uint8_t tag2, FSTR_P label2, 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 increments ();
|
||||
};
|
||||
|
@ -25,7 +25,7 @@
|
||||
#define FTDI_BED_MESH_VIEW_SCREEN_CLASS BedMeshViewScreen
|
||||
|
||||
struct BedMeshViewScreenData {
|
||||
progmem_str message;
|
||||
FSTR_P message;
|
||||
uint8_t count;
|
||||
xy_uint8_t highlight;
|
||||
};
|
||||
|
@ -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(progmem_str, int16_t font);
|
||||
template void DialogBoxBaseClass::drawMessage(FSTR_P, int16_t font);
|
||||
|
||||
void DialogBoxBaseClass::drawYesNoButtons(uint8_t default_btn) {
|
||||
CommandProcessor cmd;
|
||||
@ -67,7 +67,7 @@ void DialogBoxBaseClass::drawButton(T label) {
|
||||
}
|
||||
|
||||
template void DialogBoxBaseClass::drawButton(const char *);
|
||||
template void DialogBoxBaseClass::drawButton(progmem_str);
|
||||
template void DialogBoxBaseClass::drawButton(FSTR_P);
|
||||
|
||||
bool DialogBoxBaseClass::onTouchEnd(uint8_t tag) {
|
||||
switch (tag) {
|
||||
|
@ -39,7 +39,7 @@ void FilamentRunoutScreen::onRedraw(draw_mode_t what) {
|
||||
w.units(GET_TEXT_F(MSG_UNITS_MM));
|
||||
w.precision(0);
|
||||
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();
|
||||
#endif
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ void LockScreen::onRedraw(draw_mode_t what) {
|
||||
#define MARGIN_T 3
|
||||
#define MARGIN_B 3
|
||||
|
||||
progmem_str message;
|
||||
FSTR_P message;
|
||||
switch (message_style()) {
|
||||
case 'w':
|
||||
message = GET_TEXT_F(MSG_PASSCODE_REJECTED);
|
||||
|
@ -60,7 +60,7 @@ void SpinnerDialogBox::onRefresh() {
|
||||
void SpinnerDialogBox::onRedraw(draw_mode_t) {
|
||||
}
|
||||
|
||||
void SpinnerDialogBox::show(progmem_str message) {
|
||||
void SpinnerDialogBox::show(FSTR_P message) {
|
||||
CommandProcessor cmd;
|
||||
if (AT_SCREEN(SpinnerDialogBox)) cmd.stop().execute();
|
||||
cmd.cmd(CMD_DLSTART)
|
||||
@ -86,13 +86,13 @@ void SpinnerDialogBox::hide() {
|
||||
GOTO_PREVIOUS();
|
||||
}
|
||||
|
||||
void SpinnerDialogBox::enqueueAndWait(progmem_str message, progmem_str commands) {
|
||||
void SpinnerDialogBox::enqueueAndWait(FSTR_P message, FSTR_P commands) {
|
||||
show(message);
|
||||
ExtUI::injectCommands_P((const char*)commands);
|
||||
mydata.auto_hide = true;
|
||||
}
|
||||
|
||||
void SpinnerDialogBox::enqueueAndWait(progmem_str message, char *commands) {
|
||||
void SpinnerDialogBox::enqueueAndWait(FSTR_P message, char *commands) {
|
||||
show(message);
|
||||
ExtUI::injectCommands(commands);
|
||||
mydata.auto_hide = true;
|
||||
|
@ -37,12 +37,12 @@ class SpinnerDialogBox : public UIScreen {
|
||||
static void onRefresh();
|
||||
static void onIdle();
|
||||
|
||||
static void show(progmem_str);
|
||||
static void show(FSTR_P);
|
||||
static void hide();
|
||||
|
||||
template<typename T>
|
||||
static void enqueueAndWait(T commands) {enqueueAndWait(GET_TEXT_F(MSG_PLEASE_WAIT), commands);}
|
||||
|
||||
static void enqueueAndWait(progmem_str message, char *commands);
|
||||
static void enqueueAndWait(progmem_str message, progmem_str commands);
|
||||
static void enqueueAndWait(FSTR_P message, char *commands);
|
||||
static void enqueueAndWait(FSTR_P message, FSTR_P commands);
|
||||
};
|
||||
|
@ -344,7 +344,7 @@ void StatusScreen::draw_status_message(draw_mode_t what, const char *message) {
|
||||
#undef GRID_COLS
|
||||
}
|
||||
|
||||
void StatusScreen::setStatusMessage(progmem_str message) {
|
||||
void StatusScreen::setStatusMessage(FSTR_P message) {
|
||||
char buff[strlen_P((const char * const)message)+1];
|
||||
strcpy_P(buff, (const char * const) message);
|
||||
setStatusMessage((const char *) buff);
|
||||
|
@ -36,7 +36,7 @@ class StatusScreen : public BaseScreen, public CachedScreen<STATUS_SCREEN_CACHE,
|
||||
public:
|
||||
static void loadBitmaps();
|
||||
static void setStatusMessage(const char *);
|
||||
static void setStatusMessage(progmem_str);
|
||||
static void setStatusMessage(FSTR_P);
|
||||
static void onRedraw(draw_mode_t);
|
||||
static void onStartup();
|
||||
static void onEntry();
|
||||
|
@ -59,7 +59,7 @@ void StressTestScreen::onRedraw(draw_mode_t) {
|
||||
.cmd(CLEAR(true,true,true))
|
||||
.cmd(COLOR_RGB(bg_text_enabled))
|
||||
.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));
|
||||
|
||||
|
@ -397,6 +397,7 @@ namespace Language_en {
|
||||
LSTR MSG_ADVANCE_K = _UxGT("Advance K");
|
||||
LSTR MSG_ADVANCE_K_E = _UxGT("Advance K *");
|
||||
LSTR MSG_CONTRAST = _UxGT("LCD Contrast");
|
||||
LSTR MSG_BRIGHTNESS = _UxGT("LCD Brightness");
|
||||
LSTR MSG_STORE_EEPROM = _UxGT("Store Settings");
|
||||
LSTR MSG_LOAD_EEPROM = _UxGT("Load Settings");
|
||||
LSTR MSG_RESTORE_DEFAULTS = _UxGT("Restore Defaults");
|
||||
|
@ -50,8 +50,8 @@ inline void reset_bricks(const uint16_t v) {
|
||||
void reset_ball() {
|
||||
constexpr uint8_t ball_dist = 24;
|
||||
bdat.bally = BTOF(PADDLE_Y - ball_dist);
|
||||
bdat.ballv = FTOP(1.3f);
|
||||
bdat.ballh = -FTOP(1.25f);
|
||||
bdat.ballv = FTOF(1.3f);
|
||||
bdat.ballh = -FTOF(1.25f);
|
||||
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; }
|
||||
bdat.ballx = BTOF(bx);
|
||||
|
@ -63,7 +63,7 @@
|
||||
#define SNAKE_SIZ SNAKE_BOX
|
||||
#endif
|
||||
|
||||
constexpr fixed_t snakev = FTOP(0.20);
|
||||
constexpr fixed_t snakev = FTOF(0.20);
|
||||
|
||||
snake_data_t &sdat = marlin_game_data.snake;
|
||||
|
||||
@ -125,7 +125,7 @@ void snake_reset() {
|
||||
// Init the head and velocity
|
||||
sdat.snakex = BTOF(1);
|
||||
sdat.snakey = BTOF(GAME_H / 2);
|
||||
//snakev = FTOP(0.25);
|
||||
//snakev = FTOF(0.25);
|
||||
|
||||
// Init the tail with a cw turn
|
||||
sdat.snake_dir = 0;
|
||||
|
@ -27,7 +27,7 @@ typedef struct { int8_t x, y; } pos_t;
|
||||
|
||||
// Simple 8:8 fixed-point
|
||||
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 BTOF(X) (fixed_t(X)<<8)
|
||||
#define FTOB(X) int8_t(fixed_t(X)>>8)
|
||||
|
@ -114,7 +114,7 @@ class MenuItem_confirm : public MenuItemBase {
|
||||
static inline void select_screen(
|
||||
PGM_P const yes, PGM_P const no,
|
||||
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];
|
||||
strcpy_P(str, (PGM_P)string);
|
||||
|
Loading…
Reference in New Issue
Block a user