mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-01 09:20:37 +02:00
fw/antorcha.c (main): reset the RF subsystem if it's idle for ~1 second
For some reason, DIAG often stalls the RF subsystem. The periodic reset brings it back to life.
This commit is contained in:
parent
ed19766266
commit
a70caced48
@ -122,6 +122,7 @@ int main(void)
|
||||
{
|
||||
uint8_t buf[PAYLOAD+5]; /* 3 bytes header, 2 bytes CRC */
|
||||
uint8_t got;
|
||||
uint32_t idle = 0;
|
||||
|
||||
/*
|
||||
* The boot loader has already initialized PORTx, DDRx, and MCUCR.PUD.
|
||||
@ -135,8 +136,10 @@ int main(void)
|
||||
|
||||
while (1) {
|
||||
got = rf_recv(buf, sizeof(buf));
|
||||
if (got > 2)
|
||||
if (got > 2) {
|
||||
dispatch(buf, got-2, protos);
|
||||
idle = 0;
|
||||
}
|
||||
if (wake && !sweeping) {
|
||||
wake = 0;
|
||||
if (state == LEFT)
|
||||
@ -144,5 +147,10 @@ int main(void)
|
||||
else if (state == RIGHT)
|
||||
submit_bwd_sweep();
|
||||
}
|
||||
/* about 1 Hz */
|
||||
if (++idle == 100000) {
|
||||
rf_init();
|
||||
idle = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user