Serial protocol changed to allowing controller to know if an incoming message is a ack. Outgoing and incoming serial messages now also have the same parameter count.
radioId;childId;messageType;ack;subType;payload\n Where ack parameter means the following: outgoing: 0 = unacknoledged message, 1 = request ack from destination node Incoming: 0= normal message, 1=This is an ack message
This commit is contained in:
@@ -74,7 +74,7 @@ void MyGateway::begin(rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e da
|
|||||||
RF24::startListening();
|
RF24::startListening();
|
||||||
|
|
||||||
// Send startup log message on serial
|
// Send startup log message on serial
|
||||||
serial(PSTR("0;0;%d;%d;Arduino startup complete.\n"), C_INTERNAL, I_LOG_MESSAGE);
|
serial(PSTR("0;0;%d;0;%d;Arduino startup complete.\n"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ void MyGateway::checkButtonTriggeredInclusion() {
|
|||||||
if (buttonTriggeredInclusion) {
|
if (buttonTriggeredInclusion) {
|
||||||
// Ok, someone pressed the inclusion button on the gateway
|
// Ok, someone pressed the inclusion button on the gateway
|
||||||
// start inclusion mode for 1 munute.
|
// start inclusion mode for 1 munute.
|
||||||
serial(PSTR("0;0;%d;%d;Inclusion started by button.\n"), C_INTERNAL, I_LOG_MESSAGE);
|
serial(PSTR("0;0;%d;0;%d;Inclusion started by button.\n"), C_INTERNAL, I_LOG_MESSAGE);
|
||||||
buttonTriggeredInclusion = false;
|
buttonTriggeredInclusion = false;
|
||||||
setInclusionMode(true);
|
setInclusionMode(true);
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ void MyGateway::parseAndSend(char *commandBuffer) {
|
|||||||
// Handle messages directed to gateway
|
// Handle messages directed to gateway
|
||||||
if (type == I_VERSION) {
|
if (type == I_VERSION) {
|
||||||
// Request for version
|
// Request for version
|
||||||
serial(PSTR("0;0;%d;%d;%s\n"),C_INTERNAL, I_VERSION, LIBRARY_VERSION);
|
serial(PSTR("0;0;%d;0;%d;%s\n"),C_INTERNAL, I_VERSION, LIBRARY_VERSION);
|
||||||
} else if (type == I_INCLUSION_MODE) {
|
} else if (type == I_INCLUSION_MODE) {
|
||||||
// Request to change inclusion mode
|
// Request to change inclusion mode
|
||||||
setInclusionMode(atoi(value) == 1);
|
setInclusionMode(atoi(value) == 1);
|
||||||
@@ -202,7 +202,7 @@ void MyGateway::setInclusionMode(boolean newMode) {
|
|||||||
if (newMode != inclusionMode)
|
if (newMode != inclusionMode)
|
||||||
inclusionMode = newMode;
|
inclusionMode = newMode;
|
||||||
// Send back mode change on serial line to ack command
|
// Send back mode change on serial line to ack command
|
||||||
serial(PSTR("0;0;%d;%d;%d\n"), C_INTERNAL, I_INCLUSION_MODE, inclusionMode?1:0);
|
serial(PSTR("0;0;%d;0;%d;%d\n"), C_INTERNAL, I_INCLUSION_MODE, inclusionMode?1:0);
|
||||||
|
|
||||||
if (inclusionMode) {
|
if (inclusionMode) {
|
||||||
inclusionStartTime = millis();
|
inclusionStartTime = millis();
|
||||||
@@ -239,7 +239,7 @@ void MyGateway::serial(const char *fmt, ... ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MyGateway::serial(MyMessage &msg) {
|
void MyGateway::serial(MyMessage &msg) {
|
||||||
serial(PSTR("%d;%d;%d;%d;%s\n"),msg.sender, msg.sensor, mGetCommand(msg), msg.type, msg.getString(convBuf));
|
serial(PSTR("%d;%d;%d;%d;%d;%s\n"),msg.sender, msg.sensor, mGetCommand(msg), mGetAck(msg), msg.type, msg.getString(convBuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user