fix: handle connection loss and re-establish in modbus_tool.py
This commit is contained in:
parent
2418d4e218
commit
b54c73edb1
|
|
@ -225,11 +225,11 @@ def main_menu(stdscr, slave_id):
|
|||
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":
|
||||
client.write_register(REG_HOLDING_DEVICE_RESET, 1, slave=slave_id)
|
||||
message = "-> Sent RESET command"
|
||||
elif selected_option == "Firmware Update":
|
||||
client.write_register(REG_HOLDING_DEVICE_RESET, 1, slave=slave_id)
|
||||
message = "-> Sent RESET command"
|
||||
try:
|
||||
client.write_register(REG_HOLDING_DEVICE_RESET, 1, slave=slave_id)
|
||||
message = "-> Sent RESET command. Node should reboot."
|
||||
except Exception as e:
|
||||
message = f"-> Error sending reset: {e}"
|
||||
elif selected_option == "Firmware Update":
|
||||
filepath = file_browser(stdscr)
|
||||
if filepath:
|
||||
|
|
|
|||
Loading…
Reference in New Issue