selftest bug behoben

This commit is contained in:
devfix 2019-05-09 15:06:38 +02:00
parent 4f62b06209
commit 7791bfd5c9
4 changed files with 25 additions and 15 deletions

View file

@ -57,15 +57,13 @@ void B15F::init()
void B15F::reconnect()
{
uint8_t tries = RECONNECT_TRIES;
while(tries-- && false)
while(tries--)
{
delay_ms(RECONNECT_TIMEOUT);
discard();
discard();
if(testConnection())
return;
}
abort("Verbindung kann nicht repariert werden");
@ -73,13 +71,20 @@ void B15F::reconnect()
void B15F::discard(void)
{
usart.clearOutputBuffer();
for(uint8_t i = 0; i < 16; i++)
try
{
usart.writeByte(RQ_DISC); // sende discard Befehl (verwerfe input)
delay_ms(4);
usart.clearOutputBuffer();
for(uint8_t i = 0; i < 16; i++)
{
usart.writeByte(RQ_DISC); // sende discard Befehl (verwerfe input)
delay_ms(4);
}
usart.clearInputBuffer();
}
catch(std::exception& ex)
{
abort(ex);
}
usart.clearInputBuffer();
}
bool B15F::testConnection()