Changed updated name of macro for serial device, to follow generic MY_xx format
This commit is contained in:
@@ -107,22 +107,22 @@ bool gatewayTransportInit() {
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
delay(500);
|
||||
SERIALDEVICE.print(".");
|
||||
MY_SERIALDEVICE.print(".");
|
||||
yield();
|
||||
}
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(WiFi.localIP());
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(WiFi.localIP());
|
||||
|
||||
#else
|
||||
#ifdef MY_IP_ADDRESS
|
||||
Ethernet.begin(_ethernetGatewayMAC, _ethernetGatewayIP);
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(Ethernet.localIP());
|
||||
#else
|
||||
// Get IP address from DHCP
|
||||
Ethernet.begin(_ethernetGatewayMAC);
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(Ethernet.localIP());
|
||||
#endif /* IP_ADDRESS_DHCP */
|
||||
// give the Ethernet interface a second to initialize
|
||||
// TODO: use HW delay
|
||||
|
||||
@@ -161,21 +161,21 @@ bool gatewayTransportInit() {
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
delay(500);
|
||||
SERIALDEVICE.print(".");
|
||||
MY_SERIALDEVICE.print(".");
|
||||
yield();
|
||||
}
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(WiFi.localIP());
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(WiFi.localIP());
|
||||
#else
|
||||
#ifdef MY_IP_ADDRESS
|
||||
Ethernet.begin(_clientMAC, _clientIp);
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(Ethernet.localIP());
|
||||
#else
|
||||
// Get IP address from DHCP
|
||||
Ethernet.begin(_clientMAC);
|
||||
SERIALDEVICE.print(F("IP: "));
|
||||
SERIALDEVICE.println(Ethernet.localIP());
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(Ethernet.localIP());
|
||||
#endif /* IP_ADDRESS_DHCP */
|
||||
// give the Ethernet interface a second to initialize
|
||||
// TODO: use HW delay
|
||||
|
||||
@@ -31,7 +31,7 @@ MyMessage _serialMsg;
|
||||
|
||||
|
||||
bool gatewayTransportSend(MyMessage &message) {
|
||||
SERIALDEVICE.print(protocolFormat(message));
|
||||
MY_SERIALDEVICE.print(protocolFormat(message));
|
||||
// Serial print is always successful
|
||||
return true;
|
||||
}
|
||||
@@ -45,9 +45,9 @@ bool gatewayTransportInit() {
|
||||
bool gatewayTransportAvailable() {
|
||||
bool available = false;
|
||||
|
||||
while (SERIALDEVICE.available()) {
|
||||
while (MY_SERIALDEVICE.available()) {
|
||||
// get the new byte:
|
||||
char inChar = (char) SERIALDEVICE.read();
|
||||
char inChar = (char) MY_SERIALDEVICE.read();
|
||||
// if the incoming character is a newline, set a flag
|
||||
// so the main loop can do something about it:
|
||||
if (_serialInputPos < MY_GATEWAY_MAX_RECEIVE_LENGTH - 1 && !available) {
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include <Arduino.h>
|
||||
#endif
|
||||
|
||||
#define SERIALDEVICE Serial
|
||||
#define MY_SERIALDEVICE Serial
|
||||
#if defined __AVR_ATmega328P__
|
||||
#ifndef sleep_bod_disable
|
||||
#define sleep_bod_disable() \
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
//#include <SPI.h>
|
||||
#endif
|
||||
|
||||
#define SERIALDEVICE Serial
|
||||
#define MY_SERIALDEVICE Serial
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#define max(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
|
||||
@@ -99,9 +99,9 @@ void hwWriteConfig(int adr, uint8_t value)
|
||||
}
|
||||
|
||||
void hwInit() {
|
||||
SERIALDEVICE.begin(MY_BAUD_RATE);
|
||||
MY_SERIALDEVICE.begin(MY_BAUD_RATE);
|
||||
#ifndef MY_GATEWAY_W5100
|
||||
while (!SERIALDEVICE) {}
|
||||
while (!MY_SERIALDEVICE) {}
|
||||
#endif
|
||||
Wire.begin();
|
||||
}
|
||||
@@ -140,12 +140,12 @@ int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mo
|
||||
|
||||
#ifdef MY_DEBUG
|
||||
void hwDebugPrint(const char *fmt, ... ) {
|
||||
if (SERIALDEVICE) {
|
||||
if (MY_SERIALDEVICE) {
|
||||
char fmtBuffer[300];
|
||||
#ifdef MY_GATEWAY_FEATURE
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf(fmtBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||
SERIALDEVICE.print(fmtBuffer);
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
#endif
|
||||
va_list args;
|
||||
va_start (args, fmt );
|
||||
@@ -159,8 +159,8 @@ void hwDebugPrint(const char *fmt, ... ) {
|
||||
vsnprintf(fmtBuffer, 299, fmt, args);
|
||||
#endif
|
||||
va_end (args);
|
||||
SERIALDEVICE.print(fmtBuffer);
|
||||
// SERIALDEVICE.flush();
|
||||
MY_SERIALDEVICE.print(fmtBuffer);
|
||||
// MY_SERIALDEVICE.flush();
|
||||
|
||||
//Serial.write(freeRam());
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void hwWriteConfigBlock(void* buf, void* adr, size_t length);
|
||||
void hwWriteConfig(int adr, uint8_t value);
|
||||
uint8_t hwReadConfig(int adr);
|
||||
|
||||
#define SERIALDEVICE SerialUSB
|
||||
#define MY_SERIALDEVICE SerialUSB
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -63,7 +63,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
#ifdef MY_GATEWAY_FEATURE
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(printBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
MY_SERIALDEVICE.print(printBuffer);
|
||||
#endif
|
||||
for (int i=0; i<sz; i++)
|
||||
{
|
||||
@@ -75,12 +75,12 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
// Truncate message if this is gateway node
|
||||
printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0';
|
||||
#endif
|
||||
SERIALDEVICE.print(str);
|
||||
MY_SERIALDEVICE.print(str);
|
||||
if (sz > 0)
|
||||
{
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
MY_SERIALDEVICE.print(printBuffer);
|
||||
}
|
||||
SERIALDEVICE.println("");
|
||||
MY_SERIALDEVICE.println("");
|
||||
}
|
||||
#else
|
||||
#define DEBUG_SIGNING_PRINTBUF(str, buf, sz)
|
||||
|
||||
@@ -66,7 +66,7 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
#ifdef MY_GATEWAY_FEATURE
|
||||
// prepend debug message to be handled correctly by controller (C_INTERNAL, I_LOG_MESSAGE)
|
||||
snprintf_P(printBuffer, 299, PSTR("0;255;%d;0;%d;"), C_INTERNAL, I_LOG_MESSAGE);
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
MY_SERIALDEVICE.print(printBuffer);
|
||||
#endif
|
||||
for (int i=0; i<sz; i++)
|
||||
{
|
||||
@@ -78,12 +78,12 @@ static void DEBUG_SIGNING_PRINTBUF(const __FlashStringHelper* str, uint8_t* buf,
|
||||
// Truncate message if this is gateway node
|
||||
printBuffer[MY_GATEWAY_MAX_SEND_LENGTH-1-strlen_P((const char*)str)] = '\0';
|
||||
#endif
|
||||
SERIALDEVICE.print(str);
|
||||
MY_SERIALDEVICE.print(str);
|
||||
if (sz > 0)
|
||||
{
|
||||
SERIALDEVICE.print(printBuffer);
|
||||
MY_SERIALDEVICE.print(printBuffer);
|
||||
}
|
||||
SERIALDEVICE.println("");
|
||||
MY_SERIALDEVICE.println("");
|
||||
}
|
||||
#else
|
||||
#define DEBUG_SIGNING_PRINTBUF(str, buf, sz)
|
||||
|
||||
Reference in New Issue
Block a user