Harmonize debug outputs (#1002)
This commit is contained in:
+33
-13
@@ -166,16 +166,18 @@
|
||||
/** @}*/ // End of SerialDebugGrpPub group
|
||||
|
||||
/**
|
||||
* @defgroup RadioSettingGrpPub Radio selection
|
||||
* @ingroup MyConfigGrp
|
||||
* @brief These options control what radio type to use and various radio specific customisations.
|
||||
* @{
|
||||
* @def MY_DEBUG_VERBOSE_OTA_UPDATE
|
||||
* @brief Define this for verbose debug prints related to FOTA updates.
|
||||
*/
|
||||
//#define MY_DEBUG_VERBOSE_OTA_UPDATE
|
||||
|
||||
// Define or uncomment MY_OTA_USE_I2C_EEPROM below if you want I2C EEPROM instead
|
||||
// of a SPI flash. Used EEPROM needs to be large enough, an 24(L)C256 will do as minimum.
|
||||
// HW I2C assumed. This will exclude the SPI flash code.
|
||||
// Note that you also need an updated DualOptiboot supporting I2C EEPROM!
|
||||
/**
|
||||
* @def MY_OTA_USE_I2C_EEPROM
|
||||
* @brief Define this if you want I2C EEPROM instead
|
||||
* of a SPI flash. Used EEPROM needs to be large enough, an 24(L)C256 will do as minimum.
|
||||
* HW I2C assumed. This will exclude the SPI flash code.
|
||||
* Note that you also need an updated DualOptiboot supporting I2C EEPROM!
|
||||
*/
|
||||
//#define MY_OTA_USE_I2C_EEPROM
|
||||
|
||||
#ifdef MY_OTA_USE_I2C_EEPROM
|
||||
@@ -185,6 +187,15 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup RadioSettingGrpPub Radio selection
|
||||
* @ingroup MyConfigGrp
|
||||
* @brief These options control what radio type to use and various radio specific customisations.
|
||||
* @{
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup RS485SettingGrpPub RS485
|
||||
* @ingroup RadioSettingGrpPub
|
||||
@@ -1326,6 +1337,13 @@
|
||||
//#define MY_GATEWAY_ESP8266
|
||||
//#define MY_GATEWAY_LINUX
|
||||
|
||||
|
||||
/**
|
||||
* @def MY_DEBUG_VERBOSE_GATEWAY
|
||||
* @brief Define this for verbose debug prints related to the gateway transport.
|
||||
*/
|
||||
//#define MY_DEBUG_VERBOSE_GATEWAY
|
||||
|
||||
/**
|
||||
* @def MY_PORT
|
||||
* @brief The Ethernet TCP/UDP port to open on controller or gateway.
|
||||
@@ -1777,10 +1795,11 @@
|
||||
// standard debug output
|
||||
#define MY_DEBUG_VERBOSE_CORE //!< MY_DEBUG_VERBOSE_CORE
|
||||
#define MY_DEBUG_VERBOSE_TRANSPORT //!< MY_DEBUG_VERBOSE_TRANSPORT
|
||||
#define MY_DEBUG_VERBOSE_OTA_UPDATE //!< MY_DEBUG_VERBOSE_OTA_UPDATE
|
||||
#define MY_DEBUG_VERBOSE_GATEWAY //!< MY_DEBUG_VERBOSE_GATEWAY
|
||||
#define MY_DEBUG_VERBOSE_OTA_UPDATE //!< MY_DEBUG_VERBOSE_OTA_UPDATE
|
||||
#endif
|
||||
|
||||
#if defined(MY_DEBUG) || defined(MY_DEBUG_VERBOSE_CORE) || defined(MY_DEBUG_VERBOSE_TRANSPORT) || defined(MY_DEBUG_VERBOSE_SIGNING) || defined(MY_DEBUG_VERBOSE_OTA_UPDATE) || defined(MY_DEBUG_VERBOSE_RF24) || defined(MY_DEBUG_VERBOSE_NRF5_ESB) || defined(MY_DEBUG_VERBOSE_RFM69) || defined(MY_DEBUG_VERBOSE_RFM95)
|
||||
#if defined(MY_DEBUG) || defined(MY_DEBUG_VERBOSE_CORE) || defined(MY_DEBUG_VERBOSE_TRANSPORT) || defined(MY_DEBUG_VERBOSE_GATEWAY) || defined(MY_DEBUG_VERBOSE_SIGNING) || defined(MY_DEBUG_VERBOSE_OTA_UPDATE) || defined(MY_DEBUG_VERBOSE_RF24) || defined(MY_DEBUG_VERBOSE_NRF5_ESB) || defined(MY_DEBUG_VERBOSE_RFM69) || defined(MY_DEBUG_VERBOSE_RFM95)
|
||||
#define DEBUG_OUTPUT_ENABLED //!< DEBUG_OUTPUT_ENABLED
|
||||
#ifndef MY_DEBUG_OTA
|
||||
#define DEBUG_OUTPUT(x,...) hwDebugPrint(x, ##__VA_ARGS__) //!< debug
|
||||
@@ -1804,9 +1823,6 @@
|
||||
#define DEBUG_OUTPUT(x,...) //!< debug NULL
|
||||
#endif
|
||||
|
||||
// transport layer files
|
||||
#define debug(x,...) DEBUG_OUTPUT(x, ##__VA_ARGS__) //!< debug
|
||||
|
||||
// temp. workaround for nRF5 verifier: redirect RF24 to NRF_ESB
|
||||
#if defined(ARDUINO_ARCH_NRF5) && (defined(MY_RADIO_RF24) || defined(MY_RADIO_NRF24) )
|
||||
#undef MY_RADIO_RF24
|
||||
@@ -1908,6 +1924,7 @@
|
||||
// core
|
||||
#define MY_CORE_ONLY
|
||||
// GW
|
||||
#define MY_DEBUG_VERBOSE_GATEWAY
|
||||
#define MY_INCLUSION_BUTTON_EXTERNAL_PULLUP
|
||||
#define MY_GATEWAY_W5100
|
||||
#define MY_GATEWAY_ENC28J60
|
||||
@@ -1930,6 +1947,9 @@
|
||||
#define MY_DEBUG_VERBOSE_SIGNING
|
||||
#define MY_SIGNING_FEATURE
|
||||
#define MY_ENCRYPTION_FEATURE
|
||||
// FOTA update
|
||||
#define MY_DEBUG_VERBOSE_OTA_UPDATE
|
||||
#define MY_OTA_USE_I2C_EEPROM
|
||||
// RS485
|
||||
#define MY_RS485
|
||||
#define MY_RS485_HWSERIAL (Serial1)
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
|
||||
#define MSG_GW_STARTUP_COMPLETE "Gateway startup complete."
|
||||
|
||||
// debug output
|
||||
#if defined(MY_DEBUG_VERBOSE_GATEWAY)
|
||||
#define GATEWAY_DEBUG(x,...) DEBUG_OUTPUT(x, ##__VA_ARGS__) //!< debug
|
||||
#else
|
||||
#define GATEWAY_DEBUG(x,...) //!< debug NULL
|
||||
#endif
|
||||
|
||||
// Common gateway functions
|
||||
|
||||
void gatewayTransportProcess(void);
|
||||
|
||||
@@ -132,10 +132,9 @@ bool gatewayTransportInit(void)
|
||||
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD, 0, MY_ESP8266_BSSID);
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
wait(500);
|
||||
MY_SERIALDEVICE.print(F("."));
|
||||
GATEWAY_DEBUG(PSTR("."));
|
||||
}
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(WiFi.localIP());
|
||||
GATEWAY_DEBUG(PSTR("IP: %s\n"), WiFi.localIP().toString().c_str());
|
||||
#endif /* End of MY_ESP8266_SSID */
|
||||
#elif defined(MY_GATEWAY_LINUX) /* Elif part of MY_GATEWAY_ESP8266 */
|
||||
// Nothing to do here
|
||||
@@ -148,13 +147,13 @@ bool gatewayTransportInit(void)
|
||||
#else /* Else part of MY_IP_GATEWAY_ADDRESS && MY_IP_SUBNET_ADDRESS */
|
||||
// Get IP address from DHCP
|
||||
if (!Ethernet.begin(_ethernetGatewayMAC)) {
|
||||
MY_SERIALDEVICE.print(F("DHCP FAILURE..."));
|
||||
GATEWAY_DEBUG(PSTR("DHCP FAILURE..."));
|
||||
_w5100_spi_en(false);
|
||||
return false;
|
||||
}
|
||||
#endif /* End of MY_IP_GATEWAY_ADDRESS && MY_IP_SUBNET_ADDRESS */
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(Ethernet.localIP());
|
||||
GATEWAY_DEBUG(PSTR("IP: %" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\n"), Ethernet.localIP()[0],
|
||||
Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
|
||||
// give the Ethernet interface a second to initialize
|
||||
delay(1000);
|
||||
#endif /* End of MY_GATEWAY_ESP8266 */
|
||||
@@ -171,14 +170,14 @@ bool gatewayTransportInit(void)
|
||||
#else
|
||||
if (client.connect(_ethernetControllerIP, MY_PORT)) {
|
||||
#endif /* End of MY_CONTROLLER_URL_ADDRESS */
|
||||
debug(PSTR("Eth: connect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: connect\n"));
|
||||
_w5100_spi_en(false);
|
||||
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set(MSG_GW_STARTUP_COMPLETE));
|
||||
_w5100_spi_en(true);
|
||||
presentNode();
|
||||
} else {
|
||||
client.stop();
|
||||
debug(PSTR("Eth: Failed to connect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: Failed to connect\n"));
|
||||
}
|
||||
#endif /* End of MY_USE_UDP */
|
||||
#else /* Else part of MY_GATEWAY_CLIENT_MODE */
|
||||
@@ -220,14 +219,14 @@ bool gatewayTransportSend(MyMessage &message)
|
||||
#else
|
||||
if (client.connect(_ethernetControllerIP, MY_PORT)) {
|
||||
#endif /* End of MY_CONTROLLER_URL_ADDRESS */
|
||||
debug(PSTR("Eth: connect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: connect\n"));
|
||||
_w5100_spi_en(false);
|
||||
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set(MSG_GW_STARTUP_COMPLETE));
|
||||
_w5100_spi_en(true);
|
||||
presentNode();
|
||||
} else {
|
||||
// connecting to the server failed!
|
||||
debug(PSTR("Eth: Failed to connect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: Failed to connect\n"));
|
||||
_w5100_spi_en(false);
|
||||
return false;
|
||||
}
|
||||
@@ -263,7 +262,7 @@ bool _readFromClient(uint8_t i)
|
||||
if (inChar == '\n' || inChar == '\r') {
|
||||
// Add string terminator and prepare for the next message
|
||||
inputString[i].string[inputString[i].idx] = 0;
|
||||
debug(PSTR("Client %" PRIu8 ": %s\n"), i, inputString[i].string);
|
||||
GATEWAY_DEBUG(PSTR("Client %" PRIu8 ": %s\n"), i, inputString[i].string);
|
||||
inputString[i].idx = 0;
|
||||
if (protocolParse(_ethernetMsg, inputString[i].string)) {
|
||||
return true;
|
||||
@@ -275,7 +274,7 @@ bool _readFromClient(uint8_t i)
|
||||
}
|
||||
} else {
|
||||
// Incoming message too long. Throw away
|
||||
debug(PSTR("Client %" PRIu8 ": Message too long\n"), i);
|
||||
GATEWAY_DEBUG(PSTR("Client %" PRIu8 ": Message too long\n"), i);
|
||||
inputString[i].idx = 0;
|
||||
// Finished with this client's message. Next loop() we'll see if there's more to read.
|
||||
break;
|
||||
@@ -293,7 +292,7 @@ bool _readFromClient(void)
|
||||
if (inChar == '\n' || inChar == '\r') {
|
||||
// Add string terminator and prepare for the next message
|
||||
inputString.string[inputString.idx] = 0;
|
||||
debug(PSTR("Eth: %s\n"), inputString.string);
|
||||
GATEWAY_DEBUG(PSTR("Eth: %s\n"), inputString.string);
|
||||
inputString.idx = 0;
|
||||
if (protocolParse(_ethernetMsg, inputString.string)) {
|
||||
return true;
|
||||
@@ -305,7 +304,7 @@ bool _readFromClient(void)
|
||||
}
|
||||
} else {
|
||||
// Incoming message too long. Throw away
|
||||
debug(PSTR("Eth: Message too long\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: Message too long\n"));
|
||||
inputString.idx = 0;
|
||||
// Finished with this client's message. Next loop() we'll see if there's more to read.
|
||||
break;
|
||||
@@ -329,10 +328,10 @@ bool gatewayTransportAvailable(void)
|
||||
int packet_size = _ethernetServer.parsePacket();
|
||||
|
||||
if (packet_size) {
|
||||
//debug(PSTR("UDP packet available. Size:%" PRIu8 "\n"), packet_size);
|
||||
//GATEWAY_DEBUG(PSTR("UDP packet available. Size:%" PRIu8 "\n"), packet_size);
|
||||
_ethernetServer.read(inputString.string, MY_GATEWAY_MAX_RECEIVE_LENGTH);
|
||||
inputString.string[packet_size] = 0;
|
||||
debug(PSTR("UDP packet received: %s\n"), inputString.string);
|
||||
GATEWAY_DEBUG(PSTR("UDP packet received: %s\n"), inputString.string);
|
||||
_w5100_spi_en(false);
|
||||
const bool ok = protocolParse(_ethernetMsg, inputString.string);
|
||||
if (ok) {
|
||||
@@ -348,13 +347,13 @@ bool gatewayTransportAvailable(void)
|
||||
#else
|
||||
if (client.connect(_ethernetControllerIP, MY_PORT)) {
|
||||
#endif /* End of MY_CONTROLLER_URL_ADDRESS */
|
||||
debug(PSTR("Eth: connect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: connect\n"));
|
||||
_w5100_spi_en(false);
|
||||
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set(MSG_GW_STARTUP_COMPLETE));
|
||||
_w5100_spi_en(true);
|
||||
presentNode();
|
||||
} else {
|
||||
debug(PSTR("Eth: Failed to connect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: Failed to connect\n"));
|
||||
_w5100_spi_en(false);
|
||||
return false;
|
||||
}
|
||||
@@ -373,14 +372,14 @@ bool gatewayTransportAvailable(void)
|
||||
for (uint8_t i = 0; i < ARRAY_SIZE(clients); i++) {
|
||||
if (!clients[i].connected()) {
|
||||
if (clientsConnected[i]) {
|
||||
debug(PSTR("Client %" PRIu8 " disconnected\n"), i);
|
||||
GATEWAY_DEBUG(PSTR("Client %" PRIu8 " disconnected\n"), i);
|
||||
clients[i].stop();
|
||||
}
|
||||
//check if there are any new clients
|
||||
if (_ethernetServer.hasClient()) {
|
||||
clients[i] = _ethernetServer.available();
|
||||
inputString[i].idx = 0;
|
||||
debug(PSTR("Client %" PRIu8 " connected\n"), i);
|
||||
GATEWAY_DEBUG(PSTR("Client %" PRIu8 " connected\n"), i);
|
||||
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set(MSG_GW_STARTUP_COMPLETE));
|
||||
// Send presentation of locally attached sensors (and node if applicable)
|
||||
presentNode();
|
||||
@@ -392,7 +391,7 @@ bool gatewayTransportAvailable(void)
|
||||
}
|
||||
if (allSlotsOccupied && _ethernetServer.hasClient()) {
|
||||
//no free/disconnected spot so reject
|
||||
debug(PSTR("No free slot available\n"));
|
||||
GATEWAY_DEBUG(PSTR("No free slot available\n"));
|
||||
EthernetClient c = _ethernetServer.available();
|
||||
c.stop();
|
||||
}
|
||||
@@ -412,7 +411,7 @@ bool gatewayTransportAvailable(void)
|
||||
if (client != newclient) {
|
||||
client.stop();
|
||||
client = newclient;
|
||||
debug(PSTR("Eth: connect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: connect\n"));
|
||||
_w5100_spi_en(false);
|
||||
gatewayTransportSend(buildGw(_msgTmp, I_GATEWAY_READY).set(MSG_GW_STARTUP_COMPLETE));
|
||||
_w5100_spi_en(true);
|
||||
@@ -421,7 +420,7 @@ bool gatewayTransportAvailable(void)
|
||||
}
|
||||
if (client) {
|
||||
if (!client.connected()) {
|
||||
debug(PSTR("Eth: disconnect\n"));
|
||||
GATEWAY_DEBUG(PSTR("Eth: disconnect\n"));
|
||||
client.stop();
|
||||
} else {
|
||||
if (_readFromClient()) {
|
||||
@@ -461,7 +460,7 @@ void gatewayTransportRenewIP(void)
|
||||
return;
|
||||
}
|
||||
if (Ethernet.maintain() & ~(0x06)) {
|
||||
debug(PSTR("IP was not renewed correctly\n"));
|
||||
GATEWAY_DEBUG(PSTR("IP was not renewed correctly\n"));
|
||||
/* Error occured -> IP was not renewed */
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ bool gatewayTransportSend(MyMessage &message)
|
||||
}
|
||||
setIndication(INDICATION_GW_TX);
|
||||
char *topic = protocolFormatMQTTTopic(MY_MQTT_PUBLISH_TOPIC_PREFIX, message);
|
||||
debug(PSTR("Sending message on topic: %s\n"), topic);
|
||||
GATEWAY_DEBUG(PSTR("Sending message on topic: %s\n"), topic);
|
||||
#if defined(MY_MQTT_CLIENT_PUBLISH_RETAIN)
|
||||
bool retain = mGetCommand(message) == C_SET ||
|
||||
(mGetCommand(message) == C_INTERNAL && message.type == I_BATTERY_LEVEL);
|
||||
@@ -75,20 +75,20 @@ bool gatewayTransportSend(MyMessage &message)
|
||||
|
||||
void incomingMQTT(char* topic, uint8_t* payload, unsigned int length)
|
||||
{
|
||||
debug(PSTR("Message arrived on topic: %s\n"), topic);
|
||||
GATEWAY_DEBUG(PSTR("Message arrived on topic: %s\n"), topic);
|
||||
_MQTT_available = protocolMQTTParse(_MQTT_msg, topic, payload, length);
|
||||
}
|
||||
|
||||
bool reconnectMQTT(void)
|
||||
{
|
||||
debug(PSTR("Attempting MQTT connection...\n"));
|
||||
GATEWAY_DEBUG(PSTR("Attempting MQTT connection...\n"));
|
||||
// Attempt to connect
|
||||
if (_MQTT_client.connect(MY_MQTT_CLIENT_ID
|
||||
#if defined(MY_MQTT_USER) && defined(MY_MQTT_PASSWORD)
|
||||
, MY_MQTT_USER, MY_MQTT_PASSWORD
|
||||
#endif
|
||||
)) {
|
||||
debug(PSTR("MQTT connected\n"));
|
||||
GATEWAY_DEBUG(PSTR("MQTT connected\n"));
|
||||
|
||||
// Send presentation of locally attached sensors (and node if applicable)
|
||||
presentNode();
|
||||
@@ -107,10 +107,9 @@ bool gatewayTransportConnect(void)
|
||||
#if defined(MY_GATEWAY_ESP8266)
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
wait(500);
|
||||
MY_SERIALDEVICE.print(F("."));
|
||||
GATEWAY_DEBUG(PSTR("."));
|
||||
}
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(WiFi.localIP());
|
||||
GATEWAY_DEBUG(PSTR("IP: %s\n"),WiFi.localIP().toString().c_str());
|
||||
#elif defined(MY_GATEWAY_LINUX) /* Elif part of MY_GATEWAY_ESP8266 */
|
||||
#if defined(MY_IP_ADDRESS)
|
||||
_MQTT_ethClient.bind(_MQTT_clientIp);
|
||||
@@ -121,13 +120,13 @@ bool gatewayTransportConnect(void)
|
||||
#else /* Else part of MY_IP_ADDRESS */
|
||||
// Get IP address from DHCP
|
||||
if (!Ethernet.begin(_MQTT_clientMAC)) {
|
||||
MY_SERIALDEVICE.print(F("DHCP FAILURE..."));
|
||||
GATEWAY_DEBUG(PSTR("DHCP FAILURE..."));
|
||||
_MQTT_connecting = false;
|
||||
return false;
|
||||
}
|
||||
#endif /* End of MY_IP_ADDRESS */
|
||||
MY_SERIALDEVICE.print(F("IP: "));
|
||||
MY_SERIALDEVICE.println(Ethernet.localIP());
|
||||
GATEWAY_DEBUG(PSTR("IP: %" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\n"), Ethernet.localIP()[0],
|
||||
Ethernet.localIP()[1], Ethernet.localIP()[2], Ethernet.localIP()[3]);
|
||||
// give the Ethernet interface a second to initialize
|
||||
delay(1000);
|
||||
#endif /* End of MY_GATEWAY_ESP8266 */
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
#define MY_OTA_BOOTLOADER_VERSION (MY_OTA_BOOTLOADER_MINOR_VERSION * 256 + MY_OTA_BOOTLOADER_MAJOR_VERSION) //!< Bootloader version
|
||||
|
||||
#if defined(MY_DEBUG_VERBOSE_OTA_UPDATE)
|
||||
#define OTA_DEBUG(x,...) hwDebugPrint(x, ##__VA_ARGS__) //!< debug
|
||||
#define OTA_DEBUG(x,...) DEBUG_OUTPUT(x, ##__VA_ARGS__) //!< debug
|
||||
//#define OTA_EXTRA_FLASH_DEBUG //!< Dumps flash after each FW block
|
||||
#else
|
||||
#define OTA_DEBUG(x,...) //!< debug NULL
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@
|
||||
#define SIGNING_PRESENTATION_REQUIRE_WHITELISTING (1 << 1)
|
||||
|
||||
#if defined(MY_DEBUG_VERBOSE_SIGNING)
|
||||
#define SIGN_DEBUG(x,...) hwDebugPrint(x, ##__VA_ARGS__)
|
||||
#define SIGN_DEBUG(x,...) DEBUG_OUTPUT(x, ##__VA_ARGS__)
|
||||
#else
|
||||
#define SIGN_DEBUG(x,...)
|
||||
#endif
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#define SIGNING_IDENTIFIER (1) //HMAC-SHA256
|
||||
|
||||
#if defined(MY_DEBUG_VERBOSE_SIGNING)
|
||||
#define SIGN_DEBUG(x,...) hwDebugPrint(x, ##__VA_ARGS__)
|
||||
#define SIGN_DEBUG(x,...) DEBUG_OUTPUT(x, ##__VA_ARGS__)
|
||||
static char printStr[65];
|
||||
static char i2h(uint8_t i)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#define SIGNING_IDENTIFIER (1) //HMAC-SHA256
|
||||
|
||||
#if defined(MY_DEBUG_VERBOSE_SIGNING)
|
||||
#define SIGN_DEBUG(x,...) hwDebugPrint(x, ##__VA_ARGS__)
|
||||
#define SIGN_DEBUG(x,...) DEBUG_OUTPUT(x, ##__VA_ARGS__)
|
||||
static char printStr[65];
|
||||
static char i2h(uint8_t i)
|
||||
{
|
||||
|
||||
@@ -66,8 +66,6 @@
|
||||
* Make sure to fill in your ssid and WiFi password below for ssid & pass.
|
||||
*/
|
||||
|
||||
#include <ArduinoOTA.h>
|
||||
|
||||
// Enable debug prints to serial monitor
|
||||
#define MY_DEBUG
|
||||
|
||||
@@ -133,32 +131,33 @@
|
||||
#include <ESP8266WiFi.h>
|
||||
#endif
|
||||
|
||||
#include <ArduinoOTA.h>
|
||||
#include <MySensors.h>
|
||||
|
||||
void setup()
|
||||
{
|
||||
// Setup locally attached sensors
|
||||
ArduinoOTA.onStart([]() {
|
||||
debug("ArduinoOTA start\n");
|
||||
Serial.println("ArduinoOTA start");
|
||||
});
|
||||
ArduinoOTA.onEnd([]() {
|
||||
debug("\nArduinoOTA end\n");
|
||||
Serial.println("\nArduinoOTA end");
|
||||
});
|
||||
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
|
||||
debug("OTA Progress: %u%%\r", (progress / (total / 100)));
|
||||
Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100)));
|
||||
});
|
||||
ArduinoOTA.onError([](ota_error_t error) {
|
||||
debug("Error[%u]: ", error);
|
||||
Serial.printf("Error[%u]: ", error);
|
||||
if (error == OTA_AUTH_ERROR) {
|
||||
debug("Auth Failed\n");
|
||||
Serial.println("Auth Failed");
|
||||
} else if (error == OTA_BEGIN_ERROR) {
|
||||
debug("Begin Failed\n");
|
||||
Serial.println("Begin Failed");
|
||||
} else if (error == OTA_CONNECT_ERROR) {
|
||||
debug("Connect Failed\n");
|
||||
Serial.println("Connect Failed");
|
||||
} else if (error == OTA_RECEIVE_ERROR) {
|
||||
debug("Receive Failed\n");
|
||||
Serial.println("Receive Failed");
|
||||
} else if (error == OTA_END_ERROR) {
|
||||
debug("End Failed\n");
|
||||
Serial.println("End Failed");
|
||||
}
|
||||
});
|
||||
ArduinoOTA.begin();
|
||||
|
||||
Reference in New Issue
Block a user