Move the board profile tests into the native Unity suite

The board tests ran through tools/test-board-profile.sh with their own stubs, assert() and a script that copied nine method bodies out of Transceiver.cpp, so they were outside pio test -e native and the coverage report.

Pure decisions now live in units the native env builds: BoardProfile::usesPin is constexpr, RadioReadiness decides register validity, the receive-state outcome (ready, retry or unavailable, with one try today) and whether a queued job may transmit, and ShadeGpioGuard decides whether a shade's outputs touch a board pad. Transceiver and ShadeGpio call them with identical behaviour. New Unity suites cover the generic and LILYGO profiles (reserved pads, startup order, radio bring-up) and the readiness unit; the old harness, its script, CI step and stubs are deleted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
R. Sid Shaytay 2026-11-14 18:46:33 -08:00
parent 2b3d556729
commit 28af01195a
No known key found for this signature in database
27 changed files with 595 additions and 517 deletions

21
src/RadioReadiness.cpp Normal file
View file

@ -0,0 +1,21 @@
#include "RadioReadiness.h"
float radioFrequencyMHz(uint32_t freqWord) {
return freqWord * (26.0f / 65536.0f);
}
bool radioRegistersReady(const radio_readings_t &r, float requestedMHz) {
const float actual = radioFrequencyMHz(r.freqWord);
return r.partnum == 0 && r.version != 0 && r.version != 0xFF &&
r.iocfg0 == 0x0D && r.iocfg2 == 0x0D && (r.pktctrl0 & 0x30) == 0x30 &&
(r.mdmcfg2 & 0x70) == 0x30 && actual > requestedMHz - 0.01f && actual < requestedMHz + 0.01f;
}
rx_outcome_t radioRxOutcome(uint8_t marcstate, uint8_t attempt, uint8_t maxAttempts) {
if((marcstate & 0x1F) == RADIO_MARCSTATE_RX) return rx_outcome_t::ready;
return attempt + 1 < maxAttempts ? rx_outcome_t::retry : rx_outcome_t::unavailable;
}
bool radioMayTransmit(bool integratedRadio, bool radioAvailable) {
return !integratedRadio || radioAvailable;
}