Hi RepRap community,
first of all a big THANK YOU for all the information this forum provided for my little projects over the last years. This is my first question as an member of the RepRap Forum and I hope it is understandable and can also help other people in their quest. :)
My Setup:
I am using a MKS Gen 1.2 board (ATMEGA 2560 Processor) with Marlin 1.8.9 for controlling following components: Two bipolar stepper motors (z- and x-direction), RepRapDiscount Full Graphic Smart Controller, and two endstops (Zmin and Xmin). I "print" from SD-Card.
My Goal:
I want to configure Marlin that the state (open or triggered) of the Xmin endstop is checked before homing the z-axis. And if Xmin is triggered, the Stepper Motors should stop immediately (or not move at all) and the LCD should show a customized message.
What I already tried:
- I enabled ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED, ENDSTOPS_ALWAYS_ON_DEFAULT, SDSUPPORT and EMERGENY_PARSER
- Used M502, M500 before G28 and M540 afterwards
Expectation: When Xmin is triggered at the very beginning (before homing the z-Axis) or during the SD-Print the steppers should stop immediately.
Actual behavior: The z-Homing is executed even if Xmin is triggered. The steppers stop after homing and not immediately.
How to maybe solve the problem:
I would like to add a while-loop to Marlin. I think my while-loop has to be executed in endstops.cpp which is called from endstops.event_handler() in the main loop of Marlin_main.cpp.
So my idea is to add the following while-loop in endstops.cpp:
while (X_MIN_PIN) { //Condition is true when X_min is triggered
write specific Message to the status bar on the LCD; // Don´t know yet how to implement this...
immediately pause printer maybe via sending M0 or M112; // Don´t know this either.
}
I think M0 allows the controller to continue with the G-code when pressing a button on the LCD- that would be fine for me. Maybe someone can tell me if I am heading towards the right direction or if I am doing complete nonsense?
Any ideas are very much appreciated :) I wish you a great weekend.
Best regards
Sebastian
first of all a big THANK YOU for all the information this forum provided for my little projects over the last years. This is my first question as an member of the RepRap Forum and I hope it is understandable and can also help other people in their quest. :)
My Setup:
I am using a MKS Gen 1.2 board (ATMEGA 2560 Processor) with Marlin 1.8.9 for controlling following components: Two bipolar stepper motors (z- and x-direction), RepRapDiscount Full Graphic Smart Controller, and two endstops (Zmin and Xmin). I "print" from SD-Card.
My Goal:
I want to configure Marlin that the state (open or triggered) of the Xmin endstop is checked before homing the z-axis. And if Xmin is triggered, the Stepper Motors should stop immediately (or not move at all) and the LCD should show a customized message.
What I already tried:
- I enabled ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED, ENDSTOPS_ALWAYS_ON_DEFAULT, SDSUPPORT and EMERGENY_PARSER
- Used M502, M500 before G28 and M540 afterwards
Expectation: When Xmin is triggered at the very beginning (before homing the z-Axis) or during the SD-Print the steppers should stop immediately.
Actual behavior: The z-Homing is executed even if Xmin is triggered. The steppers stop after homing and not immediately.
How to maybe solve the problem:
I would like to add a while-loop to Marlin. I think my while-loop has to be executed in endstops.cpp which is called from endstops.event_handler() in the main loop of Marlin_main.cpp.
So my idea is to add the following while-loop in endstops.cpp:
while (X_MIN_PIN) { //Condition is true when X_min is triggered
write specific Message to the status bar on the LCD; // Don´t know yet how to implement this...
immediately pause printer maybe via sending M0 or M112; // Don´t know this either.
}
I think M0 allows the controller to continue with the G-code when pressing a button on the LCD- that would be fine for me. Maybe someone can tell me if I am heading towards the right direction or if I am doing complete nonsense?
Any ideas are very much appreciated :) I wish you a great weekend.
Best regards
Sebastian