Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noDataSince() overflow #56

Open
benjaminauer opened this issue Sep 19, 2021 · 1 comment
Open

noDataSince() overflow #56

benjaminauer opened this issue Sep 19, 2021 · 1 comment

Comments

@benjaminauer
Copy link

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
@Yorams
Copy link

Yorams commented Oct 19, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants