demo: Don't generate analog output data for disabled channels
Skip the emission of session datafeed packets for disabled analog channels. Implementation detail: Allow for quick lookup of the channel that is associated with an analog generator, as the data generation routines only pass generator references in later calls. This fixes part of bug #923 (which initially is about unexpected logic data while analog channels were affected in similar ways).
This commit is contained in:
parent
d114464551
commit
01f2adb07a
|
@ -157,6 +157,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
|
|||
|
||||
/* Every channel gets a generator struct. */
|
||||
ag = g_malloc(sizeof(struct analog_gen));
|
||||
ag->ch = ch;
|
||||
ag->amplitude = DEFAULT_ANALOG_AMPLITUDE;
|
||||
sr_analog_init(&ag->packet, &ag->encoding, &ag->meaning, &ag->spec, 2);
|
||||
ag->packet.meaning->channels = cg->channels;
|
||||
|
|
|
@ -343,6 +343,9 @@ static void send_analog_packet(struct analog_gen *ag,
|
|||
int ag_pattern_pos;
|
||||
unsigned int i;
|
||||
|
||||
if (!ag->ch || !ag->ch->enabled)
|
||||
return;
|
||||
|
||||
devc = sdi->priv;
|
||||
packet.type = SR_DF_ANALOG;
|
||||
packet.payload = &ag->packet;
|
||||
|
|
|
@ -118,6 +118,7 @@ static const char *analog_pattern_str[] = {
|
|||
};
|
||||
|
||||
struct analog_gen {
|
||||
struct sr_channel *ch;
|
||||
int pattern;
|
||||
float amplitude;
|
||||
float pattern_data[ANALOG_BUFSIZE];
|
||||
|
|
Loading…
Reference in New Issue