Skip to content

Commit

Permalink
add restart_klipper function
Browse files Browse the repository at this point in the history
  • Loading branch information
krautech committed Dec 9, 2024
1 parent 32ff891 commit fdf81d0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scripts/firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,19 @@ def set_custom_branch(self):
print("No custom branch provided.")
self.branch_menu()

def restart_klipper(self):
try:
# Execute the restart command
_ = subprocess.run(
["sudo", "service", "klipper", "restart"],
check=True,
text=True,
capture_output=True,
)
Utils.success_msg("Service restarted successfully!")
except subprocess.CalledProcessError as e:
Utils.error_msg(f"Failed to restart the service ({e.stderr})")

# Create main menu
def main_menu(self) -> None:
# Handle advanced mode and flash settings
Expand Down Expand Up @@ -993,6 +1006,11 @@ def flash_fail(self, message: str):
# Show what to do next screen
def finished(self):
Utils.header()
_ = input(
"Press any key and you may be asked for your password in order to restart klipper"
+ "Please make sure youre not printing when you do this."
)
self.restart_klipper()


class Can:
Expand Down

0 comments on commit fdf81d0

Please sign in to comment.