Skip to content

Commit

Permalink
Fix bug in state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos GALALAE committed Dec 5, 2024
1 parent 3a35dbb commit 29399e3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ void main(void) {
if (updelay > PWUP_DLY_TICKS) {
/* check PS_DLY */
if (PS_DLY)
goto_state(running);
goto_state(blanking);
/* PS_ON must have signal to continue ! */
goto_state(blanking);
else
goto_state(running);
}
break;
case running:
Expand Down Expand Up @@ -149,8 +150,13 @@ void main(void) {
blink = 0;
}
/* check power down delay */
if (updelay > PWRE_DLY_TICKS)
goto_state(tripped);
if (updelay > PWRE_DLY_TICKS) {
/* check PS_DLY, if 1 then go to tripped */
if (PS_DLY)
goto_state(tripped);
else
reset();
}
break;
case tripped:
/* tripped state */
Expand All @@ -160,7 +166,6 @@ void main(void) {
LED_ON = 0;
/* power recovery (self-reset) */
if (!PS_DLY)
//goto_state(powerup);
reset();
break;
default:
Expand Down

0 comments on commit 29399e3

Please sign in to comment.