5 ms·
Well, yes. That seems obvious. I guess I was more wondering if running in a busy loop like that was a thing people did on embedded hardware since from my very
by war1025 6y ago
Well, yes. That seems obvious.
I guess I was more wondering if running in a busy loop like that was a thing people did on embedded hardware since from my very minor experience with Arduino it is basically just a big while loop.
- CyberDildonics 6y agoAgain, you are assuming that the line that says 'wait' is a busy loop, but they are just saying that the program doesn't turn on the heat for 15 minutes after it has run for 15 minutes. That doesn't mean they are using a busy loop or not using one.
- war1025 6y ago> you are assuming that the line that says 'wait' is a busy loop I wasn't asking if the "wait" was a busy loop, I was asking if the "check whether the temperature dropped too far" was evaluated in a busy loop, and if not, how often that condition was checked. It doesn't really matter, and I imagine I won't get a response at this point, but it was just something I was curious about since I had never considered writing your own home thermostat software.
- labawi 6y agoI believe it uses sleep, and either threads or events / interrupts. I don't remember which. It's programmed in micropython. It calculates medians for each minute, and from those a 5-minute median (which is only considered valid if a majority of values are present) to filter out things like opening doors and missing values. Temperature readings are transported wirelessly from a different room. It supports multiple temperature clients for multiple rooms, each with a preset minimum (heat cycle activating) temperature, and also a maximum (safety-shutoff => don't activate heating) temperature.
- CyberDildonics 6y agoIt could be done with interrupts. With something like a raspberry pi it could be done with thread sleeps that yield non trivial amounts of process time so that the CPU usage is low.