Hi Bill!
I'm trying again to get this to work with GPIO commands. So far, I can issue commands using Macros in Marlin, but when I try to send commands from a G-Code file, it frequently fails, such as producing 6 pulses instead of 7 for Reset. Also, senting the command to select feeder 0 and feed for 21.2 seconds, it will just hold the line triggers indefinately. I'm not sure where it's failing. Here is the code I'm attempting to test with:
; Initilize Port and 3D Chameleon
M42 P45 I1 T1S0 ; Initialize port and turn on
G4 P150
M42 P45 S1 ; Turn off
G4 P150
M42 P45 S0
G4 P150
M42 P45 S1
G4 P150
M42 P45 S0
G4 P150
M42 P45 S1
G4 P150
M42 P45 S0
G4 P3550 ; 7 pulses - Reset Chameleon
M42 P45 S1
G4 S3 ; Give 3 seconds to home
;Preheat Extruder
M109 S205
;Select 0
M42 P45 S0 ; Set
G4 P550 ; 1 Pulse
M42 P45 S1 ; Release
G4 P150
M42 P45 S0 ; Set
G4 P21200 ; 21.2 seconds
G0 E25 F2100; <<<--- adjust this E value to tune extruder loading
M42 P45 S1 ; Release
G4 P400
G0 E60 F2000
M117 Filament Loaded
G4 S10
; Now Unload it
G91 ; move to relative mode
; back out the filament for cutting
G0 E5 F1500
G0 E-60 F1500 ; retract a bit, adjust this to tune waste
;******* Auto UnderClippy Code ********
; Cut Filament and Unload
M42 P45 S0 ; Set
G4 P3050 ; 6 Pulses
M42 P45 S1 ; Release
G4 S2 ; Wait for cutter to clear
; ******* End UnderClippy Code
G92 E0
G0 E10 F1500; <<<---- if mechanical cutter, change to a positive value of at least 5mm
G0 E-60 F1500; Total back out of 90mm (+5)
G92 E0
M42 P45 S0 ; Set
G4 P21200 ; 3D Chameleon Retract
M42 P45 S1 ; Release
M140 S0 ; turn off hotend
It usually fails at Select 0. Having successfully reset the 3D Chameleon and heated the nozzle, although sometimes fails at Reset as I said before.
I'm curious if adding a pull-up resistor at the 3D Chameleon connector might help. It is a rather long cable...
You can certainly add a resistor... but I'd also make sure you also have the ground pins tied together as well as make sure you're setting the pin state in the Start GCode. I'm also seeing something odd, but it must be correct, but your pin states appear to be backwards... normally pulling it to ground (with S0) is what sets it high... and setting it to S1 (or S255) sets it low. If that's the case, and you're running Klipper, it also might need to be set in the config file.
Since you're running purely digital, you can actually increase the time to something like 650 for the first long press for T0... and then add 400 for each subsequent pulse. That way it doesn't miss a cycle... the program loop has a natural 50 ms delay in it... and depending where it is in that window, at 450, it can actually miss the first pulse. So, 650, 1050, 1450, 1850 might be better numbers. The windows are 400 wide, so anywhere between 400-800 will be in the middle... with the 50ms offset, your valid range for the first pulse is 450+ to 800.
Bill