Use _msgTmp when building messages
This commit is contained in:
@@ -19,6 +19,10 @@
|
||||
|
||||
#include "MyGatewayTransport.h"
|
||||
|
||||
// global variables
|
||||
extern MyMessage _msgTmp;
|
||||
|
||||
|
||||
#if defined(MY_CONTROLLER_IP_ADDRESS)
|
||||
IPAddress _ethernetControllerIP(MY_CONTROLLER_IP_ADDRESS);
|
||||
#endif
|
||||
@@ -32,8 +36,6 @@ MyMessage _ethernetMsg;
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
|
||||
|
||||
// gatewayTransportSend(buildGw(_msg, I_GATEWAY_READY).set("Gateway startup complete."));
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char string[MY_GATEWAY_MAX_RECEIVE_LENGTH];
|
||||
@@ -113,7 +115,7 @@ bool gatewayTransportInit() {
|
||||
while (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
delay(500);
|
||||
MY_SERIALDEVICE.print(".");
|
||||
MY_SERIALDEVICE.print(F("."));
|
||||
yield();
|
||||
}
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
@@ -126,7 +128,7 @@ bool gatewayTransportInit() {
|
||||
#else
|
||||
// Get IP address from DHCP
|
||||
if (!Ethernet.begin(_ethernetGatewayMAC)) {
|
||||
MY_SERIALDEVICE.print("DHCP FAILURE...");
|
||||
MY_SERIALDEVICE.print(F("DHCP FAILURE..."));
|
||||
_w5100_spi_en(false);
|
||||
return false;
|
||||
}
|
||||
@@ -300,7 +302,7 @@ bool gatewayTransportAvailable()
|
||||
clients[i] = _ethernetServer.available();
|
||||
inputString[i].idx = 0;
|
||||
debug(PSTR("Client %d connected\n"), i);
|
||||
gatewayTransportSend(buildGw(_msg, I_GATEWAY_READY).set("Gateway startup complete."));
|
||||
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set("Gateway startup complete."));
|
||||
// Send presentation of locally attached sensors (and node if applicable)
|
||||
presentNode();
|
||||
}
|
||||
@@ -333,7 +335,7 @@ bool gatewayTransportAvailable()
|
||||
client = newclient;
|
||||
debug(PSTR("Eth: connect\n"));
|
||||
_w5100_spi_en(false);
|
||||
gatewayTransportSend(buildGw(_msg, I_GATEWAY_READY).set("Gateway startup complete."));
|
||||
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set("Gateway startup complete."));
|
||||
_w5100_spi_en(true);
|
||||
presentNode();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user