-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: main
Are you sure you want to change the base?
Conversation
Stephen-Arsenault
commented
May 3, 2022
- Adding timers for read / write
- Improving serial messaging
if (currentTime > 10000) { | ||
currentTime = readAverage; | ||
} | ||
readAverage = readAverage == 0 ? currentTime : ((readAverage + currentTime) / 2); |
There was a problem hiding this comment.
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)
Arduino Code/arduino.ino
Outdated
unsigned int long stopWrite = micros(); | ||
unsigned int long currentTime = stopWrite - startWrite; |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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?