Skip to content

Commit

Permalink
Set low and recovery voltage witty pi 4
Browse files Browse the repository at this point in the history
  • Loading branch information
Eagleshot committed Nov 15, 2023
1 parent 1a4876a commit 075be8c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,34 @@ def get_recovery_voltage_treshold_witty_pi_4():
# error += f"Could not get recovery voltage treshold: {str(e)}" # TODO Return error value
print(f"Could not get recovery voltage treshold: {str(e)}")
return "-"

# Set low voltage treshold
def set_low_voltage_treshold_witty_pi_4(voltage: float):
'''Sets the low voltage treshold from the Witty Pi 4'''
try:
low_voltage_treshold = run_witty_pi_4_command(f"set_low_voltage_threshold {voltage}")
print(f"Set low voltage treshold: {low_voltage_treshold} V")
return low_voltage_treshold
except Exception as e:
# error += f"Could not set low voltage treshold: {str(e)}" # TODO Return error value
print(f"Could not set low voltage treshold: {str(e)}")
return "-"

# Set recovery voltage treshold
def set_recovery_voltage_treshold_witty_pi_4(voltage: float):
'''Sets the recovery voltage treshold from the Witty Pi 4'''
try:
recovery_voltage_treshold = run_witty_pi_4_command(f"set_recovery_voltage_threshold {voltage}")
print(f"Set recovery voltage treshold: {recovery_voltage_treshold} V")
return recovery_voltage_treshold
except Exception as e:
# error += f"Could not set recovery voltage treshold: {str(e)}" # TODO Return error value
print(f"Could not set recovery voltage treshold: {str(e)}")
return "-"

# TODO
set_low_voltage_treshold_witty_pi_4(2.5)
set_recovery_voltage_treshold_witty_pi_4(3.0)
get_low_voltage_treshold_witty_pi_4()
get_recovery_voltage_treshold_witty_pi_4()

Expand Down

0 comments on commit 075be8c

Please sign in to comment.