mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-28 18:53:57 -04:00
AP_TemperatureSensor: Update TSYS01 for Pixhawk2
This commit is contained in:
parent
c863959296
commit
8752a10e3f
@ -40,13 +40,16 @@ void Sub::init_ardupilot()
|
|||||||
switch (AP_BoardConfig::get_board_type()) {
|
switch (AP_BoardConfig::get_board_type()) {
|
||||||
case AP_BoardConfig::PX4_BOARD_PIXHAWK2:
|
case AP_BoardConfig::PX4_BOARD_PIXHAWK2:
|
||||||
AP_Param::set_by_name("GND_EXT_BUS", 0);
|
AP_Param::set_by_name("GND_EXT_BUS", 0);
|
||||||
|
celsius.init(0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
AP_Param::set_by_name("GND_EXT_BUS", 1);
|
AP_Param::set_by_name("GND_EXT_BUS", 1);
|
||||||
|
celsius.init(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
AP_Param::set_default_by_name("GND_EXT_BUS", 1);
|
AP_Param::set_default_by_name("GND_EXT_BUS", 1);
|
||||||
|
celsius.init(1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// identify ourselves correctly with the ground station
|
// identify ourselves correctly with the ground station
|
||||||
@ -71,8 +74,6 @@ void Sub::init_ardupilot()
|
|||||||
|
|
||||||
barometer.init();
|
barometer.init();
|
||||||
|
|
||||||
celsius.init();
|
|
||||||
|
|
||||||
// Register the mavlink service callback. This will run
|
// Register the mavlink service callback. This will run
|
||||||
// anytime there are more than 5ms remaining in a call to
|
// anytime there are more than 5ms remaining in a call to
|
||||||
// hal.scheduler->delay.
|
// hal.scheduler->delay.
|
||||||
|
@ -13,9 +13,9 @@ static const uint8_t TSYS01_CMD_READ_PROM = 0xA0;
|
|||||||
static const uint8_t TSYS01_CMD_CONVERT = 0x40;
|
static const uint8_t TSYS01_CMD_CONVERT = 0x40;
|
||||||
static const uint8_t TSYS01_CMD_READ_ADC = 0x00;
|
static const uint8_t TSYS01_CMD_READ_ADC = 0x00;
|
||||||
|
|
||||||
bool TSYS01::init()
|
bool TSYS01::init(uint8_t bus)
|
||||||
{
|
{
|
||||||
_dev = std::move(hal.i2c_mgr->get_device(1, TSYS01_ADDR));
|
_dev = std::move(hal.i2c_mgr->get_device(bus, TSYS01_ADDR));
|
||||||
if (!_dev) {
|
if (!_dev) {
|
||||||
printf("TSYS01 device is null!");
|
printf("TSYS01 device is null!");
|
||||||
return false;
|
return false;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
class TSYS01 {
|
class TSYS01 {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
bool init(void);
|
bool init(uint8_t bus);
|
||||||
float temperature(void) { return _temperature; } // temperature in degrees C
|
float temperature(void) { return _temperature; } // temperature in degrees C
|
||||||
bool healthy(void) { // do we have a valid temperature reading?
|
bool healthy(void) { // do we have a valid temperature reading?
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
||||||
|
Loading…
Reference in New Issue
Block a user