Wallacoloo / printipi

3d printing directly through the Raspberry Pi's GPIO pins
MIT License
141 stars 43 forks source link

Add support for returning comments in gcode responses #79

Closed Wallacoloo closed 9 years ago

Wallacoloo commented 9 years ago

When Printipi detects an invalid gcode command (attempt to set a nonexistent fan, etc), there's not much it can do to communicate this error to the host. It can either:

  1. Reply with "!! ", which indicates a non-recoverable error and suggests that the machine will shut down. But this is overkill for a trivial, recoverable error like an attempt to access an invalid fan.
  2. Reply with "ok" and then follow up with "// warning:", which indicates that no error has been detected, but gives us the opportunity to insert some extra information that shouldn't impact operation. This is misleading, because it suggests that the attempt to set the invalid fan was successful.

Unfortunately, these are the only valid response codes besides a "resend" request, according to the Reprap Wiki. Option 2 is still better than just logging the error to the console, but I'm not sure if all hosts would accept a line starting with "//". Therefore, since this extra information doesn't actually produce any effects, it should be possible to disable it for hosts that don't support it.