Switch config allow input pins to trigger G-Code. I don’t want to have input pins trigger G-Code.
OpenPnP issues command to read things like vacuum sensors at various stages of processing.
If I use M105, then I can only read one analog variable.
I have 3 digital input pins to read (2 vacuum sensors and Pin Down Sensor).
Later will want to read 2 additional analog pins.
Can I do this in config or do I need to code a custom command?
If not supported by current code, can someone suggest where to patch this int the code.
Imported from wikidot
Thought I’d take a stab at answering your question.
I don’t know anything about OpenPnP, but if I understand you correctly you’re trying to read from 5 pins at once upon a single M-code? This may be possible in the config file with 5 separate switch modules, all using the same M-code, but if it were me, I’d probably try writing my own module for this.
The most difficult part (I say difficult because I haven’t ever done it myself) would be accessing the analog pins because you’ll need to access the ADC module to do so.
Check out the module example from the Smoothieware home page for guidance in making your own custom module.
In the source files, check out the laser module (src/modules/tools/laser/Laser.cpp) for a good example on using the ON_GCODE_RECEIVED event and how to look for a g-code and perform actions.
Also in the source files, check out the ADC module (src/libs/Adc.cpp) and the temperature control module (src/modules/tools/temperaturecontrol/AD8495.cpp) to see how to use and interface with the ADC.
Disclaimer: I’m not a member of the Smoothie team, so I can’t guarantee everything I said is 110% correct, but this should help you at least get started.