Rename femtofox-config to femto-config

This commit is contained in:
nagumii 2024-12-31 22:37:16 +02:00
parent 6d4b51aa19
commit 712eece398
2 changed files with 111 additions and 58 deletions

View file

@ -83,6 +83,34 @@ For more details, enter \`iwconfig\`.
done
}
# Pinout menu
femto_pinouts() {
while true; do
local option=""
option=$(dialog --menu "Pinouts" 15 40 5 \
1 "Femtofox" \
2 "Femtofox Zero" \
3 "Femtofox Tiny" \
4 "Luckfox" \
5 "Back to Main Menu" 3>&1 1>&2 2>&3)
exit_status=$? # This line checks the exit status of the dialog command
if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog
break
fi
case $option in
1) dialog --title "$title" --msgbox "$(femto-pinout.sh -f)" 38 70 ;;
2) dialog --title "$title" --msgbox "$(femto-pinout.sh -z)" 38 70 ;;
3) dialog --title "$title" --msgbox "$(femto-pinout.sh -t)" 38 70 ;;
4) dialog --title "$title" --msgbox "$(femto-pinout.sh -l)" 23 63 ;;
5) return ;;
*) echo "Invalid option selected!" ;;
esac
done
}
# Function to handle misc settings
misc_settings() {
local title="Misc Settings"
@ -155,7 +183,7 @@ Rerunning the script will not cause any issues if these things are already in pl
fi
;;
4)
dialog --title "$title" --msgbox "$(femto-pinout.sh -a | sed 's/|n/\\n/g')" 0 0
femto_pinouts
;;
5)
luckfox-config
@ -326,21 +354,6 @@ meshtasticd_settings() {
femto-meshtasticd-config.sh -r
dialog --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`sudo apt purge\`.\nAfter reinstallation but before first launch, run \`sudo runonce.sh\`." 8 40
fi
pause
;;
12)
return
;;
esac
done
}
# Main menu
while true; do
choice=$(dialog --title "$(date)" --menu "Femtofox Config" 15 40 5 \
1 "Wi-Fi" \
2 "Meshtasticd" \
3 "Misc" \
4 "Software" \
5 "Help" \

View file

@ -3,11 +3,10 @@
help=$(cat <<EOF
Options are:
-h This message
-a Display all pinouts
-l Luckfox pinout
-f Femtofox pinout
-z Femtofox Smol/Zero pinout
-t Femtofox Tiny pinout
-l Luckfox pinout
EOF
)
@ -17,62 +16,103 @@ if [ $# -eq 0 ]; then
exit 1
fi
luckfox="\
|Pin #|Pin ID |Function | Luckfox |Pin #|Pin ID |Function |\n\
|-----|-------|--------------|---------|-----|-------|--------------|\n\
|1 |VBus |5V in/out | USB |22 |1V8 |1.8V out |\n\
|2 |GND | | |21 |GND | |\n\
|3 |3V3 |3.3V out | |20 |4C1 |1v8 IO, SARADC|\n\
|4/42 |1B2 |Debug UART2-TX| |19 |4C0 |1v8 IO, SARADC|\n\
|5/43 |1B3 |Debug UART2-RX| [b] |18/4 |0A4 |3v3 IO |\n\
|6/48 |1C0 |CS0, IO | |17/55|1C7 |IRQ, IO |\n\
|7/49 |1C1 |CLK, IO | |16/54|1C6 |BUSY, IO |\n\
|8/50 |1C2 |MOSI, IO | |15/59|1D3 |i2c SCL |\n\
|9/51 |1C3 |MISO, IO | |14/58|1D2 |i2c SDA |\n\
|10/52|1C4 |UART4-TX | |13/57|1D1 |UART3-RX, NRST|\n\
|11/53|1C5 |UART4-RX | ETH |12/56|1D0 |UART3-TX, RXEN|\n\
|-----|-------|--------------|---------|-----|-------|--------------|\n\
R R G T T\n\
X X N X X\n\
- + D - +"
# luckfox="\
# |Pin #|Pin ID |Function | Luckfox |Pin #|Pin ID |Function |\n\
# |-----|-------|--------------|---------|-----|-------|--------------|\n\
# |1 |VBus |5V in/out | USB |22 |1V8 |1.8V out |\n\
# |2 |GND | | |21 |GND | |\n\
# |3 |3V3 |3.3V out | |20 |4C1 |1v8 IO, SARADC|\n\
# |4/42 |1B2 |Debug UART2-TX| |19 |4C0 |1v8 IO, SARADC|\n\
# |5/43 |1B3 |Debug UART2-RX| [b] |18/4 |0A4 |3v3 IO |\n\
# |6/48 |1C0 |CS0, IO | |17/55|1C7 |IRQ, IO |\n\
# |7/49 |1C1 |CLK, IO | |16/54|1C6 |BUSY, IO |\n\
# |8/50 |1C2 |MOSI, IO | |15/59|1D3 |i2c SCL |\n\
# |9/51 |1C3 |MISO, IO | |14/58|1D2 |i2c SDA |\n\
# |10/52|1C4 |UART4-TX | |13/57|1D1 |UART3-RX, NRST|\n\
# |11/53|1C5 |UART4-RX | ETH |12/56|1D0 |UART3-TX, RXEN|\n\
# |-----|-------|--------------|---------|-----|-------|--------------|\n\
# R R G T T\n\
# X X N X X\n\
# - + D - +"
femtofox="coming soon"
luckfox="
───────────────── \n\
VBUS 5V ●│● │ USB-C │ ●│● 1V8 OUT \n\
GND ●│● │ │ ●│● GND \n\
3V3 IN/OUT ●│● ─────── ●│● 145 (1.8V) \n\
UART-TX2 DEBUG, 42 ●│● ●│● 144 (1.8V) \n\
UART-RX2 DEBUG, 43 ●│● [BTN] ●│● 4 \n\
CS0, 48 ●│● ●│● 55, IRQ \n\
CLK, 49 ●│● ●│● 54 BUSY \n\
MOSI, 50 ●│● ●│● 59, I2C SCL \n\
MISO, 51 ●│● ●│● 58, I2C SDA \n\
UART4-RX, 52 ●│● ●│● 57, UART3-RX, NRST \n\
UART4-TX, 53 ●│● ETH ●│● 56, UART3-TX RXEN \n\
──●──●──●──●──●── \n\
R R G T T \n\
X X N X X \n\
- + D - + \n\
GPIO BANK 0: 4 \n\
GPIO BANK 1: 42 43 48 49 50 51 52 53 54 55 56 57 58 59 \n\
GPIO BANK 4: 144 145 "
femtofox="\
──────────────────────────────────────────────────────────────── \n\
│( ):FUSE ●│● USB-C ●│● PWR-IN |+ -| 3.3-5V ( )│\n\
│─────── ●│● ●│● ─── │\n\
│ USB-C │ ●│● ●│● ───────────────────────────── │\n\
│ POWER │ ●│● LUCKFOX ●│● │ _____________ │ │\n\
│─────── ●│● PICO MINI ●│● │ │ │ │ │\n\
│─── ●│● ●│● │ E │ │ │ │\n\
│ ● │GND ●│● FOXHOLE ●│● │ 2 │ │ │ │\n\
│ ● │3V3 ●│● ●│● │ 2 │ E22 900M22S │ │ │\n\
│ ● │TX4 ●│● ●│● │ | │ │ │ │\n\
│ ● │RX4 ●│● ●│● │ 9 │ │ │ │\n\
│─── ●│● ●│● │ 0 │_____________│ │ │\n\
│( ) ───●─●─●─●─●─── │ 0 ___________ │ │\n\
│────────────────── │ M │ │ │ │\n\
│ ● RX- │ I2C GROVE │ 3 │ SEEED │ │ │\n\
│ ● RX+ │ ─────── │ 0 │WIO SX1262│ │ │\n\
│ ● GND ETHERNET │ │● ● ● ●│ │ S │ │ │ │\n\
│ ● TX- │ │───────│ │ │___________│ │ │\n\
│ ● TX+ │ │● ● ● ●│ │ │ │\n\
│────────────────── ─────── ───────────────────────────── │\n\
│ ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● │\n\
│( )● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ●( )│\n\
──────────────────────────────────────────────────────────────── \n\
\n\
R M M \n\
G X G C O I 3 G S S 3 \n\
N E N L S S V N C D V \n\
D N D K I O 3 D L A 3 \n\
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● \n\
● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● ● \n\
C B I G G G G R R T G 5 5 \n\
S U R N N N N S X X N V V \n\
0 S Q D D D D T 4 4 D \n\
Y "
femtofox_zero="coming soon"
femtofox_tiny="coming soon"
# Parse options
while getopts "halfzt" opt; do
while getopts "hlfzt" opt; do
case ${opt} in
h) # Option -h (help)
echo -e "$help"
;;
a) # Option -s (ssid)
echo "$luckfox"
echo "\n"
f) # Option -f (femtofox)
echo "$femtofox"
echo "\n"
;;
z) # Option -z (femtofox zero)
echo "$femtofox_zero"
echo "\n"
;;
t) # Option -t (femtofox tiny)
echo "$femtofox_tiny"
;;
l) # Option -p (psk)
sed -i "/psk=/s/\".*\"/\"$OPTARG\"/" "$wpa_supplicant_conf"
echo "Setting PSK to $OPTARG."
updated_wifi="true"
;;
f) # Option -c (country)
sed -i "/country=/s/=[^ ]*/=$OPTARG/" "/etc/wpa_supplicant/wpa_supplicant.conf"
echo "Setting country to $OPTARG."
updated_wifi="true"
;;
z) # Option -r (restart wifi)
updated_wifi="true"
;;
t) # Option -r (restart wifi)
updated_wifi="true"
l) # Option -l (luckfox)
echo "$luckfox"
;;
\?) # Invalid option
echo "Invalid option: -$OPTARG"