Skip to content

Commit

Permalink
AUGUST 2023 Bugfix 1
Browse files Browse the repository at this point in the history
Improved filament run-out code
Fix Input shaping menu items
Fixes bug on some boards that disables ProUI extensions on cold boot.
  • Loading branch information
mriscoc committed Aug 14, 2023
1 parent aeae59a commit d62a328
Show file tree
Hide file tree
Showing 16 changed files with 36 additions and 35 deletions.
Binary file modified Marlin/lib/proui/stm32f1/libproui_abl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f1/libproui_mbl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f1/libproui_ubl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f4/libproui_abl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f4/libproui_mbl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32f4/libproui_ubl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32g0/libproui_abl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32g0/libproui_mbl.a
Binary file not shown.
Binary file modified Marlin/lib/proui/stm32g0/libproui_ubl.a
Binary file not shown.
1 change: 0 additions & 1 deletion Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,6 @@ void setup() {

// Check startup - does nothing if bootloader sets MCUSR to 0
const byte mcu = hal.get_reset_source();
TERN_(PROUI_EX, if (mcu & RST_EXTERNAL) hal.reboot());
hal.clear_reset_source();

#if ENABLED(MARLIN_DEV_MODE)
Expand Down
13 changes: 8 additions & 5 deletions Marlin/src/feature/runout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ bool FilamentMonitorBase::enabled = true,
#if HAS_FILAMENT_RUNOUT_DISTANCE
float RunoutResponseDelayed::runout_distance_mm = FILAMENT_RUNOUT_DISTANCE_MM;
countdown_t RunoutResponseDelayed::mm_countdown;
#if ENABLED(PROUI_EX)
uint8_t FilamentSensorBase::motion_detected;
#elif ENABLED(FILAMENT_MOTION_SENSOR)
uint8_t FilamentSensorEncoder::motion_detected;
#if ENABLED(FILAMENT_MOTION_SENSOR)
#if ENABLED(PROUI_EX)
uint8_t FilamentSensorBase::motion_detected;
#else
uint8_t FilamentSensorEncoder::motion_detected;
#endif
#endif
#else
int8_t RunoutResponseDebounced::runout_count[NUM_RUNOUT_SENSORS]; // = 0
Expand All @@ -71,6 +73,7 @@ bool FilamentMonitorBase::enabled = true,
#if ENABLED(EXTENSIBLE_UI)
#include "../lcd/extui/ui_api.h"
#elif ENABLED(DWIN_LCD_PROUI)
#include "../lcd/marlinui.h"
#include "../lcd/e3v2/proui/dwin.h"
#endif

Expand All @@ -90,7 +93,7 @@ void event_filament_runout(const uint8_t extruder) {
#endif

TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder)));
TERN_(DWIN_LCD_PROUI, dwinFilamentRunout(extruder));
TERN_(DWIN_LCD_PROUI, LCD_MESSAGE(MSG_RUNOUT_SENSOR));

#if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR)
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder);
Expand Down
14 changes: 9 additions & 5 deletions Marlin/src/feature/runout.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class FilamentSensorBase {
public:
static void setup() {
#define _INIT_RUNOUT_PIN(P,S,U,D) do{ if (ENABLED(U)) SET_INPUT_PULLUP(P); else if (ENABLED(D)) SET_INPUT_PULLDOWN(P); else SET_INPUT(P); }while(0);
#if PROUI_EX
#if ENABLED(PROUI_EX)
#define INIT_RUNOUT_PIN(N) proUIEx.setRunoutState(FIL_RUNOUT##N##_PIN);
#else
#define INIT_RUNOUT_PIN(N) _INIT_RUNOUT_PIN(FIL_RUNOUT##N##_PIN, FIL_RUNOUT##N##_STATE, FIL_RUNOUT##N##_PULLUP, FIL_RUNOUT##N##_PULLDOWN);
Expand Down Expand Up @@ -230,9 +230,13 @@ class FilamentSensorBase {
}

#if ENABLED(PROUI_EX)
static uint8_t motion_detected;
static void poll_motion_sensor();
static void block_completed(const block_t * const b);
#if HAS_FILAMENT_MOTION
static uint8_t motion_detected;
static void poll_motion_sensor();
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
static void block_completed(const block_t * const b);
#endif
static void run();
#elif ENABLED(FILAMENT_SWITCH_AND_MOTION)
// Return a bitmask of motion pin states
Expand All @@ -251,7 +255,7 @@ class FilamentSensorBase {
#endif
};

#if HAS_FILAMENT_MOTION
#if HAS_FILAMENT_MOTION && DISABLED(PROUI_EX)

/**
* This sensor uses a magnetic encoder disc and a Hall effect
Expand Down
34 changes: 18 additions & 16 deletions Marlin/src/lcd/e3v2/proui/dwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1710,11 +1710,6 @@ void dwinPrintAborted() {
dwinPrintFinished();
}

#if HAS_FILAMENT_SENSOR
// Filament Runout process
void dwinFilamentRunout(const uint8_t extruder) { LCD_MESSAGE(MSG_RUNOUT_SENSOR); }
#endif

void dwinSetColorDefaults() {
hmiData.colorBackground = defColorBackground;
hmiData.colorCursor = defColorCursor;
Expand Down Expand Up @@ -2150,7 +2145,7 @@ void autoHome() { queue.inject_P(G28_STR); }

void setMoveZto0() {
#if HAS_LEVELING && ANY(RESTORE_LEVELING_AFTER_G28, ENABLE_LEVELING_AFTER_G28)
set_bed_leveling_enabled(false));
set_bed_leveling_enabled(false);
#endif
#if ENABLED(Z_SAFE_HOMING)
gcode.process_subcommands_now(TS(F("G28Z\nG0F5000X"), Z_SAFE_HOMING_X_POINT, F("Y"), Z_SAFE_HOMING_Y_POINT, F("\nG0Z0F300\nM400")));
Expand Down Expand Up @@ -2346,8 +2341,13 @@ void applyMove() {
void liveRunoutActive() { proUIEx.drawRunoutActive(true); }
void setRunoutActive() {
uint8_t val;
val = PRO_data.FilamentMotionSensor ? 2 : PRO_data.Runout_active_state ? 1 : 0;
setOnClick(ID_SetIntNoDraw, 0, 2, 0, val, proUIEx.applyRunoutActive, liveRunoutActive);
#if ENABLED(FILAMENT_MOTION_SENSOR)
val = PRO_data.FilamentMotionSensor ? 2 : PRO_data.Runout_active_state ? 1 : 0;
setOnClick(ID_SetIntNoDraw, 0, 2, 0, val, proUIEx.applyRunoutActive, liveRunoutActive);
#else
val = PRO_data.Runout_active_state ? 1 : 0;
setOnClick(ID_SetIntNoDraw, 0, 1, 0, val, proUIEx.applyRunoutActive, liveRunoutActive);
#endif
proUIEx.drawRunoutActive(true);
}
#endif
Expand Down Expand Up @@ -2607,9 +2607,11 @@ void onDrawGetColorItem(MenuItem* menuitem, int8_t line) {
#if ALL(HAS_FILAMENT_SENSOR, PROUI_EX)
void ondrawRunoutActive(MenuItem* menuitem, int8_t line) {
onDrawMenuItem(menuitem, line);
if (PRO_data.FilamentMotionSensor)
DWINUI::drawString(VALX - 8, MBASE(line), GET_TEXT_F(MSG_MOTION));
else
#if ENABLED(FILAMENT_MOTION_SENSOR)
if (PRO_data.FilamentMotionSensor)
DWINUI::drawString(VALX - 8, MBASE(line), GET_TEXT_F(MSG_MOTION));
else
#endif
DWINUI::drawString(VALX + 8, MBASE(line), PRO_data.Runout_active_state ? GET_TEXT_F(MSG_HIGH) : GET_TEXT_F(MSG_LOW));
}
#endif
Expand Down Expand Up @@ -2893,9 +2895,9 @@ void drawFilSetMenu() {
#if PROUI_EX
MENU_ITEM(ICON_Runout, MSG_RUNOUT_ACTIVE, ondrawRunoutActive, setRunoutActive);
#endif
#endif
#if HAS_FILAMENT_RUNOUT_DISTANCE
EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, setRunoutDistance, &runout.runout_distance());
#if HAS_FILAMENT_RUNOUT_DISTANCE
EDIT_ITEM(ICON_Runout, MSG_RUNOUT_DISTANCE_MM, onDrawPFloatMenu, setRunoutDistance, &runout.runout_distance());
#endif
#endif
#if ALL(PROUI_EX, HAS_EXTRUDERS)
EDIT_ITEM(ICON_InvertE0, MSG_INVERT_EXTRUDER, onDrawChkbMenu, setInvertE0, &PRO_data.Invert_E0);
Expand Down Expand Up @@ -3062,8 +3064,8 @@ void drawTuneMenu() {
#endif

#if ENABLED(SHAPING_MENU)
void applyShapingFreq() { stepper.set_shaping_frequency(hmiValue.axis, menuData.value / 100); }
void applyShapingZeta() { stepper.set_shaping_damping_ratio(hmiValue.axis, menuData.value / 100); }
void applyShapingFreq() { stepper.set_shaping_frequency(hmiValue.axis, menuData.value * 0.01); }
void applyShapingZeta() { stepper.set_shaping_damping_ratio(hmiValue.axis, menuData.value * 0.01); }

#if ENABLED(INPUT_SHAPING_X)
void onDrawShapingXFreq(MenuItem* menuitem, int8_t line) { onDrawFloatMenu(menuitem, line, 2, stepper.get_shaping_frequency(X_AXIS)); }
Expand Down
3 changes: 0 additions & 3 deletions Marlin/src/lcd/e3v2/proui/dwin.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ void dwinPrintPause();
void dwinPrintResume();
void dwinPrintFinished();
void dwinPrintAborted();
#if HAS_FILAMENT_SENSOR
void dwinFilamentRunout(const uint8_t extruder);
#endif
void dwinPrintHeader(const char *text);
void dwinSetColorDefaults();
void dwinCopySettingsTo(char * const buff);
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/lcd/e3v2/proui/dwinui.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
#define COLOR_LIGHT_BLUE 0x3A6A
#define COLOR_MAGENTA 0xF81F
#define COLOR_LIGHT_MAGENTA 0x9813
#define COLOR_LIGHT_RED 0x8800
#define COLOR_LIGHT_RED RGB(31,31,15)
#define COLOR_ORANGE 0xFA20
#define COLOR_LIGHT_ORANGE 0xFBC0
#define COLOR_LIGHT_YELLOW 0x8BE0
Expand Down
4 changes: 0 additions & 4 deletions buildroot/share/PlatformIO/scripts/proui.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def _GetMarlinEnv(marlinEnv, feature):
stm32f1 = _GetMarlinEnv(MarlinEnv, 'MCU_STM32F1')
stm32f4 = _GetMarlinEnv(MarlinEnv, 'MCU_STM32F4')
stm32g0 = _GetMarlinEnv(MarlinEnv, 'MCU_STM32G0')
gd32f10 = _GetMarlinEnv(MarlinEnv, 'MAPLE_STM32F1')

if (prouiex):
print('ProUI extension detected')
Expand All @@ -42,9 +41,6 @@ def _GetMarlinEnv(marlinEnv, feature):
elif (stm32g0):
arch = 'stm32g0/'
print ('STM32G0 Architecture detected')
elif (gd32f10):
arch = 'gd32f10/'
print ('GD32F1 Architecture detected')
else:
print("Error: can't detect the correct architecture")
exit()
Expand Down

0 comments on commit d62a328

Please sign in to comment.