diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index b55b18080..37bb72d6a 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -305,6 +305,7 @@ bool MMU2::VerifyFilamentEnteredPTFE() { } Disable_E0(); + TryLoadUnloadProgressbarEcho(); TryLoadUnloadProgressbarDeinit(); if (fsensorState) { diff --git a/Firmware/mmu2_reporting.cpp b/Firmware/mmu2_reporting.cpp index 31ded00e3..ea14fdbea 100644 --- a/Firmware/mmu2_reporting.cpp +++ b/Firmware/mmu2_reporting.cpp @@ -1,4 +1,5 @@ #include "mmu2.h" +#include "mmu2_log.h" #include "mmu2_reporting.h" #include "mmu2_error_converter.h" #include "mmu2/error_codes.h" @@ -292,6 +293,17 @@ void TryLoadUnloadProgressbarDeinit() { lcd_reset_status_message_timeout(); } +void TryLoadUnloadProgressbarEcho() { + char buf[LCD_WIDTH]; + lcd_getstatus(buf); + for (uint8_t i = 0; i < sizeof(buf); i++) { + // 0xFF is -1 when converting from unsigned to signed char + // If the number is negative, that means filament is present + buf[i] = (buf[i] < 0) ? '1' : '0'; + } + MMU2_ECHO_MSGLN(buf); +} + void TryLoadUnloadProgressbar(uint8_t col, bool sensorState) { lcd_insert_char_into_status(col, sensorState ? '-' : LCD_STR_SOLID_BLOCK[0]); if (!lcd_update_enabled) lcdui_print_status_line(); diff --git a/Firmware/mmu2_reporting.h b/Firmware/mmu2_reporting.h index 8fedc19d4..071dd545e 100644 --- a/Firmware/mmu2_reporting.h +++ b/Firmware/mmu2_reporting.h @@ -41,6 +41,9 @@ void TryLoadUnloadProgressbarInit(); /// @brief Clear the status line and setup the LCD cursor void TryLoadUnloadProgressbarDeinit(); +/// @brief Report the results to serial +void TryLoadUnloadProgressbarEcho(); + /// @brief Add one block to the progress bar /// @param col pixel position on the LCD status line, should range from 0 to (LCD_WIDTH - 1) /// @param sensorState if true, filament is not present, else filament is present. This controls which character to render diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 7e3c68757..c06196f09 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -7079,6 +7079,10 @@ void lcd_clearstatus() lcd_status_message_idx = 0; } +void lcd_getstatus(char buf[LCD_WIDTH]) { + strncpy(buf, lcd_status_message, LCD_WIDTH); +} + void lcd_setstatuspgm(const char* message) { if (lcd_message_check(LCD_STATUS_NONE)) diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index ca917e96c..c340fef95 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -22,6 +22,10 @@ void ultralcd_init(); // Set the current status message (equivalent to LCD_STATUS_NONE) void lcdui_print_status_line(void); void lcd_clearstatus(); + +/// @brief Copy the contents of lcd_status_message +/// @param buf destination buffer +void lcd_getstatus(char buf[LCD_WIDTH]); void lcd_insert_char_into_status(uint8_t position, const char message); void lcd_setstatus(const char* message); void lcd_setstatuspgm(const char* message);