diff --git a/pigpio.c b/pigpio.c
index 261e540..942a4cc 100644
--- a/pigpio.c
+++ b/pigpio.c
@@ -25,7 +25,7 @@ OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to
*/
-/* pigpio version 73 */
+/* pigpio version 7303 */
/* include ------------------------------------------------------- */
@@ -3242,7 +3242,7 @@ int rawWaveAddGeneric(unsigned numIn1, rawWave_t *in1)
unsigned numIn2, numOut;
- uint32_t tNow, tNext1, tNext2, tDelay;
+ uint32_t tNow, tNext1, tNext2, tDelay, tMax;
rawWave_t *in2, *out;
@@ -3253,6 +3253,7 @@ int rawWaveAddGeneric(unsigned numIn1, rawWave_t *in1)
out = wf[1-wfcur];
tNow = 0;
+ tMax = 0;
if (!numIn1) tNext1 = -1; else tNext1 = 0;
if (!numIn2) tNext2 = -1; else tNext2 = 0;
@@ -3275,6 +3276,7 @@ int rawWaveAddGeneric(unsigned numIn1, rawWave_t *in1)
out[outPos].flags = in1[inPos1].flags;
tNext1 = tNow + in1[inPos1].usDelay; ++inPos1;
+ if (tMax < tNext1) tMax = tNext1;
}
else if (tNext2 < tNext1)
{
@@ -3292,6 +3294,7 @@ int rawWaveAddGeneric(unsigned numIn1, rawWave_t *in1)
out[outPos].flags = in2[inPos2].flags;
tNext2 = tNow + in2[inPos2].usDelay; ++inPos2;
+ if (tMax < tNext2) tMax = tNext2;
}
else
{
@@ -3310,6 +3313,8 @@ int rawWaveAddGeneric(unsigned numIn1, rawWave_t *in1)
tNext1 = tNow + in1[inPos1].usDelay; ++inPos1;
tNext2 = tNow + in2[inPos2].usDelay; ++inPos2;
+ if (tMax < tNext1) tMax = tNext1;
+ if (tMax < tNext2) tMax = tNext2;
}
if (tNext1 <= tNext2) { tDelay = tNext1 - tNow; tNow = tNext1; }
@@ -3342,6 +3347,13 @@ int rawWaveAddGeneric(unsigned numIn1, rawWave_t *in1)
}
+ if (tNow < tMax)
+ {
+ /* extend previous delay */
+ out[outPos-1].usDelay += (tMax - tNow);
+ tNow = tMax;
+ }
+
if ((outPos < numOut) && (outPos < level))
{
wfStats.micros = tNow;
diff --git a/pigpio.h b/pigpio.h
index 5817460..f58373c 100644
--- a/pigpio.h
+++ b/pigpio.h
@@ -30,7 +30,7 @@ For more information, please refer to
#include
#include
-#define PIGPIO_VERSION 7302
+#define PIGPIO_VERSION 7303
/*TEXT