Skip to content

Commit

Permalink
feat: strengthen penalty recovery requirements
Browse files Browse the repository at this point in the history
It seems too easy to recover without at least requiring acknowledgement. In addition, every DTG manual says recovery also requires suppression.
  • Loading branch information
YoRyan committed Jul 16, 2024
1 parent 88fef58 commit 14a2855
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib/nec/adu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ export function create<A>({
case TimerMode.NotStarted:
return overspeed ? [TimerMode.Running, atcCountdownS] : TimerMode.NotStarted;
case TimerMode.Expired:
return overspeed ? TimerMode.Expired : TimerMode.NotStarted;
const suppress = frp.snapshot(suppression);
const ack = frp.snapshot(acknowledge);
return !overspeed && suppress && ack ? TimerMode.NotStarted : TimerMode.Expired;
default:
if (overspeed) {
const [, leftS] = accum;
Expand Down Expand Up @@ -296,7 +298,8 @@ export function create<A>({
if (isPenalty) {
const belowTarget = frp.snapshot(acsesBelowTargetSpeed);
const suppress = frp.snapshot(suppression);
return !(belowTarget && suppress);
const ack = frp.snapshot(acknowledge);
return !(belowTarget && suppress && ack);
} else {
const aboveCurve = frp.snapshot(acsesAbovePenaltyCurve);
return aboveCurve;
Expand Down

0 comments on commit 14a2855

Please sign in to comment.