aboutsummaryrefslogtreecommitdiff
path: root/src/modules/sdlog2/sdlog2.c
diff options
context:
space:
mode:
authorSimon Wilks <sjwilks@gmail.com>2013-06-15 22:58:14 +0200
committerSimon Wilks <sjwilks@gmail.com>2013-06-15 22:58:14 +0200
commit12ac41802e663e5d9328c294df4117269764ef2a (patch)
treedc774ca54e1edba5c7c5c058d540c2fce2022c9e /src/modules/sdlog2/sdlog2.c
parentb714c5c9d1d38132df5cf4bff9a1fd92163be550 (diff)
downloadpx4-firmware-12ac41802e663e5d9328c294df4117269764ef2a.tar.gz
px4-firmware-12ac41802e663e5d9328c294df4117269764ef2a.tar.bz2
px4-firmware-12ac41802e663e5d9328c294df4117269764ef2a.zip
Log airspeed.
Diffstat (limited to 'src/modules/sdlog2/sdlog2.c')
-rw-r--r--src/modules/sdlog2/sdlog2.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c
index a14bd6f80..b79a07b97 100644
--- a/src/modules/sdlog2/sdlog2.c
+++ b/src/modules/sdlog2/sdlog2.c
@@ -658,6 +658,7 @@ int sdlog2_thread_main(int argc, char *argv[])
int vicon_pos_sub;
int flow_sub;
int rc_sub;
+ int airspeed_sub;
} subs;
/* log message buffer: header + body */
@@ -677,6 +678,7 @@ int sdlog2_thread_main(int argc, char *argv[])
struct log_STAT_s log_STAT;
struct log_RC_s log_RC;
struct log_OUT0_s log_OUT0;
+ struct log_AIRS_s log_AIRS;
} body;
} log_msg = {
LOG_PACKET_HEADER_INIT(0)
@@ -774,6 +776,12 @@ int sdlog2_thread_main(int argc, char *argv[])
fds[fdsc_count].events = POLLIN;
fdsc_count++;
+ /* --- AIRSPEED --- */
+ subs.airspeed_sub = orb_subscribe(ORB_ID(airspeed));
+ fds[fdsc_count].fd = subs.airspeed_sub;
+ fds[fdsc_count].events = POLLIN;
+ fdsc_count++;
+
/* WARNING: If you get the error message below,
* then the number of registered messages (fdsc)
* differs from the number of messages in the above list.
@@ -1046,6 +1054,15 @@ int sdlog2_thread_main(int argc, char *argv[])
LOGBUFFER_WRITE_AND_COUNT(RC);
}
+ /* --- AIRSPEED --- */
+ if (fds[ifds++].revents & POLLIN) {
+ orb_copy(ORB_ID(airspeed), subs.airspeed_sub, &buf.airspeed);
+ log_msg.msg_type = LOG_AIRS_MSG;
+ log_msg.body.log_AIRS.indicated_airspeed = buf.airspeed.indicated_airspeed_m_s;
+ log_msg.body.log_AIRS.true_airspeed = buf.airspeed.true_airspeed_m_s;
+ LOGBUFFER_WRITE_AND_COUNT(AIRS);
+ }
+
/* signal the other thread new data, but not yet unlock */
if (logbuffer_count(&lb) > MIN_BYTES_TO_WRITE) {
#ifdef SDLOG2_DEBUG