diff --git a/radio/src/opentx.cpp b/radio/src/opentx.cpp index 5e5df5655..6c9ccda1e 100644 --- a/radio/src/opentx.cpp +++ b/radio/src/opentx.cpp @@ -2592,7 +2592,7 @@ void opentxInit(OPENTX_INIT_ARGS) startPulses(); - wdt_enable(WDT_500MS); + wdt_enable(WDTO_500MS); } #if defined(SIMU) diff --git a/radio/src/opentx.h b/radio/src/opentx.h index 373d4eecc..570c67772 100644 --- a/radio/src/opentx.h +++ b/radio/src/opentx.h @@ -1756,6 +1756,4 @@ extern JitterMeter avgJitter[NUMBER_ANALOG]; #endif #endif -#define WDT_500MS 500 - #endif // _OPENTX_H_ diff --git a/radio/src/targets/common/avr/serial_driver.cpp b/radio/src/targets/common/avr/serial_driver.cpp index d9625fd08..6602fd890 100644 --- a/radio/src/targets/common/avr/serial_driver.cpp +++ b/radio/src/targets/common/avr/serial_driver.cpp @@ -1,23 +1,23 @@ -/* - * Copyright (C) OpenTX - * - * Based on code named - * th9x - http://code.google.com/p/th9x - * er9x - http://code.google.com/p/er9x - * gruvin9x - http://code.google.com/p/gruvin9x - * - * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - +/* + * Copyright (C) OpenTX + * + * Based on code named + * th9x - http://code.google.com/p/th9x + * er9x - http://code.google.com/p/er9x + * gruvin9x - http://code.google.com/p/gruvin9x + * + * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + #include "serial_driver.h" #include "opentx.h" @@ -292,8 +292,12 @@ void SERIAL_Init(void) { // set 8N1 UCSR0B = 0 | (0 << RXCIE0) | (0 << TXCIE0) | (0 << UDRIE0) | (0 << RXEN0) | (0 << TXEN0) | (0 << UCSZ02); UCSR0C = 0 | (1 << UCSZ01) | (1 << UCSZ00); - while (UCSR0A & (1 << RXC0)) - UDR0; // flush receive buffer + +#if !defined(SIMU) + while (UCSR0A & (1 << RXC0)) { + UDR0; // flush receive buffer + } +#endif SERIAL_EnableTXD(); SERIAL_EnableRXD(); diff --git a/radio/src/targets/horus/board.h b/radio/src/targets/horus/board.h index 73bb4d7fa..a44dd4264 100644 --- a/radio/src/targets/horus/board.h +++ b/radio/src/targets/horus/board.h @@ -175,6 +175,7 @@ extern uint32_t rotencSpeed; void checkRotaryEncoder(void); // WDT driver +#define WDTO_500MS 500 #define wdt_disable() void watchdogInit(unsigned int duration); #if defined(WATCHDOG_DISABLED) || defined(SIMU) diff --git a/radio/src/targets/taranis/board.h b/radio/src/targets/taranis/board.h index 9f89427b8..45d1b65d8 100644 --- a/radio/src/targets/taranis/board.h +++ b/radio/src/targets/taranis/board.h @@ -234,6 +234,7 @@ void checkRotaryEncoder(void); #endif // WDT driver +#define WDTO_500MS 500 #if defined(WATCHDOG_DISABLED) || defined(SIMU) #define wdt_enable(x) #define wdt_reset()