Closed EarthenSky closed 3 weeks ago
Package | Line Rate | Branch Rate | Health |
---|---|---|---|
adc | 91% | 86% | ✔ |
calibration | 100% | 100% | ✔ |
dac | 100% | 97% | ✔ |
digital_input | 100% | 100% | ✔ |
digital_output | 98% | 95% | ✔ |
eeprom | 83% | 63% | ✔ |
eeprom.protobuf_assets.eeprom_data_classes | 97% | 52% | ✔ |
eeprom.protobuf_assets.generated_pb2 | 77% | 50% | ✔ |
gpio | 98% | 94% | ✔ |
led | 0% | 0% | ❌ |
peripherals | 69% | 23% | ➖ |
pwm | 96% | 95% | ✔ |
reg_helper | 93% | 70% | ✔ |
relay | 100% | 100% | ✔ |
tc | 98% | 98% | ✔ |
utilities | 100% | 100% | ✔ |
Summary | 92% (3196 / 3488) | 80% (694 / 866) | ✔ |
splitting this into separate PRs for DIN and ADC.
The goal of this PR was to improve the performance of the SDK's ADC reads to be higher than 100hz. All 8 ADC inputs can consistently be read in less than 10ms on average (with a somewhat surprisingly high variance, likely due to the OS), while all 8 digital inputs can be read in less than 1ms on average.
It's possible to improve the performance more than 100 hz for all 8 ADC, however 1/3 of all time is being spend sleeping, while another 1/3 is spent transferring data over SPI. I think it's unlikely to get faster than 200 hz.
The speed improvements are due to bit optimizations, minimizing data sent over the channel, python optimizations, and batching of requests (minimize system calls opening & closing devices), all of which were found via profiling. For more info, see this (private) page in the wiki.