Stephan3 / dwc2-for-klipper

A translator between DWC2 and Klipper
GNU General Public License v3.0
160 stars 38 forks source link

M80/81 psu control #53

Closed shadrincev closed 4 years ago

shadrincev commented 4 years ago

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

Stephan3 commented 4 years ago

I dont have a setup to test this. If someone is willing to add this, i am happy with it. Thanks

shadrincev commented 4 years ago

I'm willing to help, but I don't know how. If you specify what you need to implement, I will do it.

sedovserge commented 4 years ago

Klipper is supported for controlling logic on pins; create M80 / M81 macros yourself. I use SKR 1.4 and Lerdge power module, this macros works fine:

[gcode_macro M81] #Power off
gcode:
      SET_PIN PIN=ShutDownPrinter VALUE=1

[output_pin ShutDownPrinter]
pin: P1.0
Stephan3 commented 4 years ago

So as the Solution is found, I close this