Repository navigation
refactor(variants): display and user button of 48 boards from the board description (note 0011, cut E1) - #38
Merged
Conversation
…the board description Inventory of the radio blocks in the 89 target.cpp (tools/refactoring/ variant_target_globals.py), why objects cannot be weak, the opt-in macro RADIOLIB_TARGET_GLOBALS in target.h, the split into D1 (31 nRF52) and D2 (22 ESP32 with the shared radio_init()), rejected alternatives and the open upstream pull requests that touch the same lines.
…riants A new host suite (native_variant_target_globals) builds the shared variant code against the target.h of a variant with the real AutoDiscoverRTCClock, with the radio block of the 31 nRF52 variants of cut C copied verbatim: the radio is built from a Module on the board pins in SX126x order with SPI passed, radio_driver wraps it and the board, rtc_clock falls back to and ticks fallback_clock, and the shared radio_init() starts that radio. The variant stand-ins move into variant_stubs.h and gain a Module stand-in.
… variants RadioLibTarget.cpp defines radio, radio_driver, fallback_clock and rtc_clock for the variants whose target.h defines the new opt-in macro RADIOLIB_TARGET_GLOBALS, built from the P_LORA_* pins: on nRF52 the radio is a Module on SPI, the fallback clock a VolatileRTCClock. Not weak: a weak object would still be constructed into a variant's own one. Other platforms and the SX1276 pin order stop the build with an #error until described. The 31 nRF52 variants of cut C delete their block from target.cpp (deletions only) and add the macro line to target.h (additions only). The host suite now runs its cases against the shared globals.
…riants A host suite in four environments, one per board description that occurs among the 22 ESP32 variants of cut D2 (SX1262 on an own bus on the default host, without P_LORA_SCLK, SX1276, own bus on another host), with their blocks and radio_init() bodies copied verbatim: the Module's pins in the chip's order, its bus (own, on which host, or none), what radio_driver wraps, the fallback clock, and that radio_init() starts the fallback clock, the RTC and then the radio on its bus, passing the result through. The SPI stand-in gets bus numbers, the radio stand-in tells the module's bus apart.
…r 22 ESP32 variants RadioLibTarget.cpp describes the radio globals for ESP32 as well: the pins in the chip's order (SX1276: DIO0, RESET, DIO1), an own SPIClass where the board names P_LORA_SCLK, on P_LORA_SPI_HOST if set, otherwise no bus so that RadioLib starts its default one, and an ESP32RTCClock as fallback clock. For those variants with an SX126x or SX1276 it adds a weak radio_init(): start the fallback clock and the RTC, then the radio on its bus. The 22 ESP32 variants left by cut C delete their block and radio_init() from target.cpp (deletions only) and add the opt-in, and five of them P_LORA_SPI_HOST (FSPI, or 0 on the C6), to target.h (additions only).
…radio_init() of 22 ESP32 variants
…their source lines
…their source lines
… (step 11, cut D1)
…board description (step 11, cut D2)
Inventory of the display, button, GPS and sensor globals of the 89 target.cpp (variant_target_globals.py --peripherals), what a shared definition would need, the cost of these lines so far and the open upstream pull requests on them.
…descriptions Characterization for cut E1 of note 0011: the display and user_btn blocks of heltec_v3, heltec_t1, heltec_v4 and promicro, verbatim, against the real MomentaryButton, in one native environment each.
…ard description Cut E1 of note 0011. src/helpers/VariantTarget.cpp defines display and user_btn for the variants whose target.h defines DISPLAY_TARGET_GLOBALS, from DISPLAY_CLASS, DISPLAY_PERIPH_POWER (new, the display's constructor argument where there is one) and USER_BTN_PULL (new, the button with the pin's pull resistor). Not weak, as the radio globals of cut D. In the 48 variants target.cpp loses the two declarations (deletions only), target.h gains the opt-in and where needed one description line.
Host tests, mutations, constructor chains of the 10 display classes and the builds of 64 environments before and after.
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.
CI only, not for merge into integration. Based on
integrationat07fa9c5c(cuts A to D, 9c and 10c merged), so the diff againstdevalso shows those commits. This PR's own commits are the last four (44369a74,6bbee986,6b99b97f,0c090d6a).Cut E1 of note 0011: 48 variants carried the same display and user button lines in
target.cpp(DISPLAY_CLASS display;andMomentaryButton user_btn(PIN_USER_BTN, 1000, true);inside#ifdef DISPLAY_CLASS, in four forms). They now live once in the newsrc/helpers/VariantTarget.cpp, for every variant whosetarget.hdefines the new opt-inDISPLAY_TARGET_GLOBALS, built from the board's description:DISPLAY_CLASS,DISPLAY_PERIPH_POWER(new: the display's constructor argument,&board.periph_powerin 7 variants,NULLin 2) andUSER_BTN_PULL(new: the button with the pin's pull resistor, 5 variants). Invariants/: 48target.cppdeletions only (237 lines), 48target.hadditions only (62 lines). Not weak, for the reason of cut D.The first commit is the design of cut E. It recommended not to build E now (small benefit per file; E2, GPS and sensors, collides with the open upstream redesign meshcore-dev#1799). E1 was built on Marcel's decision; E2 stays not built.
Evidence:
ST7789LCDDisplayandNV3001BDisplay(anSPIClassmutex) andE290Display(page buffer) allocate, so what the move can change is the order of heap allocations at start-up.SOURCE_DATE_EPOCHfixed. Controls: identical images, exceptPicoW_repeater(linker veneers in another order, every other symbol at the same address) and an ESP32 environment without display (ELF hash fields only). In the 54 edited environments: flash -44 to +88, RAM -8 to +16.nmon all 54:displayanduser_btnkeep name, size and binding; the construction moved toVariantTarget.cpp's initializer. Three environments with further size changes were rebuilt in another worktree and compared object by object: onlytarget.cpp.odiffers, the changed functions are Xtensa encoding and alignment differences or a kept inline copy that moved, and inThinkNode_M5_RepeatertheGxEPDDisplayconstructor is now inlined (not compared instruction by instruction).