diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index d3474993e..5eb607e30 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -240,7 +240,6 @@ bool MMU2::VerifyFilamentEnteredPTFE() { uint8_t fsensorState = 0; uint8_t fsensorStateLCD = 0; - uint8_t fsensor_pixel = 0; // MMU has finished its load, push the filament further by some defined constant length // If the filament sensor reads 0 at any moment, then report FAILURE @@ -248,6 +247,8 @@ bool MMU2::VerifyFilamentEnteredPTFE() { const float length_step_mm = 2 * (delta_mm) / (LCD_WIDTH + 1); float last_position = planner_get_machine_position_E_mm(); + TryLoadUnloadProgressbarInit(); + MoveE(delta_mm, MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE); MoveE(-delta_mm, MMU2_VERIFY_LOAD_TO_NOZZLE_FEED_RATE); @@ -259,8 +260,7 @@ bool MMU2::VerifyFilamentEnteredPTFE() { if ((fabs(planner_get_machine_position_E_mm() - last_position)) > length_step_mm) { last_position = planner_get_machine_position_E_mm(); // Reset - if (fsensor_pixel > 19) fsensor_pixel = 19; - TryLoadUnloadProgressbar(fsensor_pixel++, 3, fsensorStateLCD); + TryLoadUnloadProgressbar(fsensorStateLCD); fsensorStateLCD = 0; // Clear temporary bit } safe_delay_keep_alive(0); diff --git a/Firmware/mmu2_reporting.cpp b/Firmware/mmu2_reporting.cpp index 2a23044fb..647211134 100644 --- a/Firmware/mmu2_reporting.cpp +++ b/Firmware/mmu2_reporting.cpp @@ -289,8 +289,17 @@ void ReportProgressHook(CommandInProgress cip, uint16_t ec) { } } -void TryLoadUnloadProgressbar(uint8_t column, uint8_t row, bool sensorState) { - lcd_putc_at(column, row, sensorState ? '_' : LCD_STR_SOLID_BLOCK[0]); // Place character +void TryLoadUnloadProgressbarInit() { + // Clear the status line + lcd_set_cursor(0, 3); + lcd_space(LCD_WIDTH); + + // Reset cursor position + lcd_set_cursor(0, 3); +} + +void TryLoadUnloadProgressbar(bool sensorState) { + lcd_putc(sensorState ? '_' : LCD_STR_SOLID_BLOCK[0]); // Place character lcd_reset_status_message_timeout(); } diff --git a/Firmware/mmu2_reporting.h b/Firmware/mmu2_reporting.h index fe38ce385..3d5dcff58 100644 --- a/Firmware/mmu2_reporting.h +++ b/Firmware/mmu2_reporting.h @@ -32,7 +32,12 @@ void ReportErrorHook(CommandInProgress cip, uint16_t ec, uint8_t es); /// Called when the MMU sends operation progress update void ReportProgressHook(CommandInProgress cip, uint16_t ec); -void TryLoadUnloadProgressbar(uint8_t column, uint8_t row, bool sensorState); +/// @brief Clear the status line and setup the LCD cursor +void TryLoadUnloadProgressbarInit(); + +/// @brief Add one block to the progress bar +/// @param sensorState if true, filament is not present, else filament is present. This controls which character to render +void TryLoadUnloadProgressbar(bool sensorState); /// Remders the sensor status line. Also used by the "resume temperature" screen. void ReportErrorHookDynamicRender();