Add setting to choose the wifi serial

as for Davinci it is Serial and for RADDS it is Serial1
Sample-DUE-RADDS-GLCD
luc 2015-10-29 22:08:00 +08:00
rodzic 6383947325
commit c21ed2062f
2 zmienionych plików z 16 dodań i 6 usunięć

Wyświetl plik

@ -57,7 +57,17 @@
#define MODEL 1
#endif
//to enable communication using wifi module set to 1
#define ENABLE_WIFI 0
#define ENABLE_WIFI 1
//define the wifi serial output
//on Davinci use Serial
//on RADDS use Serial1
#if ENABLE_WIFI
#if DAVINCI == 0
#define WIFI_SERIAL Serial1
#else
#define WIFI_SERIAL Serial
#endif
#endif
//if wifi is enabled serial need to slow down a little, this is a delay in ms after a '\n' so normaly after a command or a message
#define DELAY_BY_LINE 50
#if ENABLE_CLEAN_NOZZLE

Wyświetl plik

@ -557,14 +557,14 @@ public:
static inline void serialSetBaudrate(long baud)
{
#if ENABLE_WIFI
Serial.begin(baud);
WIFI_SERIAL.begin(baud);
#endif
RFSERIAL.begin(baud);
}
static inline bool serialByteAvailable()
{
#if ENABLE_WIFI
if(HAL::bwifion) return Serial.available();
if(HAL::bwifion) return WIFI_SERIAL.available();
else
#endif
return RFSERIAL.available();
@ -572,7 +572,7 @@ public:
static inline uint8_t serialReadByte()
{
#if ENABLE_WIFI
if(HAL::bwifion) return Serial.read();
if(HAL::bwifion) return WIFI_SERIAL.read();
else
#endif
return RFSERIAL.read();
@ -582,7 +582,7 @@ public:
#if ENABLE_WIFI
if(HAL::bwifion)
{
Serial.write(b);
WIFI_SERIAL.write(b);
if (b=='\n')
{
HAL::delayMilliseconds(DELAY_BY_LINE);
@ -595,7 +595,7 @@ public:
static inline void serialFlush()
{
#if ENABLE_WIFI
if(HAL::bwifion) Serial.flush();
if(HAL::bwifion) WIFI_SERIAL.flush();
else
#endif
RFSERIAL.flush();