mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-12-30 19:30:46 -07:00
🧑💻 Relocate G38 data
This commit is contained in:
parent
35319049fe
commit
7fcc605595
5 changed files with 17 additions and 17 deletions
|
|
@ -164,11 +164,6 @@
|
|||
CardReader card;
|
||||
#endif
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
uint8_t G38_move; // = 0
|
||||
bool G38_did_trigger; // = false
|
||||
#endif
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
#include "module/delta.h"
|
||||
#elif ENABLED(POLARGRAPH)
|
||||
|
|
|
|||
|
|
@ -33,11 +33,6 @@ void stop();
|
|||
void idle(const bool no_stepper_sleep=false);
|
||||
inline void idle_no_sleep() { idle(true); }
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
extern uint8_t G38_move; // Flag to tell the ISR that G38 is in progress, and the type
|
||||
extern bool G38_did_trigger; // Flag from the ISR to indicate the endstop changed
|
||||
#endif
|
||||
|
||||
void kill(FSTR_P const lcd_error=nullptr, FSTR_P const lcd_component=nullptr, const bool steppers_off=false);
|
||||
void minkill(const bool steppers_off=false);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,14 @@
|
|||
#include "../../module/planner.h"
|
||||
#include "../../module/probe.h"
|
||||
|
||||
probe_target_t G38_move{0};
|
||||
|
||||
inline void G38_single_probe(const uint8_t move_value) {
|
||||
endstops.enable(true);
|
||||
G38_move = move_value;
|
||||
G38_move.type = move_value;
|
||||
prepare_line_to_destination();
|
||||
planner.synchronize();
|
||||
G38_move = 0;
|
||||
G38_move.type = 0;
|
||||
endstops.hit_on_purpose();
|
||||
set_current_from_steppers_for_axis(ALL_AXES_ENUM);
|
||||
sync_plan_position();
|
||||
|
|
@ -64,12 +66,12 @@ inline bool G38_run_probe() {
|
|||
constexpr uint8_t move_value = 1;
|
||||
#endif
|
||||
|
||||
G38_did_trigger = false;
|
||||
G38_move.triggered = false;
|
||||
|
||||
// Move until destination reached or target hit
|
||||
G38_single_probe(move_value);
|
||||
|
||||
if (G38_did_trigger) {
|
||||
if (G38_move.triggered) {
|
||||
|
||||
G38_pass_fail = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -473,7 +473,7 @@ void Endstops::update() {
|
|||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
// For G38 moves check the probe's pin for ALL movement
|
||||
if (G38_move) UPDATE_LIVE_STATE(Z, TERN(USE_Z_MIN_PROBE, MIN_PROBE, MIN));
|
||||
if (G38_move.type) UPDATE_LIVE_STATE(Z, TERN(USE_Z_MIN_PROBE, MIN_PROBE, MIN));
|
||||
#endif
|
||||
|
||||
#if ENABLED(CALIBRATION_GCODE)
|
||||
|
|
@ -723,8 +723,8 @@ void Endstops::update() {
|
|||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
// For G38 moves check the probe's pin for ALL movement
|
||||
if (G38_move && TEST_ENDSTOP(Z_MIN_PROBE) == TERN1(G38_PROBE_AWAY, (G38_move < 4))) {
|
||||
G38_did_trigger = true;
|
||||
if (G38_move.type && TEST_ENDSTOP(Z_MIN_PROBE) == TERN1(G38_PROBE_AWAY, (G38_move.type < 4))) {
|
||||
G38_move.triggered = true;
|
||||
#define _G38_SET(Q) | (AXIS_IS_MOVING(Q) << _AXIS(Q))
|
||||
#define _G38_RESP(Q) if (moving[_AXIS(Q)]) { _ENDSTOP_HIT(Q, ENDSTOP); planner.endstop_triggered(_AXIS(Q)); }
|
||||
const Flags<NUM_AXES> moving = { uvalue_t(NUM_AXES)(0 MAIN_AXIS_MAP(_G38_SET)) };
|
||||
|
|
|
|||
|
|
@ -313,3 +313,11 @@ class TemporaryGlobalEndstopsState {
|
|||
}
|
||||
~TemporaryGlobalEndstopsState() { endstops.enable_globally(saved); }
|
||||
};
|
||||
|
||||
#if ENABLED(G38_PROBE_TARGET)
|
||||
typedef struct ProbeTarget {
|
||||
uint8_t type; // Flag to tell the ISR the type of G38 in progress; 0 for NONE.
|
||||
bool triggered; // Flag from the ISR to indicate the endstop changed
|
||||
} probe_target_t;
|
||||
extern probe_target_t G38_move;
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue