-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add simulavr container for debugging (#12)
* script: restructure build commands * klipper: add simulavr target * simulavr: add klipper config for simulavr; add compose file for simulavr * simulavr: set dependencies for klipper service * move ustreamer to override file; rearrange init service in main compose file; move config for simulavr to printer.cfg * move printer.cfg for simulavr to extra file * README: add debugging section * update docs
- Loading branch information
Showing
8 changed files
with
368 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
# This file contains example pin mappings for testing with the | ||
# "simulavr" program. To use this config, compile the firmware for an | ||
# AVR atmega644p, enable "low-level configuration options", and enable | ||
# "simulavr software emulation". Further details are in | ||
# docs/Debugging.md. | ||
|
||
# See docs/Config_Reference.md for a description of parameters. | ||
|
||
[stepper_x] | ||
# Pins: PA5, PA4, PA1 | ||
step_pin: PA5 | ||
dir_pin: PA4 | ||
enable_pin: PA1 | ||
microsteps: 16 | ||
rotation_distance: 40 | ||
endstop_pin: ^PB0 | ||
position_min: -0.25 | ||
position_endstop: 0 | ||
position_max: 200 | ||
|
||
[stepper_y] | ||
# Pins: PA3, PA2 | ||
step_pin: PA3 | ||
dir_pin: PA2 | ||
enable_pin: PA1 | ||
microsteps: 16 | ||
rotation_distance: 40 | ||
endstop_pin: ^PB1 | ||
position_min: -0.25 | ||
position_endstop: 0 | ||
position_max: 200 | ||
|
||
[stepper_z] | ||
# Pins: PC7, PC6 | ||
step_pin: PC7 | ||
dir_pin: PC6 | ||
enable_pin: PA1 | ||
microsteps: 16 | ||
rotation_distance: 8 | ||
endstop_pin: ^PB2 | ||
position_min: 0.1 | ||
position_endstop: 0.5 | ||
position_max: 200 | ||
|
||
[extruder] | ||
# Pins: PC3, PC2 | ||
step_pin: PC3 | ||
dir_pin: PC2 | ||
enable_pin: PA1 | ||
microsteps: 16 | ||
rotation_distance: 33.500 | ||
nozzle_diameter: 0.500 | ||
filament_diameter: 3.500 | ||
heater_pin: PB4 | ||
sensor_type: EPCOS 100K B57560G104F | ||
sensor_pin: PA7 | ||
control: pid | ||
pid_Kp: 22.2 | ||
pid_Ki: 1.08 | ||
pid_Kd: 114 | ||
min_temp: 0 | ||
min_extrude_temp: 0 | ||
max_temp: 210 | ||
|
||
[heater_bed] | ||
heater_pin: PB3 | ||
sensor_type: EPCOS 100K B57560G104F | ||
sensor_pin: PA0 | ||
control: watermark | ||
min_temp: 0 | ||
max_temp: 110 | ||
|
||
[fan] | ||
pin: PD6 | ||
|
||
[mcu] | ||
serial: /opt/run/simulavr.tty | ||
|
||
[printer] | ||
kinematics: cartesian | ||
max_velocity: 500 | ||
max_accel: 3000 | ||
max_z_velocity: 25 | ||
max_z_accel: 30 | ||
|
||
|
||
## vvv Required by Moonraker/Mainsail/Fluidd vvv | ||
[virtual_sdcard] | ||
path: /opt/gcode | ||
|
||
[display_status] | ||
|
||
[pause_resume] | ||
|
||
[gcode_macro PAUSE] | ||
description: Pause the actual running print | ||
rename_existing: PAUSE_BASE | ||
# change this if you need more or less extrusion | ||
variable_extrude: 1.0 | ||
gcode: | ||
##### read E from pause macro ##### | ||
{% set E = printer["gcode_macro PAUSE"].extrude|float %} | ||
##### set park positon for x and y ##### | ||
# default is your max posion from your printer.cfg | ||
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %} | ||
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %} | ||
##### calculate save lift position ##### | ||
{% set max_z = printer.toolhead.axis_maximum.z|float %} | ||
{% set act_z = printer.toolhead.position.z|float %} | ||
{% if act_z < (max_z - 2.0) %} | ||
{% set z_safe = 2.0 %} | ||
{% else %} | ||
{% set z_safe = max_z - act_z %} | ||
{% endif %} | ||
##### end of definitions ##### | ||
PAUSE_BASE | ||
G91 | ||
{% if printer.extruder.can_extrude|lower == 'true' %} | ||
G1 E-{E} F2100 | ||
{% else %} | ||
{action_respond_info("Extruder not hot enough")} | ||
{% endif %} | ||
{% if "xyz" in printer.toolhead.homed_axes %} | ||
G1 Z{z_safe} F900 | ||
G90 | ||
G1 X{x_park} Y{y_park} F6000 | ||
{% else %} | ||
{action_respond_info("Printer not homed")} | ||
{% endif %} | ||
|
||
[gcode_macro RESUME] | ||
description: Resume the actual running print | ||
rename_existing: RESUME_BASE | ||
gcode: | ||
##### read E from pause macro ##### | ||
{% set E = printer["gcode_macro PAUSE"].extrude|float %} | ||
#### get VELOCITY parameter if specified #### | ||
{% if 'VELOCITY' in params|upper %} | ||
{% set get_params = ('VELOCITY=' + params.VELOCITY) %} | ||
{%else %} | ||
{% set get_params = "" %} | ||
{% endif %} | ||
##### end of definitions ##### | ||
{% if printer.extruder.can_extrude|lower == 'true' %} | ||
G91 | ||
G1 E{E} F2100 | ||
{% else %} | ||
{action_respond_info("Extruder not hot enough")} | ||
{% endif %} | ||
RESUME_BASE {get_params} | ||
|
||
[gcode_macro CANCEL_PRINT] | ||
description: Cancel the actual running print | ||
rename_existing: CANCEL_PRINT_BASE | ||
gcode: | ||
TURN_OFF_HEATERS | ||
CANCEL_PRINT_BASE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Ustreamer base Service | ||
x-ustreamer-svc: &ustreamer-svc | ||
image: mkuf/ustreamer:nightly | ||
restart: unless-stopped | ||
command: | ||
- "--host=0.0.0.0" | ||
- "--port=8080" | ||
- "--slowdown" | ||
- "--device=/dev/webcam" | ||
- "--resolution=1280x960" | ||
- "--format=MJPEG" | ||
- "--desired-fps=30" | ||
|
||
## Add your personal config here | ||
services: | ||
klipper: | ||
devices: | ||
- /dev/ttymxc3:/dev/ttymxc3 | ||
|
||
ustreamer: | ||
<<: *ustreamer-svc | ||
container_name: ustreamer | ||
devices: | ||
- /dev/video0:/dev/webcam | ||
labels: | ||
- "traefik.enable=true" | ||
- "traefik.http.services.ustreamer.loadbalancer.server.port=8080" | ||
- "traefik.http.routers.ustreamer.rule=PathPrefix(`/stream`)" | ||
- "traefik.http.routers.ustreamer.entrypoints=web" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
services: | ||
## simulavr | ||
simulavr: | ||
image: simulavr | ||
container_name: simulavr | ||
build: | ||
context: docker/klipper | ||
target: build-simulavr | ||
args: | ||
VERSION: master | ||
privileged: true | ||
volumes: | ||
- /dev:/dev | ||
- run:/opt/run | ||
|
||
## Reconfigure Klipper service for simulavr | ||
klipper: | ||
depends_on: | ||
init: | ||
condition: service_completed_successfully | ||
simulavr: | ||
condition: service_started | ||
privileged: true | ||
volumes: | ||
- ./config:/opt/cfg | ||
- run:/opt/run | ||
- gcode:/opt/gcode | ||
- log:/opt/log | ||
- /dev:/dev | ||
command: | ||
- "-I" | ||
- "run/klipper.tty" | ||
- "-a" | ||
- "run/klipper.sock" | ||
- "cfg/printer-simulavr.cfg" | ||
- "-l" | ||
- "log/klippy.log" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.