Merge branch 'main' into OSC

This commit is contained in:
Ruledo 2025-02-24 20:08:55 -08:00
commit 229c9c2bf8
9 changed files with 81 additions and 62 deletions

View file

@ -47,13 +47,13 @@ Find out more in the sections below, or in the [Wiki](https://github.com/femtofo
| Dimensions | 63 x 54 x 19mm |
**Accomplished:**
- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](supported_hardware.md))
- [x] WIFI over USB (see [supported hardware](supported_hardware.md))
- [x] Meshtastic native client controlling a LoRa radio (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
- [x] WIFI over USB (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
- [x] Ethernet over pins (see *Networking* below and wiring diagram at bottom of page)
- [x] UART communications with Meshtastic nodes (2 pin pairs) such as RAK Wisblock
- [x] USB serial communications with Meshtastic nodes (see [supported hardware](supported_hardware.md))
- [x] USB serial communications with Meshtastic nodes (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
- [x] USB mass storage
- [x] Real time clock (RTC) support (see [supported hardware](supported_hardware.md))
- [x] Real time clock (RTC) support (see [supported hardware](https://github.com/femtofox/femtofox/wiki/Supported-Hardware))
- [x] Activity LED disabled. User LED will blink for 5 seconds when boot is complete
- [x] Short pressing the "BOOT" button toggles wifi, 2-5 second press triggers reboot, 5+ second press shuts system down
- [x] Ability to reconfigure wifi via USB flash drive

View file

@ -21,6 +21,11 @@
### Meshtastic settings
## Multiple meshtastic_cli lines can be added. This is important, as the Meshtastic CLI requires that different settings categories (such as device and lora) be handled in separate commands.
## See Meshtastic CLI docs (https://meshtastic.org/docs/software/python/cli/) for more information.
#meshtastic_cli="--set lora.modem_preset LONG_FAST"
#meshtastic_cli="--set device.role CLIENT"
## Radio module to use. Options are:
## "ebyte-e22-900m30s"
## "ebyte-e22-900m22s"

View file

@ -39,7 +39,8 @@ DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-
echo "Installing dependencies for meshing-around and meshtastic cli..."
#pip config set global.extra-index-url https://www.piwheels.org/simple
pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python
pip3 install requests pyephem pytap2 meshtastic pypubsub geopy maidenhead beautifulsoup4 dadjokes schedule wikipedia googlesearch-python pubsub datetime
if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi
echo "Downloading ttyd and enabling service..."
@ -62,7 +63,8 @@ systemctl enable femto-boot-complete.service
systemctl enable femto-wifi-mesh-control
systemctl enable femto-watchclock-dog
systemctl disable meshtasticd
systemctl disable ttyd # enabled on first boot
systemctl disable meshtasticd # enabled on first boot
systemctl disable apt-daily.timer
systemctl disable unattended-upgrades
systemctl disable smbd nmbd # samba services, can be enabled via menu

View file

@ -636,7 +636,7 @@ help_menu() {
2) #Display pinout)
choice="" # zero the choice before loading the submenu
while true; do
choice=$(dialog --no-collapse --cancel-label "Back" --item-help --menu "Pinouts" 15 40 5 \
choice=$(dialog --no-collapse --cancel-label "Back" --default-item "$choice" --item-help --menu "Pinouts" 15 40 5 \
1 "Femtofox Pro/CE" "" \
2 "Femtofox Zero" "" \
3 "Femtofox Tiny" "" \

View file

@ -44,11 +44,12 @@ meshtastic_update() {
local command="$1"
local attempts=$2
local ref="$3: "
echo "${ref:+$ref}meshtastic --host $command"
echo "Submitting to Meshtastic..."
for retries in $(seq 1 $attempts); do
local output=$(meshtastic --host $command 2>&1 | tee $(if [ -e /dev/tty ]; then echo /dev/tty; else echo /dev/ttyFIQ0; fi))
logger $output
if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then
output=$(eval meshtastic --host $command 2>&1 | tee /dev/fd/2) # display the output on screen live. Use eval so quotes will be handled correctly in $command
logger "$output"
if echo "$output" | grep -qiE "Abort|invalid|Error|error|unrecognized|refused|Errno|failed|Failed"; then
if [ "$retries" -lt $attempts ]; then
local msg="${ref:+$ref}Meshtastic command failed, retrying ($(($retries + 1))/$attempts)..."
echo "$msg"
@ -177,8 +178,10 @@ get_meshtastic_settings() {
eval "url_primary_channel='$(echo "$meshtastic_info" | sed -n 's/^Primary channel URL: //p')'"
[[ "$1" != *"quiet"* ]] && echo "url_primary_channel:$url_primary_channel"
eval "url_all_channels='$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p')'"
[[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels"
if echo "$meshtastic_info" | grep -q "^Complete URL (includes all channels): "; then
url_all_channels=$(echo "$meshtastic_info" | sed -n 's/^Complete URL (includes all channels): //p')
[[ "$1" != *"quiet"* ]] && echo "url_all_channels:$url_all_channels"
fi
fi
}

View file

@ -180,7 +180,7 @@ lora_settings_actions() {
done
menu_items+=("" "" "" "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" "" "")
while true; do
choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${$lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \
choice=$(dialog --no-collapse --title "$title" --cancel-label "$([[ "$1" == "wizard" ]] && echo "Skip" || echo "Cancel")" --default-item "${lora_modemPreset^}" --item-help --menu "The default preset will provide a strong mixture of speed and range, for most users.\n\nPreset? (current: ${lora_modemPreset:-unknown})" 0 0 0 \
"${menu_items[@]}" 3>&1 1>&2 2>&3)
[ $? -eq 1 ] || [ "$choice" == "Cancel" ] || [ "$choice" == "Skip" ] && break # Exit the loop if the user selects "Cancel" or closes the dialog
[ "$choice" == "" ] && continue # Restart loop if no choice made

View file

@ -60,58 +60,58 @@ KILL: add PWR switch or thermal cutoff/fuse & remove resistor."
femtofox_zero="\
┌────┐ ┌────┐
│⚪ \ / ⚪│
│ \ / │
│ └─────────┘ │
│ ┌─────────────────┐ │
│ ●│● USB-C ●│● │
│ ●│● ●│● │
│ ●│● ●│● │
│ ●│● LUCKFOX ●│● │
│ ●│● PICO MINI ●│● │
│ ●│● ●│● │
│ ●│● FOXHOLE ●│● │
│ ●│● ●│● │
│ ●│● ●│● │
│ ●│● ●│● │
│ ●│● ●│● │
│ └────●─●─●─●─●────┘ │
├───┐ ┌─────────────┐ ┌───┤
GND │ ● │ │ HT-RA62 │ │ ● │ GND
3V3 │ ● │ │ ┌───────┐ │ │ ● │ 3V3
UART4-RX │ ● │ │ │ │ │ │ ● │ I2C SDA
UART4-TX │ ● │ │ │ WIO │ │ │ ● │ I2C SCL
├───┘ │ │SX 1262│ │ └───┤
│ │ └───────┘ │ ● │ UNUSED
│ └─────────────┘ ● │ GND
│⚪ ETH ⚪│
└────────●─●─●─●─●────────┘
R R G T T
X X N X X
- + D - + \n"
┌────┐ ┌────┐ \n\
│⚪ \ / ⚪│ \n\
│ \ / │ \n\
│ └─────────┘ │ \n\
│ ┌─────────────────┐ │ \n\
│ ●│● USB-C ●│● │ \n\
│ ●│● ●│● │ \n\
│ ●│● ●│● │ \n\
│ ●│● LUCKFOX ●│● │ \n\
│ ●│● PICO MINI ●│● │ \n\
│ ●│● ●│● │ \n\
│ ●│● FOXHOLE ●│● │ \n\
│ ●│● ●│● │ \n\
│ ●│● ●│● │ \n\
│ ●│● ●│● │ \n\
│ ●│● ●│● │ \n\
│ └────●─●─●─●─●────┘ │ \n\
├───┐ ┌─────────────┐ ┌───┤ \n\
GND │ ● │ │ HT-RA62 │ │ ● │ GND \n\
3V3 │ ● │ │ ┌───────┐ │ │ ● │ 3V3 \n\
UART4-RX │ ● │ │ │ │ │ │ ● │ I2C SDA \n\
UART4-TX │ ● │ │ │ WIO │ │ │ ● │ I2C SCL \n\
├───┘ │ │SX 1262│ │ └───┤ \n\
│ │ └───────┘ │ ● │ UNUSED \n\
│ └─────────────┘ ● │ GND \n\
│⚪ ETH ⚪│ \n\
└────────●─●─●─●─●────────┘ \n\
R R G T T \n\
X X N X X \n\
- + D - + "
femtofox_tiny="coming soon"
luckfox="\
┌────┬───────┬────┐
VBUS 3.3-5V ●│● │ USB-C │ ●│● 1V8 OUT
GND ●│● │ │ ●│● GND
3V3 IN/OUT ●│● └───────┘ ●│● 145, SARADC-IN1 1.8V
UART2-TX DEBUG, 42 ●│● ●│● 144, SARADC-IN0 1.8V
UART2-RX DEBUG, 43 ●│● [BTN] ●│● 4
CS0, 48 ●│● ●│● 55, IRQ
CLK, 49 ●│● ●│● 54, BUSY
MOSI, 50 ●│● ●│● 59, I2C SCL
MISO, 51 ●│● ●│● 58, I2C SDA
UART4-RX, 52 ●│● ●│● 57, NRST, UART3-RX
UART4-TX, 53 ●│● ETH ●│● 56, RXEN, UART3-TX
└──●──●──●──●──●──┘
R R G T T
X X N X X
- + D - +
GPIO BANK 0 (3.3v): 4
GPIO BANK 1 (3.3v): 42 43 48 49 50 51 52 53 54 55 56 57 58 59
┌────┬───────┬────┐ \n\
VBUS 3.3-5V ●│● │ USB-C │ ●│● 1V8 OUT \n\
GND ●│● │ │ ●│● GND \n\
3V3 IN/OUT ●│● └───────┘ ●│● 145, SARADC-IN1 1.8V\n\
UART2-TX DEBUG, 42 ●│● ●│● 144, SARADC-IN0 1.8V\n\
UART2-RX 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, NRST, UART3-RX \n\
UART4-TX, 53 ●│● ETH ●│● 56, RXEN, UART3-TX \n\
└──●──●──●──●──●──┘ \n\
R R G T T \n\
X X N X X \n\
- + D - + \n\
GPIO BANK 0 (3.3v): 4 \n\
GPIO BANK 1 (3.3v): 42 43 48 49 50 51 52 53 54 55 56 57 58 59\n\
GPIO BANK 4 (1.8v): 144 145 "
# Parse options

View file

@ -110,11 +110,13 @@ systemctl enable meshtasticd
#generate SSH keys
log_message "Generating new SSH encryption keys. This can take a couple minutes..."
#femto-utils.sh -E
femto-utils.sh -E
#generate ttyd SSL keys
log_message "Generating new Web Terminal (ttyd) SSL encryption keys. This can take a couple minutes..."
/usr/local/bin/packages/ttyd.sh -k
log_message "Enabling Web Terminal (ttyd) service..."
systemctl enable ttyd
# remove first boot flag
systemctl disable femto-runonce

View file

@ -270,6 +270,13 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then
meshtastic_security_command+=" -o \"$meshtastic_legacy_admin\"" # add to the command list
fi
# get meshtastic_cli= lines and run them
while IFS='=' read -r key value; do
log_message "Meshtastic CLI command found."
femto-meshtasticd-config.sh -m "$value" 3 "Meshtastic CLI command" 2>&1 | tee -a /tmp/femtofox-config.log
found_config=true
done < <(grep '^meshtastic_cli=' "$usb_config" | sed -E 's/^meshtastic_cli=["]?(.*[^"])["]?$/meshtastic_cli=\1/')
if [ "$found_config" = true ]; then #if we found a config file containing valid data
if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi
log_message "Making changes to wifi settings and restarting wifi."