PFW-1504 implement stepper_get_machine_position_E_mm()

This function should be used when reading the current machine
position while a move is ongoing

No change in memory
This commit is contained in:
Guðni Már Gilbert 2023-03-12 09:45:09 +00:00 committed by DRracer
parent 690d83a94a
commit 59e1ac0396
3 changed files with 8 additions and 3 deletions

View File

@ -245,7 +245,7 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
const float delta_mm = MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH - logic.ExtraLoadDistance(); const float delta_mm = MMU2_CHECK_FILAMENT_PRESENCE_EXTRUSION_LENGTH - logic.ExtraLoadDistance();
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 = stepper_get_machine_position_E_mm();
TryLoadUnloadProgressbarInit(); TryLoadUnloadProgressbarInit();
@ -273,8 +273,8 @@ bool MMU2::VerifyFilamentEnteredPTFE() {
fsensorStateLCD |= (WhereIsFilament() == FilamentState::NOT_PRESENT); fsensorStateLCD |= (WhereIsFilament() == FilamentState::NOT_PRESENT);
fsensorState |= fsensorStateLCD; // No need to do the above comparison twice, just bitwise OR fsensorState |= fsensorStateLCD; // No need to do the above comparison twice, just bitwise OR
if ((fabs(planner_get_machine_position_E_mm() - last_position)) > length_step_mm) { if ((fabs(stepper_get_machine_position_E_mm() - last_position)) > length_step_mm) {
last_position = planner_get_machine_position_E_mm(); // Reset last_position = stepper_get_machine_position_E_mm(); // Reset
TryLoadUnloadProgressbar(fsensorStateLCD); TryLoadUnloadProgressbar(fsensorStateLCD);
fsensorStateLCD = 0; // Clear temporary bit fsensorStateLCD = 0; // Clear temporary bit
} }

View File

@ -29,6 +29,7 @@ float MoveRaiseZ(float delta);
void planner_synchronize(); void planner_synchronize();
bool planner_any_moves(); bool planner_any_moves();
float planner_get_machine_position_E_mm(); float planner_get_machine_position_E_mm();
float stepper_get_machine_position_E_mm();
float planner_get_current_position_E(); float planner_get_current_position_E();
void planner_set_current_position_E(float e); void planner_set_current_position_E(float e);
void planner_line_to_current_position(float feedRate_mm_s); void planner_line_to_current_position(float feedRate_mm_s);

View File

@ -27,6 +27,10 @@ bool planner_any_moves() {
} }
float planner_get_machine_position_E_mm(){ float planner_get_machine_position_E_mm(){
return current_position[E_AXIS];
}
float stepper_get_machine_position_E_mm(){
return st_get_position_mm(E_AXIS); return st_get_position_mm(E_AXIS);
} }