Skip to content

Commit

Permalink
sdlog2: Complete conversion to on-demand subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzMeier committed Apr 25, 2015
1 parent 1585ede commit 742434d
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/modules/sdlog2/sdlog2.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ static const int LOG_BUFFER_SIZE_DEFAULT = 8192;
static const int MAX_WRITE_CHUNK = 512;
static const int MIN_BYTES_TO_WRITE = 512;

static const unsigned TELEMETRY_STATUS_MAX_LOG = 2;// TELEMETRY_STATUS_ORB_ID_NUM

static bool _extended_logging = false;

#define MOUNTPOINT "/fs/microsd"
Expand Down Expand Up @@ -1164,15 +1162,11 @@ int sdlog2_thread_main(int argc, char *argv[])
/* add new topics HERE */


for (unsigned i = 0; i < TELEMETRY_STATUS_MAX_LOG; i++) {
subs.telemetry_subs[i] = orb_subscribe(telemetry_status_orb_id[i]);
}

if (_extended_logging) {
subs.sat_info_sub = orb_subscribe(ORB_ID(satellite_info));
} else {
subs.sat_info_sub = 0;
for (unsigned i = 0; i < TELEMETRY_STATUS_ORB_ID_NUM; i++) {
subs.telemetry_subs[i] = -1;
}

subs.sat_info_sub = -1;

/* close non-needed fd's */

Expand Down Expand Up @@ -1752,7 +1746,7 @@ int sdlog2_thread_main(int argc, char *argv[])
}

/* --- TELEMETRY --- */
for (unsigned i = 0; i < TELEMETRY_STATUS_MAX_LOG; i++) {
for (unsigned i = 0; i < TELEMETRY_STATUS_ORB_ID_NUM; i++) {
if (copy_if_updated(telemetry_status_orb_id[i], subs.telemetry_subs[i], &buf.telemetry)) {
log_msg.msg_type = LOG_TEL0_MSG + i;
log_msg.body.log_TEL.rssi = buf.telemetry.rssi;
Expand Down

0 comments on commit 742434d

Please sign in to comment.