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