2 ms·
I mean the sheer amount of abstraction. On a brief inspection, this code essentially does: when temp > upper_threshold: turn fan on until temp < lower_thresh
by amluto 8y ago
I mean the sheer amount of abstraction. On a brief inspection, this code essentially does:
when temp > upper_threshold:
turn fan on until temp < lower_threshold
For a vendor-provided set of tuples (temperature, fan, upper_threshold, lower_threshold). And it’s not really clear whether the code is intended to handle the same temperature or fan occurring more than once.
This logic could be written in maybe 100 lines of code if all the abstraction were removed, and that’s if full support for repeats is needed.
Instead there are layers and layers of abstraction. Also, this code doesn’t belong in a user program or even on the main CPU at all. It belongs in the embedded controller.