For some reason my run on printer activation script isn't working after first job unless..
My script is below. It works the first time. HOWEVER, if i do not run @gpio Kobra off (This turns printer off) after the job it will not try to run @gpio Kobra on again for the next job. I have added @gpio kobra off to the end gcode but the problem is that if a job does not finish properly, is cancelled, power outage to printer, etc. this gcode does not run so I think repetier server things the gpio pin is still powering the printer (I think sending pin high) and it's on. is there a way to ensure that the command is run w/o doing an logic test to see if the gpio pin is already sent high/low?
@func startFirstInQueue
@func enableAndStart
@gpio Kobra on
@echo "Powering on Kobra Max"
@timedCall startQueue 10000 startFirstInQueue
@echo "10 second delay to start print"
Thanks
Dave
Dave
Comments
This is my run after job gcode
Perhaps I need to run this if job is aborted? But that will only run if i manually abort the job right? NOT if a power outage, etc. happens?
Is there a way to run something in my activation script that will check to see if the gpio is thought to be in one state (on) and if so to switch it off?
IF if GPIO1=1 then @gpio Kobra off
Thanks
Dave
You can test state
- get_gpio_state(gpioName)
So use it likeReturns the state of a gpio pin with given name (from Global Setting->GPIO Pins, not BCM pin number). Works for digital outputs and inputs.
@if {{get_gpio_state("Kobra") == 1}}
to test if it is already on.
How/where can I test this context? IE how/where can i run the get_gpio_state command to see the current status? I tried that in console but no luck. Tried @get_gpio_state(Kobra) and get_gpio_state(Kobra) and a few other syntaxes.
Thanks
Dave
I can put it into this state at will. I have a malformed script right now called test and if i call it I get an error which is in bold below. In this state I cannot do anything w/ any GPIO pins (Even other printers that have defined GPIO pins) until I set this particular printers GPIO on/off. It's very strange but that's what has to happen.
Error when I run the malformed script below:
Mesg:18:46:30.022: error: @_endfunc at place with unmatched function start - skipping all blocks
My malformed script that I can generate the problem with
@func test
@echo {{get_gpio_state("Kobra") }}
get_gpio_state is an expression command and can only be used in computed expressions.
Your skript is missing and @endif correct skript
I tested with externally changing signal and server did not see it, so for server it only counts what it did write. I will check if I can change this reading the real value instead so externally changing a pin gets reflected as well.
Once it starts to run a broken script, or doesn't complete a script I can do NOTHING in console. I cannot even run @echo Hello world after calling the broken test. I get no response from console on any command typed after that.
Here is a quick video that may help to show you what occurs and how I lose all terminal access after this bad script runs. The same thing also occurs if I do NOT end a print job w/ @gpio Kobra Off (When my start gcode includes @gpio Kobra on).
<
For the gpio stuff I need to run some tests when I get more time alsong with the read state change I already mentioned.
Also gpio is now read back from pin so external commands can change pin state as well and we see it.
Install dev version for testing. (installDev on ssh console of pi)
As a basic example I show you my @gpio commands in action. Notice WPi pin 0 status on top right screen which is called Kobra. If I use the extcommand to turn on/off via GUI it works as shown. (These just call a basic sh file w/ gpio write 0 0 and or 0 1 in it). If i try to @gpio to write to pin it no longer works as you can see.
Here is a quick video to easily understand
Thanks
Dave
Dave
Thanks