diff --git a/flight/pios/common/pios_board_io.c b/flight/pios/common/pios_board_io.c index 441bad18f..9a0d453c8 100644 --- a/flight/pios/common/pios_board_io.c +++ b/flight/pios/common/pios_board_io.c @@ -545,6 +545,7 @@ void PIOS_BOARD_IO_Configure_GCS_RCVR() void PIOS_BOARD_IO_Configure_OPLink_RCVR() { uint32_t pios_oplinkrcvr_id; + OPLinkReceiverInitialize(); #if defined(PIOS_INCLUDE_RFM22B) PIOS_OPLinkRCVR_Init(&pios_oplinkrcvr_id, pios_rfm22b_id); diff --git a/flight/pios/common/pios_ms56xx.c b/flight/pios/common/pios_ms56xx.c index 904481843..bf0237b12 100644 --- a/flight/pios/common/pios_ms56xx.c +++ b/flight/pios/common/pios_ms56xx.c @@ -34,12 +34,12 @@ #define POW2(x) (1 << x) // Command addresses -#define MS56XX_RESET 0x1E -#define MS56XX_CALIB_ADDR 0xA2 /* First sample is factory stuff */ -#define MS56XX_CALIB_LEN 16 -#define MS56XX_ADC_READ 0x00 -#define MS56XX_PRES_ADDR 0x40 -#define MS56XX_TEMP_ADDR 0x50 +#define MS56XX_RESET 0x1E +#define MS56XX_CALIB_ADDR 0xA2 /* First sample is factory stuff */ +#define MS56XX_CALIB_LEN 16 +#define MS56XX_ADC_READ 0x00 +#define MS56XX_PRES_ADDR 0x40 +#define MS56XX_TEMP_ADDR 0x50 // Option to change the interleave between Temp and Pressure conversions // Undef for normal operation @@ -128,7 +128,7 @@ const PIOS_SENSORS_Driver PIOS_MS56xx_Driver = { */ void PIOS_MS56xx_Init(const struct pios_ms56xx_cfg *cfg, int32_t i2c_device) { - i2c_id = i2c_device; + i2c_id = i2c_device; ms56xx_address = cfg->address; version = cfg->version; @@ -262,14 +262,14 @@ int32_t PIOS_MS56xx_ReadADC(void) // Offset and sensitivity at actual temperature if (version == MS56XX_VERSION_5611) { // OFF = OFFT1 + TCO * dT = C2 * 2^16 + (C4 * dT) / 2^7 - Offset = ((int64_t)CalibData.C[1]) * POW2(16) + (((int64_t)CalibData.C[3]) * deltaTemp) / POW2(7) - Offset2; + Offset = ((int64_t)CalibData.C[1]) * POW2(16) + (((int64_t)CalibData.C[3]) * deltaTemp) / POW2(7) - Offset2; // SENS = SENST1 + TCS * dT = C1 * 2^15 + (C3 * dT) / 2^8 - Sens = ((int64_t)CalibData.C[0]) * POW2(15) + (((int64_t)CalibData.C[2]) * deltaTemp) / POW2(8) - Sens2; + Sens = ((int64_t)CalibData.C[0]) * POW2(15) + (((int64_t)CalibData.C[2]) * deltaTemp) / POW2(8) - Sens2; } else { // OFF = OFFT1 + TCO * dT = C2 * 2^17 + (C4 * dT) / 2^6 - Offset = ((int64_t)CalibData.C[1]) * POW2(17) + (((int64_t)CalibData.C[3]) * deltaTemp) / POW2(6) - Offset2; + Offset = ((int64_t)CalibData.C[1]) * POW2(17) + (((int64_t)CalibData.C[3]) * deltaTemp) / POW2(6) - Offset2; // SENS = SENST1 + TCS * dT = C1 * 2^16 + (C3 * dT) / 2^7 - Sens = ((int64_t)CalibData.C[0]) * POW2(16) + (((int64_t)CalibData.C[2]) * deltaTemp) / POW2(7) - Sens2; + Sens = ((int64_t)CalibData.C[0]) * POW2(16) + (((int64_t)CalibData.C[2]) * deltaTemp) / POW2(7) - Sens2; } // Temperature compensated pressure (10…1200mbar with 0.01mbar resolution) @@ -516,10 +516,11 @@ bool PIOS_MS56xx_driver_poll(__attribute__((unused)) uintptr_t context) } /* Poll the pressure sensor and return the temperature and pressure. */ -bool PIOS_MS56xx_Read(float *temperature, float *pressure) { +bool PIOS_MS56xx_Read(float *temperature, float *pressure) +{ if (PIOS_MS56xx_driver_poll(0)) { *temperature = results.temperature; - *pressure = results.sample; + *pressure = results.sample; return true; } return false; diff --git a/flight/pios/common/pios_oplinkrcvr.c b/flight/pios/common/pios_oplinkrcvr.c index 427285561..9ca378906 100644 --- a/flight/pios/common/pios_oplinkrcvr.c +++ b/flight/pios/common/pios_oplinkrcvr.c @@ -38,7 +38,7 @@ #include // Put receiver in failsafe if not updated within timeout -#define PIOS_OPLINK_RCVR_TIMEOUT_MS 100 +#define PIOS_OPLINK_RCVR_TIMEOUT_MS 100 /* Provide a RCVR driver */ static int32_t PIOS_OPLinkRCVR_Get(uint32_t rcvr_id, uint8_t channel); diff --git a/flight/targets/boards/revolution/pios_board.h b/flight/targets/boards/revolution/pios_board.h index 0175fef67..aea74d9a8 100644 --- a/flight/targets/boards/revolution/pios_board.h +++ b/flight/targets/boards/revolution/pios_board.h @@ -1,4 +1,3 @@ - /** ****************************************************************************** * @addtogroup OpenPilotSystem OpenPilot System diff --git a/flight/targets/boards/sparky2/pios_board.h b/flight/targets/boards/sparky2/pios_board.h index 728a1367b..6470336ac 100644 --- a/flight/targets/boards/sparky2/pios_board.h +++ b/flight/targets/boards/sparky2/pios_board.h @@ -1,4 +1,3 @@ - /** ****************************************************************************** * @addtogroup OpenPilotSystem OpenPilot System