fw: Implement main loop scheduler

This commit is contained in:
Markus Koch 2020-07-30 21:41:50 +02:00
parent e4afc61eba
commit eed5435335

View File

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