PenPlotter based on Repetier firmware

Hello Octoprint users and developers !

I'm trying to use Octorpint (installed OctoPi on Rpi3) with a PenPlotter (whiteboard drawing machine, based on Repetier firmware which runs on Mega2560+Ramps1.4 hardware) so the work is similar to printing on a 3D printer, load g-code file, print.

My problem is: Since PenPlotter firmware used Repetier firmware with some additional (or modified G-codes) seems like Octoprint can't recognize some of the PenPlotter G-code and Paused.

Changing monitoring state from "Operational" to "Printing"
Send: N0 M110 N0*125
Recv: ok
Send: N1 M4 X600 E2.0 S3200.0 P88.0*35
Recv: ok 1
Changing monitoring state from "Printing" to "Pausing"
Send: N2 M400*37
Recv: penWidth 2.00ok 2
Recv: wait
Send: N3 M114*36
Recv: ok 3
Recv: X:947.00 Y:0.00 Z:0.00 E:NAN
Recv: wait
Recv: wait
Recv: wait

G-code file content:

   4 M4 X600 E2.0 S3200.0 P88.0
   5 M1 Y400
   6 G21
   7 G90
   8 G0 F1010
   9 G4 P250
  10 M340 P0 S2350
  11 G4 P250
  12 G0 X346.45184 Y283.64716
  13 G4 P250
  14 M340 P0 S1500
  15 G4 P250
  16 G1 X355.86346 Y274.23547
  17 G1 X357.29895 Y273.0197
  18 G1 X360.66455 Y271.63055
  19 G1 X362.79492 Y271.4768
  20 G1 X363.74548 Y271.7616

Trying to send G-codes manually I 've discovered that "M1 Y400" command not send.

My question: Can I change something to make it work ? Since it is open source project I can modify the source. Please advice me what I need to modify or just point me to the proper place in the code for investigating.

Thanks.,serial.log (4.4 KB)

No solution for my problem ?
Ideas ?

1 Like

You'll need to modify the source. As you've noted, OctoPrint interprets an M1 as a gcode induced pause and suppresses sending it to the printer. This is something it inherited from way back when it started out as a Cura fork.

There's currently no way to disable that behavior (although there's a feature request for this somewhere). So you'll have to adjust your sources for now (or have your plotter not use M0 and M1 - both supposed to be pauses or halts according to 3d printer gcode definitions). Take a look into sec/octoprint/util/comm.py. There's a function _gcode_M0_queuing defined in there, and one below for M1. Those are what pauses and suppresses the sending of the command. Delete both. You don't need to delete where they are called because they are called dynamically and only if they exist.

Trying to send G-codes manually I 've discovered that "M1 Y400" command not

send.

What do you expect M1 to do? M1 is always "Optional Pause" in standard
G-code:
http://linuxcnc.org/docs/2.7/html/gcode/m-code.html#mcode:m0-m1

And doesn't seem to be defined otherwise in Repetier:

I can see reasons why Octoprint would need to intercept a program-pause, so
that the system can be un-paused from the server.
Gina discusses this here:

But it is not clear if there was a conclusion reached.

Thanks, Gina, for your reply.
It seems like very close to what I need
Say, do I need to "rebuild" the project somehow ?
I just commented out "M0" related lines in comm.py

diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py
index 03d4c32..3aed92d 100644
--- a/src/octoprint/util/comm.py
+++ b/src/octoprint/util/comm.py
@@ -252,8 +252,8 @@ def baudrateList():
 gcodeToEvent = {
        # pause for user input
        "M226": Events.WAITING,
-       "M0": Events.WAITING,
-       "M1": Events.WAITING,
+#      "M0": Events.WAITING,
+#      "M1": Events.WAITING,
        # dwell command
        "G4": Events.DWELL,
 
@@ -3115,10 +3115,10 @@ class MachineCom(object):
                                except ValueError:
                                        pass
 
-       def _gcode_M0_queuing(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs):
-               self.setPause(True)
-               return None, # Don't send the M0 or M1 to the machine, as M0 and M1 are handled as an LCD menu pause.
-       _gcode_M1_queuing = _gcode_M0_queuing
+#      def _gcode_M0_queuing(self, cmd, cmd_type=None, gcode=None, subcode=None, *args, **kwargs):
+#              self.setPause(True)
+#              return None, # Don't send the M0 or M1 to the machine, as M0 and M1 are handled as an LCD menu pause.
+#      _gcode_M1_queuing = _gcode_M0_queuing

on the RPi, reboot/reload a page, connected the board, start "printing" - it Paused.
So, still not working.
I didn't see M1 Y400 command in the serial log, even if I put it manually

on the next serial log I put M1 Y400 between test (fake) commands M12345 and M123456789

 27 2018-04-23 14:58:15,399 - Recv: wait
 28 2018-04-23 14:58:16,408 - Recv: wait
 29 2018-04-23 14:58:17,417 - Recv: wait
 30 2018-04-23 14:58:18,426 - Recv: wait
 31 2018-04-23 14:58:18,984 - Send: N6 M12345 Y200*111
 32 2018-04-23 14:58:18,998 - Recv: ok 6
 33 2018-04-23 14:58:19,388 - Send: N7 M105*32
 34 2018-04-23 14:58:19,395 - Recv: ok 7
 35 2018-04-23 14:58:19,396 - Recv: T:0.00 /0 @:0
 36 2018-04-23 14:58:20,402 - Recv: wait
 37 2018-04-23 14:58:21,410 - Recv: wait
 38 2018-04-23 14:58:22,419 - Recv: wait
 39 2018-04-23 14:58:23,428 - Recv: wait
 40 2018-04-23 14:58:24,389 - Send: N8 M105*47
 41 2018-04-23 14:58:24,399 - Recv: ok 8
 42 2018-04-23 14:58:24,401 - Recv: T:0.00 /0 @:0
 43 2018-04-23 14:58:25,405 - Recv: wait
 44 2018-04-23 14:58:26,414 - Recv: wait
 45 2018-04-23 14:58:27,423 - Recv: wait
 46 2018-04-23 14:58:28,432 - Recv: wait
 47 2018-04-23 14:58:29,390 - Send: N9 M105*46
 48 2018-04-23 14:58:29,396 - Recv: ok 9
 49 2018-04-23 14:58:29,397 - Recv: T:0.00 /0 @:0
 50 2018-04-23 14:58:30,405 - Recv: wait
 51 2018-04-23 14:58:31,414 - Recv: wait
 52 2018-04-23 14:58:32,423 - Recv: wait
 53 2018-04-23 14:58:33,431 - Recv: wait
 54 2018-04-23 14:58:34,391 - Send: N10 M105*22
 55 2018-04-23 14:58:34,398 - Recv: ok 10
 56 2018-04-23 14:58:34,399 - Recv: T:0.00 /0 @:0
 57 2018-04-23 14:58:34,918 - Send: N11 M123456789*18
 58 2018-04-23 14:58:34,927 - Recv: ok 11

Is it possible to disable G-code preprocessing at all ?
Is it possible to disable "heartbeat" polling ? (temp polling)

Will be appreciate for any ideas/suggestions/breadcrumbs ..

What do you expect M1 to do? M1 is always "Optional Pause" in standard

I'm trying to do some not standard. irregular thing )
As I said before I'm trying to use OctoPrint with PenPlotter
[https://github.com/RickMcConney/PenPlotter](http://PenPlotter project)
It is a whiteboard drawing machine. Repetier Firmware has been modified and some "custom" commands has been added to the code. M1 in particular.

Standard Gcodes G0, G1, G2, G3 are supported for movement.
Standard M340 and G4 are used for servo control and dwell (wait for servo to lift lower pen).
Standard M84 is used to disable motors
Custom Gcode M1 Y is used to set the home Y position in mm.
Custom Gcode M3 X Y P S E to plot a pixel.
    X is delta x from last pixel
    Y is delta y from last pixel
    P is pixel size
    S is shade
    E is direction
Custom Gcode M4 X E S P to set the machine specs
    X is machine width
    E is pen Width
    S is steps per rev
    P is mm per Rev
When processing a gcode file the pen lift is triggered by the G0 gcode G1 will lower the pen

Now I'm trying to do some modification of OctoPrint to make it works together - run PenPlotter with OctoPrint !

I'm trying to do some not standard. irregular thing )

As I said before I'm trying to use OctoPrint with PenPlotter
[https://github.com/RickMcConney/PenPlotter](http://PenPlotter project)
It is a whiteboard drawing machine. Repetier Firmware has been modified
and some "custom" commands has been added to the code. M1 in particular.

Using M1 (a completely standard M-code with a well-defined purpose) for a
custom function seems, to me, to be a poor choice when adding custom
behaviour.

I'd have to agree there.

Yes. Or rather, reinstall into the venv. On OctoPi:

source ~/oprint/bin/activate
cd ~/OctoPrint
pip install .
sudo service octoprint restart

or, if you want to be able to keep on modifying stuff directly in the source folder:

source ~/oprint/bin/activate
cd ~/OctoPrint
pip install -e .
sudo service octoprint restart

The latter will create an "editable" install, so if you then modify stuff in ~/OctoPrint and restart the server, via sudo service octoprint restart it will immediately become active.

Is it possible to disable G-code preprocessing at all ?

Not without heavy modifications.

Is it possible to disable "heartbeat" polling ? (temp polling)

Better only call it temperature polling, the server does have a heartbeat and calling the temperature poll a heartbeat as well might cause confusion :wink:

But to answer your question: No. OctoPrint targets 3D printers. You always want to know the temperatures with a 3D printer. You could stop the regular M105 from being sent to your plotter by writing a plugin that simply suppresses it, but to be honest I'm not sure if that might not lead to other issues since while idle there would be no active communication at all going on then anymore. You'll have to experiment a bit.

Thanks, Gina !

Your first suggestion about M0/M1 is actually works. It was just need to reinstall Octoprint.
Now all is fine and I'm happy !

Using M1 (a completely standard M-code with a well-defined purpose) for a

custom function seems, to me, to be a poor choice when adding custom

behaviour.

I'd have to agree there.

I'm totally agree with you folks, I also wondering why it was needed to use M1 command for only one parameter. Anyway, the creator choose such way and a big respect to him for adapting Repetier for PenPlotter machine !
PenPlotter has a host application for generating G-code and Firmware - it is easier to me to modify Octoprint at one place than modifying host application and firmware.

Great thanks for your support, Gina.
Regards,
Igor.

1 Like

hi there
Great ! I got the exact same problem and now I know where to look at :slight_smile:

But personnaly I'll probably change the Repetier firmware and PenPlotter instead of octoprint, because I want to be able to switch between my 3D printer and my 2D plotter without hassle