AP_TemperatureSensor driver

Hi,
following issue n.#9567 and the fuel gauge discussion, I have extended the AP_TemperatureSensor library into a completely functional driver, including support for the already present TSYS01 and NTC9350 sensors (the latter taken from my PR). The AP_TemperatureSensor driver is mainly based on the AP_RangeFinder, I tried to keep a suitable parametrisation in order to allow some flexibility over sensor choice.
Now, before sending a PR, I’d like to get some feedback as it’s my first time really diving into the AP codebase. There are no compilation warnings but HITL/SITL is still not fully implemented so I can’t test via a simulator.
How can I properly debug this new sensor driver?

the easy’s way is to flash it on a board and see if it works. Then you can debug printing messages over mavlink, a dedicated mavlink message (not sure if there is one for temps or not) or by logging to the SD card.

You can always open a work in progress PR, just prefix it with WIP:

unfortunately the driver doesn’t use any MAVlink message at the moment, is there a way to print debug messages via serial?

gcs().send_text(MAV_SEVERITY_INFO, “your text here”);

will send a message over mavlink to the ground station, it will appear in the messages tab in mission planner.

I used the RangeFinder as a template but noticed the SerialManager dependance is lacking in all other types of sensor drivers (AP_Baro or AP_Compass, for instance). However, both baro and compass just rely on I2C probing to detect sensors whereas temperature sensors can be both analog or digital; that’s why the driver should support thermistors, I2C and one wire DS18B20 sensors.