mirror of
https://github.com/femtofox/femtofox.git
synced 2026-10-26 19:02:00 -04:00
Wifi mesh control checks SPI
Wifi mesh control does nothing now if meshtasticd is not using SPI
This commit is contained in:
parent
4a7b64c39c
commit
ab6096dbfe
1 changed files with 19 additions and 16 deletions
|
|
@ -66,24 +66,27 @@ monitor_changes() {
|
|||
previous_wlan_state=$(ip link show wlan0 | grep -q 'state UP' && echo "up" || echo "down")
|
||||
|
||||
while true; do
|
||||
local current_mobile_state current_wlan_state
|
||||
current_mobile_state=$(get_mobile_wifi_state)
|
||||
current_wlan_state=$(ip link show wlan0 | grep -q 'state UP' && echo "up" || echo "down")
|
||||
PID=$(ps -C meshtasticd -o pid= | tr -d ' ')
|
||||
if [[ -n "$PID" ]] && sudo lsof /dev/spidev0.0 | grep -q "$PID"; then
|
||||
#if sudo lsof /dev/spidev0.0 | grep -q "meshtasticd"; then
|
||||
local current_mobile_state current_wlan_state
|
||||
current_mobile_state=$(get_mobile_wifi_state)
|
||||
current_wlan_state=$(ip link show wlan0 | grep -q 'state UP' && echo "up" || echo "down")
|
||||
|
||||
if [[ "$current_mobile_state" != "$previous_mobile_state" ]]; then
|
||||
log "Detected mobile Wi-Fi state change: $previous_mobile_state -> $current_mobile_state"
|
||||
echo "$current_mobile_state" > "$WIFI_STATE_FILE"
|
||||
set_wlan_state "$current_mobile_state"
|
||||
previous_mobile_state="$current_mobile_state"
|
||||
if [[ "$current_mobile_state" != "$previous_mobile_state" ]]; then
|
||||
log "Detected mobile Wi-Fi state change: $previous_mobile_state -> $current_mobile_state"
|
||||
echo "$current_mobile_state" > "$WIFI_STATE_FILE"
|
||||
set_wlan_state "$current_mobile_state"
|
||||
previous_mobile_state="$current_mobile_state"
|
||||
fi
|
||||
|
||||
if [[ "$current_wlan_state" != "$previous_wlan_state" ]]; then
|
||||
log "Detected wlan0 state change: $previous_wlan_state -> $current_wlan_state"
|
||||
echo "$current_wlan_state" > "$WIFI_STATE_FILE"
|
||||
set_mobile_wifi_state "$current_wlan_state"
|
||||
previous_wlan_state="$current_wlan_state"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$current_wlan_state" != "$previous_wlan_state" ]]; then
|
||||
log "Detected wlan0 state change: $previous_wlan_state -> $current_wlan_state"
|
||||
echo "$current_wlan_state" > "$WIFI_STATE_FILE"
|
||||
set_mobile_wifi_state "$current_wlan_state"
|
||||
previous_wlan_state="$current_wlan_state"
|
||||
fi
|
||||
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue