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:
Eduard Iten 2025-07-10 23:23:00 +02:00
parent bf29061db6
commit 75e8b486f0
1 changed files with 5 additions and 1 deletions

View File

@ -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)
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
message, message_time = "", 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)
message = f"-> Toggled Output {bit+1}"
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":
input_mode, input_prompt, input_target_reg = True, "Enter Watchdog Timeout (s): ", REG_HOLDING_WATCHDOG_TIMEOUT_S
elif selected_option == "Reset Node":