Merge branch 'master' into cmake-2

This commit is contained in:
Lorenz Meier 2015-09-27 14:23:00 +02:00
commit a4e56abd71
5 changed files with 63 additions and 32 deletions

View File

@ -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;

View File

@ -96,7 +96,15 @@ void UavcanGnssBridge::gnss_fix_sub_cb(const uavcan::ReceivedDataStructure<uavca
auto report = ::vehicle_gps_position_s();
report.timestamp_position = msg.getMonotonicTimestamp().toUSec();
/*
* FIXME HACK
* There used to be the following line of code:
* report.timestamp_position = msg.getMonotonicTimestamp().toUSec();
* 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_position = hrt_absolute_time();
report.lat = msg.latitude_deg_1e8 / 10;
report.lon = msg.longitude_deg_1e8 / 10;
report.alt = msg.height_msl_mm;

View File

@ -146,7 +146,14 @@ void UavcanMagnetometerBridge::mag_sub_cb(const uavcan::ReceivedDataStructure<ua
{
lock();
_report.range_ga = 1.3F; // Arbitrary number, doesn't really mean anything
_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.x = (msg.magnetic_field_ga[0] - _scale.x_offset) * _scale.x_scale;
_report.y = (msg.magnetic_field_ga[1] - _scale.y_offset) * _scale.y_scale;

View File

@ -142,8 +142,8 @@ __END_DECLS
* Additional behavior can be added using "{\" for __px4__log_startline and
* "}" for __px4__log_endline and any other required setup or teardown steps
****************************************************************************/
#define __px4__log_startcond(cond) if (cond) printf(
#define __px4__log_startline(level) if (level <= __px4_log_level_current) printf(
#define __px4__log_printcond(cond, ...) if (cond) printf(__VA_ARGS__)
#define __px4__log_printline(level, ...) if (level <= __px4_log_level_current) printf(__VA_ARGS__)
#define __px4__log_timestamp_fmt "%-10" PRIu64 " "
#define __px4__log_timestamp_arg ,hrt_absolute_time()
@ -172,12 +172,12 @@ __END_DECLS
* if the first arg/condition is true.
****************************************************************************/
#define __px4_log_named_cond(name, cond, FMT, ...) \
__px4__log_startcond(cond)\
__px4__log_printcond(cond,\
"%s " \
FMT\
__px4__log_end_fmt \
,name, ##__VA_ARGS__\
__px4__log_endline
)
/****************************************************************************
* __px4_log:
@ -187,12 +187,12 @@ __END_DECLS
* printf("%-5s val is %d\n", __px4_log_level_str[3], val);
****************************************************************************/
#define __px4_log(level, FMT, ...) \
__px4__log_startline(level)\
__px4__log_printline(level,\
__px4__log_level_fmt \
FMT\
__px4__log_end_fmt \
__px4__log_level_arg(level), ##__VA_ARGS__\
__px4__log_endline
)
/****************************************************************************
* __px4_log_timestamp:
@ -203,7 +203,7 @@ __END_DECLS
* hrt_absolute_time(), val);
****************************************************************************/
#define __px4_log_timestamp(level, FMT, ...) \
__px4__log_startline(level)\
__px4__log_printline(level,\
__px4__log_level_fmt\
__px4__log_timestamp_fmt\
FMT\
@ -211,7 +211,7 @@ __END_DECLS
__px4__log_level_arg(level)\
__px4__log_timestamp_arg\
, ##__VA_ARGS__\
__px4__log_endline
)
/****************************************************************************
* __px4_log_timestamp_thread:
@ -222,7 +222,7 @@ __END_DECLS
* hrt_absolute_time(), pthread_self(), val);
****************************************************************************/
#define __px4_log_timestamp_thread(level, FMT, ...) \
__px4__log_startline(level)\
__px4__log_printline(level,\
__px4__log_level_fmt\
__px4__log_timestamp_fmt\
__px4__log_thread_fmt\
@ -232,7 +232,7 @@ __END_DECLS
__px4__log_timestamp_arg\
__px4__log_thread_arg\
, ##__VA_ARGS__\
__px4__log_endline
)
/****************************************************************************
* __px4_log_file_and_line:
@ -243,7 +243,7 @@ __END_DECLS
* __px4_log_level_str[3], val, __FILE__, __LINE__);
****************************************************************************/
#define __px4_log_file_and_line(level, FMT, ...) \
__px4__log_startline(level)\
__px4__log_printline(level,\
__px4__log_level_fmt\
__px4__log_timestamp_fmt\
FMT\
@ -253,7 +253,7 @@ __END_DECLS
__px4__log_timestamp_arg\
, ##__VA_ARGS__\
__px4__log_file_and_line_arg\
__px4__log_endline
)
/****************************************************************************
* __px4_log_timestamp_file_and_line:
@ -265,7 +265,7 @@ __END_DECLS
* val, __FILE__, __LINE__);
****************************************************************************/
#define __px4_log_timestamp_file_and_line(level, FMT, ...) \
__px4__log_startline(level)\
__px4__log_printline(level,\
__px4__log_level_fmt\
__px4__log_timestamp_fmt\
FMT\
@ -275,7 +275,7 @@ __END_DECLS
__px4__log_timestamp_arg\
, ##__VA_ARGS__\
__px4__log_file_and_line_arg\
__px4__log_endline
)
/****************************************************************************
* __px4_log_thread_file_and_line:
@ -287,7 +287,7 @@ __END_DECLS
* val, __FILE__, __LINE__);
****************************************************************************/
#define __px4_log_thread_file_and_line(level, FMT, ...) \
__px4__log_startline(level)\
__px4__log_printline(level,\
__px4__log_level_fmt\
__px4__log_thread_fmt\
FMT\
@ -297,7 +297,7 @@ __END_DECLS
__px4__log_thread_arg\
, ##__VA_ARGS__\
__px4__log_file_and_line_arg\
__px4__log_endline
)
/****************************************************************************
* __px4_log_timestamp_thread_file_and_line:
@ -309,7 +309,7 @@ __END_DECLS
* pthread_self(), val, __FILE__, __LINE__);
****************************************************************************/
#define __px4_log_timestamp_thread_file_and_line(level, FMT, ...) \
__px4__log_startline(level)\
__px4__log_printline(level,\
__px4__log_level_fmt\
__px4__log_timestamp_fmt\
__px4__log_thread_fmt\
@ -321,7 +321,7 @@ __END_DECLS
__px4__log_thread_arg\
, ##__VA_ARGS__\
__px4__log_file_and_line_arg\
__px4__log_endline
)
/****************************************************************************

View File

@ -233,7 +233,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");
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;