mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 00:35:34 +03:00
fixes and telemetry conversion
This commit is contained in:
parent
f40b209feb
commit
f33c2566c1
3 changed files with 6 additions and 4 deletions
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "sensors/battery.h"
|
||||
#include "sensors/sensors.h"
|
||||
#include "sensors/barometer.h"
|
||||
#include "sensors/temperature.h"
|
||||
#include "scheduler/scheduler.h"
|
||||
|
||||
#ifdef USE_RX_ELERES
|
||||
|
@ -272,7 +272,7 @@ static void telemetryRX(void)
|
|||
presfil -= presfil/4;
|
||||
presfil += baro.baroPressure;
|
||||
thempfil -= thempfil/8;
|
||||
thempfil += baro.baroTemperature/10;
|
||||
thempfil += getCurrentTemperature();
|
||||
|
||||
switch (telem_state++) {
|
||||
case 0:
|
||||
|
|
|
@ -27,4 +27,5 @@ typedef enum {
|
|||
|
||||
// Temperature is returned in degC*10
|
||||
int16_t getTemperature(tempSensor_e sensor);
|
||||
int16_t getCurrentTemperature(void);
|
||||
void temperatureUpdate(void);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "io/serial.h"
|
||||
|
||||
#include "sensors/barometer.h"
|
||||
#include "sensors/temperature.h"
|
||||
#include "sensors/acceleration.h"
|
||||
#include "sensors/battery.h"
|
||||
#include "sensors/sensors.h"
|
||||
|
@ -140,11 +141,11 @@ static uint8_t dispatchMeasurementRequest(ibusAddress_t address) {
|
|||
}
|
||||
#endif
|
||||
if (SENSOR_ADDRESS_TYPE_LOOKUP[address].value == IBUS_MEAS_VALUE_TEMPERATURE) { //BARO_TEMP\GYRO_TEMP
|
||||
if (sensors(SENSOR_BARO)) return sendIbusMeasurement2(address, (uint16_t) ((baro.baroTemperature + 50) / 10 + IBUS_TEMPERATURE_OFFSET)); //int32_t
|
||||
if (sensors(SENSOR_BARO)) return sendIbusMeasurement2(address, (uint16_t) ((DECIDEGREES_TO_CENTIDEGREES(getCurrentTemperature()) + 50) / 10 + IBUS_TEMPERATURE_OFFSET)); //int32_t
|
||||
else {
|
||||
/*
|
||||
* There is no temperature data
|
||||
* assuming (baro.baroTemperature + 50) / 10
|
||||
* assuming ((DECIDEGREES_TO_CENTIDEGREES(getCurrentTemperature()) + 50) / 10
|
||||
* 0 degrees (no sensor) equals 50 / 10 = 5
|
||||
*/
|
||||
return sendIbusMeasurement2(address, (uint16_t) (5 + IBUS_TEMPERATURE_OFFSET)); //int16_t
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue