onlyn00bs-badge

OnlyN00bs: a DEF CON 34 friend-finder badge. ESP32 firmware, Web Bluetooth setup app, printable case
git clone https://git.virtualshack.io/onlyn00bs-badge.git
Log | Files | Refs | README | LICENSE

platformio.ini (4759B)


      1 ; DefCon friend-finder badge — firmware build config
      2 ;
      3 ; Envs (badge target first):
      4 ;   oled_v3     — THE BADGE (default env): ESP32 + 2.42" SSD1309 OLED (U8g2) on Arduino
      5 ;                 core 3.x (pioarduino) — live per-peer RSSI, so "closest friend first"
      6 ;                 sorting + the points RSSI-gate actually work. huge_app partition.
      7 ;   esp32dev_v3 — DEPRECATED: core-3.x serial build, was the dev/test default. The serial
      8 ;                 backend was test-only (prove the firmware pre-hardware); build oled_v3
      9 ;                 instead. Kept for headless regression checks that need no panel.
     10 ;   oled        — core-2.x OLED badge build, kept as a proven FALLBACK (RSSI=0).
     11 ;   esp32dev    — DEPRECATED: core-2.x serial build (RSSI=0). Test-only; superseded by oled.
     12 ;   esp32c3     — parked custom-PCB v2 target (native USB, serial backend).
     13 ;
     14 ; Why two cores: PlatformIO's official espressif32 platform is still on Arduino
     15 ; core 2.0.17 (even at v7.0.1, 2026-05), whose ESP-NOW recv callback does NOT
     16 ; expose RSSI. The community pioarduino platform provides core 3.x / IDF 5.x,
     17 ; which does. RSSI is measured by the RECEIVER, so a single core-3.x observer is
     18 ; enough to read signal strength; peers can run either core. The firmware handles
     19 ; both via #if ESP_ARDUINO_VERSION_MAJOR>=3 (main.cpp on_espnow_recv).
     20 ;
     21 ; The radio is time-shared: BLE provisioning OR WiFi/ESP-NOW discovery, never
     22 ; both at once — so the single 2.4GHz radio never has to coexist.
     23 ;
     24 ; Display backend is selected per-env via -DBADGE_DISPLAY_{SERIAL,OLED};
     25 ; the firmware core is identical across all targets.
     26 
     27 [platformio]
     28 default_envs = oled_v3     ; THE BADGE (was esp32dev_v3 — serial dev build, now deprecated)
     29 src_dir = src
     30 
     31 [env]
     32 framework = arduino
     33 monitor_speed = 115200
     34 extra_scripts = pre:git_rev.py     ; injects -DGIT_REV="<short-rev>" for the boot build banner
     35 lib_deps =
     36     h2zero/NimBLE-Arduino @ ^2.1.0
     37 build_flags =
     38     -DCORE_DEBUG_LEVEL=3
     39 
     40 ; ── Arduino-ESP32 core 3.x base (pioarduino) ─────────────────────────────────
     41 ; Shared by the badge (oled_v3) and the default dev build (esp32dev_v3). Pins the
     42 ; pioarduino release in ONE place and uses huge_app.csv (no-OTA: 3MB app / ~960KB
     43 ; filesystem) so the heftier core-3.x image has headroom — the default table left
     44 ; the OLED build at 98.5%. Bump the tag here to update both envs.
     45 ; Latest tag: github.com/pioarduino/platform-espressif32/releases
     46 [core3x]
     47 platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.38/platform-espressif32.zip
     48 board = esp32dev
     49 board_build.partitions = huge_app.csv
     50 
     51 ; --- THE BADGE: ESP32 + 2.42" SSD1309 mono OLED (I2C), single 18650, core 3.x ---
     52 [env:oled_v3]
     53 extends = core3x
     54 build_flags =
     55     ${env.build_flags}
     56     -DBADGE_DISPLAY_OLED=1
     57     -DBUTTON_PIN=27          ; FireBeetle 2 ESP32-E user button is on GPIO27 (not GPIO0)
     58 lib_deps =
     59     ${env.lib_deps}
     60     olikraus/U8g2 @ ^2.35.30
     61 
     62 ; --- THE BADGE, PRODUCTION FLEET BUILD ---
     63 ;   Identical firmware to oled_v3, plus -DBADGE_PRODUCTION so config.h REFUSES to compile
     64 ;   with the throwaway GROUP_PSK (see the GROUP SECRET block there). Use THIS env for the
     65 ;   fleet flash — it can't ship the placeholder key. Use plain oled_v3 for dev iteration
     66 ;   (it warns but builds on the placeholder). Requires a real firmware/src/secrets.h.
     67 [env:oled_v3_prod]
     68 extends = env:oled_v3
     69 build_flags =
     70     ${env:oled_v3.build_flags}
     71     -DBADGE_PRODUCTION=1
     72 
     73 ; --- DEPRECATED (serial backend, test-only): core-3.x serial dev/test build. Was the
     74 ;     default; the badge (oled_v3) is now default. Kept for headless regression checks. ---
     75 [env:esp32dev_v3]
     76 extends = core3x
     77 build_flags =
     78     ${env.build_flags}
     79     -DBADGE_DISPLAY_SERIAL=1
     80 
     81 ; ── core-2.x fallbacks (stock espressif32 — RSSI=0, no proximity sort) ────────
     82 
     83 ; --- Fallback: core-2.x OLED badge build ---
     84 [env:oled]
     85 platform = espressif32 @ ^6.9.0
     86 board = esp32dev
     87 build_flags =
     88     ${env.build_flags}
     89     -DBADGE_DISPLAY_OLED=1
     90     -DBUTTON_PIN=27          ; FireBeetle 2 ESP32-E user button is on GPIO27 (not GPIO0)
     91 lib_deps =
     92     ${env.lib_deps}
     93     olikraus/U8g2 @ ^2.35.30
     94 
     95 ; --- DEPRECATED (serial backend, test-only): core-2.x serial build for generic ESP32
     96 ;     dev kits. Superseded by the OLED fallback (oled). ---
     97 [env:esp32dev]
     98 platform = espressif32 @ ^6.9.0
     99 board = esp32dev
    100 build_flags =
    101     ${env.build_flags}
    102     -DBADGE_DISPLAY_SERIAL=1
    103 
    104 ; --- ESP32-C3: parked custom-PCB v2 target (native USB) ---
    105 [env:esp32c3]
    106 platform = espressif32 @ ^6.9.0
    107 board = esp32-c3-devkitm-1
    108 build_flags =
    109     ${env.build_flags}
    110     -DBADGE_DISPLAY_SERIAL=1
    111     -DARDUINO_USB_MODE=1
    112     -DARDUINO_USB_CDC_ON_BOOT=1