How n0xa/m5stick-nemo works
Project type and purpose
• Type: Embedded firmware for ESP32-based M5Stack devices (M5Stick-C, ‑C Plus, Cardputer).
• Purpose: Provide a modular “prank toolkit” exposing multiple hardware- and network-driven features (TV-B-Gone, WiFi spam/portal, Bluetooth spam, deauth attacks, IR codes, etc.) via a menu-driven UI.
File structure
• Top-level firmware entry: m5stick-nemo.ino.
• Feature headers: NEMOMatrix.h, applejuice.h, tvbg.h, wifispam.h, portal.h, deauth.h, etc.
• Hardware abstraction & settings: sd.h, localization.h, WORLD_IR_CODES.h.
• Build/config pipelines:
– configs/ holds .env.* presets per device.
– scripts/ (compile.sh, docker-build.sh, flash.sh, entrypoint.sh).
– Dockerfile & GitHub Actions workflows (.github/workflows/).
• Misc: .gitignore, LICENSE, README.md.
README for insights
• Runtime architecture: menu controls → select feature modules → hardware/network interactions → optional SD logging.
• Build options: Arduino IDE, Arduino CLI, Docker, M5Burner, esptool.py, GitHub CI.
• Dependencies: M5Stack boards core, IRRemoteESP8266, ESP-IDF tools.
Main components and their interactions
a. Hardware Platform
– ESP32 SoC (WiFi, BT, CPU)
– Display & Buttons (Home/Next/Select)
– RTC & EEPROM
– IR LED (TV-B-Gone)
– SD card interface (optional via sd.h)
b. Firmware Modules (each in its own header + code in .ino)
– UI/Menu manager → dispatches to feature handlers
– TV-B-Gone IR manager
– AppleJuice Bluetooth spam manager
– WiFi Spam & Scanner manager
– Deauth & Evil-Twin portal manager (DNS, DHCP, Web server)
– Settings manager (brightness, rotation, portal SSID)
– Localization manager (strings in flash)
– Logging (serial, SD card via FAT FS)
– Power & Battery monitor (RTC, AXP192 PMU on some models)
c. External & Build Services
– M5Burner (binary installer)
– Arduino IDE / CLI (compilation)
– Docker container for deterministic build
– GitHub Actions CI for automated compile & release
– esptool.py (flash binaries)
Architectural patterns and design principles
• Modular feature isolation via separate headers
• Hardware-agnostic code paths gated by #define (STICK_C, STICK_C_PLUS, CARDPUTER)
• Event-driven menu loop → callback pattern
• Build-time configuration via environment files and scripts
• Single monolithic firmware binary for all features, selectable at runtime
Essential elements
• Device hardware block with all onboard peripherals
• Firmware modules grouped by function (UI, network, IR, BT, storage, settings)
• Build pipeline flow (source → compile → flash)
• External tools & services (M5Burner, Docker, GitHub Actions, esptool.py)