ardupilot
ardupilot copied to clipboard
AP_TempSensor:: Add MCP9600 and other upgrades
This PR does a few things:
- This branch is on top of the frontend/backend split PR https://github.com/ArduPilot/ardupilot/pull/20060
- Refactors the new AP_TemperatureSensor a bit
- Add support for MCP9600 temperature sensor
- Adds ability for AP_TemperatureSensor to override other library's temperature value: Battery, ESC, ESC_Motor (example, if your ESC doesn't have a temperate sensor, the value will always be zero but with an external sensor touching that ESC we can now override the ESC's temp property).
- Added AP_Periph support
- Adds a new AP_Periph hwdef build target: f303-TempSensor
This replaces https://github.com/ArduPilot/ardupilot/pull/17627 and https://github.com/ArduPilot/ardupilot/pull/18841
I always thought scripting would be a good fit for temperature sensing. However I can see why it would be useful on Periph where scripting won't fit, so I guess if we need it in c++
for that we might as well allow it on the vehicle code too.
Devcall outcome:
- battery has_temperature() needs a semaphore (the millis() could cause issues)
- default shall be: enabled by default for Sub, else disabled
I need a little help on the "default enabled for Sub, else disabled" because I can set
#define AP_TEMPERATURE_SENSOR_ENABLED APM_BUILD_TYPE(APM_BUILD_ArduSub)
in the header. I'll leave this at
#define AP_TEMPERATURE_SENSOR_ENABLED (!HAL_MINIMIZE_FEATURES && BOARD_FLASH_SIZE > 1024)
for now
@IamPete1 I've added dummy methods per your request.
Flagging for dev call, this is ready to merge.. just need someone to approve
definitely needs to be included in SITL
with use of _config.h and some ifdefs we should be able to greatly reduce impact on low flash boards
In this case, it had no impact.. but I've added the _config.h file anyway for the new scheme.
tagged for dev call, round 3
thanks for all your work on this!