Asking for sensor status in a macro

  • Hey guys,

    I want to make a script for loading filament and need the status of a photoelectric barrier. Is there a way to ask for it and use something like an if-loop?


  • In RepRap firmware 3, yes. Which board are you using?

  • @Danal said in Asking for sensor status in a macro:

    In RepRap firmware 3, yes. Which board are you using?

    Im using Duet 2 Wifi and Ethernet.

    I saw this and conditional gcode already. But before I will integrate the loading script I want to ask for levelling status of my auto bed levelling. Everytime the levelling fails because of "probe not triggered ... " or "probings not consistent" he continues the print instead of stopping it... That results in damaged build plates and unhappy users. Is there a way to ask for this? A public variable for example? Im not getting an answer in my other threads... 😞


  • Your original Q seemed to be "read a sensor pin", which will be in the object model. The follow up seems to be "detect errors", which is probably possible, but I'm a little less sure of exactly what will or won't be in the object model regarding errors and the relationship to given points in time.

    Entering M409 at the console, will give you the top level of the object model, and then M409 K"xxxx" will drill into keys, and chain with dots to keep going M409 K"xxx.yyy" and/or subscripts M409 "xxx.yyy[0]"

    Poke around and see what you see for various error statuses (stati?)

  • Oh, and to be super clear, you must be on firmware 3 to do any of this. RRF3 runs fine on Duet 2 hardware.

    Do be aware that converting from RRF2 to RRF3 involves quite a bit of change to config.g. There are guides on the dozuki.

  • @Danal Yes. I was talking about my other Q, where no one is answering anymore.

    Thank you fot that information, but how can I reed this out in a script and use it as a variable?

    Yes, I already updated some printers to RRF3.

    Thanks for your patience.

  • administrators

    To read the status of a digital input:

    • Use RRF 3.01-RC3 or later
    • Create a GPIn port for that input using M950 with the J parameter
    • Then you can read it from the object model as sensors.inputs[n] where n is the GPIn number you specified in the J parameter of the M950 command

  • @dc42 Okay, but the error is not provided by the Z probe with a digital input, it created by the duets firmware. I dont know where to ask for a error message produced by the duet.

  • administrators

Log in to reply