feat(modbus_tool): Add set functions for max open/close times
Adds new menu options to the Modbus tool to allow setting the maximum opening and closing times for the valve via Modbus registers.
This commit is contained in:
parent
bf29061db6
commit
75e8b486f0
|
|
@ -229,7 +229,7 @@ def main_menu(stdscr, slave_id):
|
||||||
curses.start_color(); curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE); curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_WHITE); curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLUE)
|
curses.start_color(); curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE); curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_WHITE); curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLUE)
|
||||||
stdscr.bkgd(' ', curses.color_pair(1))
|
stdscr.bkgd(' ', curses.color_pair(1))
|
||||||
|
|
||||||
menu = ["Open Valve", "Close Valve", "Stop Valve", "Toggle Output 1", "Toggle Output 2", "Set Watchdog", "Reset Node", "Firmware Update", "Exit"]
|
menu = ["Open Valve", "Close Valve", "Stop Valve", "Toggle Output 1", "Toggle Output 2", "Set Max Open Time", "Set Max Close Time", "Set Watchdog", "Reset Node", "Firmware Update", "Exit"]
|
||||||
current_row_idx = 0
|
current_row_idx = 0
|
||||||
message, message_time = "", 0
|
message, message_time = "", 0
|
||||||
input_mode, input_prompt, input_str, input_target_reg = False, "", "", 0
|
input_mode, input_prompt, input_str, input_target_reg = False, "", "", 0
|
||||||
|
|
@ -269,6 +269,10 @@ def main_menu(stdscr, slave_id):
|
||||||
client.write_register(REG_HOLDING_DIGITAL_OUTPUTS_STATE, current_val ^ (1 << bit), slave=slave_id)
|
client.write_register(REG_HOLDING_DIGITAL_OUTPUTS_STATE, current_val ^ (1 << bit), slave=slave_id)
|
||||||
message = f"-> Toggled Output {bit+1}"
|
message = f"-> Toggled Output {bit+1}"
|
||||||
except Exception as e: message = f"-> Error: {e}"
|
except Exception as e: message = f"-> Error: {e}"
|
||||||
|
elif selected_option == "Set Max Open Time":
|
||||||
|
input_mode, input_prompt, input_target_reg = True, "Enter Max Open Time (s): ", REG_HOLDING_MAX_OPENING_TIME_S
|
||||||
|
elif selected_option == "Set Max Close Time":
|
||||||
|
input_mode, input_prompt, input_target_reg = True, "Enter Max Close Time (s): ", REG_HOLDING_MAX_CLOSING_TIME_S
|
||||||
elif selected_option == "Set Watchdog":
|
elif selected_option == "Set Watchdog":
|
||||||
input_mode, input_prompt, input_target_reg = True, "Enter Watchdog Timeout (s): ", REG_HOLDING_WATCHDOG_TIMEOUT_S
|
input_mode, input_prompt, input_target_reg = True, "Enter Watchdog Timeout (s): ", REG_HOLDING_WATCHDOG_TIMEOUT_S
|
||||||
elif selected_option == "Reset Node":
|
elif selected_option == "Reset Node":
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue