Skip to content

tech: restructuration de main.cpp (audit A2, A3) - #39

Merged
arcadien merged 2 commits into
masterfrom
tech/main-refactor
Oct 26, 2026
Merged

arcadien merged 2 commits into
masterfrom
tech/main-refactor

Conversation

@arcadien

Copy link
Copy Markdown
Owner

Basée sur #38 (à fusionner d'abord).

  • A2 — include/EnvironmentEncoder.h : alias EnvironmentEncoder (Oregon ou Lacrosse) choisi à la compilation, ConfigureEncoder(), ApplyMeasurements() par encodeur. Statique, pas de vtable.
  • A3 — include/LightSensor.h (wrapper BH1750, stub natif). Capteur et encodeur Lacrosse lumière créés une fois ; lux toujours en Lacrosse type 5, émis 2 fois.
  • include/Measurements.h remplace les sentinelles NOT_SET = -1000.
  • Corrigé au passage : _delay_ms(150) direct dans main.cpp, vccMv hors portée pour ANALOG1_X10_ID seul, stub natif BMx280::Shutdown().
  • test_environment (7 tests) : mêmes ordres HAL qu'avec les appels directs d'avant.
  • Doc : docs/architecture.md (diagramme + section Main loop structure), CLAUDE.md, audit.

Aucun changement de trame attendu. La CI compile les 7 cibles ; vérification sur banc recommandée pour SOLAR_TEST (BH1750).


Generated by Claude Code

@arcadien
arcadien changed the base branch from tech/audit-fixes to master October 25, 2026 15:53
@arcadien arcadien closed this Oct 25, 2026
@arcadien arcadien reopened this Oct 25, 2026
arcadien and others added 2 commits October 26, 2026 13:49
Audit A2 + A3. No change in transmitted frames.

- Measurements (include/Measurements.h): one cycle's values with a
  present flag each, replacing the NOT_SET = -1000 sentinel floats.
- EnvironmentEncoder (include/EnvironmentEncoder.h): build-time alias to
  OregonV3 or LacrosseWS7000, ConfigureEncoder() and one
  ApplyMeasurements() overload per encoder. Static, no virtual table.
- LightSensor (include/LightSensor.h): BH1750 wrapper with Hal* and a
  native stub; the BH1750 and the dedicated Lacrosse light encoder are
  now created once instead of every cycle. Luminosity still goes out as
  a Lacrosse type-5 frame, twice (LIGHT_FRAME_REPEAT).
- Fixes: direct _delay_ms(150) in main.cpp (now Hal::Delay30ms x5);
  vccMv declared only in the battery block but used by the analog block;
  missing native BMx280::Shutdown() stub.
- test_environment: HAL orders through ApplyMeasurements() match the
  former direct encoder calls (Oregon, Lacrosse, battery-low flag).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNYLnB9ATL4uFdUmr9bSfN
docs/architecture.md: component diagram (EnvironmentEncoder,
LightSensor, Measurements), responsibilities, and a Main loop structure
section with the design choices. CLAUDE.md and audit updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RNYLnB9ATL4uFdUmr9bSfN
@arcadien
arcadien merged commit 15e6957 into master Oct 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant