I’m working on a multi-hole probe, so I’d like to log 3 additional pressure sensors via I2C. So far, I have some success and some failure… could someone help me understand what I’m doing wrong?
Issue 1: Do I need a separate HAL i2c_device for each sensor? Or can a single HAL device talk to all 3 separate I2C addresses? Right now I’m using separate HAL devices, despite “the sensor” being a single “device” physically.
Issue 2: I don’t understand semaphores yet. (Feel free to chuckle if I say something silly…) Can a single semaphore cover all 3 I2C sensors? Or should I be getting a “separate semaphore” for each individual measure()/collect() call from timer()?
Issue 3: How important are determining “accurate” scheduler values for the rate and maximum-time of the sensor-reading-and-logging task? In other words, could my random-guesses (10Hz rate and 200us maximum) actually be my problem? How would I determine that from logs?
Some background, in case that helps to find the underlying problem(s):
In my mind, the 3 pressure sensors are part of a single “unit” so I originally had my sensor’s driver (copied-and-modified from AP_Airspeed) read() and collect() from all 3 sensors with a single function call (from the timer() functionality.) This worked in bench-testing, when I would disable arming checks, arm the pixhawk, and log the sensors. However, when I flew the firmware, only 1 sensor logged correctly, while the other 2 logged always-zero values. I’m confused by this behavior, and don’t know how to diagnose my problem.