Replies: 4 comments
-
|
While supporting I2C bridges like the DS2482 is a solid professional approach for multi-node buses, we shouldn't overlook the importance of native OneWire support directly via GPIO. |
Beta Was this translation helpful? Give feedback.
-
|
I agree with both approaches. Personally I'm inclined towards not having extra hardware needed for such a simple device. #9995 does that, though I wanted to be smart and imagined use cases with 100–200 sensors on the bus (I do actually have the use case for this). The C++ STL (std::vector, std::sort, ) is what caused the 12kB+ flash hit, the protocol logic itself is lean. The fix is a fixed array sized to the protobuf cap plus a simple insertion sort, which brings it back to near-zero overhead. On bridge IC selection: DS2484 and DS2482-100 share a compatible register set, they only diverge on the PCTLZ external MOSFET control bit. One driver with two macros covers both. DS2482-800 (8 channels) is a natural superset to add later. That answers the "why this one and not the other" question: you don't have to pick. @FFAMax, and not only that, with native GPIO you can run multiple independent 1-Wire buses on whichever GPIOs you like, which is more flexible than any bridge IC. That said, the bridge does handle one thing better: the PCTLZ active pull-up control manages parasite power timing in hardware, which is genuinely cleaner than doing it in software. My suggestion: keep native 1-Wire as a |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As discussed in #9995, one-wire sensors such as DS18B20 family will be done via I2C bridges (DS2482 series)
Support for the driver in question is available for two versions, and can be easily added in the firmware.
There are some details to iron out however, considering how this opens the door to supporting several sensors on the same bus measuring the same metric (which is currently not supported in the current protobuf structure). I suggest we divide this in two stages.
Short-term
Provide access to the driver for a single one-wire sensor, using the library above. This would solve the need for many users already, and we can start testing. This would require simply adding the DS18B20 series to the supported telemetry protos and add support for at least the 1-channel version.
Long-term (3.0)
On a separate PR, to avoid lagging the first implementation, I'd suggest we consider how this can be considered as part of other more bigger changes on the telemetry.proto. In particular, a nested approach for the protos could be considered for these sensors like the one in meshtastic/protobufs#852.
We need to be particularly careful to always report the readings on the same location. For instance, if we have 8-channels for temperature, on every device reset, we need to make sure that ch1 makes it to ch1 and not to another channel. For this, we could envision a
repeatedreading including the address in the payload:Then in the DS24800 class we can add ways to handle this.
@Elwimen and others, feel free to contribute.
Beta Was this translation helpful? Give feedback.
All reactions