Trouble assigning filament sensor after using pin for GPIO
-
Hi all,
I have a question about assigning a filament sensor to an input after using it for a GPIO pin.
I'm using a rotary magnetic encoder as filament sensor, this is placed inside my extruder and is declared as a pulse generating filament sensor.Now i'm trying to write a macro for loading the filament into the extruder and priming the nozzle. To do this i remove the filament sensor in the macro, read the output of the sensor (0 or 1), and keep extruding until that changes. After that i extrude an extra amount to prime the nozzle and remove the GPIO and try to redefine the filament sensor.
However if i do this it throws this, Error: M591: Pin 20.io1.in is not free, even tho i
removed it using: M950 J9 C"nil" and echo exists(sensors.gpIn[9]) returns false.Does anyone know of a way to fix this or should i abandon this macro?
G91 ; relative posisitioning M591 D0 P0 ; remove existing filament sensor M950 J9 C"20.io1.in" ; add GPIO at filament sensor pin var sensorInput = sensors.gpIn[9].value ; read current filamentsensor output M291 P"Load filament into the drive gears." S3 while (sensors.gpIn[9].value == var.sensorInput) ; while filamentsensor value does not change keep extruding G1 E1 F1800 if iterations > 50 M291 P"Loading filament has timed out" S2 M591 D0 P7 C"20.io1.in" L0.061 R80:120 E1 S1 G90 M99 echo "Filament sensor has been triggered. Priming nozzle." M400 G1 E110 F300 ; prime nozzle M400 G90 M950 J9 C"nil" ; remove GPIO echo exists(sensors.gpIn[9]) M591 D0 P7 C"20.io1.in" L0.061 R80:120 E1 S1 ; add filament sensor again M291 P"Filament has been loaded." S2
Thanks in advance,
Piet.
-
@piet which firmware version are you using? A bug in this area was fixed in firmware 3.3.
-
@dc42 Im using version 3.4.0beta3 in SBC mode
-
@piet thanks, I'll test that.
-
@piet I confirm there is a bug. M950 J# C"nil" does not release the port if it is on an expansion board. This will be fixed in the next beta release of the expansion board firmware.
As a workaround, if you have a spare IOx.IN port on the same expansion board, then instead of deleting the GpIn port using C"nil" you could reassign it to that pin.
-
@dc42 Alright, thanks for the help!