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":
|
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":
|
||||||
client.write_register(REG_HOLDING_DEVICE_RESET, 1, slave=slave_id)
|
try:
|
||||||
message = "-> Sent RESET command"
|
client.write_register(REG_HOLDING_DEVICE_RESET, 1, slave=slave_id)
|
||||||
elif selected_option == "Firmware Update":
|
message = "-> Sent RESET command. Node should reboot."
|
||||||
client.write_register(REG_HOLDING_DEVICE_RESET, 1, slave=slave_id)
|
except Exception as e:
|
||||||
message = "-> Sent RESET command"
|
message = f"-> Error sending reset: {e}"
|
||||||
elif selected_option == "Firmware Update":
|
elif selected_option == "Firmware Update":
|
||||||
filepath = file_browser(stdscr)
|
filepath = file_browser(stdscr)
|
||||||
if filepath:
|
if filepath:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue