mortenfyhn / coffee-scales

⚖️ Scales for brewing coffee ☕
GNU General Public License v3.0
22 stars 2 forks source link

Manual sleep before HX711 read? #84

Open mortenfyhn opened 5 months ago

mortenfyhn commented 5 months ago

If the read is a busy loop, maybe that's wasting energy and I instead can sleep until it's ready.

mortenfyhn commented 2 months ago

It does seem to be a busy loop, the HX711 driver just does "while not ready, delay(0)".

I should instead try to estimate when it will be ready and do some kind of proper low power sleep until then.

I should also consider just hooking up an interrupt to the DOUT pin, which is what "is ready" actually checks: When DOUT goes low, it means data is ready for reading.

And I should do some timing again to see which parts of the program take how much time.

And then consider optimizing the rest of the code.