Control Printoid with ADB

#⃣ Control Printoid through ADB (Premium version)

The Premium version of Printoid can be piloted by using the Android Debug Bridge (ADB). Following is a link to learn more about ADB: https://developer.android.com/studio/command-line/adb.html

Controlling Printoid through ADB is a bit more difficult than from a physical keyboard since it’s not plug-n-play. But this is also more powerful, since you are able to send extra values with some commands. Typically, this is the solution I use to control Printoid with physical keys & buttons: my actuators are connected to the GPIO ports of my Raspberry Pi, then I perform a simple conversion from “GPIO action” to “Printoid command”.

You have to ensure first that ADB is properly installed on your Raspberry Pi (The question has already been asked on internet). Then, you have to activate the developer options on your device and activate ADB.

The first time you’ll plug your device to the Raspberry, execute the adb devices command to check if your device is properly recognized. May you will have to accept the debug bridge from the device (don’t forget to check to “remember” box)

Once you’re able to communicate with the device, here’s how to communicate with Printoid. First start the application manually, or by sending the following command:

adb shell am start -n fr.yochi76.printoid.phones.pro/.MainActivity

Then, each control commands should be executed while the app is in the foreground, with the following schemes:

adb shell am broadcast -a PRINTOID_COMMAND --es PRINTOID_ACTION XXXX

or by passing a float value as argument (when the command requests a float value):

adb shell am broadcast -a PRINTOID_COMMAND --es PRINTOID_ACTION XXXX --ef PRINTOID_VALUE YY.YY

or by passing a string value as argument (when the command requests a string value):

adb shell am broadcast -a PRINTOID_COMMAND --es PRINTOID_ACTION XXXX --ez PRINTOID_VALUE YY.YY

Where you have to replace the XXXX by one of the following action, and when available you can complete the command with an optional value (so you have to replace YY.YY by your own float value, as for example 1.0, 5.2, 12.9…)

Here are the available actions (this list will be enhanced over the time and the versions of Printoid Premium).

Function Action key Value (unit) [type]
Connect/Disconnect printer CONNECT
Switch fullscreen FULLSCREEN
Show streaming STREAMING
Show commands COMMANDS
Show OctoPrint web-app WEBAPP
Show the files FILES
Show timelapses TIMELAPSES
Show Printoid web-site WEBSITE
Show printer profiles PRINTER_PROFILES
Show app settings SETTINGS
Show app infos INFOS
Move X axis to left X_LEFT distance (mm) [float]
Move X axis to right X_RIGHT distance (mm) [float]
Move Y axis to back Y_TOP distance (mm) [float]
Move Y axis to front Y_BOTTOM distance (mm) [float]
Move Z axis to top Z_UP distance (mm) [float]
Move Z axis to bottom Z_DOWN distance (mm) [float]
Set XY home XY_HOME
Set Z home Z_HOME
Extrusion EXTRUSION length (mm) [float]
Retraction RETRACTION length (mm) [float]
Increment fan speed INC_FAN delta [float]
Decrement fan speed DEC_FAN delta [float]
Increment extruder 1 temp. INC_EXT1 delta (°) [float]
Decrement extruder 1 temp. DEC_EXT1 delta (°) [float]
Increment extruder 2 temp. INC_EXT2 delta (°) [float]
Decrement extruder 2 temp. DEC_EXT2 delta (°) [float]
Increment extruder 3 temp. INC_EXT3 delta (°) [float]
Decrement extruder 3 temp. DEC_EXT3 delta (°) [float]
Increment extruder 4 temp. INC_EXT4 delta (°) [float]
Decrement extruder 4 temp. DEC_EXT4 delta (°) [float]
Increment extruder 5 temp. INC_EXT5 delta (°) [float]
Decrement extruder 5 temp. DEC_EXT5 delta (°) [float]
Increment extruder 6 temp. INC_EXT6 delta (°) [float]
Decrement extruder 6 temp. DEC_EXT6 delta (°) [float]
Increment extruder 7 temp. INC_EXT7 delta (°) [float]
Decrement extruder 7 temp. DEC_EXT7 delta (°) [float]
Increment extruder 8 temp. INC_EXT8 delta (°) [float]
Decrement extruder 8 temp. DEC_EXT8 delta (°) [float]
Increment extruder 9 temp. INC_EXT9 delta (°) [float]
Decrement extruder 9 temp. DEC_EXT9 delta (°) [float]
Increment extruder 10 temp. INC_EXT10 delta (°) [float]
Decrement extruder 10 temp. DEC_EXT10 delta (°) [float]
Increment bed temp. INC_BED delta (°) [float]
Decrement bed temp. DEC_BED delta (°) [float]
Select a tool (printer head) SELECT_TOOL tool index (0->9) [float]
Print selected file PRINT
Pause print PAUSE
Stop print STOP
Send GCODE command GCODE GCODE command(s) [string]

For the GCODE command, which let you sending your own GCODE command(s), please note that you can send multiple GCODE instructions at once, separating the commands by commas.