From 222180fcba71ee7c4687e94f4604c09a7114d65e Mon Sep 17 00:00:00 2001 From: Ruledo Date: Tue, 7 Jan 2025 23:19:53 -0800 Subject: [PATCH] Added an error handler from Josh. Checks to make sure meshtastic is running and responsive. --- .../rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh index e39c8ba..4ef054b 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/wifi-mesh-control.sh @@ -17,6 +17,12 @@ get_mobile_wifi_state() { set_mobile_wifi_state() { local state="$1" local meshtastic_output + + if [[ "$(meshtastic --host 127.0.0.1 --get network.wifi_enabled 2>&1 | grep -i refused)" ]] || [[ ! "$(meshtastic --host 127.0.0.1 --get network.wifi_enabled)" ]]; then + log "Error connecting to MeshtasticD. Aborting." + exit 2 + fi + if [[ "$state" == "up" ]]; then meshtastic_output=$(meshtastic --host 127.0.0.1 --set network.wifi_enabled true 2>&1) else