adafruit / adafruit/Adafruit_Wippersnapper_Arduino

Implement independent i2c sensor readings

Open
#986 0 comments 0 reactions 0 assignees View on GitHub
api-v2 bug
Dominant language
C++
Stars
54
Forks
56
Avg merge
2d 12h
Merged PRs (30d)
11

Description

The types field on `ws_i2c_Add` is a proto `map`. Because nanopb has no map type, it generates a `ws_i2c_Add_TypesEntry` submessage.

The key is an index, assigned by the broker and the `value` is the sensor's SI type.

Currently, the key is plumbed E2E from an `Add` (via `EnableSensorReads()`) to an event (via `GetSensorEvent`). However, dispatching via `GetSensorEvent` is by type.

If a sensor contains 3 light sensor components, the `GetSensorEvent` will return the same `getEventLight()` handler function.

To fix this - we want to pass the full `...TypesEntry` into `GetSensorEvent()` to allow a driver to optionally switch, based on the index and optional key, to select the correct `getEventLight()`. The base driver header will also need to be modified to optionally select based on the key

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing ws_i2c_Add through EnableSensorReads() and GetSensorEvent(), then inspect the base driver header and the getEventLight() handlers. Done means GetSensorEvent() and the base driver can receive the full TypesEntry and optionally select a handler using its index or key, while preserving existing type-based behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
arduino, cpp
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.