Skip to content

Commit

Permalink
[modules] ms45xx publishes BARO_DIFF and TEMPERATURE via ABI
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Oct 21, 2014
1 parent 2d26cdb commit 4516a11
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sw/airborne/modules/sensors/airspeed_ms45xx_i2c.c
Expand Up @@ -29,6 +29,7 @@
#include "mcu_periph/i2c.h"
#include "modules/sensors/airspeed_ms45xx_i2c.h"
#include "filters/low_pass_filter.h"
#include "subsystems/abi.h"

#include "mcu_periph/uart.h"
#include "messages.h"
Expand Down Expand Up @@ -200,6 +201,12 @@ void ms45xx_i2c_event(void)
*/
ms45xx.temperature = ((uint32_t)temp_raw * 2000) / 2047 - 500;

// Send differential pressure via ABI
AbiSendMsgBARO_DIFF(MS45XX_SENDER_ID, &ms45xx.diff_pressure);
// Send temperature as float in deg Celcius via ABI
float temp = ms45xx.temperature / 10.0f;
AbiSendMsgTEMPERATURE(MS45XX_SENDER_ID, &temp);

// Compute airspeed
ms45xx.airspeed = sqrtf(Max(ms45xx.diff_pressure * ms45xx.airspeed_scale, 0));
#if USE_AIRSPEED_MS45XX
Expand Down
8 changes: 8 additions & 0 deletions sw/airborne/subsystems/abi_sender_ids.h
Expand Up @@ -80,6 +80,14 @@
#define METEO_STICK_SENDER_ID 30
#endif

/*
* IDs of differential pressure sensors
* can usually also publish temperature like baro sensors
*/
#ifndef MS45XX_SENDER_ID
#define MS45XX_SENDER_ID 40
#endif

/*
* IDs of AGL measurment modules that can be loaded (sonars,...)
*/
Expand Down

0 comments on commit 4516a11

Please sign in to comment.