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:
parent
41e1508354
commit
92070e143d
|
@ -416,12 +416,13 @@ void loop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
byte burstBuffer[12];
|
byte burstBuffer[12];
|
||||||
unsigned long elapsed = micros() - lastTS;
|
unsigned long curTime = micros();
|
||||||
|
unsigned long elapsed = curTime - lastTS;
|
||||||
|
|
||||||
checkButtonState();
|
checkButtonState();
|
||||||
|
|
||||||
// polling interval : more than > 0.5 ms.
|
// polling interval : more than > 0.5 ms.
|
||||||
if (elapsed > 870) { // 870...whut?
|
if (elapsed >= 1000) {
|
||||||
adnsComBegin();
|
adnsComBegin();
|
||||||
SPI.beginTransaction(SPISettings(SPIMAXIMUMSPEED, MSBFIRST, SPI_MODE3));
|
SPI.beginTransaction(SPISettings(SPIMAXIMUMSPEED, MSBFIRST, SPI_MODE3));
|
||||||
|
|
||||||
|
@ -460,6 +461,6 @@ void loop() {
|
||||||
dy = 0;
|
dy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
lastTS = micros();
|
lastTS = curTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue