# Step 2 Adoption Matrix

## Scope
Repository: `microReticulumTbeam`  
Submodule source: `external/microReticulum_Firmware`

## What Step 2 Means
Identify and wire the first low-risk points where this repo should consume existing board-integration logic from `microReticulum_Firmware`, instead of maintaining duplicate local assumptions.

## High-Value Upstream Sources
- `external/microReticulum_Firmware/Boards.h`
  - T-Beam Supreme pin map and feature flags.
  - Includes SD pins (`SD_CS=47`, `SD_CLK=36`, `SD_MISO=37`, `SD_MOSI=35`), PMU I2C pins (`I2C_SDA=42`, `I2C_SCL=41`), LoRa pins.
- `external/microReticulum_Firmware/Power.h`
  - AXP2101 setup sequence for T-Beam Supreme (`BOARD_TBEAM_S_V1`), including SD rail (BLDO1), ALDO rails, charging config.
- `external/microReticulum_Firmware/platformio.ini`
  - `env:ttgo-t-beam-supreme` build model and dependency pattern.

## Local Targets And First Consumers
1. `firmware/fieldtest_beacon/src/main.cpp`
- Why first: this is the integration entry point, not just a smoke test.
- Step-2 change made: SD CS now comes from `Boards.h` instead of hardcoded `10`.

2. `exercises/04_SD_card/src/main.cpp`
- Why second: duplicates PMU + SD pin assumptions already present upstream.
- Planned consume-first item: PMU rail setup pattern from `Power.h`.

3. `exercises/05_SD_Card_Watcher/src/main.cpp`
- Why third: extends `04` and should share the same PMU/pin source strategy.
- Planned consume-first item: same board/power source as `04`.

4. `exercises/06_RTC_check/src/main.cpp`
- Why fourth: depends on PMU + I2C pin assumptions that overlap upstream.
- Planned consume-first item: board I2C pin source and PMU readiness sequence.

## Current Wiring Done
- Added submodule:
  - `external/microReticulum_Firmware`
- Wired one concrete consumer:
  - `firmware/fieldtest_beacon/src/main.cpp` now includes `Boards.h` and uses `SD_CS`.
  - `firmware/fieldtest_beacon/platformio.ini` now includes `external/microReticulum_Firmware` headers and sets `BOARD_MODEL=BOARD_TBEAM_S_V1`.
- Added local adapter:
  - `shared/boards/tbeam_supreme_adapter.h`
  - Exposes board pins and PMU setup based on upstream T-Beam Supreme definitions.
- Refactored exercises to consume adapter:
  - `exercises/04_SD_card`
  - `exercises/05_SD_Card_Watcher`
  - `exercises/06_RTC_check`

## Validation Status
- `firmware/fieldtest_beacon` now builds after adding required deps:
  - `ArduinoJson` 7.x
  - `MsgPack`
  - `Crypto` (provides `Ed25519.h` and `Curve25519.h`)
- `exercises/04_SD_card` builds.
- `exercises/05_SD_Card_Watcher` builds.
- `exercises/06_RTC_check` builds.

## Next Step Candidate
Reduce macro redefinition warnings emitted by `Boards.h` in adapter consumers:
- Option A: small local board-map header with only required constants copied from upstream board model.
- Option B: upstream contribution to make board capability macros conditional/override-safe.
