1
0
mirror of https://github.com/sjlongland/cluster-powerctl.git synced 2025-09-13 12:03:14 +10:00
Commit Graph

25 Commits

Author SHA1 Message Date
fe8520116f
powerctl: Drop solar presence check.
At night, we probably don't want to just hammer the batteries with 14.4V
all the time.  If we switch to "solar mode", that'll give the batteries
a bit of a break from the charger.
2018-10-01 10:07:17 +10:00
27612b9173
powerctl: Split out core loop functions.
This just tries to make things a bit more readable by reducing the depth
of indentation, as per guidance in the Linux kernel style documentation.
2018-09-22 14:38:32 +10:00
caf3e27565
Drop UART support.
Not being used, and bitrotten.
2018-09-22 14:26:26 +10:00
a7c86401e7
powerctl.c: Re-Add LED blinking
Before when blinking LEDs I just XORed a bit-mask, that turns out to be
unwise as they blinked out of phase which was just annoying, but it is
still useful to have that "flashing" state to draw your attention to a
problem or to indicate a state.

- We use a single 8-bit register to hold things like the blink phase
  (which is XORed each cycle), and whether we have checked the ADCs.
- Temperature LEDs blink when fan is in "kick-start" state.
- Battery voltage LED now has three states:
  - On: battery is above minimum voltage (good)
  - Off: battery is low
  - Blinking: battery is critical (bad)
- In "solar" mode, mains charger LED will blink if we are in the
  "waiting for low voltage timeout" sub-state.
2018-09-22 14:23:00 +10:00
d6f926fae9
powerctl.c, setpoints.h: Tweak the state machine.
- Re-introduce the "critically low" threshold which kick-starts the
  charger immediately (like the "low" threshold does now).
- Add a charging time so we consider the charger to be "charging" for
  `T_CHARGE_S` seconds, then check to see the battery has reached the
  float voltage.
- Delay starting the charger until the battery has been low for
  `T_LOW_S` seconds to prevent the charger flapping in and out.
- Re-work the state machines so charging and discharging uses the same
  timer.
2018-09-22 13:50:33 +10:00
3f0aff5a00
powerctl: Switch to mains at sunset.
Rather than just waiting for the battery to reach rock bottom or for the
solar override to force the mains charger on.
2018-09-17 22:51:10 +10:00
03161f8d8e
powerctl: Re-work controller logic. 2018-09-17 22:51:00 +10:00
723d226399
powerctl: Use ADC units not MV 2017-03-19 13:22:32 +10:00
4a87ef25a4
powerctl: Implement V_DELTA_MV checks. 2017-03-19 12:56:02 +10:00
8a27a8df8f
powerctl: Don't change warning state in check.
Doing so causes flapping that is unable to be resolved by timers.
2017-03-19 12:36:45 +10:00
c2e6915996
powerctl: Wait until t_cwarn expiry before clearing timer. 2017-03-19 12:24:13 +10:00
3969248610
powerctl: In CHARGE_WAIT state, reset if battery improving. 2017-03-19 11:23:57 +10:00
97d4732c6c
powerctl: Implement warning timer. 2017-03-19 10:59:33 +10:00
10cf0c710a
powerctl: Re-locate WARNING LED update. 2017-03-19 10:15:51 +10:00
5fe8ce3d74
powerctl: Revert t_adc to being a tick timer.
Rather than counting seconds, count ticks, so we can set sub-second ADC
samples.
2017-03-19 09:41:41 +10:00
a5031f0403
powerctl: Tweak warning LED usage.
Show a warning when charging and the battery voltage is *not*
increasing.
2017-03-19 09:28:55 +10:00
511309aa74
powerctl: Create one-second timer
This creates a one-second timing event from the high-frequency timer for
less frequent events so we don't have to keep ticking down larger
numbers.
2017-03-18 15:44:48 +10:00
c29736ca86
powerctl: Fix some debug typos 2017-03-18 15:22:35 +10:00
3db2e03807
powerctl: Re-locate high-voltage threshold check.
If the charger is doing a bulk charge, it'll likely be dumping high
current into the battery, resulting in a high voltage appearing at the
terminals.

We don't want to disturb this… we want to wait until the charger thinks
it's done, which it signifies by turning off.  We should see the voltage
drop back and continue falling.  If we're above our "high" threshold at
this point, *then* we might consider leaving it off.
2017-03-18 14:04:12 +10:00
312d21c01c
powerctl: Re-write battery charge control logic.
See doc/flowdiag.png and
https://hackaday.io/project/10529-solar-powered-cloud-computing/log/54762-charge-control-flow-control-diagram
for details on how this new logic is supposed to work.
2017-03-12 15:47:39 +10:00
d29d15308b
Add shutdown delay on "high" threshold.
We should delay our shutdown in case the charger decides to ramp down
itself.  Otherwise we can get the situation where a smart charger starts
high, tripping the high threshold immediately, leading to the controller
and charger oscillating between on and off.
2016-11-05 17:04:05 +10:00
d91ec8d786
Move setpoint definitions to separate header.
This will get copied over to setpoints.h, where the developer can
customise them.  If they do so, and I have to change things, the
Makefile will warn them of this.
2016-09-04 06:57:36 +10:00
772d5b9d30
FAN control: Fine-tune minimum PWM
It appears the minimum PWM is more strongly dependent on battery voltage
than I had planned, it needs to be just a little higher to ensure the
fan keeps turning at low RPM.
2016-09-04 06:47:28 +10:00
e62cbf497a
fan PWM tweaks.
- Adjust the calculations so that we base our initial PWM at 0 then
  clamp to minimum PWM
- Implement a fan kick-start mode
- Start with fan off so kick-start mode works
2016-09-04 06:30:52 +10:00
882541392f
Initial check-in 2016-09-03 17:31:15 +10:00