Merge pull request #169 from noon92/working

try fix .bashrc location & show clearly in femto-config when using simradio
This commit is contained in:
noon92 2025-01-09 19:59:45 +02:00 • committed by GitHub
commit 47882f46a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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