Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de3e120c7e | ||
|
|
b65256fa45 | ||
|
|
a84abf03ca | ||
|
|
4da0679d4e | ||
|
|
da9859571b | ||
|
|
52603fb097 | ||
|
|
974ffadb1c | ||
|
|
eb4c3d1657 | ||
|
|
456b4f0b9a | ||
|
|
a338c9f65f | ||
|
|
fbf2e9a7c1 | ||
|
|
1377abe248 | ||
|
|
551225d308 | ||
|
|
7f2e3f6dad | ||
|
|
a85a2d776b | ||
|
|
6dbab23329 | ||
|
|
4b3697c8e6 | ||
|
|
f87ddec742 | ||
|
|
d58b6dd814 |
@@ -20,25 +20,86 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build Firmware
|
name: Build Firmware
|
||||||
|
needs: [cppcheck, flawfinder, gitleaks]
|
||||||
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
runs-on: anvil
|
runs-on: anvil
|
||||||
container:
|
container:
|
||||||
image: docker.io/espressif/idf:v5.3
|
image: docker.io/espressif/idf:v5.3
|
||||||
|
volumes:
|
||||||
|
- /var/cache/ccache:/ccache
|
||||||
|
env:
|
||||||
|
CCACHE_DIR: /ccache
|
||||||
|
IDF_CCACHE_ENABLE: 1
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
git clone --depth=1 --branch=${{ github.ref_name }} \
|
git clone --depth=1 --branch=${{ github.ref_name }} \
|
||||||
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git .
|
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git .
|
||||||
|
|
||||||
|
- name: Setup ccache
|
||||||
|
run: |
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends ccache
|
||||||
|
ccache --zero-stats
|
||||||
|
ccache --show-config | grep -E "(cache_dir|max_size)"
|
||||||
|
|
||||||
- name: Build firmware
|
- name: Build firmware
|
||||||
run: |
|
run: |
|
||||||
. /opt/esp/idf/export.sh
|
. /opt/esp/idf/export.sh
|
||||||
cd get-started/csi_recv_router
|
cd get-started/csi_recv_router
|
||||||
idf.py build
|
idf.py build
|
||||||
|
|
||||||
|
- name: Show ccache stats
|
||||||
|
run: ccache --show-stats
|
||||||
|
|
||||||
- name: Show binary size
|
- name: Show binary size
|
||||||
run: |
|
run: |
|
||||||
ls -lh get-started/csi_recv_router/build/*.bin
|
ls -lh get-started/csi_recv_router/build/*.bin
|
||||||
|
|
||||||
|
- name: Check firmware size
|
||||||
|
run: |
|
||||||
|
BIN="get-started/csi_recv_router/build/csi_recv_router.bin"
|
||||||
|
MAX_SIZE=1966080 # 0x1E0000 = 1920 KB partition
|
||||||
|
WARN_PERCENT=85
|
||||||
|
|
||||||
|
SIZE=$(stat -c%s "$BIN")
|
||||||
|
PERCENT=$((SIZE * 100 / MAX_SIZE))
|
||||||
|
|
||||||
|
echo "Firmware: $((SIZE/1024)) KB / $((MAX_SIZE/1024)) KB ($PERCENT%)"
|
||||||
|
|
||||||
|
if [ $SIZE -gt $MAX_SIZE ]; then
|
||||||
|
echo "::error::Firmware exceeds partition size!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $PERCENT -gt $WARN_PERCENT ]; then
|
||||||
|
echo "::warning::Firmware using $PERCENT% of partition"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Security checks
|
||||||
|
run: |
|
||||||
|
BIN="get-started/csi_recv_router/build/csi_recv_router.bin"
|
||||||
|
CFG="get-started/csi_recv_router/sdkconfig"
|
||||||
|
|
||||||
|
echo "=== Checking for hardcoded secrets ==="
|
||||||
|
if strings "$BIN" | grep -iqE '(password|secret|api_key|apikey)=[^$]'; then
|
||||||
|
echo "::error::Potential hardcoded secret found in binary"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "No hardcoded secrets detected"
|
||||||
|
|
||||||
|
echo "=== Checking release configuration ==="
|
||||||
|
LOG_LEVEL=$(grep 'CONFIG_LOG_DEFAULT_LEVEL=' "$CFG" | cut -d= -f2)
|
||||||
|
if [ "$LOG_LEVEL" -gt 3 ]; then
|
||||||
|
echo "::warning::Debug/verbose logging enabled (level $LOG_LEVEL)"
|
||||||
|
else
|
||||||
|
echo "Log level OK ($LOG_LEVEL)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "=== Component size breakdown ==="
|
||||||
|
. /opt/esp/idf/export.sh
|
||||||
|
cd get-started/csi_recv_router
|
||||||
|
idf.py size-components 2>/dev/null | head -30
|
||||||
|
|
||||||
- name: Upload firmware artifact
|
- name: Upload firmware artifact
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/artifacts
|
mkdir -p /tmp/artifacts
|
||||||
@@ -52,14 +113,14 @@ jobs:
|
|||||||
deploy:
|
deploy:
|
||||||
name: Deploy to ESP Fleet
|
name: Deploy to ESP Fleet
|
||||||
runs-on: anvil
|
runs-on: anvil
|
||||||
needs: build
|
needs: [cppcheck, flawfinder, gitleaks]
|
||||||
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true' || startsWith(github.ref, 'refs/tags/v')
|
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy == 'true' || startsWith(github.ref, 'refs/tags/v')
|
||||||
container:
|
container:
|
||||||
image: docker.io/espressif/idf:v5.3
|
image: docker.io/espressif/idf:v5.3
|
||||||
|
options: --network=host
|
||||||
steps:
|
steps:
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: |
|
run: apt-get update && apt-get install -y --no-install-recommends git curl jq netcat-openbsd
|
||||||
apt-get update && apt-get install -y --no-install-recommends netcat-openbsd curl jq
|
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
run: |
|
run: |
|
||||||
@@ -72,6 +133,39 @@ jobs:
|
|||||||
cd get-started/csi_recv_router
|
cd get-started/csi_recv_router
|
||||||
idf.py build
|
idf.py build
|
||||||
|
|
||||||
|
- name: Security checks
|
||||||
|
run: |
|
||||||
|
BIN="get-started/csi_recv_router/build/csi_recv_router.bin"
|
||||||
|
CFG="get-started/csi_recv_router/sdkconfig"
|
||||||
|
|
||||||
|
echo "=== Checking for hardcoded secrets ==="
|
||||||
|
if strings "$BIN" | grep -iqE '(password|secret|api_key|apikey)=[^$]'; then
|
||||||
|
echo "::error::Potential hardcoded secret found in binary"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "No hardcoded secrets detected"
|
||||||
|
|
||||||
|
echo "=== Checking release configuration ==="
|
||||||
|
LOG_LEVEL=$(grep 'CONFIG_LOG_DEFAULT_LEVEL=' "$CFG" | cut -d= -f2)
|
||||||
|
if [ "$LOG_LEVEL" -gt 3 ]; then
|
||||||
|
echo "::warning::Debug/verbose logging enabled (level $LOG_LEVEL)"
|
||||||
|
else
|
||||||
|
echo "Log level OK ($LOG_LEVEL)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Validate version tag
|
||||||
|
run: |
|
||||||
|
TAG="${{ github.ref_name }}"
|
||||||
|
# Extract version from binary metadata
|
||||||
|
BIN_VER=$(strings get-started/csi_recv_router/build/csi_recv_router.bin | grep -oP '^v\d+\.\d+(\.\d+)?' | head -1)
|
||||||
|
|
||||||
|
echo "Git tag: $TAG"
|
||||||
|
echo "Binary version: $BIN_VER"
|
||||||
|
|
||||||
|
if [ "$TAG" != "$BIN_VER" ]; then
|
||||||
|
echo "::warning::Tag ($TAG) differs from binary ($BIN_VER)"
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Create release and upload firmware
|
- name: Create release and upload firmware
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ github.token }}
|
GITEA_TOKEN: ${{ github.token }}
|
||||||
@@ -106,32 +200,74 @@ jobs:
|
|||||||
-F "attachment=@get-started/csi_recv_router/build/csi_recv_router.bin" \
|
-F "attachment=@get-started/csi_recv_router/build/csi_recv_router.bin" \
|
||||||
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=csi_recv_router.bin"
|
"$API_URL/repos/$REPO/releases/$RELEASE_ID/assets?name=csi_recv_router.bin"
|
||||||
|
|
||||||
# Store release URL for OTA
|
|
||||||
FIRMWARE_URL="https://git.mymx.me/$REPO/releases/download/$TAG/csi_recv_router.bin"
|
|
||||||
echo "Firmware URL: $FIRMWARE_URL"
|
|
||||||
echo "$FIRMWARE_URL" > /tmp/firmware_url.txt
|
|
||||||
|
|
||||||
- name: Deploy via OTA
|
- name: Deploy via OTA
|
||||||
run: |
|
run: |
|
||||||
FIRMWARE_URL=$(cat /tmp/firmware_url.txt)
|
SENSORS="muddy-storm:192.168.129.29 amber-maple:192.168.129.30 hollow-acorn:192.168.129.31"
|
||||||
echo "Using firmware URL: $FIRMWARE_URL"
|
EXPECTED_VERSION="${{ github.ref_name }}"
|
||||||
|
|
||||||
# Deploy to muddy-storm
|
# Use Gitea release URL (uploaded in previous step)
|
||||||
echo "=== Deploying to muddy-storm (192.168.129.29) ==="
|
FIRMWARE_URL="https://git.mymx.me/${{ github.repository }}/releases/download/${{ github.ref_name }}/csi_recv_router.bin"
|
||||||
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.29 5501 || true
|
echo "Firmware URL: $FIRMWARE_URL"
|
||||||
sleep 30
|
|
||||||
|
|
||||||
# Deploy to amber-maple
|
# Verify firmware is accessible
|
||||||
echo "=== Deploying to amber-maple (192.168.129.30) ==="
|
curl -sI "$FIRMWARE_URL" | head -1
|
||||||
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.30 5501 || true
|
|
||||||
sleep 30
|
|
||||||
|
|
||||||
# Deploy to hollow-acorn
|
# Deploy to all sensors in parallel
|
||||||
echo "=== Deploying to hollow-acorn (192.168.129.31) ==="
|
echo "=== Deploying to all sensors in parallel ==="
|
||||||
echo "OTA $FIRMWARE_URL" | nc -u -w 2 192.168.129.31 5501 || true
|
for entry in $SENSORS; do
|
||||||
sleep 30
|
NAME="${entry%%:*}"
|
||||||
|
IP="${entry##*:}"
|
||||||
|
echo "OTA $FIRMWARE_URL" | nc -u -w 2 "$IP" 5501 &
|
||||||
|
done
|
||||||
|
wait
|
||||||
|
|
||||||
echo "=== Deployment complete ==="
|
# Monitor progress
|
||||||
|
echo "=== Monitoring OTA progress (timeout: 90s) ==="
|
||||||
|
TIMEOUT=90
|
||||||
|
INTERVAL=5
|
||||||
|
ELAPSED=0
|
||||||
|
|
||||||
|
while [ $ELAPSED -lt $TIMEOUT ]; do
|
||||||
|
sleep $INTERVAL
|
||||||
|
ELAPSED=$((ELAPSED + INTERVAL))
|
||||||
|
|
||||||
|
echo "--- Progress check at ${ELAPSED}s ---"
|
||||||
|
ALL_UPDATED=true
|
||||||
|
|
||||||
|
for entry in $SENSORS; do
|
||||||
|
NAME="${entry%%:*}"
|
||||||
|
IP="${entry##*:}"
|
||||||
|
|
||||||
|
# Query sensor version via UDP STATUS command
|
||||||
|
RESPONSE=$(echo "STATUS" | nc -u -w 1 "$IP" 5501 2>/dev/null || echo "")
|
||||||
|
VERSION=$(echo "$RESPONSE" | grep -oP 'version=\K[^ ]+' || echo "offline")
|
||||||
|
|
||||||
|
if [ "$VERSION" = "$EXPECTED_VERSION" ]; then
|
||||||
|
echo " $NAME: ✓ $VERSION"
|
||||||
|
elif [ "$VERSION" = "offline" ] || [ -z "$VERSION" ]; then
|
||||||
|
echo " $NAME: ⟳ updating..."
|
||||||
|
ALL_UPDATED=false
|
||||||
|
else
|
||||||
|
echo " $NAME: $VERSION (waiting for $EXPECTED_VERSION)"
|
||||||
|
ALL_UPDATED=false
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "$ALL_UPDATED" = true ]; then
|
||||||
|
echo "=== All sensors updated to $EXPECTED_VERSION ==="
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Final status
|
||||||
|
echo "=== Final sensor status ==="
|
||||||
|
for entry in $SENSORS; do
|
||||||
|
NAME="${entry%%:*}"
|
||||||
|
IP="${entry##*:}"
|
||||||
|
RESPONSE=$(echo "STATUS" | nc -u -w 1 "$IP" 5501 2>/dev/null || echo "")
|
||||||
|
VERSION=$(echo "$RESPONSE" | grep -oP 'version=\K[^ ]+' || echo "offline")
|
||||||
|
echo " $NAME: $VERSION"
|
||||||
|
done
|
||||||
|
|
||||||
cppcheck:
|
cppcheck:
|
||||||
name: C/C++ Static Analysis
|
name: C/C++ Static Analysis
|
||||||
@@ -191,27 +327,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Run gitleaks
|
- name: Run gitleaks
|
||||||
run: gitleaks detect --source . --verbose --redact
|
run: gitleaks detect --source . --verbose --redact
|
||||||
|
|
||||||
shellcheck:
|
|
||||||
name: Shell Script Analysis
|
|
||||||
runs-on: anvil
|
|
||||||
container:
|
|
||||||
image: docker.io/koalaman/shellcheck-alpine:stable
|
|
||||||
steps:
|
|
||||||
- name: Install git
|
|
||||||
run: apk add --no-cache git
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
run: |
|
|
||||||
git clone --depth=1 --branch=${{ github.ref_name }} \
|
|
||||||
https://oauth2:${{ github.token }}@git.mymx.me/${{ github.repository }}.git .
|
|
||||||
|
|
||||||
- name: Find and check shell scripts
|
|
||||||
run: |
|
|
||||||
SCRIPTS=$(find . -name "*.sh" -type f 2>/dev/null || true)
|
|
||||||
if [ -n "$SCRIPTS" ]; then
|
|
||||||
echo "Checking: $SCRIPTS"
|
|
||||||
echo "$SCRIPTS" | xargs shellcheck --severity=warning
|
|
||||||
else
|
|
||||||
echo "No shell scripts found, skipping"
|
|
||||||
fi
|
|
||||||
|
|||||||
88
PROJECT.md
88
PROJECT.md
@@ -1,47 +1,97 @@
|
|||||||
# ESP32 Hacking Project
|
# ESP32 Hacking Project
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
Firmware customization and experimentation for ESP32 CSI (Channel State Information) sensors used in the [wifi-sensing](~/git/wifi-sensing/) project.
|
|
||||||
|
Firmware and tooling for ESP32 CSI (Channel State Information) sensors used for passive wireless sensing, device tracking, and security monitoring (OPSEC/OSINT/Purple team).
|
||||||
|
|
||||||
## Goals
|
## Goals
|
||||||
- Document current firmware and configuration
|
|
||||||
- Add remote management commands (reboot, identify, status)
|
|
||||||
- Implement OTA firmware updates
|
|
||||||
- Explore BLE scanning for complementary presence detection
|
|
||||||
- Optimize CSI data pipeline (adaptive rate, on-device processing)
|
|
||||||
|
|
||||||
## Current State
|
- Custom ESP32 firmware with remote management, OTA updates, adaptive sampling
|
||||||
- 3x ESP32-DevKitC V1 deployed with stock `csi_recv_router` firmware
|
- BLE scanning and WiFi probe/deauth detection for device intelligence
|
||||||
- Firmware sends raw CSI data via UDP at ~100 pkt/s per device
|
- CSI-based presence detection without cameras
|
||||||
- No remote management capability (must physically access USB)
|
- Flask REST API backend for data aggregation and OSINT queries
|
||||||
|
- Fleet management for multiple sensors
|
||||||
|
|
||||||
|
## Components
|
||||||
|
|
||||||
|
| Component | Location | Description |
|
||||||
|
|-----------|----------|-------------|
|
||||||
|
| Firmware | `get-started/csi_recv_router/` | ESP32 sensor firmware (C, ESP-IDF) |
|
||||||
|
| CLI Tools | `~/git/esp-tools/` | `esp-ctl`, `esp-fleet`, `esp-ota` |
|
||||||
|
| Flask API | `~/git/esp32-web/` | REST API backend (Python, Flask) |
|
||||||
|
|
||||||
|
## Current State (v1.9)
|
||||||
|
|
||||||
|
- 3x ESP32-DevKitC V1 deployed with custom firmware
|
||||||
|
- UDP data streams: CSI_DATA, BLE_DATA, PROBE_DATA, ALERT_DATA, EVENT
|
||||||
|
- Remote management via UDP commands (port 5501)
|
||||||
|
- OTA firmware updates (HTTP/HTTPS)
|
||||||
|
- Presence detection via CSI baseline calibration
|
||||||
|
- Multi-channel scanning for broader WiFi coverage
|
||||||
|
- BLE fingerprinting (company_id, tx_power, flags)
|
||||||
|
|
||||||
## Hardware
|
## Hardware
|
||||||
|
|
||||||
| Device | Chip | IP Address | Location |
|
| Device | Chip | IP Address | Location |
|
||||||
|--------|------|------------|----------|
|
|--------|------|------------|----------|
|
||||||
| muddy-storm | ESP32-WROOM-32 | 192.168.129.29 | Living Room |
|
| muddy-storm | ESP32-WROOM-32 | 192.168.129.29 | Living Room |
|
||||||
| amber-maple | ESP32-WROOM-32 | 192.168.129.30 | Office |
|
| amber-maple | ESP32-WROOM-32 | 192.168.129.30 | Office |
|
||||||
| hollow-acorn | ESP32-WROOM-32 | 192.168.129.31 | Kitchen |
|
| hollow-acorn | ESP32-WROOM-32 | 192.168.129.31 | Kitchen |
|
||||||
|
|
||||||
|
## Network Ports
|
||||||
|
|
||||||
|
| Port | Protocol | Direction | Description |
|
||||||
|
|------|----------|-----------|-------------|
|
||||||
|
| 5500 | UDP | Sensors → Flask | Sensor data streams (CSI, BLE, probes, alerts, events) |
|
||||||
|
| 5500 | TCP | Clients → Flask | REST API (HTTP) |
|
||||||
|
| 5501 | UDP | Flask → Sensors | Sensor commands |
|
||||||
|
|
||||||
|
## Data Streams (UDP 5500)
|
||||||
|
|
||||||
|
| Stream | Format | Use Case |
|
||||||
|
|--------|--------|----------|
|
||||||
|
| CSI_DATA | hostname,count,mac,rssi,... | Motion/presence detection |
|
||||||
|
| BLE_DATA | hostname,mac,rssi,type,name,company_id,tx_power,flags | Device fingerprinting |
|
||||||
|
| PROBE_DATA | hostname,mac,rssi,ssid,channel | Device tracking, SSID enumeration |
|
||||||
|
| ALERT_DATA | hostname,type,source,target,rssi | Wireless IDS (deauth detection) |
|
||||||
|
| EVENT | hostname,key=value pairs | Motion, presence, calibration events |
|
||||||
|
|
||||||
## Software Stack
|
## Software Stack
|
||||||
|
|
||||||
| Component | Version | Purpose |
|
| Component | Version | Purpose |
|
||||||
|-----------|---------|---------|
|
|-----------|---------|---------|
|
||||||
| ESP-IDF | v5.5.2 | Development framework (`~/esp/esp-idf/`) |
|
| ESP-IDF | v5.5.2 | Firmware development framework |
|
||||||
| esp-csi | latest | CSI extraction library |
|
| Flask | 3.x | REST API backend |
|
||||||
| FreeRTOS | (bundled) | RTOS kernel |
|
| SQLAlchemy | 2.x | Database ORM |
|
||||||
|
| SQLite/PostgreSQL | - | Data storage |
|
||||||
|
| podman | - | Container runtime |
|
||||||
|
|
||||||
## Key Paths
|
## Key Paths
|
||||||
|
|
||||||
| Path | Description |
|
| Path | Description |
|
||||||
|------|-------------|
|
|------|-------------|
|
||||||
| `~/git/esp32-hacking/` | This project (firmware sources, docs) |
|
| `~/git/esp32-hacking/` | This project (firmware sources, docs) |
|
||||||
| `~/git/wifi-sensing/` | Server application (receives CSI data) |
|
| `~/git/esp32-web/` | Flask API backend (planned) |
|
||||||
|
| `~/git/esp-tools/` | CLI tools (esp-ctl, esp-fleet, esp-ota) |
|
||||||
| `~/esp/esp-idf/` | ESP-IDF toolchain |
|
| `~/esp/esp-idf/` | ESP-IDF toolchain |
|
||||||
| `~/esp/esp-csi/` | Original esp-csi repo (build from here) |
|
|
||||||
|
|
||||||
## Dependencies
|
## API Endpoints (Planned)
|
||||||
- ESP-IDF toolchain (`~/esp/esp-idf/`)
|
|
||||||
- USB cable for initial flash (OTA planned)
|
Base URL: `http://<host>:5500/api/v1`
|
||||||
|
|
||||||
|
| Method | Endpoint | Description |
|
||||||
|
|--------|----------|-------------|
|
||||||
|
| GET | `/sensors` | List sensors with status |
|
||||||
|
| GET | `/devices` | List discovered devices |
|
||||||
|
| GET | `/alerts` | Alert feed with filters |
|
||||||
|
| GET | `/probes` | Probe requests |
|
||||||
|
| GET | `/events` | Sensor events |
|
||||||
|
| POST | `/sensors/<id>/command` | Send command to sensor |
|
||||||
|
| GET | `/stats` | Aggregate statistics |
|
||||||
|
|
||||||
## References
|
## References
|
||||||
|
|
||||||
- [ESP-IDF Docs](https://docs.espressif.com/projects/esp-idf/en/latest/)
|
- [ESP-IDF Docs](https://docs.espressif.com/projects/esp-idf/en/latest/)
|
||||||
- [ESP-CSI GitHub](https://github.com/espressif/esp-csi)
|
- [ESP-CSI GitHub](https://github.com/espressif/esp-csi)
|
||||||
- [ESP32 WiFi CSI API](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_wifi.html)
|
- [IEEE OUI Database](https://standards-oui.ieee.org/)
|
||||||
|
- [Bluetooth Company Identifiers](https://www.bluetooth.com/specifications/assigned-numbers/company-identifiers/)
|
||||||
|
|||||||
79
ROADMAP.md
79
ROADMAP.md
@@ -131,9 +131,77 @@ Note: Promiscuous mode (probe/deauth capture) disabled on original ESP32 — bre
|
|||||||
- [x] presence= and pr_score= fields in STATUS reply
|
- [x] presence= and pr_score= fields in STATUS reply
|
||||||
- [x] NVS persistence for baseline (bl_amps blob, bl_nsub) and presence config
|
- [x] NVS persistence for baseline (bl_amps blob, bl_nsub) and presence config
|
||||||
- [ ] Tune presence threshold per room with real-world testing
|
- [ ] Tune presence threshold per room with real-world testing
|
||||||
- [ ] Pi-side presence event handling in watch daemon
|
|
||||||
|
|
||||||
## v2.0 - Hardware Upgrade (ESP32-S3/C6)
|
## v1.8 - HTTPS OTA Support [DONE]
|
||||||
|
- [x] Support HTTPS URLs for OTA updates (esp_https_ota)
|
||||||
|
- [x] CI: Upload firmware to Gitea releases for OTA
|
||||||
|
- [x] CI: Simplify deploy script to pure POSIX sh
|
||||||
|
|
||||||
|
## v1.9 - Multi-Channel Scanning & BLE Fingerprinting [DONE]
|
||||||
|
- [x] CHANSCAN command (ON/OFF/NOW/INTERVAL)
|
||||||
|
- [x] Channel hopping (1-13) with 100ms dwell, pause CSI during scan
|
||||||
|
- [x] chanscan= field in STATUS, chanscan_int NVS persistence
|
||||||
|
- [x] BLE fingerprinting: company_id, tx_power, adv_flags in BLE_DATA
|
||||||
|
- [x] Historical presence sessions support
|
||||||
|
|
||||||
|
## v2.0 - Flask API Backend (Purple Team)
|
||||||
|
|
||||||
|
REST API backend for OPSEC/OSINT/Purple team operations using ESP32 sensor fleet.
|
||||||
|
API-first design; frontend dashboard deferred to v2.1+.
|
||||||
|
|
||||||
|
- **HTTP API:** TCP 5500
|
||||||
|
- **UDP Collector:** UDP 5500 (sensor data)
|
||||||
|
- **Sensor Commands:** UDP 5501 (outbound)
|
||||||
|
|
||||||
|
### Phase 1: Project Setup
|
||||||
|
- [ ] Project scaffold (`~/git/esp32-web/`) with Flask + SQLAlchemy + Blueprints
|
||||||
|
- [ ] Database schema: sensors, devices, sightings, alerts, events, probes
|
||||||
|
- [ ] Containerfile for podman deployment
|
||||||
|
- [ ] Makefile (build, run, dev, stop, logs)
|
||||||
|
- [ ] pytest setup with fixtures
|
||||||
|
|
||||||
|
### Phase 2: UDP Collector
|
||||||
|
- [ ] Async UDP listener daemon (threading or asyncio)
|
||||||
|
- [ ] Parse all sensor streams: CSI_DATA, BLE_DATA, PROBE_DATA, ALERT_DATA, EVENT
|
||||||
|
- [ ] Store to database with timestamps
|
||||||
|
- [ ] Sensor heartbeat tracking (online/offline status)
|
||||||
|
- [ ] Run as background thread alongside Flask
|
||||||
|
|
||||||
|
### Phase 3: Core API Endpoints
|
||||||
|
- [ ] `GET /api/v1/sensors` — list sensors with status, uptime, last_seen
|
||||||
|
- [ ] `GET /api/v1/sensors/<id>/status` — detailed sensor info
|
||||||
|
- [ ] `POST /api/v1/sensors/<id>/command` — send UDP command (proxy)
|
||||||
|
- [ ] `GET /api/v1/devices` — list all discovered devices (BLE + WiFi)
|
||||||
|
- [ ] `GET /api/v1/devices/<mac>` — device profile (sightings, zones, vendor)
|
||||||
|
- [ ] `GET /api/v1/alerts` — alert feed with pagination + filters
|
||||||
|
- [ ] `GET /api/v1/probes` — probe requests with SSID enumeration
|
||||||
|
- [ ] `GET /api/v1/events` — sensor events (motion, presence, calibration)
|
||||||
|
|
||||||
|
### Phase 4: OSINT Features
|
||||||
|
- [ ] MAC vendor lookup (IEEE OUI database)
|
||||||
|
- [ ] BLE company_id to manufacturer mapping
|
||||||
|
- [ ] `GET /api/v1/devices/<mac>/profile` — enriched device intel
|
||||||
|
- [ ] `GET /api/v1/stats` — aggregate statistics (device counts, alert counts)
|
||||||
|
- [ ] Export endpoints: `GET /api/v1/export/devices.csv`, `.json`
|
||||||
|
|
||||||
|
### Phase 5: Fleet Management API
|
||||||
|
- [ ] `GET /api/v1/sensors/<id>/config` — current sensor configuration
|
||||||
|
- [ ] `PUT /api/v1/sensors/<id>/config` — update sensor settings
|
||||||
|
- [ ] `POST /api/v1/sensors/<id>/ota` — trigger OTA update
|
||||||
|
- [ ] `POST /api/v1/sensors/<id>/calibrate` — trigger baseline calibration
|
||||||
|
- [ ] `GET /api/v1/sensors/<id>/history` — historical metrics
|
||||||
|
|
||||||
|
## v2.1 - Web Dashboard (Future)
|
||||||
|
|
||||||
|
Frontend dashboard using htmx + Pico CSS, built on top of v2.0 API.
|
||||||
|
|
||||||
|
- [ ] Live sensor status dashboard
|
||||||
|
- [ ] Device inventory table with search/filter
|
||||||
|
- [ ] Alert timeline with severity badges
|
||||||
|
- [ ] Presence heatmap per zone
|
||||||
|
- [ ] Sensor fleet management UI
|
||||||
|
|
||||||
|
## v3.0 - Hardware Upgrade (ESP32-S3/C6)
|
||||||
|
|
||||||
Requires replacing current ESP32 (original) DevKitC V1 boards with ESP32-S3
|
Requires replacing current ESP32 (original) DevKitC V1 boards with ESP32-S3
|
||||||
or ESP32-C6 modules. The original ESP32 lacks FTM and has CSI/promiscuous
|
or ESP32-C6 modules. The original ESP32 lacks FTM and has CSI/promiscuous
|
||||||
@@ -152,10 +220,11 @@ mode conflicts.
|
|||||||
## Future
|
## Future
|
||||||
- AP+STA config portal (WIFI_MODE_APSTA, captive portal for initial setup)
|
- AP+STA config portal (WIFI_MODE_APSTA, captive portal for initial setup)
|
||||||
- ESP-NOW mesh (ESP32-to-ESP32 CSI)
|
- ESP-NOW mesh (ESP32-to-ESP32 CSI)
|
||||||
- Multi-channel scanning (hop across WiFi channels)
|
|
||||||
- BLE device fingerprinting (identify phone models by advertisement patterns)
|
|
||||||
- Historical presence logging (who was here, when, how long)
|
|
||||||
- External sensor support (PIR, temp/humidity via GPIO)
|
- External sensor support (PIR, temp/humidity via GPIO)
|
||||||
- Pin mapping for ESP32-DevKitC V1
|
- Pin mapping for ESP32-DevKitC V1
|
||||||
- Compare CSI quality: passive (router) vs active (ESP-NOW)
|
- Compare CSI quality: passive (router) vs active (ESP-NOW)
|
||||||
- Multi-sensor deployment guide (placement, zones, triangulation)
|
- Multi-sensor deployment guide (placement, zones, triangulation)
|
||||||
|
- Home Assistant integration (MQTT discovery, entity creation)
|
||||||
|
- Grafana dashboards for long-term analytics
|
||||||
|
- ML-based device classification (phone vs laptop vs IoT)
|
||||||
|
- RSSI triangulation with 3+ sensors (approximate device location)
|
||||||
|
|||||||
52
TASKS.md
52
TASKS.md
@@ -2,15 +2,41 @@
|
|||||||
|
|
||||||
**Last Updated:** 2026-02-05
|
**Last Updated:** 2026-02-05
|
||||||
|
|
||||||
## Current Sprint: v1.7+ — Presence Tuning & Integration
|
## Current Sprint: v2.0 — Flask API Backend
|
||||||
|
|
||||||
### P2 - Normal
|
### P0 - Critical (Phase 1: Project Setup)
|
||||||
|
- [ ] Create project scaffold `~/git/esp32-web/`
|
||||||
|
- [ ] Flask app factory pattern with Blueprints
|
||||||
|
- [ ] HTTP API on TCP 5500, UDP collector on UDP 5500
|
||||||
|
- [ ] SQLAlchemy models: Sensor, Device, Sighting, Alert, Event, Probe
|
||||||
|
- [ ] Containerfile for podman
|
||||||
|
- [ ] Makefile (build, run, dev, stop, logs)
|
||||||
|
- [ ] Basic pytest setup
|
||||||
|
|
||||||
|
### P1 - High (Phase 2: UDP Collector)
|
||||||
|
- [ ] UDP listener thread (parse CSI_DATA, BLE_DATA, PROBE_DATA, ALERT_DATA, EVENT)
|
||||||
|
- [ ] Store parsed data to SQLite/PostgreSQL
|
||||||
|
- [ ] Sensor heartbeat tracking (mark online/offline)
|
||||||
|
- [ ] Integrate collector with Flask app lifecycle
|
||||||
|
|
||||||
|
### P1 - High (Phase 3: Core API)
|
||||||
|
- [ ] `GET /api/v1/sensors` — list sensors
|
||||||
|
- [ ] `GET /api/v1/devices` — list devices (BLE + WiFi MACs)
|
||||||
|
- [ ] `GET /api/v1/alerts` — alert feed with pagination
|
||||||
|
- [ ] `GET /api/v1/probes` — probe requests
|
||||||
|
- [ ] `GET /api/v1/events` — sensor events
|
||||||
|
- [ ] `POST /api/v1/sensors/<id>/command` — send command to sensor
|
||||||
|
|
||||||
|
### P2 - Normal (Phase 4: OSINT)
|
||||||
|
- [ ] MAC vendor lookup (OUI database)
|
||||||
|
- [ ] BLE company_id mapping
|
||||||
|
- [ ] `GET /api/v1/stats` — aggregate statistics
|
||||||
|
- [ ] Export endpoints (CSV, JSON)
|
||||||
|
|
||||||
|
### P2 - Normal (Backlog from v1.x)
|
||||||
- [ ] Tune presence threshold per room with real-world testing
|
- [ ] Tune presence threshold per room with real-world testing
|
||||||
- [x] Pi-side presence event handling in watch daemon
|
|
||||||
- [x] Firmware security audit (cppcheck + manual review — no issues found)
|
|
||||||
- [ ] Power consumption measurements using POWERTEST + external meter
|
- [ ] Power consumption measurements using POWERTEST + external meter
|
||||||
- [ ] Test OTA rollback (flash bad firmware, verify auto-revert)
|
- [ ] Test OTA rollback (flash bad firmware, verify auto-revert)
|
||||||
- [ ] Create HA webhook automations for deauth_flood / unknown_probe
|
|
||||||
|
|
||||||
### P3 - Low
|
### P3 - Low
|
||||||
- [ ] Deep sleep mode with wake-on-CSI-motion
|
- [ ] Deep sleep mode with wake-on-CSI-motion
|
||||||
@@ -19,6 +45,20 @@
|
|||||||
- [ ] Document esp-radar console features
|
- [ ] Document esp-radar console features
|
||||||
- [ ] Pin mapping for ESP32-DevKitC V1
|
- [ ] Pin mapping for ESP32-DevKitC V1
|
||||||
|
|
||||||
|
## Completed: v1.9 - Multi-Channel Scanning & BLE Fingerprinting
|
||||||
|
|
||||||
|
- [x] CHANSCAN command (ON/OFF/NOW/INTERVAL)
|
||||||
|
- [x] Channel hopping (1-13) with 100ms dwell, pause CSI during scan
|
||||||
|
- [x] chanscan= field in STATUS, chanscan_int NVS persistence
|
||||||
|
- [x] BLE fingerprinting: company_id, tx_power, adv_flags in BLE_DATA
|
||||||
|
- [x] Historical presence sessions support
|
||||||
|
|
||||||
|
## Completed: v1.8 - HTTPS OTA Support
|
||||||
|
|
||||||
|
- [x] Support HTTPS URLs for OTA updates (esp_https_ota)
|
||||||
|
- [x] CI: Upload firmware to Gitea releases for OTA
|
||||||
|
- [x] CI: Simplify deploy script to pure POSIX sh
|
||||||
|
|
||||||
## Completed: v1.7 - Baseline Calibration & Presence Detection
|
## Completed: v1.7 - Baseline Calibration & Presence Detection
|
||||||
|
|
||||||
- [x] CALIBRATE command (capture N seconds of CSI, average per-subcarrier amplitudes)
|
- [x] CALIBRATE command (capture N seconds of CSI, average per-subcarrier amplitudes)
|
||||||
@@ -172,7 +212,7 @@
|
|||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
- Adaptive threshold varies by environment; 0.001-0.01 is a good starting range
|
- Adaptive threshold varies by environment; 0.001-0.01 is a good starting range
|
||||||
- NVS keys: `send_rate`, `tx_power`, `adaptive`, `threshold`, `ble_scan`, `target_ip`, `target_port`, `hostname`, `boot_count`, `csi_mode`, `hybrid_n`, `auth_secret`, `flood_thresh`, `flood_window`, `scan_rate`, `probe_rate`, `powersave`, `presence`, `pr_thresh`, `bl_nsub`, `bl_amps`
|
- NVS keys (24 total): `send_rate`, `tx_power`, `adaptive`, `threshold`, `ble_scan`, `target_ip`, `target_port`, `hostname`, `boot_count`, `csi_mode`, `hybrid_n`, `auth_secret`, `flood_thresh`, `flood_window`, `scan_rate`, `probe_rate`, `powersave`, `presence`, `pr_thresh`, `bl_nsub`, `bl_amps`, `chanscan`, `chanscan_int`
|
||||||
- EVENT packets include sensor hostname: `EVENT,<hostname>,motion=... rate=... wander=...`
|
- EVENT packets include sensor hostname: `EVENT,<hostname>,motion=... rate=... wander=...`
|
||||||
- ALERT_DATA format: `ALERT_DATA,<hostname>,<deauth|disassoc>,<sender_mac>,<target_mac>,<rssi>` or `ALERT_DATA,<hostname>,deauth_flood,<count>,<window_s>`
|
- ALERT_DATA format: `ALERT_DATA,<hostname>,<deauth|disassoc>,<sender_mac>,<target_mac>,<rssi>` or `ALERT_DATA,<hostname>,deauth_flood,<count>,<window_s>`
|
||||||
- STATUS fields: `uptime=`, `uptime_s=`, `heap=`, `rssi=`, `channel=`, `tx_power=`, `rate=`, `csi_rate=`, `hostname=`, `version=`, `adaptive=`, `motion=`, `ble=`, `target=`, `temp=`, `csi_count=`, `boots=`, `rssi_min=`, `rssi_max=`, `csi_mode=`, `hybrid_n=`, `auth=`, `flood_thresh=`, `powersave=`, `presence=`, `pr_score=`
|
- STATUS fields: `uptime=`, `uptime_s=`, `heap=`, `rssi=`, `channel=`, `tx_power=`, `rate=`, `csi_rate=`, `hostname=`, `version=`, `adaptive=`, `motion=`, `ble=`, `target=`, `temp=`, `csi_count=`, `boots=`, `rssi_min=`, `rssi_max=`, `csi_mode=`, `hybrid_n=`, `auth=`, `flood_thresh=`, `powersave=`, `presence=`, `pr_score=`
|
||||||
|
|||||||
65
TODO.md
65
TODO.md
@@ -1,28 +1,79 @@
|
|||||||
# ESP32 Hacking TODO
|
# ESP32 Hacking TODO
|
||||||
|
|
||||||
|
## Flask API (`~/git/esp32-web/`)
|
||||||
|
|
||||||
|
### Architecture
|
||||||
|
- [ ] App factory pattern (`create_app()`)
|
||||||
|
- [ ] Blueprints: `api`, `collector`
|
||||||
|
- [ ] SQLAlchemy with migrations (Flask-Migrate)
|
||||||
|
- [ ] Background UDP collector (threading or Celery)
|
||||||
|
- [ ] Config from environment variables
|
||||||
|
- [ ] Port 5500: HTTP API (TCP) + UDP collector (UDP) on same port number
|
||||||
|
|
||||||
|
### Database Schema
|
||||||
|
- [ ] `sensors` — id, hostname, ip, last_seen, status, config_json
|
||||||
|
- [ ] `devices` — mac, type (ble/wifi), vendor, first_seen, last_seen
|
||||||
|
- [ ] `sightings` — device_id, sensor_id, rssi, timestamp
|
||||||
|
- [ ] `alerts` — sensor_id, type, source_mac, target_mac, rssi, timestamp
|
||||||
|
- [ ] `probes` — device_id, sensor_id, ssid, rssi, channel, timestamp
|
||||||
|
- [ ] `events` — sensor_id, event_type, payload_json, timestamp
|
||||||
|
|
||||||
|
### API Endpoints
|
||||||
|
- [ ] Sensors: list, detail, status, command, config, history
|
||||||
|
- [ ] Devices: list, detail, profile, sightings
|
||||||
|
- [ ] Alerts: list with filters (type, sensor, time range)
|
||||||
|
- [ ] Probes: list, group by SSID, group by MAC
|
||||||
|
- [ ] Events: list with filters
|
||||||
|
- [ ] Stats: counts, activity graphs data
|
||||||
|
- [ ] Export: CSV, JSON for devices/alerts/probes
|
||||||
|
|
||||||
|
### UDP Collector
|
||||||
|
- [ ] Parse CSI_DATA (hostname, count, mac, rssi, features)
|
||||||
|
- [ ] Parse BLE_DATA (hostname, mac, rssi, type, name, company_id, tx_power, flags)
|
||||||
|
- [ ] Parse PROBE_DATA (hostname, mac, rssi, ssid, channel)
|
||||||
|
- [ ] Parse ALERT_DATA (hostname, type, source, target, rssi OR flood count)
|
||||||
|
- [ ] Parse EVENT (hostname, key=value pairs)
|
||||||
|
- [ ] Heartbeat timeout detection (mark sensor offline)
|
||||||
|
|
||||||
|
### OSINT
|
||||||
|
- [ ] IEEE OUI database (download + parse)
|
||||||
|
- [ ] BLE company ID database (Bluetooth SIG)
|
||||||
|
- [ ] Device fingerprinting by BLE advertisement patterns
|
||||||
|
- [ ] Probe request SSID profiling (home networks, corporate, etc.)
|
||||||
|
|
||||||
## Firmware
|
## Firmware
|
||||||
- [ ] On-device CSI processing (send metrics, not raw)
|
|
||||||
- [ ] Deep sleep mode with wake-on-CSI-motion
|
- [ ] Deep sleep mode with wake-on-CSI-motion
|
||||||
- [ ] Battery-optimized duty cycling
|
- [ ] Battery-optimized duty cycling
|
||||||
|
- [ ] AP+STA config portal (captive portal for initial setup)
|
||||||
|
|
||||||
## Tools (esp-ctl)
|
## Tools (esp-ctl)
|
||||||
- [ ] Multi-sensor BLE correlation (zone tracking by source sensor)
|
|
||||||
|
- [ ] Migrate OSINT database to Flask API (esp-ctl becomes thin client)
|
||||||
|
- [ ] `esp-ctl api` subcommand (query Flask API)
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
- [ ] Benchmark: CSI callback latency
|
- [ ] Benchmark: CSI callback latency
|
||||||
- [ ] Benchmark: UDP throughput at different rates
|
- [ ] Benchmark: UDP throughput at different rates
|
||||||
- [ ] Power consumption measurements (per-mode: idle, CSI, BLE, probe)
|
- [ ] Power consumption measurements (per-mode: idle, CSI, BLE, probe)
|
||||||
|
- [ ] API load testing (concurrent requests)
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
|
- [ ] Flask API: OpenAPI/Swagger spec
|
||||||
|
- [ ] Deployment guide (podman, systemd)
|
||||||
- [ ] Pin mapping for ESP32-DevKitC V1
|
- [ ] Pin mapping for ESP32-DevKitC V1
|
||||||
- [ ] Compare CSI quality: passive (router) vs active (ESP-NOW)
|
- [ ] Compare CSI quality: passive (router) vs active (ESP-NOW)
|
||||||
- [ ] Multi-sensor deployment guide (placement, zones, triangulation)
|
- [ ] Multi-sensor deployment guide (placement, zones, triangulation)
|
||||||
|
|
||||||
## Ideas
|
## Ideas
|
||||||
|
|
||||||
- ESP-NOW mesh for direct ESP32-to-ESP32 CSI
|
- ESP-NOW mesh for direct ESP32-to-ESP32 CSI
|
||||||
- External PIR sensor for CSI ground truth validation
|
- External PIR sensor for CSI ground truth validation
|
||||||
- AP+STA config portal (captive portal for initial setup)
|
- RSSI triangulation with 3+ sensors (approximate device location)
|
||||||
- Multi-channel scanning (hop across WiFi channels)
|
- Home Assistant MQTT discovery integration
|
||||||
- RSSI triangulation with 3 sensors (approximate device location)
|
- Grafana dashboards for long-term analytics
|
||||||
- BLE device fingerprinting (identify phone models by advertisement patterns)
|
- ML-based device classification (phone vs laptop vs IoT)
|
||||||
- Historical presence logging (who was here, when, how long)
|
- Webhook callbacks for alerts (Slack, Discord, ntfy)
|
||||||
|
- Rate limiting and API authentication (JWT)
|
||||||
|
|||||||
@@ -35,6 +35,8 @@
|
|||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
#include "esp_ota_ops.h"
|
#include "esp_ota_ops.h"
|
||||||
#include "esp_https_ota.h"
|
#include "esp_https_ota.h"
|
||||||
|
#include "esp_partition.h"
|
||||||
|
#include "esp_chip_info.h"
|
||||||
#include "esp_http_client.h"
|
#include "esp_http_client.h"
|
||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "soc/soc_caps.h"
|
#include "soc/soc_caps.h"
|
||||||
@@ -88,6 +90,7 @@ static int s_send_frequency = CONFIG_SEND_FREQUENCY_DEFAULT;
|
|||||||
static int8_t s_tx_power_dbm = 10;
|
static int8_t s_tx_power_dbm = 10;
|
||||||
static esp_ping_handle_t s_ping_handle = NULL;
|
static esp_ping_handle_t s_ping_handle = NULL;
|
||||||
static volatile led_mode_t s_led_mode = LED_OFF;
|
static volatile led_mode_t s_led_mode = LED_OFF;
|
||||||
|
static bool s_led_quiet = false; /* quiet mode: off normally, solid on motion/presence */
|
||||||
static volatile int64_t s_last_csi_time = 0;
|
static volatile int64_t s_last_csi_time = 0;
|
||||||
static volatile int64_t s_identify_end_time = 0;
|
static volatile int64_t s_identify_end_time = 0;
|
||||||
static volatile bool s_ota_in_progress = false;
|
static volatile bool s_ota_in_progress = false;
|
||||||
@@ -193,6 +196,14 @@ static int s_calib_nsub = 0;
|
|||||||
static float s_pr_scores[PRESENCE_WINDOW];
|
static float s_pr_scores[PRESENCE_WINDOW];
|
||||||
static uint32_t s_pr_score_idx = 0;
|
static uint32_t s_pr_score_idx = 0;
|
||||||
|
|
||||||
|
/* Multi-channel scanning */
|
||||||
|
#define CHANSCAN_CHANNELS 13
|
||||||
|
#define CHANSCAN_DWELL_MS 100
|
||||||
|
static bool s_chanscan_enabled = false;
|
||||||
|
static int s_chanscan_interval_s = 300; /* 5 min default */
|
||||||
|
static volatile bool s_chanscan_active = false;
|
||||||
|
static int64_t s_chanscan_last = 0;
|
||||||
|
|
||||||
/* Probe dedup rate (moved before config_load_nvs for NVS access) */
|
/* Probe dedup rate (moved before config_load_nvs for NVS access) */
|
||||||
#define PROBE_DEDUP_DEFAULT_US 10000000LL
|
#define PROBE_DEDUP_DEFAULT_US 10000000LL
|
||||||
static int64_t s_probe_dedup_us = PROBE_DEDUP_DEFAULT_US;
|
static int64_t s_probe_dedup_us = PROBE_DEDUP_DEFAULT_US;
|
||||||
@@ -283,11 +294,23 @@ static void config_load_nvs(void)
|
|||||||
s_baseline_nsub = (int)bl_nsub;
|
s_baseline_nsub = (int)bl_nsub;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int8_t chanscan;
|
||||||
|
if (nvs_get_i8(h, "chanscan", &chanscan) == ESP_OK) {
|
||||||
|
s_chanscan_enabled = (chanscan != 0);
|
||||||
|
}
|
||||||
|
int32_t chanscan_int;
|
||||||
|
if (nvs_get_i32(h, "chanscan_int", &chanscan_int) == ESP_OK && chanscan_int >= 60 && chanscan_int <= 3600) {
|
||||||
|
s_chanscan_interval_s = (int)chanscan_int;
|
||||||
|
}
|
||||||
|
int8_t led_quiet;
|
||||||
|
if (nvs_get_i8(h, "led_quiet", &led_quiet) == ESP_OK) {
|
||||||
|
s_led_quiet = (led_quiet != 0);
|
||||||
|
}
|
||||||
nvs_close(h);
|
nvs_close(h);
|
||||||
ESP_LOGI(TAG, "NVS loaded: hostname=%s rate=%d tx_power=%d adaptive=%d threshold=%.6f ble=%d target=%s:%d csi_mode=%d hybrid_n=%d powersave=%d presence=%d pr_thresh=%.4f baseline_nsub=%d",
|
ESP_LOGI(TAG, "NVS loaded: hostname=%s rate=%d tx_power=%d adaptive=%d threshold=%.6f ble=%d target=%s:%d csi_mode=%d hybrid_n=%d powersave=%d presence=%d pr_thresh=%.4f baseline_nsub=%d led_quiet=%d",
|
||||||
s_hostname, s_send_frequency, s_tx_power_dbm, s_adaptive, s_motion_threshold, s_ble_enabled,
|
s_hostname, s_send_frequency, s_tx_power_dbm, s_adaptive, s_motion_threshold, s_ble_enabled,
|
||||||
s_target_ip, s_target_port, (int)s_csi_mode, s_hybrid_interval, s_powersave,
|
s_target_ip, s_target_port, (int)s_csi_mode, s_hybrid_interval, s_powersave,
|
||||||
s_presence_enabled, s_pr_threshold, s_baseline_nsub);
|
s_presence_enabled, s_pr_threshold, s_baseline_nsub, s_led_quiet);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGI(TAG, "NVS: no saved config, using defaults");
|
ESP_LOGI(TAG, "NVS: no saved config, using defaults");
|
||||||
}
|
}
|
||||||
@@ -383,10 +406,25 @@ static void led_task(void *arg)
|
|||||||
if (s_led_mode == LED_SOLID && s_identify_end_time > 0) {
|
if (s_led_mode == LED_SOLID && s_identify_end_time > 0) {
|
||||||
if (esp_timer_get_time() >= s_identify_end_time) {
|
if (esp_timer_get_time() >= s_identify_end_time) {
|
||||||
s_identify_end_time = 0;
|
s_identify_end_time = 0;
|
||||||
s_led_mode = LED_SLOW_BLINK;
|
s_led_mode = s_led_quiet ? LED_OFF : LED_SLOW_BLINK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Quiet mode: off normally, solid on motion/presence, OTA pattern during OTA */
|
||||||
|
if (s_led_quiet && s_led_mode != LED_OTA && s_identify_end_time == 0) {
|
||||||
|
bool activity = s_motion_detected ||
|
||||||
|
(s_presence_enabled && s_baseline_nsub > 0 && s_pr_last_score > s_pr_threshold);
|
||||||
|
if (activity) {
|
||||||
|
gpio_set_level(LED_GPIO, 1);
|
||||||
|
led_on = true;
|
||||||
|
} else {
|
||||||
|
gpio_set_level(LED_GPIO, 0);
|
||||||
|
led_on = false;
|
||||||
|
}
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(200));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Auto-switch between slow/fast blink based on CSI activity */
|
/* Auto-switch between slow/fast blink based on CSI activity */
|
||||||
if (s_led_mode == LED_SLOW_BLINK || s_led_mode == LED_FAST_BLINK) {
|
if (s_led_mode == LED_SLOW_BLINK || s_led_mode == LED_FAST_BLINK) {
|
||||||
int64_t now = esp_timer_get_time();
|
int64_t now = esp_timer_get_time();
|
||||||
@@ -769,27 +807,50 @@ static int ble_gap_event_cb(struct ble_gap_event *event, void *arg)
|
|||||||
disc->rssi, disc->addr.val[5], disc->addr.val[4], disc->addr.val[3],
|
disc->rssi, disc->addr.val[5], disc->addr.val[4], disc->addr.val[3],
|
||||||
disc->addr.val[2], disc->addr.val[1], disc->addr.val[0]);
|
disc->addr.val[2], disc->addr.val[1], disc->addr.val[0]);
|
||||||
|
|
||||||
/* Parse advertisement for device name */
|
/* Parse advertisement for device name, manufacturer data, TX power, flags */
|
||||||
struct ble_hs_adv_fields fields;
|
struct ble_hs_adv_fields fields;
|
||||||
int rc = ble_hs_adv_parse_fields(&fields, disc->data, disc->length_data);
|
int rc = ble_hs_adv_parse_fields(&fields, disc->data, disc->length_data);
|
||||||
|
|
||||||
char name[32] = "";
|
char name[32] = "";
|
||||||
if (rc == 0 && fields.name != NULL && fields.name_len > 0) {
|
uint16_t company_id = 0;
|
||||||
int nlen = fields.name_len < (int)sizeof(name) - 1 ? fields.name_len : (int)sizeof(name) - 1;
|
int8_t tx_power = 127; /* 127 = not present */
|
||||||
memcpy(name, fields.name, nlen);
|
uint8_t adv_flags = 0;
|
||||||
name[nlen] = '\0';
|
|
||||||
|
if (rc == 0) {
|
||||||
|
/* Device name */
|
||||||
|
if (fields.name != NULL && fields.name_len > 0) {
|
||||||
|
int nlen = fields.name_len < (int)sizeof(name) - 1 ? fields.name_len : (int)sizeof(name) - 1;
|
||||||
|
memcpy(name, fields.name, nlen);
|
||||||
|
name[nlen] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Manufacturer-specific data: first 2 bytes = company ID (little-endian) */
|
||||||
|
if (fields.mfg_data != NULL && fields.mfg_data_len >= 2) {
|
||||||
|
company_id = fields.mfg_data[0] | (fields.mfg_data[1] << 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TX power level */
|
||||||
|
if (fields.tx_pwr_lvl_is_present) {
|
||||||
|
tx_power = fields.tx_pwr_lvl;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Advertisement flags (always present in struct, 0 if not in advert) */
|
||||||
|
adv_flags = fields.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send BLE_DATA via UDP */
|
/* Send BLE_DATA via UDP with extended format */
|
||||||
char buf[160];
|
char buf[192];
|
||||||
int len = snprintf(buf, sizeof(buf),
|
int len = snprintf(buf, sizeof(buf),
|
||||||
"BLE_DATA,%s,%02x:%02x:%02x:%02x:%02x:%02x,%d,%s,%s\n",
|
"BLE_DATA,%s,%02x:%02x:%02x:%02x:%02x:%02x,%d,%s,%s,0x%04X,%d,%u\n",
|
||||||
s_hostname,
|
s_hostname,
|
||||||
disc->addr.val[5], disc->addr.val[4], disc->addr.val[3],
|
disc->addr.val[5], disc->addr.val[4], disc->addr.val[3],
|
||||||
disc->addr.val[2], disc->addr.val[1], disc->addr.val[0],
|
disc->addr.val[2], disc->addr.val[1], disc->addr.val[0],
|
||||||
disc->rssi,
|
disc->rssi,
|
||||||
disc->addr.type == BLE_ADDR_PUBLIC ? "pub" : "rnd",
|
disc->addr.type == BLE_ADDR_PUBLIC ? "pub" : "rnd",
|
||||||
name);
|
name,
|
||||||
|
company_id,
|
||||||
|
(int)tx_power,
|
||||||
|
(unsigned)adv_flags);
|
||||||
|
|
||||||
if (s_udp_socket >= 0) {
|
if (s_udp_socket >= 0) {
|
||||||
sendto(s_udp_socket, buf, len, 0,
|
sendto(s_udp_socket, buf, len, 0,
|
||||||
@@ -847,6 +908,9 @@ static void ble_host_task(void *param)
|
|||||||
nimble_port_freertos_deinit();
|
nimble_port_freertos_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- Forward declarations --- */
|
||||||
|
static void channel_scan_run(void);
|
||||||
|
|
||||||
/* --- Adaptive sampling --- */
|
/* --- Adaptive sampling --- */
|
||||||
|
|
||||||
static void adaptive_task(void *arg)
|
static void adaptive_task(void *arg)
|
||||||
@@ -908,6 +972,15 @@ static void adaptive_task(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Periodic channel scanning */
|
||||||
|
if (s_chanscan_enabled && !s_chanscan_active) {
|
||||||
|
int64_t now = esp_timer_get_time();
|
||||||
|
int64_t interval_us = (int64_t)s_chanscan_interval_s * 1000000LL;
|
||||||
|
if (s_chanscan_last == 0 || (now - s_chanscan_last) >= interval_us) {
|
||||||
|
channel_scan_run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!s_adaptive || s_energy_idx < WANDER_WINDOW) continue;
|
if (!s_adaptive || s_energy_idx < WANDER_WINDOW) continue;
|
||||||
|
|
||||||
/* Compute mean */
|
/* Compute mean */
|
||||||
@@ -966,6 +1039,56 @@ static void adaptive_task(void *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* --- Channel scanning --- */
|
||||||
|
|
||||||
|
static void channel_scan_run(void)
|
||||||
|
{
|
||||||
|
if (s_chanscan_active) return;
|
||||||
|
s_chanscan_active = true;
|
||||||
|
|
||||||
|
/* Get current AP info for return */
|
||||||
|
wifi_ap_record_t ap;
|
||||||
|
uint8_t home_channel = 1;
|
||||||
|
if (esp_wifi_sta_get_ap_info(&ap) == ESP_OK) {
|
||||||
|
home_channel = ap.primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESP_LOGI(TAG, "CHANSCAN: starting scan, home channel=%d", home_channel);
|
||||||
|
|
||||||
|
/* Stop ping to pause CSI during scan */
|
||||||
|
if (s_ping_handle) {
|
||||||
|
esp_ping_stop(s_ping_handle);
|
||||||
|
esp_ping_delete_session(s_ping_handle);
|
||||||
|
s_ping_handle = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hop through channels 1-13 */
|
||||||
|
for (int ch = 1; ch <= CHANSCAN_CHANNELS; ch++) {
|
||||||
|
esp_wifi_set_channel(ch, WIFI_SECOND_CHAN_NONE);
|
||||||
|
vTaskDelay(pdMS_TO_TICKS(CHANSCAN_DWELL_MS));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return to AP channel */
|
||||||
|
esp_wifi_set_channel(home_channel, WIFI_SECOND_CHAN_NONE);
|
||||||
|
|
||||||
|
/* Restart ping */
|
||||||
|
wifi_ping_router_start();
|
||||||
|
|
||||||
|
s_chanscan_last = esp_timer_get_time();
|
||||||
|
s_chanscan_active = false;
|
||||||
|
|
||||||
|
/* Emit completion event */
|
||||||
|
char event[128];
|
||||||
|
int len = snprintf(event, sizeof(event),
|
||||||
|
"EVENT,%s,chanscan=done channels=%d",
|
||||||
|
s_hostname, CHANSCAN_CHANNELS);
|
||||||
|
if (s_udp_socket >= 0) {
|
||||||
|
sendto(s_udp_socket, event, len, 0,
|
||||||
|
(struct sockaddr *)&s_dest_addr, sizeof(s_dest_addr));
|
||||||
|
}
|
||||||
|
ESP_LOGI(TAG, "CHANSCAN: complete, returned to channel %d", home_channel);
|
||||||
|
}
|
||||||
|
|
||||||
/* --- OTA --- */
|
/* --- OTA --- */
|
||||||
|
|
||||||
static void ota_task(void *arg)
|
static void ota_task(void *arg)
|
||||||
@@ -1155,12 +1278,13 @@ static void wifi_promiscuous_cb(void *buf, wifi_promiscuous_pkt_type_t type)
|
|||||||
|
|
||||||
char probe[192];
|
char probe[192];
|
||||||
int len = snprintf(probe, sizeof(probe),
|
int len = snprintf(probe, sizeof(probe),
|
||||||
"PROBE_DATA,%s,%02x:%02x:%02x:%02x:%02x:%02x,%d,%s\n",
|
"PROBE_DATA,%s,%02x:%02x:%02x:%02x:%02x:%02x,%d,%s,%d\n",
|
||||||
s_hostname,
|
s_hostname,
|
||||||
hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
|
hdr->addr2[0], hdr->addr2[1], hdr->addr2[2],
|
||||||
hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
|
hdr->addr2[3], hdr->addr2[4], hdr->addr2[5],
|
||||||
pkt->rx_ctrl.rssi,
|
pkt->rx_ctrl.rssi,
|
||||||
ssid);
|
ssid,
|
||||||
|
pkt->rx_ctrl.channel);
|
||||||
|
|
||||||
if (s_udp_socket >= 0) {
|
if (s_udp_socket >= 0) {
|
||||||
sendto(s_udp_socket, probe, len, 0,
|
sendto(s_udp_socket, probe, len, 0,
|
||||||
@@ -1383,6 +1507,30 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
|
|||||||
return strlen(reply);
|
return strlen(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* LED [QUIET|AUTO] */
|
||||||
|
if (strncmp(cmd, "LED", 3) == 0) {
|
||||||
|
if (cmd[3] == '\0' || cmd[3] == '\n') {
|
||||||
|
snprintf(reply, reply_size, "OK LED %s", s_led_quiet ? "quiet" : "auto");
|
||||||
|
return strlen(reply);
|
||||||
|
}
|
||||||
|
if (strncmp(cmd + 4, "QUIET", 5) == 0) {
|
||||||
|
s_led_quiet = true;
|
||||||
|
s_led_mode = LED_OFF;
|
||||||
|
config_save_i8("led_quiet", 1);
|
||||||
|
snprintf(reply, reply_size, "OK LED quiet (off, solid on motion)");
|
||||||
|
return strlen(reply);
|
||||||
|
}
|
||||||
|
if (strncmp(cmd + 4, "AUTO", 4) == 0) {
|
||||||
|
s_led_quiet = false;
|
||||||
|
s_led_mode = LED_SLOW_BLINK;
|
||||||
|
config_save_i8("led_quiet", 0);
|
||||||
|
snprintf(reply, reply_size, "OK LED auto (blink)");
|
||||||
|
return strlen(reply);
|
||||||
|
}
|
||||||
|
snprintf(reply, reply_size, "ERR LED [QUIET|AUTO]");
|
||||||
|
return strlen(reply);
|
||||||
|
}
|
||||||
|
|
||||||
/* STATUS */
|
/* STATUS */
|
||||||
if (strncmp(cmd, "STATUS", 6) == 0) {
|
if (strncmp(cmd, "STATUS", 6) == 0) {
|
||||||
int64_t up = esp_timer_get_time() / 1000000LL;
|
int64_t up = esp_timer_get_time() / 1000000LL;
|
||||||
@@ -1422,12 +1570,29 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
|
|||||||
const char *csi_mode_str = (s_csi_mode == CSI_MODE_COMPACT) ? "compact" :
|
const char *csi_mode_str = (s_csi_mode == CSI_MODE_COMPACT) ? "compact" :
|
||||||
(s_csi_mode == CSI_MODE_HYBRID) ? "hybrid" : "raw";
|
(s_csi_mode == CSI_MODE_HYBRID) ? "hybrid" : "raw";
|
||||||
|
|
||||||
|
/* NVS stats */
|
||||||
|
nvs_stats_t nvs_stats = {0};
|
||||||
|
nvs_get_stats("nvs", &nvs_stats);
|
||||||
|
|
||||||
|
/* Partition info */
|
||||||
|
const esp_partition_t *running = esp_ota_get_running_partition();
|
||||||
|
uint32_t part_size = running ? running->size : 0;
|
||||||
|
|
||||||
|
/* Chip info */
|
||||||
|
esp_chip_info_t chip_info;
|
||||||
|
esp_chip_info(&chip_info);
|
||||||
|
const char *chip_model = (chip_info.model == CHIP_ESP32S3) ? "ESP32S3" :
|
||||||
|
(chip_info.model == CHIP_ESP32C3) ? "ESP32C3" :
|
||||||
|
(chip_info.model == CHIP_ESP32) ? "ESP32" : "ESP32xx";
|
||||||
|
|
||||||
snprintf(reply, reply_size,
|
snprintf(reply, reply_size,
|
||||||
"OK STATUS uptime=%s uptime_s=%lld heap=%lu rssi=%d channel=%d tx_power=%d rate=%d csi_rate=%d"
|
"OK STATUS uptime=%s uptime_s=%lld heap=%lu rssi=%d channel=%d tx_power=%d rate=%d csi_rate=%d"
|
||||||
" hostname=%s version=%s adaptive=%s motion=%d ble=%s target=%s:%d"
|
" hostname=%s version=%s adaptive=%s motion=%d ble=%s target=%s:%d"
|
||||||
" temp=%.1f csi_count=%lu boots=%lu rssi_min=%d rssi_max=%d"
|
" temp=%.1f csi_count=%lu boots=%lu rssi_min=%d rssi_max=%d"
|
||||||
" csi_mode=%s hybrid_n=%d auth=%s flood_thresh=%d/%d powersave=%s"
|
" csi_mode=%s hybrid_n=%d auth=%s flood_thresh=%d/%d powersave=%s"
|
||||||
" presence=%s pr_score=%.4f",
|
" presence=%s pr_score=%.4f chanscan=%s led=%s"
|
||||||
|
" nvs_used=%lu nvs_free=%lu nvs_total=%lu part_size=%lu"
|
||||||
|
" built=%s_%s idf=%s chip=%sr%dc%d",
|
||||||
uptime_str, (long long)up, (unsigned long)heap, rssi, channel, (int)s_tx_power_dbm,
|
uptime_str, (long long)up, (unsigned long)heap, rssi, channel, (int)s_tx_power_dbm,
|
||||||
s_send_frequency, actual_rate,
|
s_send_frequency, actual_rate,
|
||||||
s_hostname, app_desc->version,
|
s_hostname, app_desc->version,
|
||||||
@@ -1439,7 +1604,14 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
|
|||||||
s_auth_secret[0] ? "on" : "off",
|
s_auth_secret[0] ? "on" : "off",
|
||||||
s_flood_thresh, s_flood_window_s,
|
s_flood_thresh, s_flood_window_s,
|
||||||
s_powersave ? "on" : "off",
|
s_powersave ? "on" : "off",
|
||||||
s_presence_enabled ? "on" : "off", s_pr_last_score);
|
s_presence_enabled ? "on" : "off", s_pr_last_score,
|
||||||
|
s_chanscan_enabled ? "on" : "off", s_led_quiet ? "quiet" : "auto",
|
||||||
|
(unsigned long)nvs_stats.used_entries,
|
||||||
|
(unsigned long)nvs_stats.free_entries,
|
||||||
|
(unsigned long)nvs_stats.total_entries,
|
||||||
|
(unsigned long)part_size,
|
||||||
|
app_desc->date, app_desc->time, app_desc->idf_ver,
|
||||||
|
chip_model, chip_info.revision, chip_info.cores);
|
||||||
return strlen(reply);
|
return strlen(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1912,6 +2084,46 @@ static int cmd_handle(const char *cmd, char *reply, size_t reply_size)
|
|||||||
return strlen(reply);
|
return strlen(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CHANSCAN [ON|OFF|NOW|INTERVAL <60-3600>] */
|
||||||
|
if (strcmp(cmd, "CHANSCAN") == 0) {
|
||||||
|
snprintf(reply, reply_size, "OK CHANSCAN %s interval=%ds active=%s",
|
||||||
|
s_chanscan_enabled ? "on" : "off",
|
||||||
|
s_chanscan_interval_s,
|
||||||
|
s_chanscan_active ? "yes" : "no");
|
||||||
|
return strlen(reply);
|
||||||
|
}
|
||||||
|
if (strncmp(cmd, "CHANSCAN ", 9) == 0) {
|
||||||
|
const char *arg = cmd + 9;
|
||||||
|
if (strncmp(arg, "ON", 2) == 0) {
|
||||||
|
s_chanscan_enabled = true;
|
||||||
|
config_save_i8("chanscan", 1);
|
||||||
|
snprintf(reply, reply_size, "OK CHANSCAN on interval=%ds", s_chanscan_interval_s);
|
||||||
|
} else if (strncmp(arg, "OFF", 3) == 0) {
|
||||||
|
s_chanscan_enabled = false;
|
||||||
|
config_save_i8("chanscan", 0);
|
||||||
|
snprintf(reply, reply_size, "OK CHANSCAN off");
|
||||||
|
} else if (strncmp(arg, "NOW", 3) == 0) {
|
||||||
|
if (s_chanscan_active) {
|
||||||
|
snprintf(reply, reply_size, "ERR CHANSCAN already in progress");
|
||||||
|
} else {
|
||||||
|
channel_scan_run();
|
||||||
|
snprintf(reply, reply_size, "OK CHANSCAN triggered");
|
||||||
|
}
|
||||||
|
} else if (strncmp(arg, "INTERVAL ", 9) == 0) {
|
||||||
|
int val = atoi(arg + 9);
|
||||||
|
if (val < 60 || val > 3600) {
|
||||||
|
snprintf(reply, reply_size, "ERR CHANSCAN INTERVAL range 60-3600 seconds");
|
||||||
|
return strlen(reply);
|
||||||
|
}
|
||||||
|
s_chanscan_interval_s = val;
|
||||||
|
config_save_i32("chanscan_int", (int32_t)val);
|
||||||
|
snprintf(reply, reply_size, "OK CHANSCAN INTERVAL %ds (saved)", val);
|
||||||
|
} else {
|
||||||
|
snprintf(reply, reply_size, "ERR CHANSCAN ON|OFF|NOW|INTERVAL <60-3600>");
|
||||||
|
}
|
||||||
|
return strlen(reply);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(reply, reply_size, "ERR UNKNOWN");
|
snprintf(reply, reply_size, "ERR UNKNOWN");
|
||||||
return strlen(reply);
|
return strlen(reply);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=
|
|||||||
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=
|
CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=
|
||||||
|
|
||||||
#
|
#
|
||||||
# Compiler options
|
# Compiler options (size optimization saves ~75 KB)
|
||||||
#
|
#
|
||||||
CONFIG_COMPILER_OPTIMIZATION_PERF=y
|
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
||||||
|
|
||||||
#
|
#
|
||||||
# FreeRTOS
|
# FreeRTOS
|
||||||
|
|||||||
Reference in New Issue
Block a user