|
Clarification - reaction time Marlin 2.1.2.5 September 07, 2025 10:23AM |
Registered: 4 years ago Posts: 2 |
// ### insdie gcode.cpp gcode.h also have addtional info for M1910
void GcodeSuite::M1910() {
float saved_z = current_position.z;
//float real_z = planner.get_axis_position_mm(Z_AXIS);
edm_mode=true; // set flag when 1st used
SERIAL_ECHO(" before synchro: "); // debug
SERIAL_ECHO(millis()); // debug
planner.synchronize(); // Stop movment
SERIAL_ECHO(" after synchro: "); //debug
SERIAL_ECHO(millis()); //debug
current_position.z -= 0.35; // move bit back
line_to_current_position(); // alig axis
current_position.z += 0.35; // move to start position
line_to_current_position(); // align axis
SERIAL_ECHO(" after all "); //debug
SERIAL_ECHO(millis()); // debug
}
Than inside MarlinCore.cpp i have this code - its sensing LOW state at one of GPIO and when it sens it change of state triggers its checked at idle()
// ## MarlinCore.cpp
// ## this is called at idle loop
void edm_trigger_update() {
if(edm_mode==true){
static bool edm_triggered_last = false; // this is to handle only one change from Hi to Low state
bool edm_triggered_now = (digitalRead(EDM_TRIGGER_PIN) == LOW); // this is to handle only one change from Hi to Low state
if (edm_triggered_now && !edm_triggered_last) {
SERIAL_ECHO("Loop enters: "); // debug
SERIAL_ECHO(millis()); // debug
queue.enqueue_one("M410"); // let’s stop current movment
SERIAL_ECHO(" enqueue_one M410 at: "); // debug
SERIAL_ECHO( millis()); // debug
queue.enqueue_one("M1910"); // lets call bit back bit FWD
//SERIAL_ECHO(" enqueue_one M1910 at: "); // debug
SERIAL_ECHO(millis()); // debug
}
edm_triggered_last = edm_triggered_now; // this is to handle only one change from Hi to Low state
}
}
|
Re: Clarification - reaction time Marlin 2.1.2.5 September 07, 2025 03:39PM |
Admin Registered: 14 years ago Posts: 7,283 |
|
Re: Clarification - reaction time Marlin 2.1.2.5 September 08, 2025 10:56AM |
Registered: 4 years ago Posts: 2 |
“// M1910
void EDM_reaction(){ // zmiana
// last_executed_gcode is copied in gcode.cpp = last gcode
float saved_z = current_position.z;
current_position.z -= 0.35;
line_to_current_position();
current_position.z += 0.35;
line_to_current_position();
if (last_executed_gcode[0]) {
queue.enqueue_one(last_executed_gcode) ;// inject command one more time expect to se OK in terminal because coordinates were reached
}