You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use adb tools to trigger phone camera through USB. This will allow to take snapshots on command allowing for a Klipper macro integration on Z layer change.
Insert the macros below in your printer.cfg
5.Inside your slicer call the ADB_TAKE_FRAME macro on z layer change
If you want timelapse with head parked either integrate the ADB_TAKE_FRAME into another macro that does just that
OR
If you use Cura, there's a Time Lapse post proccessing script. See below
Make sure camera app is running and the phone doesn't have a sleep timeout.
Execute the ADB_START_SERVER macro to make sure adb-server is running and listening to commands. You can add this macro to your START GCODE if you want
Focus and lock exposure to where your print will sit/be parked
Print!
⌨️ useful adb commands:
adb shell input keyevent CAMERA #this command will trigger
adb shell input keyevent FOCUS #this command will focus
adb shell input tap x y #will send a tap at x and y pixel coordinates.
adb shell input swipe x1 x2 y1 y2 #will send a swipe from (x1,y1) to (x2,y2)
❗ Note!
Some cameras have timeouts. To avoid that, Open Camera app is recommended.
Otherwise, to wake the camera if it times out, we can send a swipe before triggering. (If we send a tap while the camera hasn't timed out yet, it will focus there and you might not want that if you use manual focus).This is still tricky and focus resets to center after every wakeup.
⚙️ Macro template
#this macro will start the adb server on the klippy host
[gcode_shell_command adb_start]
command: adb start-server
timeout: 3.
verbose: False
[gcode_macro ADB_START_SERVER]
gcode:
RUN_SHELL_COMMAND CMD=adb_start
#this macro will take a snapshot on your android phone using adb shell command
[gcode_shell_command adb_trigger]
command: adb shell input keyevent KEYCODE_CAMERA
timeout: 3.
verbose: False
[gcode_macro ADB_TAKE_FRAME]
gcode:
RUN_SHELL_COMMAND CMD=adb_trigger
After you copy the above macros to printer.cfg, buttons should appear here. You can manually execute them if you want to test:
Static Timelapses
To create timelapses with the head out of the way, make another macro that parks the head and calls the ADB_TAKE_FRAME macro. Make sure to insert the newly created macro in your slicer layer change instead.
OR
If you use Cura, you can take advantage of the Time Lapse post proccesing script and insert the ADB_TAKE_FRAME in the Trigger camera command field
<----> <---->
Use
adb
tools to trigger phone camera through USB. This will allow to take snapshots on command allowing for a Klipper macro integration onZ layer change
.Inspired from here and here
🔢 Steps:
adb
tools on your Klippy host or install it from repo: for OpenWrt that would beopkg install adb
shell_command
extension here by Arksineklipper/klippy/extras/gcode_shell_command.py
printer.cfg
5.Inside your slicer call the
ADB_TAKE_FRAME
macro on z layer changeOR
ADB_START_SERVER
macro to make sure adb-server is running and listening to commands. You can add this macro to yourSTART GCODE
if you want⌨️ useful adb commands:
❗ Note!
⚙️ Macro template
After you copy the above macros to
printer.cfg
, buttons should appear here. You can manually execute them if you want to test:Static Timelapses
To create timelapses with the head out of the way, make another macro that parks the head and calls the
ADB_TAKE_FRAME
macro. Make sure to insert the newly created macro in your slicer layer change instead.OR
If you use Cura, you can take advantage of the Time Lapse post proccesing script and insert the
ADB_TAKE_FRAME
in theTrigger camera command
fieldHere's a test print:
calicube.mp4
Many thanks to Kruze17 for testing and helping!
The text was updated successfully, but these errors were encountered: