hw26: add factory reset function

- check rs232 for break condition duration to invoke
  factory reset or recovery boot. same logic as reset button.
- check rs232 break condition followed by command
  - 'f': factory reset
  - 'r': recovery boot
This commit is contained in:
Rene Straub 2020-08-13 13:53:38 +02:00
parent 93a35c7311
commit 9b04a8130e
1 changed files with 10 additions and 25 deletions

View File

@ -1235,9 +1235,6 @@ static int check_button(int time, bool button)
state = INIT;
}
/* TODO: Remove printf, puts */
/* printf("button: state %d button %d -> ", state, button); */
switch (state) {
case INIT:
if (button) {
@ -1293,13 +1290,9 @@ static int check_button(int time, bool button)
break;
}
/* printf("act %d\n", act); */
return act;
}
#if 0
static int check_break_length(int time, bool rx_line)
{
/*
@ -1328,9 +1321,6 @@ static int check_break_length(int time, bool rx_line)
wait_time = BREAK_DEB_TIME;
}
/* TODO: Remove */
/* printf("break length: state %d have_break_cond %d duration %d -> ", state, have_break_cond, duration); */
switch (state) {
case WAIT_BREAK:
if (rx_line) {
@ -1400,13 +1390,9 @@ static int check_break_length(int time, bool rx_line)
break;
}
/* printf("act %d\n", act); */
return act;
}
#endif
static int check_break_command(int time, int has_input, int c)
{
/*
@ -1435,9 +1421,6 @@ static int check_break_command(int time, int has_input, int c)
static int wait_time;
/* TODO: remove */
/* printf("break command: state %d, input %d %02x -> ", state, has_input, c); */
if (time == 0) {
state = WAIT_BREAK;
wait_time = BREAK_WAIT_TIME;
@ -1506,8 +1489,6 @@ static int check_break_command(int time, int has_input, int c)
break;
}
/* printf("act %d\n", act); */
return act;
}
@ -1541,12 +1522,16 @@ static void check_reset_button(void)
}
/* run processing state machines */
a_[0] = NONE;
a_[0] = check_button(counter, button);
if (hw_type == 26) {
/* break function are only present on hw26 */
a_[1] = check_break_length(counter, rx_line);
a_[2] = check_break_command(counter, has_input, c);
}
else {
a_[1] = NONE;
a_[2] = NONE;
a_[0] = check_button(counter, button);
/* a_[1] = check_break_length(counter, rx_line); */
a_[2] = check_break_command(counter, has_input, c);
}
/* if all SMs are sure there is not action, stop here */
if ((a_[0] == NONE) && (a_[1] == NONE) && (a_[2] == NONE)) {