ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_TempSensor:: Add MCP9600 and other upgrades

Open magicrub opened this issue 2 years ago • 2 comments

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

magicrub avatar Sep 07 '22 17:09 magicrub

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.

IamPete1 avatar Sep 07 '22 19:09 IamPete1

Devcall outcome:

  • battery has_temperature() needs a semaphore (the millis() could cause issues)
  • default shall be: enabled by default for Sub, else disabled

magicrub avatar Sep 13 '22 00:09 magicrub

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

magicrub avatar Sep 26 '22 16:09 magicrub

@IamPete1 I've added dummy methods per your request.

magicrub avatar Sep 29 '22 21:09 magicrub

Flagging for dev call, this is ready to merge.. just need someone to approve

magicrub avatar Oct 07 '22 16:10 magicrub

definitely needs to be included in SITL

tridge avatar Oct 10 '22 23:10 tridge

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.

magicrub avatar Oct 12 '22 18:10 magicrub

tagged for dev call, round 3

magicrub avatar Oct 17 '22 18:10 magicrub

thanks for all your work on this!

tridge avatar Oct 17 '22 23:10 tridge