Repository navigation
tech(TECH-MAIN-001): runCycle(Hal*) extrait de la boucle principale - #51
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…envs Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add test_main_cycle suite (5 tests) and four native_cycle_* envs (oregon, oregon_vcc, lacrosse, x10) building src/ with UNIT_TEST and SLEEP_TIME_IN_SECONDS=0; native_debug ignores the suite. TDD red: fails with "main.h: No such file or directory". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rf LED calls x10rf::SendCommand drives the LED itself, so the reference sequence is now recorded on a CycleSpyHal, and transmissions are counted as LedOff+Delay30ms pairs (one per TRANSMIT_WITH_LED) instead of LedOn. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
One cycle is now runCycle(Hal *hal), declared in include/main.h. Encoders and sensor wrappers are built inside it from the injected hal; TRANSMIT_WITH_LED and SerialPrintInfo use it too. lowBattery and batteryVoltageInMv are locals. main() (hal.Init(); while(1) runCycle(&hal)) and the global hal are compiled out under UNIT_TEST. AVR size, flash before -> after (static RAM): S_02 5354 -> 5368 (+14) RAM 124 -> 62 S_03 5338 -> 5438 (+100) RAM 120 -> 58 S_04 7626 -> 7876 (+250, 96.1%) RAM 124 -> 62 S_05 3982 -> 3992 (+10) RAM 120 -> 58 robot 7612 -> 8000 (+388, 97.7%) RAM 120 -> 58 SOLAR_TEST 6568 -> 6802 (+234) RAM 107 -> 58 devmodule 3932 -> 3962 (+30) RAM 120 -> 58 Static RAM drop is objects moving to the stack; peak stack not measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_main_cycle only runs in the native_cycle_* envs (native_debug ignores it), so the native job now tests all five envs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t protocol Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ild flags Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd LACROSSE_ID Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ke no Hal* Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…flash BMx280 delegates all hardware access to the SparkFun driver, so it takes no Hal* (TECH-HAL-001). It is a file-scope object in src/main.cpp: built per cycle in ReadEnvironment it cost ~300 B flash. Flash / RAM (static), bytes, HEAD before -> after: | env | flash before | flash after | RAM before | RAM after | |------------|-------------:|------------:|-----------:|----------:| | robot | 8000 | 7688 | 58 | 109 | | S_04 | 7876 | 7584 | 62 | 113 | | S_02 | 5368 | 5300 | 62 | 113 | | S_03 | 5438 | 5272 | 58 | 109 | | S_05 | 3992 | 3944 | 58 | 109 | | devmodule | 3962 | 3894 | 58 | 109 | | SOLAR_TEST | 6802 | 6802 | 58 | 58 | The +51 B static RAM is the BME280 object moving from the stack to .bss (no net change in peak RAM use). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 7, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Résumé
Un cycle complet (capteurs ON → mesure → émissions → capteurs OFF → hibernation) devient
runCycle(Hal*)(include/main.h).main()=hal.Init()+while (1) runCycle(&hal);, exclu sousUNIT_TEST. Tout appelHaldu cycle va auhalinjecté : le cycle est testable sur native. Reprend l'intention dearchive/master-2026-06, réécrite sur lemain.cppactuel.Exigences
runCycle(Hal*), 4 envsnative_cycle_*(Oregon, Oregon VCC, Lacrosse, sans protocole) + suitetest_main_cycle.#error.LACROSSE_IDrequis avecUSE_LACROSSEouUSE_BH1750→#errorexplicite.BMx280(driver SparkFun via TinyI2C) ne prend plus deHal*; il devient un objet de portée fichier (optimisation flash).CI
native_debug+ 4native_cycle_*(106 tests).test/compile_fail/) et variantes de capteurs (test/build_variants/).Taille AVR (flash, octets)
RAM statique : −62 o environ (objets sur la pile), sauf +51 o là où le BMx280 passe en
.bss(pic réel inchangé).Reste à faire (hors PR)
main()» à corriger).Ds18b20.hvsds18b20.h, casse).Test plan
🤖 Generated with Claude Code