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

Update arduino.ino #1

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Stephen-Arsenault
Copy link
Owner

  • Adding timers for read / write
  • Improving serial messaging

if (currentTime > 10000) {
currentTime = readAverage;
}
readAverage = readAverage == 0 ? currentTime : ((readAverage + currentTime) / 2);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the division here is inefficient? (just guessing)

Comment on lines 78 to 79
unsigned int long stopWrite = micros();
unsigned int long currentTime = stopWrite - startWrite;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what's common with Ardiuno code, but I always like to declare variables at the top of the function. Not sure if this has a performance implication or not (probably not).

interrupts(); Serial.println("Test: Write \"1\" then \"0\" and Verify Read"); Serial.flush(); noInterrupts(); fill(1);
unsigned int long dramTimerStop = micros();
unsigned int long dramTimerDuration = dramTimerStop - dramTimerStart;
interrupts(); Serial.println((String)"Total Test Duration: " + (dramTimerDuration / 1000) + " ms"); Serial.flush(); noInterrupts();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another example of math that could be slow?

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

Successfully merging this pull request may close these issues.

2 participants