Buttons will not recognized after own gcodes

I have made my own gcode commands to control case lights. These commands are added to "Console/Commands". Gcode is for controlling lights is: M42 P9 S255 to set lights to 100%, for exmaple. It is also possible to control lights from "Param/Toggle Lights" menu at the front-end.
Now, if I control lights from "Console/Commands", the "Param/Toggle Lights" button won't work anymore, at least it will not control case lights. If I make reboot the "Param/Toggle Lights" button will work again.

Any hints?

Comments

  • Enable show commands in console and see if the gcode gets send to firmware when you call the function. If it gets send the problem is in the firmware.

    I wonder how you do toggle with the command. S255 always means on. For toggle you need to switch between 0 and 255 each call and that is not possible in a single script. So maybe you just need 2 script on and off.
  • I have three different "buttons" and those will control PWM output. Three different codes are:
    M42 P9 S153 to set LED's to 60%
    M42 P9 S85 to set LED's to 33% and
    M42 P9 S38 to set LED's to 15%

    Above Gcode commands will work all the time, I can see it also in the console.
    In firmware (Repetier-Firmware, version 1.0.1dev) I have configured that case light pin for LED's is heater 2 output. I can also control LED's ON or OFF via "Control/ Toggle Lights" but not after when any of those gcodes mentioned above are carried out...

    My setup is:
    Arduino Mega 2560 + Ramps 1.4
    Repetier FW 1.0.1dev (download and updated in end of June)
    Raspberry Pi 3 B+ with 5" TFT display
  • That is correct. M355 uses the pin as digital pin. With your P values in M42 you switch the pin to PWM mode and that overrides the digital pin state. You have to use either your or the firmware solution and do not mix.
  • Ok, now I understand :) Thank you for your help.
Sign In or Register to comment.