Skip to content

Update for error refactor, uart#921

Open
brentru wants to merge 24 commits into
migrate-api-v2from
update-for-errors
Open

Update for error refactor, uart#921
brentru wants to merge 24 commits into
migrate-api-v2from
update-for-errors

Conversation

@brentru
Copy link
Copy Markdown
Member

@brentru brentru commented May 20, 2026

Updated WipperSnapper's codebase to match the inclusion/refactor of the error module (and removal of Added messages) via adafruit/Wippersnapper_Protobuf#196 and updated UART protobufs via adafruit/Wippersnapper_Protobuf#199.

Other changes:

  • Changed _DS18X20_pins from a vector of std::unique_ptr to a vector of raw pointers, and added explicit deletion of sensor hardware objects in the destructor and removal methods to prevent memory leaks. [1] [2] [3]
  • Refactored DS18X20 add handler to simplify initialization logic, remove platform-specific code, and ensure proper cleanup on failure.
  • Removed all code and references related to the unused Ds18x20Added message from the DS18X20 model, simplifying the message API. [1] [2] [3] [4] [5]

brentru and others added 22 commits May 15, 2026 14:08
Mechanical rename pass across 8 source files to align with the
regenerated i2c.pb.h naming conventions. No logic changes.

Types: DeviceAddOrReplace->Add, DeviceAddedOrReplaced->Added,
DeviceRemove->Remove, DeviceRemoved->Removed, DeviceEvent->Event,
DeviceStatus->Status. Enum values: DS_*->S_*. B2D/D2B tags and
payload fields simplified. Struct fields: device_name->name,
device_period->period, device_description->descriptor, etc.

Deferred work (Scan->Probe, map entries, Descriptor split) tracked
in src/components/i2c/DEFERRED_PB_CHANGES.md.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update all C++ code to use the new ws_i2c_Descriptor type which
nests ws_i2c_AddressSpace for bus/mux info. Field accesses now go
through .address_space for pin_scl, pin_sda, mux_address,
mux_channel and .address replaces the old .device_address.

Scan/Probe code left unchanged (deferred).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DeviceAddOrReplace->Add, DeviceRemove->Remove. B2D tags and payload
fields simplified to match new gps.pb.h naming.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Field renames: device_type->type, device_id->id, sensor_types->types
on DeviceConfig, Descriptor, GenericInputConfig, and PM25AQIConfig.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Field renames: sensor_types->types, sensor_types_count->types_count,
sensor_events->events, sensor_events_count->events_count.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Driver stores ws_i2c_Add_TypesEntry (key + sensor type) instead of
bare ws_sensor_Type. Events carry the broker key through the full
read cycle so the broker can correlate readings to sensor slots.

Also renames controller methods: Handle_Add, Handle_Probe,
Handle_Remove and updates checkin callback to match ws_i2c_Add.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replaces the old brute-force bus scan with a targeted probe system.
The broker sends AddressSpaces (bus or mux channel) and a list of
specific addresses to probe. Hardware handles mux selection internally.

- hardware: ScanBus/ScanMux replaced by ProbeAddresses which takes
  an AddressSpace, probes listed addresses (or all 112 if empty),
  and populates an AddressSpaceResult
- model: owns all Probe decode/encode via nanopb callbacks, buffers
  decoded address spaces and addresses, stores Probed results with
  per-result found-address contexts for encode callbacks
- controller: Handle_Probe reads from model, iterates address spaces,
  delegates to hardware, publishes via model

Compiles clean on huzzah8266.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@brentru brentru added the api-v2 label May 20, 2026
@brentru brentru changed the title Update for errors Update for error refactor, uart May 20, 2026
@brentru brentru marked this pull request as ready for review May 20, 2026 17:49
@brentru brentru requested review from lorennorman and tyeth May 20, 2026 17:52
@brentru
Copy link
Copy Markdown
Member Author

brentru commented May 20, 2026

@tyeth @lorennorman this is a large PR. I do not expect you to review the entire thing, but I do need a second set of eyes to quickly look.

Comment thread .vscode/settings.json
Comment thread src/components/error/controller.cpp Outdated
@brentru
Copy link
Copy Markdown
Member Author

brentru commented May 20, 2026

@tyeth Check it out! ☝️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants