Welcome! Log In Create A New Profile

Advanced

Marlin M226 Not Working

Posted by _dreamer 
Marlin M226 Not Working
October 16, 2015 11:52AM
Hello,

I have a conveyor belt system set up as my y-axis. What I want to do is, create a generic g-code to position objects in an exact potion on the conveyor belt before executing the main sequence of g-codes (print operation). I use the signal wire of a photoelectric switch to input +5V to pin D59 on AUX2 of RAMPS. I believe that pin is technically the A5 pin on Arduino.

when trying to pause the operation using: M226 P59 S255 but the line is just ignored.

What is the proper method to tell Marlin not to execute any preceding lines until the input of a certain pin is HIGH?
Is the M226 being ignored because pin 59 is not set as a digitalRead or analogRead?

Edited 1 time(s). Last edit at 10/16/2015 11:54AM by _dreamer.
Re: Marlin M226 Not Working
November 03, 2015 11:26PM
I encountered the same issue recently. The M226 was ignored by marlin.
I went through marlin_main.cpp and found M226 was actually defined in the firmware.
The code is pretty clear and M226 really should do its job...
Anybody can help ?

Thanks,

case 226: // M226 P S- Wait until the specified pin reaches the state required
{
if(code_seen('P')){
int pin_number = code_value(); // pin number
int pin_state = -1; // required pin state - default is inverted

if(code_seen('S')) pin_state = code_value(); // required pin state

if(pin_state >= -1 && pin_state <= 1){

for(int8_t i = 0; i < (int8_t)(sizeof(sensitive_pins)/sizeof(int)); i++)
{
if (sensitive_pins == pin_number)
{
pin_number = -1;
break;
}
}

if (pin_number > -1)
{
int target = LOW;

st_synchronize();

pinMode(pin_number, INPUT);

switch(pin_state){
case 1:
target = HIGH;
break;

case 0:
target = LOW;
break;

case -1:
target = !digitalRead(pin_number);
break;
}

while(digitalRead(pin_number) != target){
manage_heater();
manage_inactivity();
lcd_update();
Re: Marlin M226 Not Working
November 04, 2015 10:09PM
The code seems pretty clear that it will ignore M226 if P is undeclared or S is not -1, 0, or 1.
If S == 0, then M226 will wait for the pin to go LOW.
If S == 1, then M226 will wait for the pin to go HIGH.
If S == -1, then M226 will wait for the pin to change from its current value.

Edited 1 time(s). Last edit at 11/04/2015 10:14PM by RevarBat.
Re: Marlin M226 Not Working
November 04, 2015 10:10PM
Quote
_dreamer
when trying to pause the operation using: M226 P59 S255 but the line is just ignored.

What is the proper method to tell Marlin not to execute any preceding lines until the input of a certain pin is HIGH?
Is the M226 being ignored because pin 59 is not set as a digitalRead or analogRead?

M226 P59 S1
Sorry, only registered users may post in this forum.

Click here to login