diff --git a/flight/Modules/Airspeed/revolution/airspeed.c b/flight/Modules/Airspeed/revolution/airspeed.c index eb6fe093a..eec3f015b 100644 --- a/flight/Modules/Airspeed/revolution/airspeed.c +++ b/flight/Modules/Airspeed/revolution/airspeed.c @@ -47,7 +47,7 @@ // Private constants #define STACK_SIZE_BYTES 500 #define TASK_PRIORITY (tskIDLE_PRIORITY+1) -#define SENSITIVE_DELAY_MS 500 +#define SAMPLING_DELAY_MS 50 // Private types @@ -113,17 +113,16 @@ static void airspeedTask(void *parameters) // TODO: Check the pressure sensor and set a warning if it fails test - float test=0; // Main task loop while (1) { float airspeed; // Update the airspeed - vTaskDelay(SENSITIVE_DELAY_MS); + vTaskDelay(SAMPLING_DELAY_MS); airspeed = PIOS_ETASV3_ReadAirspeed(); - data.Airspeed = (test++)*1000.0f + airspeed; + data.Airspeed = airspeed; // Update the AirspeedActual UAVObject BaroAirspeedSet(&data); diff --git a/flight/PiOS/Common/pios_etasv3.c b/flight/PiOS/Common/pios_etasv3.c index 6c7cac483..87e400c81 100644 --- a/flight/PiOS/Common/pios_etasv3.c +++ b/flight/PiOS/Common/pios_etasv3.c @@ -42,14 +42,14 @@ static bool PIOS_ETASV3_Read(uint8_t command, uint8_t * buffer, uint8_t len) }; const struct pios_i2c_txn txn_list[] = { - { + /*{ .info = __func__, .addr = ETASV3_I2C_ADDR, .rw = PIOS_I2C_TXN_WRITE, .len = sizeof(cmd_buffer), .buf = cmd_buffer, } - , + ,*/ { .info = __func__, .addr = ETASV3_I2C_ADDR, @@ -66,12 +66,12 @@ int16_t PIOS_ETASV3_ReadAirspeed (void) { uint8_t airspeed_raw[2]; - if (!PIOS_ETASV3_Read(ETASV3_I2C_READ_CMD, airspeed_raw, sizeof(airspeed_raw))) { + if (PIOS_ETASV3_Read(ETASV3_I2C_READ_CMD, airspeed_raw, sizeof(airspeed_raw)) != 0) { /* Failed to read airspeed */ return -1; } - return (airspeed_raw[0] << 8 || airspeed_raw[1]); + return (airspeed_raw[0] | (airspeed_raw[1]<<8)); } #endif /* PIOS_INCLUDE_ETASV3 */