diff options
-rw-r--r-- | libarmep/configuration.c | 1 | ||||
-rw-r--r-- | libarmep/libarmep.h | 1 | ||||
-rw-r--r-- | libarmep/sample.c | 12 | ||||
-rw-r--r-- | libarmep/service.c | 13 |
4 files changed, 22 insertions, 5 deletions
diff --git a/libarmep/configuration.c b/libarmep/configuration.c index 829ba09..3236483 100644 --- a/libarmep/configuration.c +++ b/libarmep/configuration.c @@ -246,6 +246,7 @@ int configure(struct aep_context *aep_context, struct aep *aep, const char *dev_ break; } actions = APCA_PULL_CHANNELS; + ch->flag_was_configured = 1; copy_pos = 0; no_copy = ch == wch; break; diff --git a/libarmep/libarmep.h b/libarmep/libarmep.h index 6e8f6fe..dafbe04 100644 --- a/libarmep/libarmep.h +++ b/libarmep/libarmep.h @@ -202,6 +202,7 @@ struct aep_channel { double avg_count; char summary[128]; + int flag_was_configured; }; struct aep { diff --git a/libarmep/sample.c b/libarmep/sample.c index 320bfd9..f44e61b 100644 --- a/libarmep/sample.c +++ b/libarmep/sample.c @@ -77,6 +77,9 @@ int process_sample(struct aep *aep, int ch_index) struct aepd_interface *aepd_interface; struct aepd_interface_result *aepd_interface_result; + if (!ch->flag_was_configured) + goto done; + if (!aep->aep_context->no_correction) { vo0 = ch->voffset[0]; vo1 = ch->voffset[1]; @@ -158,7 +161,7 @@ unripe: ch->trigger_slave = who_triggered; else { who_triggered = ch; - somebody_triggered = ch->samples_seen; + somebody_triggered = ch->samples_seen; } ch->triggered = 1; ch->simple_avg[0] = 0; @@ -278,7 +281,10 @@ unripe: if (!aep->aep_context->aeps[m].fd) continue; for (i = 0; i < CHANNELS_PER_PROBE; i++) { - if (aep->aep_context->aeps[m].ch[i].out_head == aep->aep_context->aeps[m].ch[i].out_tail) + if (!aep->aep_context->aeps[m].ch[i].flag_was_configured) + continue; + if (aep->aep_context->aeps[m].ch[i].out_head == + aep->aep_context->aeps[m].ch[i].out_tail) goto done; hit++; } @@ -301,6 +307,8 @@ unripe: for (i = 0; i < CHANNELS_PER_PROBE; i++) { ich = &aep->aep_context->aeps[m].ch[i]; + if (!ich->flag_was_configured) + continue; v1a = ich->out_ring[0][ich->out_tail]; v2a = ich->out_ring[1][ich->out_tail]; diff --git a/libarmep/service.c b/libarmep/service.c index b5b736b..798e256 100644 --- a/libarmep/service.c +++ b/libarmep/service.c @@ -78,6 +78,7 @@ static void init_aep(struct aep_context *aep_context, struct aep *aep, const cha ch->voffset[1] = 0; ch->vnoise[1] = 0; ch->rshunt = 0; + ch->flag_was_configured = 0; sprintf(ch->channel_name, "%s-%d", device_filepath, n); ch->pretrig_ring = NULL; ch->ring_samples = 0; @@ -277,6 +278,9 @@ int service_aeps(struct aep_context *aep_context, int fd_with_rx) for (n = 0; n < CHANNELS_PER_PROBE; n++) { struct aep_channel *ch = &aep_context->aeps[aep_context->scan].ch[n]; + if (!ch->flag_was_configured) + continue; + select_map(ch); if (aep_context->original_count_channel_names) { @@ -340,7 +344,8 @@ bail: for (m = 0; m <= aep_context->highest; m++) if (aep_context->aeps[m].fd > 0 && aep_context->aeps[m].done_config == 3) { for (i = 0; i < CHANNELS_PER_PROBE; i++) - if (aep_context->aeps[m].ch[i].requested) + if (aep_context->aeps[m].ch[i].requested && + aep_context->aeps[m].ch[i].flag_was_configured) c++; } @@ -370,7 +375,7 @@ bail: for (i = 0; i < CHANNELS_PER_PROBE; i++) { ch = &aep_context->aeps[m].ch[i]; - if (!ch->requested) + if (!ch->requested || !ch->flag_was_configured) continue; copy_public_ch_info_to_shared(aep_context->aepd_interface, chan, ch); @@ -623,10 +628,12 @@ int aep_init_and_fork(struct aep_context *aep_context, char *argv[]) for (i = 0; i < CHANNELS_PER_PROBE; i++) { ch = &aep_context->aeps[n].ch[i]; ; - if (configure(aep_context, &aep_context->aeps[n], + if (ch->flag_was_configured) { + if (configure(aep_context, &aep_context->aeps[n], aep_context->aeps[n].dev_filepath, aep_context->config_filepath, ch) < 0) fprintf(stderr, "failed to update config\n"); + } } probe_close(&aep_context->aeps[n]); |