From 37ea688eaba9097ff62e98c40fae4d8869ce472f Mon Sep 17 00:00:00 2001 From: Harald Barth Date: Tue, 2 Aug 2022 20:58:05 +0200 Subject: [PATCH] do compare with 255 right --- DCCWaveform.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DCCWaveform.h b/DCCWaveform.h index 3ba313a..5ff9805 100644 --- a/DCCWaveform.h +++ b/DCCWaveform.h @@ -63,9 +63,9 @@ class DCCWaveform { uint32_t packetcount = isMainTrack ? rmtMainChannel->packetCount() : rmtProgChannel->packetCount(); uint32_t count = packetcount - resetPacketBase; - if ((count & 255) == 0) // no high bits set - return count; - return 255; + if (count > 255) // cap to 255 + return 255; + return count; }; #endif void schedulePacket(const byte buffer[], byte byteCount, byte repeats);