fw: Implement main loop scheduler

This commit is contained in:
Markus Koch 2020-07-30 21:41:50 +02:00
parent e4afc61eba
commit eed5435335
1 changed files with 15 additions and 2 deletions

View File

@ -83,6 +83,7 @@ void lcd_title(const char *msg1, const char *msg2)
int main() int main()
{ {
char *post_msg; char *post_msg;
uint8_t sched = 0;
MCUSR &= ~(1 << WDRF); MCUSR &= ~(1 << WDRF);
WDTCSR = (1 << WDCE); WDTCSR = (1 << WDCE);
@ -108,8 +109,20 @@ int main()
while (1) { while (1) {
if (!spi_proc()) { if (!spi_proc()) {
timer_proc(); switch (sched) {
input_proc(); case 0:
timer_proc();
break;
case 1:
input_proc();
break;
}
}
sched = sched + 1;
if (sched == 4) {
sched = 0;
if (batmon_proc())
reset();
} }
} }
return 0; return 0;