srd: PDs now get a logic feed with sample numbers, not time/duration
[libsigrokdecode.git] / type_logic.c
index 2f7923425b08bae786db5e106bdc153864ae1584..851a42ead51070334db360985b698962165df6be 100644 (file)
@@ -56,16 +56,14 @@ PyObject *srd_logic_iternext(PyObject *self)
                sample >>= 1;
        }
 
-       /* TODO: samplenum should be in the inbuf feed, instead of time/duration.
-        * fake it for now...
-        */
        /* Prepare the next samplenum/sample list in this iteration. */
-       py_samplenum = PyLong_FromUnsignedLongLong(logic->itercnt++);
+       py_samplenum = PyLong_FromUnsignedLongLong(logic->start_samplenum + logic->itercnt);
        PyList_SetItem(logic->sample, 0, py_samplenum);
        py_samples = PyBytes_FromStringAndSize((const char *)probe_samples,
                        logic->di->num_probes);
        PyList_SetItem(logic->sample, 1, py_samples);
        Py_INCREF(logic->sample);
+       logic->itercnt++;
 
        return logic->sample;
 }