PFW-1504 Add init for progress bar
In case we are running a retry, the firmware should clear the old rendering before starting on a new one Change in memory: Flash: +6 bytes SRAM: 0 bytes
This commit is contained in:
parent
51f1aa14a5
commit
73c76579af
|
|
@ -240,7 +240,6 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
|
||||||
|
|
||||||
uint8_t fsensorState = 0;
|
uint8_t fsensorState = 0;
|
||||||
uint8_t fsensorStateLCD = 0;
|
uint8_t fsensorStateLCD = 0;
|
||||||
uint8_t fsensor_pixel = 0;
|
|
||||||
// MMU has finished its load, push the filament further by some defined constant length
|
// 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
|
// 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);
|
const float length_step_mm = 2 * (delta_mm) / (LCD_WIDTH + 1);
|
||||||
float last_position = planner_get_machine_position_E_mm();
|
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);
|
||||||
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) {
|
if ((fabs(planner_get_machine_position_E_mm() - last_position)) > length_step_mm) {
|
||||||
last_position = planner_get_machine_position_E_mm(); // Reset
|
last_position = planner_get_machine_position_E_mm(); // Reset
|
||||||
if (fsensor_pixel > 19) fsensor_pixel = 19;
|
TryLoadUnloadProgressbar(fsensorStateLCD);
|
||||||
TryLoadUnloadProgressbar(fsensor_pixel++, 3, fsensorStateLCD);
|
|
||||||
fsensorStateLCD = 0; // Clear temporary bit
|
fsensorStateLCD = 0; // Clear temporary bit
|
||||||
}
|
}
|
||||||
safe_delay_keep_alive(0);
|
safe_delay_keep_alive(0);
|
||||||
|
|
|
||||||
|
|
@ -289,8 +289,17 @@ void ReportProgressHook(CommandInProgress cip, uint16_t ec) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TryLoadUnloadProgressbar(uint8_t column, uint8_t row, bool sensorState) {
|
void TryLoadUnloadProgressbarInit() {
|
||||||
lcd_putc_at(column, row, sensorState ? '_' : LCD_STR_SOLID_BLOCK[0]); // Place character
|
// 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();
|
lcd_reset_status_message_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,12 @@ void ReportErrorHook(CommandInProgress cip, uint16_t ec, uint8_t es);
|
||||||
/// Called when the MMU sends operation progress update
|
/// Called when the MMU sends operation progress update
|
||||||
void ReportProgressHook(CommandInProgress cip, uint16_t ec);
|
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.
|
/// Remders the sensor status line. Also used by the "resume temperature" screen.
|
||||||
void ReportErrorHookDynamicRender();
|
void ReportErrorHookDynamicRender();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue