Merge branch 'sdlog2_timestamp' into beta

This commit is contained in:
Anton Babushkin
2014-01-19 23:25:48 +01:00
4 changed files with 204 additions and 124 deletions
+2 -2
View File
@@ -8,9 +8,9 @@ then
if hw_ver compare PX4FMU_V1 if hw_ver compare PX4FMU_V1
then then
echo "Start sdlog2 at 50Hz" echo "Start sdlog2 at 50Hz"
sdlog2 start -r 50 -a -b 16 sdlog2 start -r 50 -a -b 16 -t
else else
echo "Start sdlog2 at 200Hz" echo "Start sdlog2 at 200Hz"
sdlog2 start -r 200 -a -b 16 sdlog2 start -r 200 -a -b 16 -t
fi fi
fi fi
+13 -7
View File
@@ -270,7 +270,8 @@ private:
orb_advert_t _to_servorail; ///< servorail status orb_advert_t _to_servorail; ///< servorail status
orb_advert_t _to_safety; ///< status of safety orb_advert_t _to_safety; ///< status of safety
actuator_outputs_s _outputs; ///<mixed outputs actuator_outputs_s _outputs; ///< mixed outputs
servorail_status_s _servorail_status; ///< servorail status
bool _primary_pwm_device; ///< true if we are the default PWM output bool _primary_pwm_device; ///< true if we are the default PWM output
@@ -505,6 +506,7 @@ PX4IO::PX4IO(device::Device *interface) :
_mavlink_fd = ::open(MAVLINK_LOG_DEVICE, 0); _mavlink_fd = ::open(MAVLINK_LOG_DEVICE, 0);
_debug_enabled = true; _debug_enabled = true;
_servorail_status.rssi_v = 0;
} }
PX4IO::~PX4IO() PX4IO::~PX4IO()
@@ -1331,19 +1333,18 @@ PX4IO::io_handle_battery(uint16_t vbatt, uint16_t ibatt)
void void
PX4IO::io_handle_vservo(uint16_t vservo, uint16_t vrssi) PX4IO::io_handle_vservo(uint16_t vservo, uint16_t vrssi)
{ {
servorail_status_s servorail_status; _servorail_status.timestamp = hrt_absolute_time();
servorail_status.timestamp = hrt_absolute_time();
/* voltage is scaled to mV */ /* voltage is scaled to mV */
servorail_status.voltage_v = vservo * 0.001f; _servorail_status.voltage_v = vservo * 0.001f;
servorail_status.rssi_v = vrssi * 0.001f; _servorail_status.rssi_v = vrssi * 0.001f;
/* lazily publish the servorail voltages */ /* lazily publish the servorail voltages */
if (_to_servorail > 0) { if (_to_servorail > 0) {
orb_publish(ORB_ID(servorail_status), _to_servorail, &servorail_status); orb_publish(ORB_ID(servorail_status), _to_servorail, &_servorail_status);
} else { } else {
_to_servorail = orb_advertise(ORB_ID(servorail_status), &servorail_status); _to_servorail = orb_advertise(ORB_ID(servorail_status), &_servorail_status);
} }
} }
@@ -1450,6 +1451,11 @@ PX4IO::io_publish_raw_rc()
rc_val.input_source = RC_INPUT_SOURCE_UNKNOWN; rc_val.input_source = RC_INPUT_SOURCE_UNKNOWN;
} }
/* set RSSI */
// XXX the correct scaling needs to be validated here
rc_val.rssi = (_servorail_status.rssi_v / 3.3f) * UINT8_MAX;
/* lazily advertise on first publication */ /* lazily advertise on first publication */
if (_to_input_rc == 0) { if (_to_input_rc == 0) {
_to_input_rc = orb_advertise(ORB_ID(input_rc), &rc_val); _to_input_rc = orb_advertise(ORB_ID(input_rc), &rc_val);
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
* *
* Copyright (c) 2012, 2013 PX4 Development Team. All rights reserved. * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions