Klipper: SYSTEM COMMAND FOR "FIRMWARE_RESTART" AND "RESTART" PLEASE

Created on 18 Aug 2018  路  5Comments  路  Source: KevinOConnor/klipper

Someone else may one day want this as well so....

I use OctoPrint's PSU plugin to control my pi's GPIOs using a bash script to automatically switch a set of relays to power on my printer in stages. I am looking for pi terminal commands that perform the exact same function of FIRMWARE_RESTART and RESTART to insert into the script. I assume the following:

RESTART = sudo service klipper restart ??????
FIRMWARE_RESTART = ???????

I am using 2 MCUs and my setup seems to respond better/cleaner when I issue FIRMWARE_RESTART 5 seconds after initial power up and then RESTART 6 seconds after that. I am just looking to automate this. Thanks in advance.

Most helpful comment

Thanks!!!!! That worked perfectly. So I assumed that "echo RESTART > /tmp/printer would be the other command and that worked perfectly, too. For future klipperers running a similar setup I include the PSU plugin System Command code, below. Thanks again.
Switching Method = System Command
On System Command:
gpio mode 24 out && gpio mode 25 out && gpio write 24 1 && sleep 3 && gpio write 25 1 && sleep 5 && echo FIRMWARE_RESTART > /tmp/printer && sleep 6 && echo RESTART > /tmp/printer && sleep 5

All 5 comments

Octoprint has several Plugins to convert GCodes to run system commands or you could set up a GCode Macro in your firmware config, if the PSU control will fire them off.

Probably the easiest way to invoke a FIRMWARE_RESTART from the command-line is to run: echo FIRMWARE_RESTART > /tmp/printer

-Kevin

Thanks!!!!! That worked perfectly. So I assumed that "echo RESTART > /tmp/printer would be the other command and that worked perfectly, too. For future klipperers running a similar setup I include the PSU plugin System Command code, below. Thanks again.
Switching Method = System Command
On System Command:
gpio mode 24 out && gpio mode 25 out && gpio write 24 1 && sleep 3 && gpio write 25 1 && sleep 5 && echo FIRMWARE_RESTART > /tmp/printer && sleep 6 && echo RESTART > /tmp/printer && sleep 5

I don't think you need both FIRMWARE_RESTART and RESTART. Afaik later one is included with the firmware restart as that one is documented as restart with also reseting the MCU.

Point taken. I have removed the last one. Thanks again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KevinOConnor picture KevinOConnor  路  5Comments

krpepe picture krpepe  路  5Comments

sapell picture sapell  路  3Comments

jannoke picture jannoke  路  3Comments

SergeyKrutyko picture SergeyKrutyko  路  6Comments