EV-05 round 7: Solar watches while not writing; shadow start writes nothing
Review of b4a222f, brief v6 Expected 11 (owner 2026-11-18):
- Solar keeps watching for another writer while it is not writing (Stop,
shadow, safety stop), so hold is true for every reader: the exit, the
shutdown, the peak alarms, and Start afterwards.
- car_solar_can_cut() also needs Solar to be writing: the peak alarms stand
as in Off and the quarter is banked.
- A start or restart in Solar with shadow on writes nothing (the
not-writing 0 A is owed only when Solar had the charger before).
- Once that exit 0 A is taken, nothing more is written, shutdown included.
Tests: alarm rows for Stop, shadow on and safety stop against an Off twin;
shutdown after another writer in shadow and Stop; a start in shadow with the
car already charging; Start after a stop; two variants inside the 30 s watch.
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -665,6 +665,7 @@ class SolarWriter(ManualWriter):
|
||||
self.engaged = False # Solar has run since it was chosen
|
||||
self.reinit = True # start again from 0 A and the start rule
|
||||
self.out = False # not writing (shadow, Stop, safety stop)
|
||||
self.had_control = False # Solar wrote since it was chosen/started
|
||||
self.zero_for = None # the way out a 0 A is owed for
|
||||
self.zero_ok = False # ... and the charger has taken it
|
||||
self.inflight = None # a current being written, not yet back
|
||||
@@ -768,7 +769,7 @@ class SolarWriter(ManualWriter):
|
||||
|
||||
def _leave(self) -> None:
|
||||
self.engaged, self.seq, self.would = False, None, None
|
||||
self.out = False
|
||||
self.out = self.had_control = False
|
||||
self._zero_done()
|
||||
self.fault = None
|
||||
self.reinit = True
|
||||
@@ -820,14 +821,21 @@ class SolarWriter(ManualWriter):
|
||||
if not writing:
|
||||
# Shadow, Stop, a safety stop, stopping: 0 A until taken, then
|
||||
# nothing. The plan goes on, so the card says what it would set.
|
||||
# Round 7 (brief v6, Expected 11): only if Solar had the charger
|
||||
# before; a start or restart in shadow writes nothing. And Solar
|
||||
# keeps watching for another writer, so `hold` stays true for
|
||||
# every reader (the exit, the shutdown, the peak alarms).
|
||||
self.seq = None
|
||||
self.out = True
|
||||
await self._exit_zero("out", drv, cur, now, tracker)
|
||||
if self.had_control:
|
||||
await self._exit_zero("out", drv, cur, now, tracker)
|
||||
self._watch(cur, now)
|
||||
self._plan_step(sun, now, clamp)
|
||||
self.would = (self.amps_out(clamp), self.n_calc)
|
||||
self.reinit = True
|
||||
return
|
||||
self.out = False
|
||||
self.had_control = True
|
||||
self.would = None
|
||||
fault = ("error" if (r.error or r.state in ("E", "F")) else
|
||||
"stuck" if tracker is not None and tracker.stuck(now)
|
||||
@@ -938,6 +946,11 @@ class SolarWriter(ManualWriter):
|
||||
cur = self.last_a # the reading predates our own write
|
||||
self._clock = self._clock or (lambda: now)
|
||||
self.inflight = None
|
||||
# Round 7: not writing (shadow, Stop, a safety stop) and the way-out
|
||||
# 0 A already taken, or Solar never had the charger: nothing more,
|
||||
# shutdown included (N10).
|
||||
if self.out and (self.zero_ok or not self.had_control):
|
||||
return
|
||||
# One try: the add-on is stopping, bounded by `ctl_car.RELEASE_WAIT_S`.
|
||||
if not self.hold and not (cur is not None and cur <= TOL_A):
|
||||
self.zero_at, self.sent_a = now, 0.0
|
||||
|
||||
Reference in New Issue
Block a user