Change polling interval to a regular 1ms

Motion burst + analog reads takes around 408us.
The total 408us + 870us wait doesn't seem necessary.
This commit is contained in:
Daniel Kao 2019-11-16 03:57:33 -08:00
parent f4ad846e82
commit a8b247bb0e
1 changed files with 4 additions and 3 deletions

View File

@ -416,12 +416,13 @@ void loop() {
}
byte burstBuffer[12];
unsigned long elapsed = micros() - lastTS;
unsigned long curTime = micros();
unsigned long elapsed = curTime - lastTS;
checkButtonState();
// polling interval : more than > 0.5 ms.
if (elapsed > 870) { // 870...whut?
if (elapsed >= 1000) {
adnsComBegin();
SPI.beginTransaction(SPISettings(SPIMAXIMUMSPEED, MSBFIRST, SPI_MODE3));
@ -460,6 +461,6 @@ void loop() {
dy = 0;
}
lastTS = micros();
lastTS = curTime;
}
}