diff --git a/src/modules/uavcan/sensors/baro.cpp b/src/modules/uavcan/sensors/baro.cpp index 1986de4247..694a3988a1 100644 --- a/src/modules/uavcan/sensors/baro.cpp +++ b/src/modules/uavcan/sensors/baro.cpp @@ -159,7 +159,14 @@ void UavcanBarometerBridge::air_pressure_sub_cb(const { baro_report report; - report.timestamp = msg.getMonotonicTimestamp().toUSec(); + /* + * FIXME HACK + * This code used to rely on msg.getMonotonicTimestamp().toUSec() instead of HRT. + * It stopped working when the time sync feature has been introduced, because it caused libuavcan + * to use an independent time source (based on hardware TIM5) instead of HRT. + * The proper solution is to be developed. + */ + report.timestamp = hrt_absolute_time(); report.temperature = last_temperature_kelvin - 273.15F; report.pressure = msg.static_pressure / 100.0F; // Convert to millibar report.error_count = 0; diff --git a/src/modules/uavcan/sensors/gnss.cpp b/src/modules/uavcan/sensors/gnss.cpp index 0830aba4ee..d80b4b425d 100644 --- a/src/modules/uavcan/sensors/gnss.cpp +++ b/src/modules/uavcan/sensors/gnss.cpp @@ -96,7 +96,15 @@ void UavcanGnssBridge::gnss_fix_sub_cb(const uavcan::ReceivedDataStructure 0) { - read(0, &c, 1); + if (read(0, &c, 1) <= 0) { + printf("ESC calibration read error\n"); + return 0; + } if (c == 'y' || c == 'Y') { break; @@ -315,7 +318,10 @@ esc_calib_main(int argc, char *argv[]) ret = poll(&fds, 1, 0); if (ret > 0) { - read(0, &c, 1); + if (read(0, &c, 1) <= 0) { + printf("ESC calibration read error\n"); + goto done; + } if (c == 13) { break; @@ -352,7 +358,10 @@ esc_calib_main(int argc, char *argv[]) ret = poll(&fds, 1, 0); if (ret > 0) { - read(0, &c, 1); + if (read(0, &c, 1) <= 0) { + printf("ESC calibration read error\n"); + goto done; + } if (c == 13) { break;