Realtime Reporting, S000, P000, R000 (#19330)

This commit is contained in:
fedetony
2021-04-16 08:59:28 +02:00
committed by GitHub
parent 58cc4b7043
commit 32dba5e0c7
17 changed files with 275 additions and 70 deletions

View File

@ -230,6 +230,50 @@ void report_current_position_projected() {
stepper.report_a_position(planner.position);
}
#if EITHER(FULL_REPORT_TO_HOST_FEATURE, REALTIME_REPORTING_COMMANDS)
M_StateEnum M_State_grbl = M_INIT;
/**
* Output the current grbl compatible state to serial while moving
*/
void report_current_grblstate_moving() { SERIAL_ECHOLNPAIR("S_XYZ:", int(M_State_grbl)); }
/**
* Output the current position (processed) to serial while moving
*/
void report_current_position_moving() {
get_cartesian_from_steppers();
const xyz_pos_t lpos = cartes.asLogical();
SERIAL_ECHOPAIR("X:", lpos.x, " Y:", lpos.y, " Z:", lpos.z, " E:", current_position.e);
stepper.report_positions();
#if IS_SCARA
scara_report_positions();
#endif
report_current_grblstate_moving();
}
/**
* Set a Grbl-compatible state from the current marlin_state
*/
M_StateEnum grbl_state_for_marlin_state() {
switch (marlin_state) {
case MF_INITIALIZING: return M_INIT;
case MF_SD_COMPLETE: return M_ALARM;
case MF_WAITING: return M_IDLE;
case MF_STOPPED: return M_END;
case MF_RUNNING: return M_RUNNING;
case MF_PAUSED: return M_HOLD;
case MF_KILLED: return M_ERROR;
default: return M_IDLE;
}
}
#endif
/**
* Run out the planner buffer and re-sync the current
* position from the last-updated stepper positions.
@ -241,6 +285,20 @@ void quickstop_stepper() {
sync_plan_position();
}
#if ENABLED(REALTIME_REPORTING_COMMANDS)
void quickpause_stepper() {
planner.quick_pause();
//planner.synchronize();
}
void quickresume_stepper() {
planner.quick_resume();
//planner.synchronize();
}
#endif
/**
* Set the planner/stepper positions directly from current_position with
* no kinematic translation. Used for homing axes and cartesian/core syncing.