Skip to content

Commit

Permalink
Add option to disable status messages
Browse files Browse the repository at this point in the history
  • Loading branch information
gmag11 committed Feb 4, 2021
1 parent 025609a commit a3e0439
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/EnigmaIOTGatewayMQTT/EnigmaIOTGatewayMQTT.ino
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,15 @@ void processRxData (uint8_t* mac, uint8_t* buffer, uint8_t length, uint16_t lost
GwOutput.outputDataSend (nodeName ? nodeName : mac_str, payload, pld_size, GwOutput_data_type::lostmessages);
DEBUG_INFO ("Published MQTT from %s: %s", nodeName ? nodeName : mac_str, payload);
}
#if ENABLE_STATUS_MESSAGES
pld_size = snprintf (payload, PAYLOAD_SIZE, "{\"per\":%e,\"lostmessages\":%u,\"totalmessages\":%u,\"packetshour\":%.2f}",
EnigmaIOTGateway.getPER ((uint8_t*)mac),
EnigmaIOTGateway.getErrorPackets ((uint8_t*)mac),
EnigmaIOTGateway.getTotalPackets ((uint8_t*)mac),
EnigmaIOTGateway.getPacketsHour ((uint8_t*)mac));
GwOutput.outputDataSend (nodeName ? nodeName : mac_str, payload, pld_size, GwOutput_data_type::status);
DEBUG_INFO ("Published MQTT from %s: %s", nodeName ? nodeName : mac_str, payload);
#endif
}

void onDownlinkData (uint8_t* address, char* nodeName, control_message_type_t msgType, char* data, unsigned int len) {
Expand Down
1 change: 1 addition & 0 deletions src/EnigmaIoTconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static const int RESET_PIN_DURATION = 5000; ///< @brief Number of milliseconds t
static const unsigned int MAX_KEY_VALIDITY = 86400000U; ///< @brief After this time (in ms) a node is unregistered. Setting this to 0 means imfinite
static const unsigned int MAX_NODE_INACTIVITY = 86400000U; ///< @brief After this time (in ms) a node is marked as gone. Setting this to 0 means imfinite
static const size_t MAX_MQTT_QUEUE_SIZE = 3; ///< @brief Maximum number of MQTT messages to be sent
#define ENABLE_STATUS_MESSAGES 1 ///< @brief Enable sending status message after every data message
static const int RATE_AVE_ORDER = 5; ///< @brief Message rate filter order
static const int MAX_INPUT_QUEUE_SIZE = 3; ///< @brief Input queue size for EnigmaIOT messages. Acts as a buffer to be able to handle messages during high load
#ifndef NUM_NODES
Expand Down

0 comments on commit a3e0439

Please sign in to comment.