You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
737 B

#include "AP_BattMonitor_SMBus_Rotoye.h"
#include <AP_HAL/AP_HAL.h>
// Specific to Rotoye Batmon
#define BATTMONITOR_SMBUS_TEMP_EXT 0x07
// return the maximum of the internal and external temperature sensors
void AP_BattMonitor_SMBus_Rotoye::read_temp(void) {
uint16_t t_int, t_ext;
/* Both internal and external values will always be sent by Batmon.
If no external thermistor is used, a zero-value is sent. */
if (read_word(BATTMONITOR_SMBUS_TEMP, t_int) &&
read_word(BATTMONITOR_SMBUS_TEMP_EXT, t_ext)) {
uint16_t t;
_state.temperature_time = AP_HAL::millis();
t = ((t_ext > t_int) ? t_ext : t_int);
_state.temperature = KELVIN_TO_C(0.1f * (float)t);
}
}