DMXSerial icon indicating copy to clipboard operation
DMXSerial copied to clipboard

noDataSince() overflow

Open benjaminauer opened this issue 2 years ago • 1 comments

typecasting the returned unsigned long shows that it returns an overflown unsigned long it seems that the calculation in the function is interrupted and this is resulting to cause the substraction giving out a negative number, although im not really experienced. Code is run on Arduino Micro

unsigned long dmx_last_packet;
void loop() {
	dmx_last_packet = DMXSerial.noDataSince();
	if(dmx_last_packet>2000) {
		count++;
		printf("\nADIOS:%i",count);
		printf("=%ld OR %lu",(long signed) dmx_last_packet,dmx_last_packet);

		if(count>100) {
			led_debug.setOnSingle();
			for(;;) {}
		}
	}
}

console output:


ADIOS:1=-217 OR 4294967079
ADIOS:2=-218 OR 4294967078

benjaminauer avatar Sep 19 '21 14:09 benjaminauer

I have exact the same issue using an Arduino Every. I wil take a look at the method. I'm not that experienced to, but maybe i can make something out of it.

Yorams avatar Oct 19 '21 18:10 Yorams