Gateway.cpp now compiles,

Ethernet gateway fits in memory with debug enabled. :)
This commit is contained in:
Henrik Ekblad
2014-05-16 15:13:56 +02:00
parent 891c826a0c
commit 8e07382d74
4 changed files with 14 additions and 12 deletions
+1 -1
View File
@@ -12,6 +12,6 @@
/***
* Enable/Disable debug logging
*/
//#define DEBUG
#define DEBUG
#endif
+10 -8
View File
@@ -11,6 +11,7 @@
#include "MyGateway.h"
MyGateway::MyGateway(uint8_t _cepin, uint8_t _cspin, uint8_t _inclusion_time) : MySensor(_cepin, _cspin) {
ledMode = false;
inclusionTime = _inclusion_time;
@@ -37,8 +38,8 @@ void MyGateway::begin(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e da
useWriteCallback = false;
}
s.nodeId = 0;
s.distance = 0;
nc.nodeId = 0;
nc.distance = 0;
inclusionMode = 0;
buttonTriggeredInclusion = false;
countRx = 0;
@@ -93,11 +94,6 @@ void MyGateway::checkButtonTriggeredInclusion() {
serial(PSTR("0;0;%d;%d;Inclusion started by button.\n"), C_INTERNAL, I_LOG_MESSAGE);
buttonTriggeredInclusion = false;
setInclusionMode(true);
#ifdef DEBUG
sendChildren();
#endif
}
}
@@ -154,7 +150,13 @@ void MyGateway::parseAndSend(char *commandBuffer) {
}
} else {
txBlink(1);
ok = sendRoute(msg.build(GATEWAY_ADDRESS, destination, sensor, command, type).set(value));
msg.sender = GATEWAY_ADDRESS;
msg.destination = destination;
msg.sensor = sensor;
msg.type = type;
mSetCommand(msg,command);
msg.set(value);
ok = sendRoute(msg);
if (!ok) {
errBlink(1);
}
+1 -1
View File
@@ -154,7 +154,7 @@ void MySensor::findParentNode() {
boolean MySensor::sendRoute(MyMessage message) {
// Make sure to process any incoming messages before sending (could this end up in recursive loop?)
process();
// process();
// If we still don't have any node id, re-request and skip this message.
if (nc.nodeId == AUTO && !(mGetCommand(message) == C_INTERNAL && message.type == I_REQUEST_ID)) {
+2 -2
View File
@@ -204,6 +204,8 @@ class MySensor : public RF24
NodeConfig nc; // Essential settings for node to work
ControllerConfig cc; // Configuration coming from controller
boolean relayMode;
MyMessage msg; // Buffer for incoming messages.
MyMessage ack; // Buffer for ack messages.
void setupRelayMode();
void setupRadio(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate);
@@ -214,8 +216,6 @@ class MySensor : public RF24
private:
uint8_t failedTransmissions;
uint8_t *childNodeTable; // In memory buffer for routing information to other nodes. also stored in EEPROM
MyMessage msg; // Buffer for incoming messages.
MyMessage ack; // Buffer for ack messages.
void (*timeCallback)(unsigned long); // Callback for requested time messages
void (*msgCallback)(MyMessage); // Callback for incoming messages from other nodes and gateway.