From 83d14e10894463782518d8a9f4d6c280cc8de4e7 Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 9 Jan 2025 19:59:20 +0200 Subject: [PATCH] try fix .bashrc location & show clearly in femto-config when using simradio --- .../out/rootfs_uclibc_rv1106/home/{pico => femto}/.bashrc | 0 .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 8 ++++---- .../usr/local/bin/femto-meshtasticd-config.sh | 8 ++++++-- .../usr/local/bin/femto-network-config.sh | 2 -- 4 files changed, 10 insertions(+), 8 deletions(-) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/home/{pico => femto}/.bashrc (100%) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/home/pico/.bashrc b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/home/femto/.bashrc similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/home/pico/.bashrc rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/home/femto/.bashrc diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 6449dde..e731524 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -83,7 +83,7 @@ networking_settings() { dialog --colors --msgbox "\Z1Network adapter wlan0 does not exist.\Zn\n\nIs a wifi adapter connected?" 8 40 else while true; do - choice=$(dialog --cancel-label "Back" --title "Wi-Fi Status" --menu "Enable/disable Wi-Fi" 9 40 5 \ + choice=$(dialog --cancel-label "Back" --title "Enable/disable Wi-Fi" --menu "Tip: Wi-Fi can also be toggled by short-pressing the BOOT button on the Luckfox." 11 50 5 \ 1 "Turn Wi-Fi on" \ 2 "Turn Wi-Fi off" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command @@ -196,7 +196,7 @@ utilities() { ;; 5) luckfox-config ;; 6) - dialog --title "$title" --yesno "Reboot now?" 6 45 + dialog --title "$title" --yesno "Reboot now?\n\nTip: Reboot can also be triggered by long-pressing the BOOT button on the luckfox." 10 45 if [ $? -eq 0 ]; then #unless cancel/no dialog --infobox "Rebooting..." 5 45 reboot @@ -289,7 +289,7 @@ meshtasticd_settings() { local service_state="unknown" fi local option="" - option=$(dialog --colors --title "$title" --cancel-label "Back" --menu "Meshtasticd service is $service_state" 23 50 4 \ + option=$(dialog --colors --title "$title" --cancel-label "Back" --menu "Meshtasticd service is $service_state$(femto-meshtasticd-config.sh -k | grep -q 'simulated' && echo '\n\Z1Using simulated radio\Zn')" 23 50 4 \ 1 "View configuration URL & QR code" \ 2 "Set new configuration URL" \ 3 "View lora radio selection" \ @@ -329,7 +329,7 @@ meshtasticd_settings() { fi ;; 3) - dialog --title "LoRa radio" --msgbox "Currently configured LoRa radio: $(femto-meshtasticd-config.sh -k)" 6 40 + dialog --colors --title "LoRa radio" --msgbox "Currently configured LoRa radio: $(replace_colors "$(femto-meshtasticd-config.sh -k)")" 6 40 ;; 4) set_lora_radio diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index ac57580..91e9bd5 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -81,21 +81,25 @@ while getopts ":hgkl:q:va:cpo:struxm" opt; do echo $url ;; k) # Option -k (get current lora radio model) - ls /etc/meshtasticd/config.d/femtofox* | xargs -n 1 basename | sed 's/^femtofox_//;s/\.yaml$//' + ls /etc/meshtasticd/config.d/femtofox* 2>/dev/null | [ -s /dev/stdin ] && xargs -n 1 basename | sed 's/^femtofox_//;s/\.yaml$//' || echo -e "\033[0;31mnone (simulated radio)\033[0m" ;; l) # Option -l (choose lora radio model) - prepare="rm -f /etc/meshtasticd/config.d/femtofox* && echo \"Radio type $OPTARG selected.\" && systemctl restart meshtasticd" + prepare="rm -f /etc/meshtasticd/config.d/femtofox* && echo \"Radio type $OPTARG selected.\"" if [ "$OPTARG" = "lr1121_tcxo" ]; then eval $prepare cp /etc/meshtasticd/available.d/femtofox/femtofox_LR1121_TCXO.yaml /etc/meshtasticd/config.d + systemctl restart meshtasticd elif [ "$OPTARG" = "sx1262_tcxo" ]; then eval $prepare cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + systemctl restart meshtasticd elif [ "$OPTARG" = "sx1262_xtal" ]; then eval $prepare cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d + systemctl restart meshtasticd elif [ "$OPTARG" = "none" ]; then eval $prepare + systemctl restart meshtasticd else echo "$OPTARG is not a valid option. Options are \`lr1121_tcxo\`, \`sx1262_tcxo\`, \`sx1262_xtal\`, \`none\` (simradio)" fi diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index ae0d78d..eb526cc 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -145,6 +145,4 @@ if [ "$updated_wifi" = true ]; then systemctl restart wpa_supplicant wpa_cli -i wlan0 reconfigure # <-------- add watch for FAIL response, error out timeout 30s dhclient -v - echo " Wi-Fi enabled and restarted. Enabling Meshtastic Wi-Fi setting." - #femto-meshtasticd-config.sh -m "--set network.wifi_enabled true" 10 "USB config" #| tee -a /tmp/femtofox-config.log fi