Feature/add sx1276 support #2

Zusammengeführt
tom hat 7 Commits von feature/add-sx1276-support nach main 2026-10-20 04:34:44 +02:00 zusammengeführt
3 geänderte Dateien mit 279 neuen und 184 gelöschten Zeilen
Nur Änderungen aus Commit f8088d3793 werden angezeigt - Alle Commits anzeigen

Keine Dateien entsprechen Ihrer Suche

+192 -183
Datei anzeigen
@@ -1,9 +1,10 @@
name: Automated CI Build of FoxMesh
name: Build of FoxMesh
on:
push:
branches:
- main
branches: [ main ]
pull_request:
branches: [ main ] # Trigger the workflow on pull request events targeting the main branch
workflow_dispatch:
inputs:
target_branch:
@@ -19,113 +20,121 @@ jobs:
contents: write # We want also create official Releases
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
# 1. Checkout the target branch
- name: Checkout Target branch
uses: actions/checkout@v7
with:
ref: ${{ github.event.inputs.target_branch || github.ref }}
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
# 2. Extract Git and Date Metadata for the dynamic artifact filename
- name: Generate Dynamic Artifact Metadata
id: meta
run: |
# Get current date in YYYYMMDD format
echo "CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
# 1. Checkout the target branch
- name: Checkout Target branch
uses: actions/checkout@v7
with:
ref: ${{ github.event.inputs.target_branch || github.ref }}
# Get short 7-character git commit hash
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# 2. Extract Git and Date Metadata for the dynamic artifact filename
- name: Generate Dynamic Artifact Metadata
id: meta
run: |
# Get current date in YYYYMMDD format
echo "CURRENT_DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
# Extract and sanitize branch name (replace slashes and special characters with dashes)
RAW_BRANCH=${{ github.event.inputs.target_branch || github.ref_name }}
CLEAN_BRANCH=$(echo "$RAW_BRANCH" | sed 's/[^a-zA-Z0-9.\-]/_§/g' | sed 's|§|-|g' | sed 's|_||g')
echo "GIT_BRANCH=$CLEAN_BRANCH" >> $GITHUB_ENV
# Get short 7-character git commit hash
echo "GIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
# 3. Set up Python environment
- name: Set up Python 3.x
uses: actions/setup-python@v7
with:
python-version: '3.x'
# Extract and sanitize branch name (replace slashes and special characters with dashes)
RAW_BRANCH=${{ github.event.inputs.target_branch || github.ref_name }}
CLEAN_BRANCH=$(echo "$RAW_BRANCH" | sed 's/[^a-zA-Z0-9.\-]/_§/g' | sed 's|§|-|g' | sed 's|_||g')
echo "GIT_BRANCH=$CLEAN_BRANCH" >> $GITHUB_ENV
# 4. Cache global PlatformIO directories, uses a dynamic key based on platformio.ini
- name: Cache PlatformIO
uses: actions/cache@v6
with:
path: |
~/.cache/pio
~/.platformio
.pio
key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-pio-
#3 Python alread installed
- name: Show Python Version
run: python --version
# 5. Install PlatformIO Core and the required intelhex extension in a single, quiet command
- name: Install PlatformIO Core
run: python -m pip install --quiet --upgrade pip platformio intelhex
# 4. Cache global PlatformIO directories, uses a dynamic key based on platformio.ini
- name: Cache PlatformIO
uses: actions/cache@v6
with:
path: |
.platformio
.pio
key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-pio-
# 6. Install ESP32 Platform SDK
- name: Install ESP32 platform
run: pio pkg install --silent --global --platform espressif32
- name: PlatformIO in venv installieren
run: |
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --quiet --upgrade pip platformio intelhex
# Ab hier steht platformio in diesem Schritt zur Verfügung
pio --version
# Fügt den Pfad absolut dem GitHub/Gitea-Pfad hinzu:
echo "$PWD/.venv/bin" >> $GITHUB_PATH
# 7. Compile the Project
- name: Compile the Project
run: pio run
# 5. Install PlatformIO Core and the required intelhex extension in a single, quiet command
# - name: Install PlatformIO Core
# run: python -m pip install --quiet --upgrade pip platformio intelhex
# 8. Dynamically create the smart flashing scripts next to the T-Beam binary
# with optional bootloader detection and group check
# the table of flash addresses usually found at /partitions-4MB-safeboot.csv
- name: Create Desktop Flashing Scripts
run: |
# ----------------------------------------------------------------------
# 0. Flash Address Configuration ← edit here to change the layout
# ----------------------------------------------------------------------
FLASH_BOOTLOADER_ADDR="0x1000"
FLASH_PARTITIONS_ADDR="0x8000"
FLASH_OTADATA_ADDR="0xE000"
FLASH_SAFEBOOT_ADDR="0x10000"
FLASH_FIRMWARE_ADDR="0x10000"
# 6. Install ESP32 Platform SDK
# - name: Install ESP32 platform
# run: pio pkg install --silent --global --platform espressif32
# ----------------------------------------------------------------------
# 1. Universal Linux Shell Script
# ----------------------------------------------------------------------
cat << 'EOF' > flash_esp32_board.sh
#!/usr/bin/env bash
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
# 7. Compile the Project
- name: Compile the Project
run: pio run
echo -e "${YELLOW}=== FoxMesh Universal ESP32 Flashing Script ===${NC}"
# 8. Dynamically create the smart flashing scripts next to the T-Beam binary
# with optional bootloader detection and group check
# the table of flash addresses usually found at /partitions-4MB-safeboot.csv
- name: Create Desktop Flashing Scripts
run: |
# ----------------------------------------------------------------------
# 0. Flash Address Configuration ← edit here to change the layout
# ----------------------------------------------------------------------
FLASH_BOOTLOADER_ADDR="0x1000"
FLASH_PARTITIONS_ADDR="0x8000"
FLASH_OTADATA_ADDR="0xE000"
FLASH_SAFEBOOT_ADDR="0x10000"
FLASH_FIRMWARE_ADDR="0x10000"
if ! command -v esptool &> /dev/null; then
# ----------------------------------------------------------------------
# 1. Universal Linux Shell Script
# ----------------------------------------------------------------------
cat << 'EOF' > flash_esp32_board.sh
#!/usr/bin/env bash
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m'
echo -e "${YELLOW}=== FoxMesh Universal ESP32 Flashing Script ===${NC}"
if ! command -v esptool &> /dev/null; then
echo -e "${RED}Error: esptool is not installed.${NC}"
echo "Please install it via your package manager or pip: 'pip install esptool'"
echo "Option Linux Arch: 'sudo pacman -Sy && sudo pacman -S extra-testing/esptool'"
exit 1
fi
fi
FIRMWARE="firmware.bin"
FIRMWARE="firmware.bin"
# Firmware File
if [ ! -f "$FIRMWARE" ]; then
# Firmware File
if [ ! -f "$FIRMWARE" ]; then
echo -e "${RED}Error: No matching firmware binary found in this folder!${NC}"
exit 1
fi
fi
echo -e "${GREEN}Selected Firmware:${NC} $FIRMWARE ($BOARD_NAME)"
PORT=$(ls /dev/ttyUSB* /dev/ttyACM* 2>/dev/null | head -n 1)
if [ -z "$PORT" ]; then
echo -e "${GREEN}Selected Firmware:${NC} $FIRMWARE ($BOARD_NAME)"
PORT=$(ls /dev/ttyUSB* /dev/ttyACM* 2>/dev/null | head -n 1)
if [ -z "$PORT" ]; then
echo -e "${RED}Error: No connected ESP32 Board (ttyUSB/ttyACM) found!${NC}"
exit 1
fi
echo -e "${GREEN}Detected Board on port:${NC} $PORT"
fi
echo -e "${GREEN}Detected Board on port:${NC} $PORT"
# Dynamic Permission Check: Determine required group for the specific TTY device
REQUIRED_GROUP=$(stat -c '%G' "$PORT")
if [ "$REQUIRED_GROUP" != "root" ]; then
# Dynamic Permission Check: Determine required group for the specific TTY device
REQUIRED_GROUP=$(stat -c '%G' "$PORT")
if [ "$REQUIRED_GROUP" != "root" ]; then
if ! groups "$USER" | grep -q "\b${REQUIRED_GROUP}\b"; then
echo -e "${RED}Error: You do not have permissions to access $PORT.${NC}"
echo -e "The device belongs to the group: ${YELLOW}$REQUIRED_GROUP${NC}"
@@ -134,107 +143,107 @@ jobs:
echo -e "After running the command, please log out and log back in for the changes to take effect."
exit 1
fi
fi
fi
# Build flash arguments from the address table (only include files that exist)
FLASH_ARGS=""
if [ -f "bootloader.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __BOOTLOADER_ADDR__ bootloader.bin"
fi
if [ -f "partitions.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __PARTITIONS_ADDR__ partitions.bin"
fi
if [ -f "otadata.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __OTADATA_ADDR__ otadata.bin"
fi
if [ -f "safeboot.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __SAFEBOOT_ADDR__ safeboot.bin"
fi
FLASH_ARGS="$FLASH_ARGS __FIRMWARE_ADDR__ $FIRMWARE"
# Build flash arguments from the address table (only include files that exist)
FLASH_ARGS=""
if [ -f "bootloader.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __BOOTLOADER_ADDR__ bootloader.bin"
fi
if [ -f "partitions.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __PARTITIONS_ADDR__ partitions.bin"
fi
if [ -f "otadata.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __OTADATA_ADDR__ otadata.bin"
fi
if [ -f "safeboot.bin" ]; then
FLASH_ARGS="$FLASH_ARGS __SAFEBOOT_ADDR__ safeboot.bin"
fi
FLASH_ARGS="$FLASH_ARGS __FIRMWARE_ADDR__ $FIRMWARE"
echo -e "${GREEN}Flashing:${NC}$FLASH_ARGS"
esptool --chip esp32 --port "$PORT" --baud 921600 write-flash -z $FLASH_ARGS
echo -e "${GREEN}Flashing:${NC}$FLASH_ARGS"
esptool --chip esp32 --port "$PORT" --baud 921600 write-flash -z $FLASH_ARGS
if [ $? -eq 0 ]; then
if [ $? -eq 0 ]; then
echo -e "${GREEN}=== Success! $BOARD_NAME successfully updated ===${NC}"
else
else
echo -e "${RED}=== Flash failed! ===${NC}"
exit 1
fi
EOF
fi
EOF
# Substitute address placeholders with configured hex values
sed -i \
# Substitute address placeholders with configured hex values
sed -i \
-e "s|__BOOTLOADER_ADDR__|${FLASH_BOOTLOADER_ADDR}|g" \
-e "s|__PARTITIONS_ADDR__|${FLASH_PARTITIONS_ADDR}|g" \
-e "s|__OTADATA_ADDR__|${FLASH_OTADATA_ADDR}|g" \
-e "s|__SAFEBOOT_ADDR__|${FLASH_SAFEBOOT_ADDR}|g" \
-e "s|__FIRMWARE_ADDR__|${FLASH_FIRMWARE_ADDR}|g" \
flash_esp32_board.sh
chmod +x flash_esp32_board.sh
chmod +x flash_esp32_board.sh
# ----------------------------------------------------
# 2. Universal Windows Batch Script
# ----------------------------------------------------
cat << 'EOF' > flash_esp32_board.bat
@echo off
setlocal enabledelayedexpansion
echo ===================================================
echo === FoxMesh Universal ESP32 Windows Flashing ======
echo ===================================================
# ----------------------------------------------------
# 2. Universal Windows Batch Script
# ----------------------------------------------------
cat << 'EOF' > flash_esp32_board.bat
@echo off
setlocal enabledelayedexpansion
echo ===================================================
echo === FoxMesh Universal ESP32 Windows Flashing ======
echo ===================================================
set "FIRMWARE=firmware.bin"
set "FIRMWARE=firmware.bin"
if not exist "!FIRMWARE!" (
if not exist "!FIRMWARE!" (
echo [ERROR] No matching firmware binary found in this folder!
pause
exit /b 1
)
)
echo [INFO] Selected Firmware: %FIRMWARE% (%BOARD_NAME%)
echo [INFO] Selected Firmware: %FIRMWARE% (%BOARD_NAME%)
set "COMPORT="
for /f "tokens=2 delims=()" %%A in ('wmic path Win32_PnPEntity get Name ^| findstr /i "COM" ^| findstr /i "Silicon CP210 CH340 CH9102 USB-to-UART"') do set "COMPORT=%%A"
if "%COMPORT%"=="" (
for /f "tokens=2 delims=()" %%A in ('wmic path Win32_PnPEntity get Name ^| findstr /i "(COM"') do set "COMPORT=%%A"
)
if "%COMPORT%"=="" (
echo [ERROR] No ESP32 Board or USB-UART bridge detected!
set "COMPORT="
for /f "tokens=2 delims=()" %%A in ('wmic path Win32_PnPEntity get Name ^| findstr /i "COM" ^| findstr /i "Silicon CP210 CH340 CH9102 USB-to-UART"') do set "COMPORT=%%A"
if "%COMPORT%"=="" (
for /f "tokens=2 delims=()" %%A in ('wmic path Win32_PnPEntity get Name ^| findstr /i "(COM"') do set "COMPORT=%%A"
)
if "%COMPORT%"=="" (
echo [ERROR] No ESP32 Board or USB-UART bridge detected!
pause
exit /b 1
)
echo [INFO] Detected Board on port: %COMPORT%
set "FLASH_ARGS="
if exist "bootloader.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __BOOTLOADER_ADDR__ bootloader.bin"
)
if exist "partitions.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __PARTITIONS_ADDR__ partitions.bin"
)
if exist "otadata.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __OTADATA_ADDR__ otadata.bin"
)
if exist "safeboot.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __SAFEBOOT_ADDR__ safeboot.bin"
)
set "FLASH_ARGS=!FLASH_ARGS! __FIRMWARE_ADDR__ %FIRMWARE%"
echo [INFO] Flashing: !FLASH_ARGS!
esptool --chip esp32 --port %COMPORT% --baud 921600 write-flash -z !FLASH_ARGS!
if %ERRORLEVEL% EQU 0 (
echo === SUCCESS! Flash operation successfully completed ===
) else (
echo [ERROR] Flash failed!
pause
exit /b 1
)
pause
exit /b 1
)
echo [INFO] Detected Board on port: %COMPORT%
EOF
set "FLASH_ARGS="
if exist "bootloader.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __BOOTLOADER_ADDR__ bootloader.bin"
)
if exist "partitions.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __PARTITIONS_ADDR__ partitions.bin"
)
if exist "otadata.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __OTADATA_ADDR__ otadata.bin"
)
if exist "safeboot.bin" (
set "FLASH_ARGS=!FLASH_ARGS! __SAFEBOOT_ADDR__ safeboot.bin"
)
set "FLASH_ARGS=!FLASH_ARGS! __FIRMWARE_ADDR__ %FIRMWARE%"
echo [INFO] Flashing: !FLASH_ARGS!
esptool --chip esp32 --port %COMPORT% --baud 921600 write-flash -z !FLASH_ARGS!
if %ERRORLEVEL% EQU 0 (
echo === SUCCESS! Flash operation successfully completed ===
) else (
echo [ERROR] Flash failed!
pause
exit /b 1
)
pause
EOF
# Substitute address placeholders with configured hex values
sed -i \
# Substitute address placeholders with configured hex values
sed -i \
-e "s|__BOOTLOADER_ADDR__|${FLASH_BOOTLOADER_ADDR}|g" \
-e "s|__PARTITIONS_ADDR__|${FLASH_PARTITIONS_ADDR}|g" \
-e "s|__OTADATA_ADDR__|${FLASH_OTADATA_ADDR}|g" \
@@ -242,27 +251,27 @@ jobs:
-e "s|__FIRMWARE_ADDR__|${FLASH_FIRMWARE_ADDR}|g" \
flash_esp32_board.bat
# -----------------------------------------------------------------------------
# 3. Gather binaries and scripts into target directory for structural packaging
# -----------------------------------------------------------------------------
mkdir -p deploy_package
BUILD_OUTPUT=".pio/build/ttgo-lora32-v21"
# -----------------------------------------------------------------------------
# 3. Gather binaries and scripts into target directory for structural packaging
# -----------------------------------------------------------------------------
mkdir -p deploy_package
BUILD_OUTPUT=".pio/build/ttgo-lora32-v21"
# Copy binaries only if they exist
[ -f "$BUILD_OUTPUT/firmware.bin" ] && cp "$BUILD_OUTPUT/firmware.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/bootloader.bin" ] && cp "$BUILD_OUTPUT/bootloader.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/partitions.bin" ] && cp "$BUILD_OUTPUT/partitions.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/otadata.bin" ] && cp "$BUILD_OUTPUT/otadata.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/safeboot.bin" ] && cp "$BUILD_OUTPUT/safeboot.bin" ./deploy_package/
# Copy binaries only if they exist
[ -f "$BUILD_OUTPUT/firmware.bin" ] && cp "$BUILD_OUTPUT/firmware.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/bootloader.bin" ] && cp "$BUILD_OUTPUT/bootloader.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/partitions.bin" ] && cp "$BUILD_OUTPUT/partitions.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/otadata.bin" ] && cp "$BUILD_OUTPUT/otadata.bin" ./deploy_package/
[ -f "$BUILD_OUTPUT/safeboot.bin" ] && cp "$BUILD_OUTPUT/safeboot.bin" ./deploy_package/
# Move flash scripts into the deployment directory
mv flash_esp32_board.sh ./deploy_package/
mv flash_esp32_board.bat ./deploy_package/
# Move flash scripts into the deployment directory
mv flash_esp32_board.sh ./deploy_package/
mv flash_esp32_board.bat ./deploy_package/
# 9. Dynamic Artifact Upload: FoxMesh-branch-date-hash.zip
- name: Upload Compiled Firmware Package
uses: actions/upload-artifact@v7
with:
name: FoxMesh-${{ env.GIT_BRANCH }}-${{ env.CURRENT_DATE }}-${{ env.GIT_HASH }}
path: deploy_package/
# 9. Dynamic Artifact Upload: FoxMesh-branch-date-hash.zip
- name: Upload Compiled Firmware Package
uses: actions/upload-artifact@v7
with:
name: FoxMesh-${{ env.GIT_BRANCH }}-${{ env.CURRENT_DATE }}-${{ env.GIT_HASH }}
path: deploy_package/
retention-days: 10 # Artifacts will be automatically deleted after 10 days
+84
Datei anzeigen
@@ -58,3 +58,87 @@ The frequency block from **433.050 to 434.790 MHz** is shared globally as an **I
The 433 MHz ISM band in Europe is heavily congested by consumer devices like car key fobs, weather stations, and garage door openers. If you want to escape this interference completely, the European standard is to switch to the **868 MHz band**.
* **Note:** MeshCom itself is historically tied to 433 MHz in Austria. Shifting to 868 MHz effectively means migrating away from MeshCom infrastructure into the license-free **Meshtastic** ecosystem, which features a massive, highly dense node network across Austria on 868 MHz.
---
## 🔒 Part 3: LoRa Synchronization Words & Hardware Filtering
The **LoRa Synchronization Word (Sync Word)** is a critical 8-bit hardware filter configured inside register **`0x39` (`RegSyncWord`)** of the Semtech SX1276 transceiver. It functions as a physical RF barrier inside the radio's baseband modem. If an incoming packet's preamble synchronization pattern does not perfectly match the receiver's configured value, the hardware discards the payload instantly on chip-level, preventing the **`RxDone`** flag from firing and keeping the physical interrupt line completely silent.
### Technical Reference Matrix
While register `0x39` accepts any 8-bit value from `0x00` to `0xFF`, specific combinations have established themselves as international operational standards:
| Sync Word | Network Profile | Operational Target / Description |
| :--- | :--- | :--- |
| **`0x34`** | **Public LoRaWAN** | **MeshCom Standard** (ÖVSV standard for amateur radio mesh infrastructures operating at **433.175 MHz**). Triggers advanced hardware preamble correlation rules in the silicon for maximum noise immunity near the thermal noise floor. |
| **`0x24`** | **Tactical Mesh** | **Meshtastic Default** (Civilian off-grid digital communications). Used globally on the license-free 433 MHz ISM and 868 MHz bands. Requires modern low-data-rate optimization configurations to eliminate sensitivity degradation on legacy SX127x silicon steps. |
| **`0x12`** | **Private Network** | **Semtech Factory Default**. Standard baseline initialization value utilized for isolated point-to-point (P2P) bridging outside global networks. |
| **`0x55`** | **Isolated Array A** | **Custom / Experimental**. Alternating bit pattern (`01010101`) providing optimal transition density for the internal clock-data recovery (CDR) PLL loop. |
| **`0xAA`** | **Isolated Array B** | **Custom / Experimental**. Alternating bit pattern (`10101010`) offering optimal signal integrity transitions for proprietary cryptography deployments. |
> ⚠️ **The Preamble Correlation Trap:**
> Custom deployments should strictly avoid sync words with sparse bit transitions (such as `0x00` or `0xFF`). The internal baseband correlation engine relies on distinct signal transitions to sync its timing grid. Continuous sequences of zeros or ones drastically degrade receiver sensitivity.
### MeshCom Co-Existence Layout
To successfully capture live telemetry frames from official ÖVSV MeshCom gateways, the firmware forces a multi-register synchronization sequence during the unified thread-safe constructor pass:
```cpp
// Predefined LoRa Sync Word options for hardware correlation filtering
constexpr uint8_t LORA_SYNC_WORD_PUBLIC_NETWORK_MODE = 0x34; // MeshCom (ÖVSV standard for amateur radio mesh)
constexpr uint8_t LORA_SYNC_WORD_TACTICAL_NETWORK_MODE = 0x24; // Meshtastic (Civilian off-grid tactical mesh network)
constexpr uint8_t LORA_SYNC_WORD_PRIVATE_NETWORK_MODE = 0x12; // Semtech Default (Factory default / Private point-to-point)
constexpr uint8_t LORA_SYNC_WORD_CUSTOM_NETWORK_MODE = 0x55; // Custom / Experimental individual networks (highly isolated)
constexpr uint8_t LORA_SYNC_WORD_EXPERIMENTAL_NETWORK_MODE = 0xAA; // Custom / Experimental individual networks (highly isolated)
// Active hardware synchronization configuration selector
constexpr uint8_t LORA_SYNC_WORD = LORA_SYNC_WORD_PUBLIC_NETWORK_MODE;
```
This variable updates the Semtech baseband modem alongside an expanded preamble length of **12 symbols** to prevent packet dropping during long correlation windows:
```cpp
// Write the dynamic sync word byte to register 0x39
writeRegister(0x39, Config::LORA_SYNC_WORD);
// Expand hardware preamble length to 12 symbols for robust network correlation
writeRegister(0x20, 0x00U); // RegPreambleMsb
writeRegister(0x21, 0x0CU); // RegPreambleLsb (12 = 0x0C)
```
---
## 🛠️ Part 4: Troubleshooting Packet Drops & Telemetry Failures
When listening to live MeshCom grids or experimental point-to-point networks, your terminal might remain silent despite active RF activity in your area. This section details how to diagnose, interpret, and resolve low-level hardware anomalies using the automated register metrics layer.
### 1. The Low-Level Interrupt Diagnostics (Bypassing FreeRTOS Flags)
If your application task does not wake up, you must verify if the Semtech silicon is tracking any signals at all. By reading register **`0x12` (`RegIrqFlags`)**, you can isolate the failure source instantly:
```text
Reg 0x12 Value Hardware Status Root Cause & Resolution
-------------- ----------------------- -------------------------------------------------------------
0x00 No Signal Detected - Transceiver is out of range or frequency calibration mismatch.
- Check if your device is actively in RXCONTINUOUS mode [0x85].
0x20 PayloadCrcError Active - The packet was received but failed the hardware checksum.
- Caused by bad SNR (noise floor interference) or SF mismatch.
0x80 RxTimeout Active - The preamble was detected, but the complete frame timed out.
- Increase your preamble length to 12 symbols (Reg 0x20/0x21).
0x40 RxDone Success - The hardware captured, matched, and validated the packet!
- If terminal stays silent, check your FreeRTOS semaphore handles.
```
---
### 2. Common Integration Failure Modes
#### Symptom A: Zero Output from `readRegister(0x42)` during Boot
* **Root Cause:** The SPI peripheral host is misconfigured, or the hardware reset pin failed to pull low during the unified constructor pass.
* **Resolution:** Verify that `spi_bus_initialize()` is bound to the correct Host controller (`SPI2_HOST` for standard LilyGO TTGO boards). Ensure your initialization logic executes safely on **Core 0** inside the main task context to guarantee uniform driver registration.
#### Symptom B: The First Packet Arrives, then Total Silence
* **Root Cause:** The hardware interrupt flags within register `0x12` were not acknowledged, or the internal read pointer (`RegFifoAddrPtr`) was not explicitly reset to the packet's current base address.
* **Resolution:** You must overwrite register `0x12` with its active bit mask at the **absolute beginning** of your processing chain. This forces the physical `DIO0` line to fall back to logic low, enabling the ESP32 to detect subsequent rising edges (`GPIO_INTR_POSEDGE`). Always call `setModeReceiver()` at the end of the extraction loop to clear baseband modulations.
#### Symptom C: Constant `PayloadCrcError` [0x20] on Local MeshCom Traffic
* **Root Cause:** Inverted IQ configurations or local industrial noise (shared 433 MHz ISM congestion) is corrupting incoming headers.
* **Resolution:** Verify that your local modem target bandwidth exactly mirrors the MeshCom standard of **250 kHz** and **SF11**. For extreme near-field interference, ensure your `calculateTelemetry()` float calculation is active to track if sub-noise SNR regressions are pulling the signal strength below `-120 dBm`.
+3 -1
Datei anzeigen
@@ -23,7 +23,7 @@ build_flags =
-D CCACHE_ENABLE=1
; Treats ESP-IDF libc extensions headers as system headers to suppress external warnings
; -isystem /home/tom/.platformio/packages/framework-espidf/components/esp_libc/platform_include
-Wno-include-next
; --- STRICT MODE FOR PROJECT APPLICATION CODE ONLY ---
; These flags are strictly applied ONLY to C++ files inside the src/ directory.
build_src_flags =
@@ -39,5 +39,7 @@ build_src_flags =
-Wconversion
; Warns if a local variable shadows another variable in scope
-Wshadow
-Wno-include-next
; Promotes all warnings to hard compilation errors to guarantee clean code
;-Werror