From f7d5188b2f0a59b752fbabf6b96ff1ed4aed8112 Mon Sep 17 00:00:00 2001 From: GHGiampy <83699429+GHGiampy@users.noreply.github.com> Date: Sat, 19 Aug 2023 22:53:45 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixes=20for=20ProUI,=20build=20r?= =?UTF-8?q?ename=20(#26177)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Scott Lahteine --- Marlin/src/feature/caselight.h | 2 +- Marlin/src/lcd/e3v2/proui/dwin.cpp | 65 ++++++++++++------- Marlin/src/lcd/e3v2/proui/dwin.h | 3 + Marlin/src/lcd/e3v2/proui/dwin_defines.h | 2 +- Marlin/src/lcd/e3v2/proui/menus.cpp | 12 ++-- Marlin/src/lcd/e3v2/proui/menus.h | 6 +- Marlin/src/module/motion.h | 2 +- .../PlatformIO/scripts/offset_and_rename.py | 5 +- buildroot/share/scripts/upload.py | 3 +- 9 files changed, 61 insertions(+), 39 deletions(-) diff --git a/Marlin/src/feature/caselight.h b/Marlin/src/feature/caselight.h index 17e1222acbfa..d88b3d67bf83 100644 --- a/Marlin/src/feature/caselight.h +++ b/Marlin/src/feature/caselight.h @@ -30,7 +30,7 @@ class CaseLight { public: static bool on; - #if ENABLED(CASELIGHT_USES_BRIGHTNESS) + #if CASELIGHT_USES_BRIGHTNESS static uint8_t brightness; #endif diff --git a/Marlin/src/lcd/e3v2/proui/dwin.cpp b/Marlin/src/lcd/e3v2/proui/dwin.cpp index 824b730019b1..7c69d0f900d8 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin.cpp @@ -214,13 +214,13 @@ Menu *prepareMenu = nullptr; Menu *trammingMenu = nullptr; #endif Menu *moveMenu = nullptr; -Menu *ControlMenu = nullptr; -Menu *AdvancedSettings = nullptr; +Menu *controlMenu = nullptr; +Menu *advancedSettingsMenu = nullptr; #if HAS_HOME_OFFSET Menu *homeOffsetMenu = nullptr; #endif #if HAS_BED_PROBE - Menu *ProbeSetMenu = nullptr; + Menu *probeSettingsMenu = nullptr; #endif Menu *filSetMenu = nullptr; Menu *selectColorMenu = nullptr; @@ -229,7 +229,7 @@ Menu *tuneMenu = nullptr; Menu *motionMenu = nullptr; Menu *filamentMenu = nullptr; #if ENABLED(MESH_BED_LEVELING) - Menu *manualMesh = nullptr; + Menu *manualMeshMenu = nullptr; #endif #if HAS_PREHEAT Menu *preheatMenu = nullptr; @@ -251,7 +251,7 @@ Menu *stepsMenu = nullptr; #if ENABLED(PIDTEMPBED) && ANY(PID_EDIT_MENU, PID_AUTOTUNE_MENU) Menu *bedPIDMenu = nullptr; #endif -#if ENABLED(CASELIGHT_USES_BRIGHTNESS) +#if CASELIGHT_USES_BRIGHTNESS Menu *caseLightMenu = nullptr; #endif #if ENABLED(LED_CONTROL_MENU) @@ -2152,9 +2152,10 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, toggleCheckboxLine(caselight.on); caselight.update_enabled(); } - #if ENABLED(CASELIGHT_USES_BRIGHTNESS) + #if CASELIGHT_USES_BRIGHTNESS + bool enableLiveCaseLightBrightness = true; void liveCaseLightBrightness() { caselight.brightness = menuData.value; caselight.update_brightness(); } - void setCaseLightBrightness() { setIntOnClick(0, 255, caselight.brightness, nullptr, liveCaseLightBrightness); } + void setCaseLightBrightness() { setIntOnClick(0, 255, caselight.brightness, liveCaseLightBrightness, enableLiveCaseLightBrightness ? liveCaseLightBrightness : nullptr); } #endif #endif @@ -2166,10 +2167,12 @@ void setMoveZ() { hmiValue.axis = Z_AXIS; setPFloatOnClick(Z_MIN_POS, Z_MAX_POS, } #endif #if HAS_COLOR_LEDS + bool enableLiveLedColor = true; void applyLEDColor() { hmiData.ledColor = LEDColor( {leds.color.r, leds.color.g, leds.color.b OPTARG(HAS_WHITE_LED, hmiData.ledColor.w) } ); + if (!enableLiveLedColor) leds.update(); } - void liveLEDColor(uint8_t *color) { *color = menuData.value; leds.update(); } + void liveLEDColor(uint8_t *color) { *color = menuData.value; if (enableLiveLedColor) leds.update(); } void liveLEDColorR() { liveLEDColor(&leds.color.r); } void liveLEDColorG() { liveLEDColor(&leds.color.g); } void liveLEDColorB() { liveLEDColor(&leds.color.b); } @@ -3039,35 +3042,37 @@ void drawPrepareMenu() { void drawControlMenu() { checkkey = ID_Menu; - if (SET_MENU_R(ControlMenu, selrect({103, 1, 28, 14}), MSG_CONTROL, 11)) { + if (SET_MENU_R(controlMenu, selrect({103, 1, 28, 14}), MSG_CONTROL, 11)) { BACK_ITEM(gotoMainMenu); MENU_ITEM(ICON_Temperature, MSG_TEMPERATURE, onDrawTempSubMenu, drawTemperatureMenu); MENU_ITEM(ICON_Motion, MSG_MOTION, onDrawMotionSubMenu, drawMotionMenu); - #if ENABLED(EEPROM_SETTINGS) - MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, writeEEPROM); - MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, readEEPROM); - MENU_ITEM(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, resetEEPROM); - #endif - MENU_ITEM(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, rebootPrinter); #if ENABLED(CASE_LIGHT_MENU) - #if ENABLED(CASELIGHT_USES_BRIGHTNESS) + #if CASELIGHT_USES_BRIGHTNESS + enableLiveCaseLightBrightness = true; // Allow live update of brightness in control menu MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawSubMenu, drawCaseLightMenu); #else MENU_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); #endif #endif #if ENABLED(LED_CONTROL_MENU) + enableLiveLedColor = true; // Allow live update of color in control menu MENU_ITEM(ICON_LedControl, MSG_LED_CONTROL, onDrawSubMenu, drawLedControlMenu); #endif + #if ENABLED(EEPROM_SETTINGS) + MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawWriteEeprom, writeEEPROM); + MENU_ITEM(ICON_ReadEEPROM, MSG_LOAD_EEPROM, onDrawReadEeprom, readEEPROM); + MENU_ITEM(ICON_ResumeEEPROM, MSG_RESTORE_DEFAULTS, onDrawResetEeprom, resetEEPROM); + #endif + MENU_ITEM(ICON_Reboot, MSG_RESET_PRINTER, onDrawMenuItem, rebootPrinter); MENU_ITEM(ICON_Info, MSG_INFO_SCREEN, onDrawInfoSubMenu, gotoInfoMenu); } ui.reset_status(true); - updateMenu(ControlMenu); + updateMenu(controlMenu); } void drawAdvancedSettingsMenu() { checkkey = ID_Menu; - if (SET_MENU(AdvancedSettings, MSG_ADVANCED_SETTINGS, 23)) { + if (SET_MENU(advancedSettingsMenu, MSG_ADVANCED_SETTINGS, 23)) { BACK_ITEM(gotoMainMenu); #if ENABLED(EEPROM_SETTINGS) MENU_ITEM(ICON_WriteEEPROM, MSG_STORE_EEPROM, onDrawMenuItem, writeEEPROM); @@ -3129,7 +3134,7 @@ void drawAdvancedSettingsMenu() { #endif } ui.reset_status(true); - updateMenu(AdvancedSettings); + updateMenu(advancedSettingsMenu); } void drawMoveMenu() { @@ -3180,7 +3185,7 @@ void drawMoveMenu() { void drawProbeSetMenu() { checkkey = ID_Menu; - if (SET_MENU(ProbeSetMenu, MSG_ZPROBE_SETTINGS, 9)) { + if (SET_MENU(probeSettingsMenu, MSG_ZPROBE_SETTINGS, 9)) { BACK_ITEM(drawAdvancedSettingsMenu); #if HAS_X_AXIS EDIT_ITEM(ICON_ProbeOffsetX, MSG_ZPROBE_XOFFSET, onDrawPFloatMenu, setProbeOffsetX, &probe.offset.x); @@ -3203,7 +3208,7 @@ void drawMoveMenu() { MENU_ITEM(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, probeTest); #endif } - updateMenu(ProbeSetMenu); + updateMenu(probeSettingsMenu); } #endif // HAS_BED_PROBE @@ -3251,7 +3256,7 @@ void drawFilSetMenu() { void drawLedControlMenu() { checkkey = ID_Menu; if (SET_MENU(ledControlMenu, MSG_LED_CONTROL, 10)) { - BACK_ITEM(drawControlMenu); + BACK_ITEM((currentMenu == tuneMenu) ? drawTuneMenu : drawControlMenu); #if !ALL(CASE_LIGHT_MENU, CASE_LIGHT_USE_NEOPIXEL) EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, setLedStatus, &leds.lights_on); #endif @@ -3282,7 +3287,7 @@ void drawFilSetMenu() { void drawTuneMenu() { checkkey = ID_Menu; - if (SET_MENU_R(tuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 17)) { + if (SET_MENU_R(tuneMenu, selrect({73, 2, 28, 12}), MSG_TUNE, 18)) { BACK_ITEM(gotoPrintProcess); EDIT_ITEM(ICON_Speed, MSG_SPEED, onDrawSpeedItem, setSpeed, &feedrate_percentage); #if HAS_HOTEND @@ -3327,6 +3332,16 @@ void drawTuneMenu() { #endif #if ENABLED(CASE_LIGHT_MENU) EDIT_ITEM(ICON_CaseLight, MSG_CASE_LIGHT, onDrawChkbMenu, setCaseLight, &caselight.on); + #if CASELIGHT_USES_BRIGHTNESS + // Avoid heavy interference with print job disabling live update of brightness in tune menu + enableLiveCaseLightBrightness = false; + EDIT_ITEM(ICON_Brightness, MSG_CASE_LIGHT_BRIGHTNESS, onDrawPInt8Menu, setCaseLightBrightness, &caselight.brightness); + #endif + #if ENABLED(LED_CONTROL_MENU) + // Avoid heavy interference with print job disabling live update of color in tune menu + enableLiveLedColor = false; + MENU_ITEM(ICON_LedControl, MSG_LED_CONTROL, onDrawSubMenu, drawLedControlMenu); + #endif #elif ENABLED(LED_CONTROL_MENU) && DISABLED(CASE_LIGHT_USE_NEOPIXEL) EDIT_ITEM(ICON_LedControl, MSG_LEDS, onDrawChkbMenu, setLedStatus, &leds.lights_on); #endif @@ -3478,7 +3493,7 @@ void drawMotionMenu() { void drawManualMeshMenu() { checkkey = ID_Menu; - if (SET_MENU(manualMesh, MSG_UBL_MANUAL_MESH, 6)) { + if (SET_MENU(manualMeshMenu, MSG_UBL_MANUAL_MESH, 6)) { BACK_ITEM(drawPrepareMenu); MENU_ITEM(ICON_ManualMesh, MSG_LEVEL_BED, onDrawMenuItem, manualMeshStart); mMeshMoveZItem = EDIT_ITEM(ICON_Zoffset, MSG_MOVE_Z, onDrawMMeshMoveZ, setMMeshMoveZ, ¤t_position.z); @@ -3486,7 +3501,7 @@ void drawMotionMenu() { MENU_ITEM(ICON_MeshViewer, MSG_MESH_VIEW, onDrawSubMenu, dwinMeshViewer); MENU_ITEM(ICON_MeshSave, MSG_UBL_SAVE_MESH, onDrawMenuItem, manualMeshSave); } - updateMenu(manualMesh); + updateMenu(manualMeshMenu); } #endif // MESH_BED_LEVELING diff --git a/Marlin/src/lcd/e3v2/proui/dwin.h b/Marlin/src/lcd/e3v2/proui/dwin.h index ccc90b3de608..21b72d321a60 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin.h +++ b/Marlin/src/lcd/e3v2/proui/dwin.h @@ -35,6 +35,9 @@ #include "../common/encoder.h" #include "../common/limits.h" #include "../../../libs/BL24CXX.h" +#if ENABLED(LED_CONTROL_MENU) + #include "../../../feature/leds/leds.h" +#endif #if ANY(BABYSTEPPING, HAS_BED_PROBE) #define HAS_ZOFFSET_ITEM 1 diff --git a/Marlin/src/lcd/e3v2/proui/dwin_defines.h b/Marlin/src/lcd/e3v2/proui/dwin_defines.h index 8ac7c5eb6231..e3526849a808 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_defines.h +++ b/Marlin/src/lcd/e3v2/proui/dwin_defines.h @@ -66,7 +66,7 @@ #if ALL(LED_CONTROL_MENU, HAS_COLOR_LEDS) #define defColorLeds LEDColorWhite() #endif -#if ENABLED(CASELIGHT_USES_BRIGHTNESS) +#if CASELIGHT_USES_BRIGHTNESS #define defCaseLightBrightness 255 #endif #ifdef Z_AFTER_HOMING diff --git a/Marlin/src/lcd/e3v2/proui/menus.cpp b/Marlin/src/lcd/e3v2/proui/menus.cpp index 347130743c63..d537bc5ae663 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.cpp +++ b/Marlin/src/lcd/e3v2/proui/menus.cpp @@ -507,25 +507,25 @@ void initMenu() { bool setMenu(Menu* &menu, FSTR_P fTitle, int8_t totalitems) { if (!menu) menu = new Menu(); - const bool NotCurrent = (currentMenu != menu); - if (NotCurrent) { + const bool notCurrent = (currentMenu != menu); + if (notCurrent) { menu->menuTitle.setCaption(fTitle); menuItemsPrepare(totalitems); } - return NotCurrent; + return notCurrent; } bool setMenu(Menu* &menu, frame_rect_t cn, FSTR_P fTitle, int8_t totalitems) { if (!menu) menu = new Menu(); - const bool NotCurrent = (currentMenu != menu); - if (NotCurrent) { + const bool notCurrent = (currentMenu != menu); + if (notCurrent) { if (cn.w != 0) menu->menuTitle.setFrame(cn.x, cn.y, cn.w, cn.h); else menu->menuTitle.setCaption(fTitle); menuItemsPrepare(totalitems); } - return NotCurrent; + return notCurrent; } void resetMenu(Menu* &menu) { diff --git a/Marlin/src/lcd/e3v2/proui/menus.h b/Marlin/src/lcd/e3v2/proui/menus.h index 58dd92f0f6ac..be0c88176006 100644 --- a/Marlin/src/lcd/e3v2/proui/menus.h +++ b/Marlin/src/lcd/e3v2/proui/menus.h @@ -183,13 +183,13 @@ void resetMenu(Menu* &menu); // Invalidate currentMenu to prepare for full menu drawing void invalidateMenu(); -//Update the Menu and Draw if it is valid +// Update the Menu and Draw if it is valid void updateMenu(Menu* &menu); -//Redraw the current Menu if it is valid +// Redraw the current Menu if it is valid void ReDrawMenu(bool force=false); -//Redraw selected menu item +// Redraw selected menu item void ReDrawItem(); // Clear menuItems array and free menuItems elements diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index fceeffa70748..7d5d657ac735 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -407,7 +407,7 @@ void restore_feedrate_and_scaling(); #if HAS_Z_AXIS #if ALL(DWIN_LCD_PROUI, INDIVIDUAL_AXIS_HOMING_SUBMENU, MESH_BED_LEVELING) - #define Z_POST_CLEARANCE hmiData.z_after_homing + #define Z_POST_CLEARANCE hmiData.zAfterHoming #elif defined(Z_AFTER_HOMING) #define Z_POST_CLEARANCE Z_AFTER_HOMING #else diff --git a/buildroot/share/PlatformIO/scripts/offset_and_rename.py b/buildroot/share/PlatformIO/scripts/offset_and_rename.py index e9940a50d014..20f2b78024b8 100644 --- a/buildroot/share/PlatformIO/scripts/offset_and_rename.py +++ b/buildroot/share/PlatformIO/scripts/offset_and_rename.py @@ -61,6 +61,9 @@ def encrypt(source, target, env): def rename_target(source, target, env): from pathlib import Path from datetime import datetime - Path(target[0].path).replace(Path(target[0].dir.path, datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S')))) + from os import path + _newpath = Path(target[0].dir.path, datetime.now().strftime(new_name.replace('{date}', '%Y%m%d').replace('{time}', '%H%M%S'))) + Path(target[0].path).replace(_newpath) + env['PROGNAME'] = path.splitext(_newpath)[0] marlin.add_post_action(rename_target) diff --git a/buildroot/share/scripts/upload.py b/buildroot/share/scripts/upload.py index c97605e3f4b7..ee48af6fc6de 100644 --- a/buildroot/share/scripts/upload.py +++ b/buildroot/share/scripts/upload.py @@ -157,7 +157,8 @@ def _RollbackUpload(FirmwareFile): marlin_string_config_h_author = _GetMarlinEnv(MarlinEnv, 'STRING_CONFIG_H_AUTHOR') # Get firmware upload params - upload_firmware_source_name = str(source[0]) # Source firmware filename + upload_firmware_source_name = env['PROGNAME'] + '.bin' if env['PROGNAME'] else str(source[0]) + # Source firmware filename upload_speed = env['UPLOAD_SPEED'] if 'UPLOAD_SPEED' in env else 115200 # baud rate of serial connection upload_port = _GetUploadPort(env) # Serial port to use