Skip to content

Commit

Permalink
🐛 Fixes for ProUI, build rename (#26177)
Browse files Browse the repository at this point in the history
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
GHGiampy and thinkyhead authored Aug 19, 2023
1 parent 1d17c34 commit f7d5188
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/feature/caselight.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class CaseLight {
public:
static bool on;
#if ENABLED(CASELIGHT_USES_BRIGHTNESS)
#if CASELIGHT_USES_BRIGHTNESS
static uint8_t brightness;
#endif

Expand Down
65 changes: 40 additions & 25 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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

Expand All @@ -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) } );

This comment has been minimized.

Copy link
@classicrocker883

classicrocker883 Aug 22, 2023

Contributor

just a quick curiosity:
at the end of this line it says hmiData.ledColor.w but line 2183 has

    #if HAS_WHITE_LED
      void liveLEDColorW() { liveLEDColor(&leds.color.w); }
      void setLEDColorW() { setIntOnClick(0, 255, leds.color.w, applyLEDColor, liveLEDColorW); }
    #endif

how can setting the LED color for white (im guessing just sets the brightness) be for led.color.w when its also being applied in hmiData.ledColor.w??

This comment has been minimized.

Copy link
@GHGiampy

GHGiampy Aug 28, 2023

Author Contributor

Probably an issue, it should be leds.color.w, but I don't have the (4th) white led so I never noticed it.

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); }
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -3129,7 +3134,7 @@ void drawAdvancedSettingsMenu() {
#endif
}
ui.reset_status(true);
updateMenu(AdvancedSettings);
updateMenu(advancedSettingsMenu);
}

void drawMoveMenu() {
Expand Down Expand Up @@ -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);
Expand All @@ -3203,7 +3208,7 @@ void drawMoveMenu() {
MENU_ITEM(ICON_ProbeTest, MSG_M48_TEST, onDrawMenuItem, probeTest);
#endif
}
updateMenu(ProbeSetMenu);
updateMenu(probeSettingsMenu);
}

#endif // HAS_BED_PROBE
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -3478,15 +3493,15 @@ 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, &current_position.z);
MENU_ITEM(ICON_Axis, MSG_UBL_CONTINUE_MESH, onDrawMenuItem, manualMeshContinue);
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
Expand Down
3 changes: 3 additions & 0 deletions Marlin/src/lcd/e3v2/proui/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/dwin_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions Marlin/src/lcd/e3v2/proui/menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/lcd/e3v2/proui/menus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion buildroot/share/PlatformIO/scripts/offset_and_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 2 additions & 1 deletion buildroot/share/scripts/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f7d5188

Please sign in to comment.