Writing support for new print drivers

Much like the rest of Photonic3d, printer drivers can be created rather easily. Writing support for a new Printer Driver requires two steps:

  • * Writing a new java class that extends this abstract class: `org.area515.resinprinter.gcode.PrinterController`
  • Add the following things to your installation of the `config.properties` file

First let's tackle step 1. Here are the methods you'll need to implement for the printer controls page. None of these methods are required for actual printing, but if you'd like to to use all of the buttons on the print controls page, they will require an implementation:

  1. `public String executeSetAbsolutePositioning()`
  2. `public String executeSetRelativePositioning()`
  3. `public String executeMoveX(double dist)`
  4. `public String executeMoveY(double dist)`
  5. `public String executeMoveZ(double dist)`
  6. `public String executeMotorsOn()`
  7. `public String executeMotorsOff()`
  8. `public String executeXHome()`
  9. `public String executeYHome()`
  10. `public String executeZHome()`
  11. `public String executeHomeAll()`
  12. `public String executeSingleCommand(String cmd)`: This method is already implemented, but may need to be overridden in the event your printer doesn't use a serial port to communicate.

The following methods are required to print:

  1. `public String readWelcomeChitChatFromFirmwareSerialPort() throws IOException`: Just leave the method blank if the printer doesn't have a chit chat when you first start communicating with it. In the future this method may be renamed to “initializePrinter()” or something more generic for none serial port based printers.
  2. `public String executeCommands(PrintJob printJob, String commands, boolean stopSendingGCodeWhenPrintInactive) throws InappropriateDeviceException`: This method is the main work method, each of the templating commands(header, footer, preslice, pause, resume) will use this method to perform work. Here you will interpret the printer commands in whatever manner you deem necessary.

Step 2: Add your printer driver to the list of printer drivers in your `config.properties` file:

  1. - class name(must extend `org.area515.resinprinter.gcode.PrinterController`)
  2. driver name(the name that is saved in your printer configuration)
  3. pretty name(the name shown in the Photonic3d gui)

Here is the json format for the printer drivers line:

[{"driverClassName":"org.area515.resinprinter.gcode.eGENERICGCodeControl",  
"driverName":"eGENERIC",  
"prettyName":"Generic GCode"},  
{"driverClassName":"org.area515.resinprinter.gcode.PhotocentricGCodeControl",  
"driverName":"Photocentric",  
"prettyName":"Photocentric"},  
{"driverClassName":"org.area515.resinprinter.gcode.SedgwickGCodeControl",  
"driverName":"Sedgwick",  
"prettyName":"Sedgwick"},  
{"driverClassName":"org.area515.resinprinter.gcode.JavascriptControl",  
"driverName":"Javascript",  
"prettyName":"Generic Javascript"}]  

Here are a few examples of print drivers in Photonic3D: