kaxori
07/03/2023, 2:25 PMfloitsch
07/03/2023, 2:47 PMfloitsch
07/03/2023, 2:48 PMfloitsch
07/03/2023, 2:49 PMtest.toit
itself looks good.kaxori
07/03/2023, 3:14 PMfloitsch
07/03/2023, 3:30 PMfloitsch
07/03/2023, 3:30 PMkaxori
07/03/2023, 3:31 PMfloitsch
07/03/2023, 3:31 PMkaxori
07/03/2023, 3:41 PMhttps://cdn.discordapp.com/attachments/1125432091543347255/1125451214193176697/ads1115.png▾
floitsch
07/03/2023, 3:41 PMfloitsch
07/03/2023, 3:42 PMkaxori
07/03/2023, 3:43 PMfloitsch
07/03/2023, 3:43 PMkaxori
07/03/2023, 5:58 PMfloitsch
07/03/2023, 5:59 PMkaxori
07/03/2023, 6:00 PMfloitsch
07/03/2023, 6:00 PMkaxori
07/03/2023, 6:01 PMfloitsch
07/03/2023, 6:01 PMfloitsch
07/03/2023, 6:01 PMfloitsch
07/03/2023, 6:02 PMkaxori
07/03/2023, 6:54 PMfloitsch
07/04/2023, 8:11 AMfloitsch
07/04/2023, 8:12 AMsleep
for very short periods. We are using the Freertos timer underneath and that one only has a granularity of 10ms. So the driver's sleep --ms=1
will only come back after 10ms. But that doesn't explain the delays of ~1s.kaxori
07/04/2023, 8:32 AMkaxori
07/04/2023, 8:33 AMfloitsch
07/04/2023, 10:00 AMsleep
work better with less granularity.
It shouldn't be an issue here, though. As I said: I should get an ADS1115 soon, and will investigate then.
Can you confirm that it's the sleep loop that takes so much time?
Would be interesting to count the number of iterations of that loop. Checking how often the device responds with "not ready yet".floitsch
07/17/2023, 10:52 PMconfig
register.
It directly ors in the RATES_DR_475SPS_
constant. However, the location of the data rate is bits 5-7. So there is a shift needed:
| RATES_DR_475SPS_ << 5
Alternatively, the RATES_DR_475SPS_
constant should have the bits already shifted. (That would actually be more consistent with the rest of the code).
Once I fixed that, I also changed the sleep --ms=1
to yield
.
The driver should probably remember the samples-per-second, and then either just yield
(if it's less than 10ms), or sleep
otherwise.
With that change the driver is nicely computing new values close to the speed that it should.floitsch
07/17/2023, 10:55 PMkaxori
07/18/2023, 7:29 AMfloitsch
07/18/2023, 9:29 AMkaxori
07/18/2023, 9:30 AMfloitsch
07/19/2023, 10:05 PMkaxori
07/20/2023, 12:47 PM