From: Joel Holdsworth Date: Sat, 13 Apr 2013 15:08:52 +0000 (+0100) Subject: demo: Fixed glitching in increment signal X-Git-Tag: dsupstream~157 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=bbd7ef0f18df94232bafe6606c6d37eaad9ffd80;p=libsigrok.git demo: Fixed glitching in increment signal --- diff --git a/hardware/demo/demo.c b/hardware/demo/demo.c index 7d97bf79..0da3fd58 100644 --- a/hardware/demo/demo.c +++ b/hardware/demo/demo.c @@ -347,9 +347,8 @@ static void samples_generator(uint8_t *buf, uint64_t size, switch (devc->sample_generator) { case PATTERN_SIGROK: /* sigrok pattern */ for (i = 0; i < size; i++) { - *(buf + i) = ~(pattern_sigrok[p] >> 1); - if (++p == 64) - p = 0; + *(buf + i) = ~(pattern_sigrok[ + p++ % sizeof(pattern_sigrok)] >> 1); } break; case PATTERN_RANDOM: /* Random */ @@ -358,7 +357,7 @@ static void samples_generator(uint8_t *buf, uint64_t size, break; case PATTERN_INC: /* Simple increment */ for (i = 0; i < size; i++) - *(buf + i) = i; + *(buf + i) = p++; break; case PATTERN_ALL_LOW: /* All probes are low */ memset(buf, 0x00, size);