Open mitra42 opened 1 month ago
a: support multiple sensors - e.g. one at 0x45 and one at 0x44
How do we load the module twice, ideally without duplicating the code. I can see different ways to tackle this, but they might not work
a1: via define
s so the module is loaded more than once, but I don't think this will work well with the way the Arduino IDE compiles each cpp, the cpp file isnt "included" like the .h
is.
a2: splitting the sensor_SHT85 into something like a library that exists once and something trivial that can be loaded multiple times that calls it (like sensor_SHT85 itself calls the SHT library). But we still have the challenge of how to do this structurally.
UPDATE: Solved by a different method - passing an _ARRAY version of the addresses to sensor_SHT85.cpp this should be extendable to other sensors
c: was able to work with other sensors on the same I2C - i.e. not restarting the Wire.
I think the wires can be supported by splitting the Wire setup into a separate module (system_wire) and only including its header and setup() if any module that needs it is used. (this would happen in _settings.h)
b: support multiple wires - e.g. a sensor at 0x45 on one set of pins, and another on a different set of pins
This is a similar problem to "a1" we need to include multiple instances of the Wire and setup()
them all.
This module has been reorganized to make it easier to do things like above. Now defines a wrapper class for the SHT85 library
Sensor_SHT85 is tested for a single sensor - my test hardware is a SHT30 shield plugged into an Lolin D1 mini, using its default address of 0x45
It would be a more generically useful module if it could.
This will require some cleverness - some notes below.