Giter VIP home page Giter VIP logo

dwc2-for-klipper's Introduction

DO NOT USE THIS ANYMORE!

This is only here for refference. please use:

Socket version


dwc2-for-klipper

A translator between DWC2 and Klipper

Alt text Alt text

What works

  • printing from Klipper's virtual sdcard
  • pause / cancel prints (resume?)
  • babystepping feature using Klipper's SET_GCODE_OFFSET Z_ADJUST
  • editing Klipper's configuration. Its displayed as config.g in system section. So the web interface restarts Klipper after saving.
  • Klipper macros are imported as virtual files and can be accesed from the dashboard
  • uploads and downloads of gcodes
  • gcode analysis using regex to determine duration / layerhight / firstlayer / filamentusage and others
  • the math for printtime left based on whatever, showing layerhistory, detecting layerchanges etc. (needs working slicer regex)
  • settings of web interface are saved and loaded correctly
  • homing / extruding / moving
  • heater control
  • setting fanspeed / extrusionmultiplier / speedfactor during print in status window
  • heightmap is working (needs manual BED_MESH_CALIBATE). It is kept only for displaying, even after BED_MESH_CLEAR
  • webcam integration works now
  • pause/resume/cancel macros are working now - see Things You Should Know below
  • plugin for Cura 4.0 does work, just enter URL; for example: http://192.168.2.188:4750/

What is not working

  • webcam integration
  • heightmap
  • printsimulation
  • actual machinespeed, only displaying the requested values
    • klipper does not have this feedback (yet)? due to its lookahead feature
    • can we calc this? movelength/junction/acceleration is there
  • cancel/pause/resume macros. I will do this soon
  • rrf/dwc cura plugin
  • ...

Things you should know

  • Klipper messages are marked as warnings (yellow).
    • Normaly Klipper knows ok and error
  • Klipper's printer.cfg is displayed as a virtual file (config.g) in system section
    • restart after configuration edits works
  • The macros you define in printer.cfg are displayed as virtual files wthin DWC's macros
  • For pause and resume macros you can use:
    • Klipper gcode macros pause_print, resume_print, cancel_print (not case sensitive)
    • DWC macros pause.g, resume.g, cancel.g - this is in line with RRF
    • DWC macros are overriding Klipper's macros
  • ...

Installation

Prerequisites

Python 2, Tornado, gunzip, unzip and wget.

On ArchLinux:

sudo pacman -Syu python2 python2-tornado wget gzip

Maybe you´ll need to change the startup system for Klipper to access ~/klipper/klippy/klippy.py.

On Debian-based systems such as Octopi or Ubuntu:

I asume here that you used the Octopi install script from Kevin's GitHub repository.

sudo apt install wget gzip tar

Then switch to your klipper user and:

sudo systemctl stop klipper
cd ~
mv klipper klipper_backup 
PYTHONDIR="${HOME}/klippy-env"
virtualenv ${PYTHONDIR}
${PYTHONDIR}/bin/pip install tornado==5.1.1

git clone https://github.com/KevinOConnor/klipper.git
git clone https://github.com/Stephan3/dwc2-for-klipper.git
ln -s ~/dwc2-for-klipper/web_dwc2.py ~/klipper/klippy/extras/web_dwc2.py

mkdir -p ~/sdcard/dwc2/web
mkdir -p ~/sdcard/sys
cd ~/sdcard/dwc2/web 
wget https://github.com/Duet3D/DuetWebControl/releases/download/3.1.1/DuetWebControl-SD.zip
unzip *.zip && for f_ in $(find . | grep '.gz');do gunzip ${f_};done
sudo systemctl start klipper

If you want backwards compatibility to DWC1:

cd ~/sdcard/dwc2/web 
wget https://github.com/chrishamm/DuetWebControl/releases/download/1.22.5/DuetWebControl-1.22.5.zip
unzip DuetWebContro*.zip
for f_ in $(find . | grep '.gz');do gunzip ${f_};done

Klipper config example:

[virtual_sdcard]
path: /home/pi/sdcard

[web_dwc2]
# optional - defaulting to Klipper
printer_name: Reiner Calmund
# optional - defaulting to 127.0.0.1
listen_adress: 0.0.0.0
# needed - use above 1024 as nonroot
listen_port: 4750
#	optional defaulting to dwc2/web. Its a folder relative to your virtual sdcard.
web_path: dwc2/web

dwc2-for-klipper's People

Contributors

athemis avatar exxperto avatar moonlight63 avatar pierre-vo avatar pizzle-d avatar rafaljot avatar sixtyfive avatar stephan3 avatar yxist avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dwc2-for-klipper's Issues

M80/81 psu control

Good afternoon. How can I activate the enable / disable button? I write a macro for the M80 and M81 commands that are sent when it is clicked, but an error occurs: Malformed command 'RESPOND type:command MSG=action:poweron'. Or is this also not implemented?

[respond]
default_type: echo

[gcode_macro M80]
gcode: RESPOND type:command MSG=action:poweron

# power off
[gcode_macro M81]
gcode: RESPOND type:command MSG=action:poweroff

To run gpio did this:

cd /home/octo
git clone https://github.com/zhaolei/WiringOP.git -b h3 && cd WiringOP
chmod +x ./build
sudo ./build
cd ..
gpio readall

a table with gpio outputs appears.
Create a folder for scripts to enable and disable printers and download the scripts themselves.

mkdir power_scripts
cd power_scripts
wget https://raw.githubusercontent.com/Nebari-xx/octoprint_installer/master/poweron.sh
wget https://raw.githubusercontent.com/Nebari-xx/octoprint_installer/master/poweroff.sh
chmod +x poweron.sh
chmod +x poweroff.sh

Check the performance:
Turning on the printer
./poweron.sh
Turning off the printer
./poweroff.sh

suppress specific klipper messages

is there any way to suppress some of the messages klipper sends? particularly for the mesh bed measurements? klipper produces one message per measurement, which translates into 27 popups in dwc with a 3x3 mesh and 3 sample points. quite annoying. maybe some regex filters for klipper messages?

Section dwc2_web is not a valid config section

Stephan, I started an issue thread on the Klipper hub about my problem as I thought my issue might have been with Klipper alone. But now I am not sure.

I am trying to install Klipper with DWC onto an RPi running Arch.
I have it running successfully on Raspbian after following your instructions but after repeating the same steps more times than I can count on Arch I am running into errors. I think Klipper is running properly but only assume that it is if I completely remove the [dwc2_web] section from my .cfg.
It's only then that Klipper begins communicating with the printer.
If I re-enable that section, I get Section dwc2_web is not a valid config section and communication is lost.
And it goes without saying I have yet to be able to connect to the DWC UI.
Thanks for your attention to this.

EDIT- I thought it was of note to mention this is with Octoprint NOT installed.

Starting Klippy...
Args: ['/opt/klipper/klippy/klippy.py', '/etc/klipper/klipper.cfg', '-l', '/var/log/klipper/klippy.log', '-I', '/run/klipper/sock']
Git version: 'v0.7.0-691-g0af5b9ff-archlinux'
CPU: 4 core ARMv7 Processor rev 4 (v7l)
Python: '2.7.16 (default, Mar 15 2019, 13:03:02) \n[GCC 8.2.1 20181127]'
Start printer at Sun Jul 14 20:58:53 2019 (1563155933.5 970.9)
===== Config file =====
[virtual_sdcard]
path = /home/scott/sdcard

[dwc2_web]
printer_name = Anet A8
listen_adress = 0.0.0.0
listen_port = 4750
web_path = dwc2/web

[stepper_x]
step_pin = PD7
dir_pin = PC5
enable_pin = !PD6
step_distance = .01
endstop_pin = ^!PC2
position_endstop = -20
position_max = 205
position_min = -23
homing_speed = 50

[stepper_y]
step_pin = PC6
dir_pin = PC7
enable_pin = !PD6
step_distance = .01
endstop_pin = ^!PC3
position_endstop = -20
position_min = -23
position_max = 205
homing_speed = 50

[stepper_z]
step_pin = PB3
dir_pin = !PB2
enable_pin = !PA5
step_distance = .0025
endstop_pin = ^!PC4
position_endstop = 0
position_max = 240
homing_speed = 10

[extruder]
step_pin = PB1
dir_pin = PB0
enable_pin = !PD6
step_distance = .0105
nozzle_diameter = 0.400
filament_diameter = 1.750
heater_pin = PD5
sensor_type = ATC Semitec 104GT-2
sensor_pin = PA7
control = pid
pid_kp = 2.151492
pid_ki = 0.633897
pid_kd = 230.042965
min_temp = 0
max_temp = 250
pressure_advance = 0.4

[heater_bed]
heater_pin = PD4
sensor_type = ATC Semitec 104GT-2
sensor_pin = PA6
control = watermark
min_temp = 0
max_temp = 130

[fan]
pin = PB4

[mcu]
serial = /dev/ttyUSB0

[printer]
kinematics = cartesian
max_velocity = 300
max_accel = 1000
max_z_velocity = 20
max_z_accel = 100

[display]
lcd_type = hd44780
rs_pin = PA3
e_pin = PA2
d4_pin = PD2
d5_pin = PD3
d6_pin = PC0
d7_pin = PC1
=======================
Extruder max_extrude_ratio=0.266081
Config error
Traceback (most recent call last):
  File "/opt/klipper/klippy/klippy.py", line 134, in _connect
    self._read_config()
  File "/opt/klipper/klippy/klippy.py", line 131, in _read_config
    pconfig.check_unused_options(config)
  File "/opt/klipper/klippy/configfile.py", line 235, in check_unused_options
    section,))
Error: Section 'dwc2_web' is not a valid config section

G10 firmware retraction

The duet firmware allows G10 without any parameters to be parsed as a firmware retraction and with parameter as you have implement temperature control.
I have a klipper macro using G10/11 for retract, unretract, G11 works if command is issued in DWC
G10 doesn't work, is it possible to allow G10 without parameters to be parsed?

I want this in my life

This looks amazing, I'm new to 3d printing and coming from the cnc router control interfaces my first impression was how the hell do people deal with octoprint. I find it very counter intuitive and the need to keep moving between tabs is annoying to say the least.
my biggest annoyance is the lack of a machine position read out, so no way to know where the tool head is at a glance
the front end of dwc looks fantastic, so much info and control in one place.

Please do not take this as a criticism but simply a sign of my ignorance , I have read the install procedure 3 times and have absolutely no idea as to what I need to do.

I have a pi3b+ running a stock install of octopi and klipper installed as per Kevins instructions for klipper.
how do I make the change? assume you are talking to an carpenter with access to a keyboard

many thanks in advance

Drag & Drop

You did a great job! thank you for that it is a real pleasure to no longer use Octoprint! the installation is still a little complex and is not accessible to everyone unfortunately.

Is it possible to add a dragged and dropped function to load a .gcode file when we are in the Jobs tab?

Gcode hanging issue

I'm trying out dwc w/klipper and so far a few issues.

  1. Some gcodes when entered in dwc's gcode console will execute but dwc spins forever thinking the gcode never ran. Ie "m117 test" will display test, but a subsequent "m117 hello" will do nothing. I'm watching the klippy.log but there's no particular error.

bed_mesh error

Good day clipper has been updated and now an error is displayed when connecting

DWC2 starting at: http://0.0.0.0:5000
Extruder max_extrude_ratio=0.266081
Extruder max_extrude_ratio=0.266081
Config error
Traceback (most recent call last):
  File "/home/pi/klipper/klippy/klippy.py", line 134, in _connect
    self._read_config()
  File "/home/pi/klipper/klippy/klippy.py", line 131, in _read_config
    pconfig.check_unused_options(config)
  File "/home/pi/klipper/klippy/configfile.py", line 237, in check_unused_options
    section,))
Error: Section 'bed_mesh' is not a valid config section
DWC2:37652.39 - 192.168.1.232 - GET - /rr_connect?password=reprap&time=2020-1-14T0%3A47%3A32
DWC2:37652.74 - 192.168.1.232 - GET - /rr_filelist?dir=0%3A%2Fsys&first=0
DWC2:37652.77 - 192.168.1.232 - GET - /rr_config
DWC2:37652.79 - 192.168.1.232 - GET - /rr_filelist?dir=0%3A%2Fmacros&first=0

then, if you release an update, how do I update?

Cancel job routine

Hi Stephan, great work! Switched to dwc2 as it is much better than octoprint.

Is there a way to support cancel job routine, like lift head up and move to parking position and then disable heaters and motors?

no issue just great work

I have installed on a Replicape/BeagleBone Black with Debian.
The install instruction are great, the installation of gunzip is not needed with Debian well at least for the version I was using BBB-9.2

I have been using for a couple of hours doing small prints with no issues DWC2 is quite nice actually like it better then DWC1

I have no issues to report it is fast to load and operate compared to Octoprint

awesome work
thank you

Not displaying tool temperature and infinite loading on some gcodes

Just installed Klipper with DWC2.

I really like the interface but I cant get the UI to show my tool temperature.

I can set the tool temperature and it is displaying on the Printer-LCD just fine.

Also there are some g-codes that make the UI load infinitely and do not execute (e.g. M105).

I ran Klipper with OctoPrint before without problems.

[P.S. recognized reiner calmund in the config, greetings from lev ;) ]

Network Connection error and DWC2 crashes uploading large Gcode

I have a very detailed large gcode of 702mb, when attempting to upload i get a network error and it crashes dwc2 instantly, if i scp the file to dwc2 and then refresh the gcode list then it crashes dwc2 as soon as it starts scanning the file.

Octoprint seems to handle the gcode fine.

Is their a file size or complexity limit for this?

How to cancel job?

Maybe I am blind and don't see it, but I can not find anything in interface about canceling jobs.
I see that in code it is implemented. But nothing in UI. I presume it must be on the job control (and DWC2 JS code hints that), but there isn't! Do I do something wrong?

M600 macro

Good afternoon. There was a problem with the m600 command.
The code for replacing the filament on the command is written in the file printer.cfg:

[gcode_macro M600]
gcode:
    SAVE_GCODE_STATE NAME=M600_State
    PAUSE_MACRO

[gcode_macro PAUSE_MACRO]
gcode:
    PAUSE
    PARK_MACRO

[gcode_macro PARK_MACRO]
default_parameter_X: 0
default_parameter_Y: 0
default_parameter_Z: 20
gcode:
    M117 PARKING..
    G92 E0
    G91
    M83
    G1 E-3.14 F1500
    G1 Z{Z}
    G90
    M82
    G1 X{X} Y{Y} F3000
    M117 Nozzle Parked

[gcode_macro RESUME_MACRO]
gcode:
    M117  RESUMING..
    RESTORE_GCODE_STATE NAME=M600_State MOVE=1
    CLEAR_PAUSE

Dwc gives an error printing is interrupted, not paused:

Warning: Unknown command:"M117"
27.01.2020, 22:09:19 M98 P"0:/macros/PAUSE_MACRO"
Warning: Unknown command:"PAUSE"
Warning: Unknown command:"M117"
27.01.2020, 22:08:55 M98 P"0:/macros/RESUME_MACRO"
Warning: Unknown command:"M117"
Warning: Unknown command:"CLEAR_PAUSE"
27.01.2020, 22:07:10 Warning: Unknown command:"M117"
Warning: Move exceeds maximum extrusion (1.302mm^2 vs 0.640mm^2)
Warning: See the 'max_extrude_cross_section' config option for details
Error: Move exceeds maximum extrusion (1.302mm^2 vs 0.640mm^2)
27.01.2020, 22:07:04 Warning: Unknown command:"PAUSE"
Warning: Unknown command:"M117"

Incomprehensible error
Warning: Move exceeds maximum extrusion (1.302mm^2 vs 0.640mm^2) I have is worth:
max_extrude_only_distance: 1000.0

a similar problem has arisen here, there was advised to contact you.

Suggestion: could the functionality of the OctoPrint-Cancelobject plugin be added?

I have just switched to Klipper and am using DWC2 instead of Octoprint. It is overall a vastly improved UI, but if there is one quality-of-life feature that miss from Octoprint is the Cancel Object plugin. Typing this now as I babysit a print where one object of 11 has failed and I am trying to salvage as it goes.

I don't know how much work it would be to add, but thought I would leave the suggestion. If I knew more Python and web programming I'd be happy to help.

Recent upstream changes in klipper break dwc2-for-klipper

Hi,
first of all, thanks for this great alternative to octoprint!
A recent upstream commit changes the way how to check whether a motor is enabled or not: Klipper3d/klipper@0e30b86

This leads to the following error:

Traceback (most recent call last):
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/web.py", line 1592, in _execute
    result = yield result
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/concurrent.py", line 261, in result
    raise_exc_info(self._exc_info)
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/gen.py", line 326, in wrapper
    yielded = next(result)
  File "/home/pi/git/klipper/klippy/extras/web_dwc2.py", line 256, in get
    self.web_dwc2.rr_status_2()
  File "/home/pi/git/klipper/klippy/extras/web_dwc2.py", line 752, in rr_status_2
    "axesHomed": self.get_axes_homed() ,
  File "/home/pi/git/klipper/klippy/extras/web_dwc2.py", line 1364, in get_axes_homed
    if rail.is_motor_enabled():
AttributeError: PrinterRail instance has no attribute 'is_motor_enabled'

Failed to maintain connection

Hello..
First of all thank you for dwc2 i am pretty happy about it and have been using it for some time..

However i get the fault failed to maintain connection oretty much constantly.. I get on the web interface after 40 seconds i get this error and i cant input any data..
If i reopen the window in the browser it works again for 30 seconds..

What can i do i never had this problem with octoprint and i can see on the pi that i have a very steady and stable internet connection.

Constant re-connects using DWC

As title.
I've attatched 2 log files.
Latest is the latest DWC2 for klipper, and 3e98053 is the last commit that worked(Fixes the "lets set heater to -273.15")
The errors in the latest log file show up as soon as the DWC webpage is opened, and then the constant stream of reconnects which blocks all user control to the webpage.

klippy.3e98053.log
klippy.latest.log

DWC2 uses G-codes missing in Klipper

DWC2 uses some RRF-specific G-codes (especially M120/121 for push/pop, which wraps all macros in case of RRF), which are missing in Klipper.
Of course, there is always possibility to define bunch of empty/non-empty macros in Klipper. To stop DWC2 from complains, but I am unsure it is best course of action.
Would it be better if DWC python code would somehow take care of it?

Starting next job

Hi,

I think there is a little bug when starting a new job after finishing one. It takes a couple of attempts. The first one will execute the end of the previous job again (it will not load the new job and will display the old one as 100%), then once that is done you have to reload the new job for it to start. That's what I have observed. It's not a major issue as there is a way around it but something I thought was worth mentioning.

"RETRACT" and "EXTRUDE" buttons disabled

Hi Stephan,

Thanks for the excellent work. I have just installed yesterday klipper +dwc2 on an Orange Pi Zero Plus and it is working so far with the usual "beta" issues.

I know that this was brought up in #7 , but I am not sure if that was solved or if it just died because the OP never reported back.

I think this issue is purely related to dwc2 for the following reasons:

  1. R&E buttons worked this morning (the temperature of the extruder was 220degC)
  2. R&E buttons no longer worked this afternoon (the temperature of the extruder was 220degC)
  3. Tried restarting klipper, the printer. Nothing worked.
  4. Issuing gcode to extrude 20mm worked using the top bar.
  5. After messing with the html code of the buttons by changing styles ( "disabled" and "v-btn-disabled" I think it was), and then refreshing the browser brought the buttons back, and they work again as expected. I don't think it is a coincidence but I could be wrong.

If you need more info let me know. Happy to help.

Problem with manual stepper (case-sensitivity, no response?)

I posted this problem originally in the Klipper bugtracker. I was advised to replace DWC2-for-Klipper with Octoprint which made the problem go away. So I guess it's a DWC2-for-Klipper Problem:

My config: SKR Pro Board from Bigtreetech with TMC5160 V1.2 from Bigtreetech. Raspberry Pi 4 B running Duet Web Control

I want to use a manual stepper for cutting filament, so I defined it as:

[manual_stepper cutter]
step_pin = PD15
dir_pin = PE7
enable_pin = !PA3
step_distance = .003125
velocity = 70
accel = 1200

When I issue "MANUAL_STEPPER STEPPER=CUTTER ENABLE=1 MOVE=10"
the response is "failed: MANUAL_STEPPERThe value 'CUTTER' is not valid for STEPPER"

It makes no difference if I issue CUTTER or cutter on the gcode console, the output is the same and always uppercase.

Then I changed cutter to CUTTER in the printer.cfg, so it is now:

[manual_stepper CUTTER]
step_pin = PD15
dir_pin = PE7
enable_pin = !PA3
step_distance = .003125
velocity = 70
accel = 1200

When I run "MANUAL_STEPPER STEPPER=CUTTER ENABLE=1 MOVE=10" the g-code console get's stuck, as it is waiting for a return message that never comes. Also there is no movement from the stepper.

All steps can be seen in the klippy.log, I did a fresh restart before the experiment to get a clean log that shows only the behaviour described above.

Source: Klipper3d/klipper#2146

Macro loading is broken on latest DWC releases

After updating to DWC 2.0.6 i have noticed that macros are not being loaded anymore. Just checked recently released 2.0.7 and it's affected too.

Log message
Uncaught exception GET /rr_filelist?dir=0%3A%2Fmacros&first=0 (192.168.145.121)
HTTPServerRequest(protocol='http', host='raspberrypi.local:4750', method='GET', uri='/rr_filelist?dir=0%3A%2Fmacros&first=0', version='HTTP/1.1', remote_ip='192.168.145.121')
Traceback (most recent call last):
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/web.py", line 1592, in _execute
    result = yield result
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/concurrent.py", line 261, in result
    raise_exc_info(self._exc_info)
  File "/home/pi/klippy-env/local/lib/python2.7/site-packages/tornado/gen.py", line 326, in wrapper
    yielded = next(result)
  File "/home/pi/klipper/klippy/extras/web_dwc2.py", line 218, in get
    self.repl_ = self.web_dwc2.rr_filelist(self)
  File "/home/pi/klipper/klippy/extras/web_dwc2.py", line 454, in rr_filelist
    "date": datetime.datetime.fromtimestamp(os.stat(el_path).st_mtime).strftime("%Y-%m-%dT%H:%M:%S")
UnboundLocalError: local variable 'el_path' referenced before assignment
DWC2:17503.64 - 192.168.145.121 - GET - /rr_filelist?dir=0%3A%2Fmacros&first=0

Height Map co-ordinates do not match bed width

I have a 310x310 print bed and when I probe the bed for a mesh it is displayed in the height map page; however if I click on a point it is not the correct X & Y co-ordinate. Otherwise the height map is correct, just it seems to get the X & Y co-ordinates off (like it is scaling to a smaller bed size (100x100).

can't send G commands after FIRMWARE_RESTART

after FIRMWARE_RESTART I can't send G commands to printer from dwc2 web interface.
I see nothing special in log,
LCD works,

I tried to debug and I think the problem is with

self.reactor.register_callback(self.gcode_reactor_callback)

because this callback never triggers after FIRMWARE_RESTART

Do you have the same issue ?

Filenames with spaces

Is it possible to solve that problem?

Klipper can't print these files.
Each time need to check spaces and rename files.

AttributeError: BedMesh instance has no attribute 'calibrate'

Not sure what's going on to be honest. Running a very recent Klipper. When I run a BED_MESH_CALIBRATE; it correctly probes and I see output to the dwc2 console.

However, when trying to generate a bed map; I get an internal error:

HTTPServerRequest(protocol='http', host='octopi.wirehead.be:8080', method='GET', uri='/rr_download?name=0%3A%2Fsys%2Fheightmap.csv', version='HTTP/1.1', remote_ip='192.168.100.14')
Traceback (most recent call last):
  File "/home/jeffrey/klippy-env/local/lib/python2.7/site-packages/tornado/web.py", line 1592, in _execute
    result = yield result
  File "/home/jeffrey/klippy-env/local/lib/python2.7/site-packages/tornado/gen.py", line 1133, in run
    value = future.result()
  File "/home/jeffrey/klippy-env/local/lib/python2.7/site-packages/tornado/concurrent.py", line 261, in result
    raise_exc_info(self._exc_info)
  File "/home/jeffrey/klippy-env/local/lib/python2.7/site-packages/tornado/gen.py", line 326, in wrapper
    yielded = next(result)
  File "/home/jeffrey/klipper/klippy/extras/web_dwc2.py", line 216, in get
    self.repl_ = self.web_dwc2.rr_download(self)
  File "/home/jeffrey/klipper/klippy/extras/web_dwc2.py", line 376, in rr_download
    repl_ = self.get_heigthmap()
  File "/home/jeffrey/klipper/klippy/extras/web_dwc2.py", line 1302, in get_heigthmap
    z_matrix = self.bed_mesh.calibrate.probed_z_table
AttributeError: BedMesh instance has no attribute 'calibrate'
DWC2:05382.78 - 192.168.100.14 - GET - /rr_download?name=0%3A%2Fsys%2Fheightmap.csv

gcode uploaded but not printing

Hello. When the gcode is uploaded via cura plugin it works fine, but when I upload the gcode directly it does not want to start the print. Does anyone experieced this issue? Thanks

File list on LCD

If you are using LCD there is a menu "SD Card". It lists files from folder /home/pi/sdcard
Unfortunately Klipper doesn't suport subfolders.

dwc2-for-klipper stores all files in "gcodes" subfolder so I can't print uploaded files using LCD menu.

I made little workaround:
[virtual_sdcard]
path: /home/pi/sdcard/gcodes

#<-----><------>self.sdpath = self.configfile.getsection("virtual_sdcard").get("path", None) <------><------>self.sdpath = config.get( 'sd_path', self.configfile.getsection("virtual_sdcard").get("path", None))

then:

[web_dwc2]
(...)
sd_path: /home/pi/sdcard

Show saved Gcodes in Klipper display

The Klipper searches for files in the CD card (/sdcard) and does not show the files in the subdirectories
DWC2 stores the files in /gcodes (/sdcard/gcodes) and then does not show them in the klipper on the display.
Can I change this?

Page Not Found After Adding callback for gcode responses

Hello,
After installation I had access to the web page, however it did not seem to communicate with Klipper.
image

I therefore carry out the modification operation of the gcode.py file by hand, after this modification it is impossible to find the web page ...
I tried to redo an installation from the beginning without success

Webcam stream

I got the webcam stream to work pretty easily.

If one used octopi and installed klipper over it, then everything is already set up and ready to go, but it is also pretty easy to set up if a stock raspberry pi image without octopi is used. Octopi uses MJPG-Streamer to stream the webcam. By installing ocotpi it already sets up the streamer to start on boot so the user doesn't have to themselves. As explained by this guide, https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337 (farther down there is a webcam section), making MJPG-Streamer start on boot is really quite easy.

Once the streamer is running, all one has to do is under User Interface>General Settings> Webcam URL, put in the URL of the stream ( It will be the same one you access the DWC with, but change the port) and then add /?action=stream to the end. Octopi by default has the stream at port 8080, and if you set MJPG streamer manually then use whatever port you set it to.

Example: I access DWC with 192.168.0.4:4750 thus my camera URL is 192.168.0.4:8080/?action=stream.

image

I'm in love with this DWC interface.

Thank you for all your work Stephan,
Noah.

Touch Screen GUI

Would like to connect a Touch Screen to my RPI, is there a GUI for your DWC2, or could you make one? Like TouchUI for OctoPi...

ack needers and midprint_allow command - needs more commands in

Hi Stephan,
thanks for this amazing DWC translator,
I got 2 issues that are actually related,
adding manually every single command, needed is hard to do,
could it be done simply by parsing all the commands klipper offers?
And arranging the list in:
1- What Klipper command or Gcode command does not need ack, then load them in ack_needers array
2- What Klipper command or Gcode command needs to be used while printing, then load them in the midprint_allow array
If not
I was thinking about some sort of parsing from the printer.cfg file under:

[web_dwc2]
# optional - defaulting to Klipper
printer_name: YOUR_PRINTER_NAME
# optional - defaulting to 127.0.0.1
listen_adress: 0.0.0.0
# needed - use above 1024 as nonroot
listen_port: 4750
#optional defaulting to dwc2/web. Its a folder relative to your virtual sdcard.
web_path: dwc2/web
**#commands allowed to be used mid print
midprint_allowed:
command_1
command_2
#commands not reporting output to the klippy console
ack_needers:
command_1
command_2**

This is what I tested now:
added G92 E0, to reset the extruder
ack_needers = [ "G0", "G1", "G28", "G90", "G91", **"G92"**, "M0", "M24", "M25", "M83", "M84", "M104", "M112", "M117", "M140", "M141", "DUMP_TMC", "FIRMWARE_RESTART" "", "SET_PIN", "STEPPER_BUZZ", 'SET_GCODE_OFFSET Z_ADJUST' ]

And in midprint_allow,
AFAIK, M290 Zxx.xx, for babystepping the Z axis offset,
needs a macro to work on klipper.

[gcode_macro M290 Z]
variable_parameter_Z:-0.02 #should be changed to a variable user input
gcode:
SET_GCODE_OFFSET Z_ADJUST={Z} MOVE=1

and the command that Kevin uses instead is:
SET_GCODE_OFFSET Z_ADJUST=[your offset step] MOVE=1
Z_ADJUST ensure to make a relative move from previous position,
and MOVE=1 make it running right after a move is finished.

Also M290 allows in midprint could be used if added with a macro to also offsets x and y axis which in is not needed in midprint command, IMO.

More commands to the midprint_allow array:
Set fan speed: M106 S
Turn fan off: M107
Emergency stop: M112
Get current position: M114
Get firmware version: M115
Set extruder temperature: M104 [T] [S]
Set acceleration: M204 S
Select tool: T

So it will look something like this:

midprint_allow = [ **'SET_GCODE_OFFSET Z_ADJUST'**, 'DUMP_TMC', 'G10', 'GET_POSITION', 'HELP', 'M0', **'M104'**, **'M106'**, **'M107'**, **'M112'**, **'M114'**, **'M115'**, 'M140', 'M24', 'M25', 'M106', **'M204'**, 'M220', 'M221', 'M290', 'M292', 'QUERY_FILAMENT_SENSOR', 'SET_TMC_CURRENT', 'SET_PIN',
				'SET_PRESSURE_ADVANCE', 'SET_VELOCITY_LIMIT', **'T'**  ]

thanks for making something so great, and reviewing my changes.

Connectivity issues

Description:

  • Klipper is running
  • DWC2 is running
  1. The dashboard shows 2 extruders (my printer only has one), and wrong data overall as if it had not been able to connect to the printer. Looks like default information when the communication is not established.
  2. The printer is listed under /dev/serial/device-by-id/.....
  3. If I stop klipper and restart it, sometimes the dashboard will show the right printer data (one extruder, right temperatures, etc).
  4. Sometimes I have to go as far as restarting the OrangePi Zero.

Not sure where this is happening but if you point me in the right direction I will get whatever log files or anything needed to debug it. It could be a klipper problem maybe?

SyntaxError: Non-ASCII character '\xc2' in file

Hello,
Did a clean install of Ubuntu 18.04
Then followed the instructions posted here.
Klipper service is running, but /tmp/klippy.log is showing an error.
The web panel is down.

`pi@pi-pc:~$ cat /tmp/klippy.log
Starting Klippy...
Args: ['/home/pi/klipper/klippy/klippy.py', '/home/pi/printer.cfg', '-l', '/tmp/klippy.log']
Git version: 'v0.8.0-87-g0bfb655f-dirty'
CPU: 4 core Intel(R) Atom(TM) CPU Z3735F @ 1.33GHz
Python: '2.7.15+ (default, Oct 7 2019, 17:39:04) \n[GCC 7.4.0]'
Start printer at Sat Nov 9 00:11:48 2019 (1573233109.0 8.4)
===== Config file =====
[virtual_sdcard]
path = /home/pi/sdcard

[web_dwc2]
printer_name = Reiner Calmund
listen_adress = 0.0.0.0
listen_port = 4750
web_path = dwc2/web

Unhandled exception during connect
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 134, in _connect
self._read_config()
File "/home/pi/klipper/klippy/klippy.py", line 127, in _read_config
self.try_load_module(config, section_config.get_name())
File "/home/pi/klipper/klippy/klippy.py", line 110, in try_load_module
mod = importlib.import_module('extras.' + module_name)
File "/usr/lib/python2.7/importlib/init.py", line 37, in import_module
import(name)
File "/home/pi/klipper/klippy/extras/web_dwc2.py", line 543
SyntaxError: Non-ASCII character '\xc2' in file /home/pi/klipper/klippy/extras/web_dwc2.py on line 543, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details`

port to replicape

Is anyone interested in working on porting DWC2 for Replicape to replace octoprint?

i don't have the skillset myself but would happily test or help out where possible.

Revert to DWC1

In the 'Machine Specific Settings' there is an option to Divert to DWC1.

Is there a way to set it for it to default to DWC1 when connecting?

3 extruders, one hotend

Hi,

First of all, Thanks for the work! I love this, this is so much more informational and faster than Octoprint.

I have a printer with 3 extruders and a 3-in 1-out switching hotend. So I only use one heater shared over the 3 extruders. So I don't need 3 hotends showing up in the web-interface.
Is it possible not only to check in printer.cfg if there are multiple extruder definitions but also check if they share the same heater? In printer.cfg this is configured as shared_heater: extruder0 in the [extruder1] and [extruder2] section.
I that is the case you could only show extruder0 and omit the other extruders.

Thanx.

Height Map co-ordinates do not match bed width

Sorry to reopen the issue like this but i did some further testing to see where it originates and came up with this:

having the same problem, in the csv there are 10 x 10 points, i only set up 4 x 4

Max z Probed point is 74.5 in the gui, even though the csv says 224.98

I think the spacing is calculated wrongly, the points are much further apart then 21.498 it displays 10 points but i only set up 4, thats probably why.

Heightmap

'web_dwc2' is not a valid configuration section

I updated Klipper today (main branch) and DWC2 couldn't connect. "OK, I thought, it's been a long time and many changes, lets see if DWC2 has changed" It had, so I updated it as well. Now Klipper errors out with the infamous

Config error
Traceback (most recent call last):
File "/home/pi/klipper/klippy/klippy.py", line 134, in _connect
self._read_config()
File "/home/pi/klipper/klippy/klippy.py", line 131, in _read_config
pconfig.check_unused_options(config)
File "/home/pi/klipper/klippy/configfile.py", line 235, in check_unused_options
section,))
Error: Section 'web_dwc2' is not a valid config section`

I made sure the link was still there, and did the sed commands to modify Klipper's file. The link and web_dwc2's permissions are good. Can't figure out what I'm doing wrong. I had this once before and it was an actual problem, so I'm logging this just in case.

chmod 777 for trouble-shooting purposes.

pi@raspberrypi:~/klipper/klippy/extras $ ls -la web_dwc*
lrwxrwxrwx 1 pi pi 37 Dec 29 18:57 web_dwc2.py -> /home/pi/dwc2-for-klipper/web_dwc2.py
-rwxrwxrwx 1 pi pi 129 Dec 29 17:59 web_dwc2.pyc

pi@raspberrypi:~/klipper/klippy/extras $ ls -la /home/pi/dwc2-for-klipper/web_dwc2.py
-rwxrwxrwx 1 pi pi 0 Dec 29 18:04 /home/pi/dwc2-for-klipper/web_dwc2.py

What about permissions here?

pi@raspberrypi:~ $ ls -la klipper/klippy/gcode.py
-rw-r--r-- 1 pi pi 31164 Dec 29 18:25 klipper/klippy/gcode.py

Complete log: https://pastebin.com/AE2fTiiE

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.