add incomplete pinouts to femto-config

This commit is contained in:
nagumii 2024-12-31 18:33:58 +02:00
parent ccd8cc47c8
commit e90f7dc2ad
2 changed files with 105 additions and 10 deletions

View file

@ -0,0 +1,83 @@
#!/bin/bash
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
EOF
)
if [ $# -eq 0 ]; then
echo "No arguments provided."
echo -e "$help"
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 - +"
femtofox="coming soon"
femtofox_zero="coming soon"
femtofox_tiny="coming soon"
# Parse options
while getopts "halfzt" opt; do
case ${opt} in
h) # Option -h (help)
echo -e "$help"
;;
a) # Option -s (ssid)
echo "$luckfox"
echo "\n"
echo "$femtofox"
echo "\n"
echo "$femtofox_zero"
echo "\n"
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"
;;
\?) # Invalid option
echo "Invalid option: -$OPTARG"
echo -e "$help"
exit 1
;;
esac
done

View file

@ -91,8 +91,10 @@ misc_settings() {
option=$(dialog --menu "Misc Settings" 15 40 4 \
1 "Set system timezone" \
2 "Ham radio support" \
3 "blah" \
4 "Back to Main Menu" 3>&1 1>&2 2>&3)
3 "Re-run first-boot script" \
4 "Display pinout" \
5 "Run OEM luckfox-config" \
6 "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
@ -145,9 +147,20 @@ then \`depmod\` will be run. To remove support, those modules will be deleted.\n
depmod -a 5.10.160
;;
3)
dialog --msgbox "Node info retrieved successfully!" 8 40
dialog --title "$title" --yesno "Rerunning the first-boot script will add support for RTC (real time clock), \
set the eth0 MAC address and Meshtastic nodeID to a derivative of the CPU serial number and enable wifi in Meshtastic settings. \
Rerunning the script will not cause any issues if these things are already in place. Femtofox will reboot after execution.\n\nConfirm?" 12 60
if [ $? -eq 0 ]; then #unless cancel/no
runonce.sh
fi
;;
4)
dialog --title "$title" --msgbox "$(femto-pinout.sh -a | sed 's/|n/\\n/g')" 0 0
;;
5)
luckfox-config
;;
6)
return
;;
esac
@ -158,7 +171,7 @@ then \`depmod\` will be run. To remove support, those modules will be deleted.\n
set_lora_radio() {
while true; do
local option=""
option=$(dialog --menu "Misc Settings" 0 0 10 \
option=$(dialog --menu "Misc" 0 0 10 \
1 "ebyte-e22-900m30s" \
2 "ebyte-e22-900m22s" \
3 "ebyte-e80-900m22s" \
@ -250,6 +263,7 @@ meshtasticd_settings() {
case $option in
1) #Get current configuration URL & QR code)
femto-meshtasticd-config.sh -g
pause
;;
2)
newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3)
@ -329,9 +343,8 @@ while true; do
2 "Meshtasticd" \
3 "Misc" \
4 "Software" \
5 "Run OEM luckfox-config" \
6 "Help" \
7 "Exit" 3>&1 1>&2 2>&3)
5 "Help" \
6 "Exit" 3>&1 1>&2 2>&3)
exit_status=$? # This line checks the exit status of the dialog command
@ -344,9 +357,8 @@ while true; do
2) meshtasticd_settings ;;
3) misc_settings ;;
4) software_settings ;;
5) luckfox-config ;;
6) femto_help ;;
7) break ;;
5) femto_help ;;
6) break ;;
*) dialog --msgbox "Invalid choice, please try again." 8 40 ;;
esac
done