Auto fake acknowledgement for certain gcode

I searched a lot to find a way to fake acknowledgement right after sending G4 P1 but couldn't find anything. can anybody give me some hint about how to do so?

Hello @William_Gauthier !

G4 is rarely used. Maybe there is another way to achieve your aim with a different command. The OctoPrint command @pause maybe?

You may tell us what you want to do with the G4.

I want to control the fan and if I just set the command M107 to set the fan off, it get executed too soon, M400 command doesn't work and G4 P1 set a delay of at least a second insted of a milisecond since it wait for the OK but doesn't receve it until the end of G4

I understand.
What printer are you using?
This G4 command makes the printer make to nothing, even not an OK also not receiving new commands. So a fake wont do the trick either.

Yeah M400 wouldn't work because I think it only takes into account movement commands. You might be able to use a low set and wait temperature command followed by your fan off command and temperature off command to achieve what I think you are after (cooldown nozzle/bed quicker with fan on).

actualy, I want to put the fan ON only for wall because I want the strongest part possible but also to be able to print more than 30Β° overhang. the ffcp can't control the fan speed and I am trying to counter that by putting it ON and OFF. as it seams G4 can't work and so does M400. I dont know if there is any command left that can and I fear that my only solution is to modify the printer firmware.

turns out that if I send the command G4 P60000 in the terminal it does respond with OK and it can listen to commands. when I do it via terminal it looks like that( I wrote the M106 command 5 second after the G4 and it still responded.

Send: G4 P60000
Recv:  T:33 /0 B:25 /0 T0:33 /0 T1:32 /0 @:0 B@:0
Recv:  T:32 /0 B:24 /0 T0:32 /0 T1:32 /0 @:0 B@:0
Recv:  T:33 /0 B:23 /0 T0:33 /0 T1:32 /0 @:0 B@:0
Recv:  T:32 /0 B:25 /0 T0:32 /0 T1:32 /0 @:0 B@:0
Recv:  T:33 /0 B:25 /0 T0:33 /0 T1:32 /0 @:0 B@:0
Recv: ok
Send: M106 S255
Recv: ok

after more tests, I found that the printer send the Ok only when it HIT the G4 command. in my case it doesn't let enough time to octoprint to send the next command and thus create a second of lag.
what I need is for the printer to send the Ok sooner or to fake the Ok.

Firmware seem to react different wig G4:

  • Klipper responds immediately with ok after a G4 S20
  • With Prusa firmware the terminal keeps unresponsive for 20 seconds after G4 S20

But even if you have an early fake ok, the printer won't accept the next command until the time set with G4 is over.

then I could just fake OK for the 3 next move command, If I do that in the terminal it will do them after the pause. but that is waaaay out of my knowledge, I think for now I will upload to Sd since there is no delay after the G4 command.