@gohan confirmed one of my guesses. I made some further guesses as well. I hard coded a node ID, disabled the uplink check, hard coded a parent ID and defined it as static. All of this seems to have gotten the node to be independent.
One of the consequences of my modifications is that entering "0" or "1" in the terminal no longer has any real effect. Below is the output, including the results of me entering "T" from the serial monitor at the end.
__ __ ____
| \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___
| |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __|
| | | | |_| |___| | __/ | | \__ \ _ | | \__ \
|_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/
|___/ 2.2.0-rc.1
18 MCO:BGN:INIT NODE,CP=RLNNA---,VER=2.2.0-rc.1
28 TSM:INIT
28 TSF:WUR:MS=0
47 TSM:INIT:TSP OK
49 TSM:INIT:STATID=201
51 TSF:SID:OK,ID=201
53 TSM:FPAR
53 TSM:FPAR:STATP=1
55 TSM:ID
57 TSM:ID:OK
59 TSM:UPL:DISABLED
61 TSM:READY:ID=201,PAR=1,DIS=1
15376 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=NACK:0100
32694 !TSF:MSG:SEND,201-201-1-0,s=255,c=0,t=17,pt=0,l=10,sg=0,ft=1,st=NACK:2.2.0-rc.1
48015 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=2,st=NACK:1
65335 !TSF:MSG:SEND,201-201-1-0,s=1,c=0,t=23,pt=0,l=0,sg=0,ft=3,st=NACK:
80656 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=11,pt=0,l=9,sg=0,ft=4,st=NACK:Yang Node
96006 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=12,pt=0,l=4,sg=0,ft=5,st=NACK:v1.0
Yang NodeReady.
96014 MCO:REG:REQ
111357 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=6,st=NACK:2
111366 !TSM:READY:UPL FAIL,STATP
128645 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=NACK:2
145936 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=1,st=NACK:2
163254 !TSF:MSG:SEND,201-201-1-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=2,st=NACK:2
165263 MCO:BGN:STP
Setting node id to: 201.
***Please restart the node for changes to take effect.
165267 MCO:BGN:INIT OK,TSP=1
T received - starting test...
Sending Ping to Ying Node
289431 !TSF:MSG:SEND,201-201-1-200,s=1,c=1,t=24,pt=5,l=4,sg=0,ft=3,st=NACK:274122
Here's is my hacked, diced and sliced version of the sketch. As noted, nothing is changed below void presentation()
/***
* This is a simple sketch used to demenstrate and test node-to-node MySensor's communication.
* To use this sketch, assemble MySensors nodes - they need nothing more than a radio
* 1. Flash each node with the same sketch, open the console and type either 0 or 1 to the respective nodes to set thei ID
* 2. You only need to set the node id once, and restart the nodes
* 3. To being a ping-pong test, simply type T in the console for one of the nodes.
*
* 2015-05-25 Bruce Lacey v1.0
*/
//The Node ID's are hard coded in this sketch, so the option described in #1 above
//of specifying 0 or 1 no longer works. Each node will need to be flahed with the
//correct #define for eith NODE_YING or NODE_YANG
//Which node is this?
//#define NODE_YING
#define NODE_YANG
// Define two generic nodes with a single child
#define YING 200
#define YANG 201
#define CHILD 1
// Enable debug prints to serial monitor
#define MY_DEBUG
//#define MY_SPECIAL_DEBUG
#define MY_TRANSPORT_UPLINK_CHECK_DISABLED //Don't check for uplink
#define MY_NODE_ID 199 //Fallback NodeId
//We don't care about a parent, but this satisfies various demands
//We hard code a parent ID of 1 and say that it's static
//so that the system won't check for one
#define MY_PARENT_NODE_ID 1
#define MY_PARENT_NODE_IS_STATIC
//Override the fallback NodeId
#ifdef NODE_YING
#define MY_NODE_ID YING
#endif
#ifdef NODE_YANG
#define MY_NODE_ID YANG
#endif
// Enable and select radio type attached
//#define MY_RADIO_NRF24
//#define MY_RADIO_NRF5_ESB
//#define MY_RADIO_RFM69
//#define MY_RADIO_RFM95
//RFM95 with various trial settings
#define MY_RFM95_FREQUENCY RFM95_915MHZ
#define MY_RFM95_MODEM_CONFIGRUATION RFM95_BW125CR45SF128
#define MY_RFM95_ATC_MODE_DISABLED
#define MY_RFM95_MAX_POWER_LEVEL_DBM 20
//My nodes are different hardware with different pinouts
#ifdef NODE_YING
#define RFM95_IRQ_PIN 5 // library 2.1.1 = GPIO Pin 9
#define RFM95_RST_PIN 5 // library 2.1.1
#define RFM95_SPI_CS 6 // library 2.1.1
#define MY_RFM95_IRQ_PIN 5 // library 2.2 beta = GPIO
#define MY_RFM95_RST_PIN 5 // library 2.2 beta
#define MY_RFM95_CS_PIN 6 // library 2.2 beta
#endif
#ifdef NODE_YANG
#define RFM95_IRQ_PIN 6 // library 2.1.1
#define RFM95_RST_PIN 9 // library 2.1.1
#define RFM95_SPI_CS 10 // library 2.1.1
#define MY_RFM95_IRQ_PIN 6 // library 2.2 beta = GPIO Pin 6
#define MY_RFM95_RST_PIN 9 // library 2.2 beta
#define MY_RFM95_CS_PIN 10 // library 2.2 beta
#endif
#define MY_RADIO_RFM95
//#define MY_DEBUG_VERBOSE_RFM95
#include <MySensors.h>
#include "MYSLog.h"
#define VSN "v1.0"
MyMessage mPing(CHILD, V_VAR1); //Ping message
MyMessage mPong(CHILD, V_VAR2); //Pong message
void setup()
{
#ifdef NODE_YING
setNodeId(YING);
#endif
#ifdef NODE_YANG
setNodeId(YANG);
#endif
}
//////////////////////////////////////////////
//No changes have been made below this point
//////////////////////////////////////////////
void presentation()
{
present(CHILD, S_CUSTOM); //
sendSketchInfo( nodeTypeAsCharRepresentation( getNodeId() ), VSN );
LOG(F("\n%sReady.\n"), nodeTypeAsCharRepresentation(getNodeId()));
}
void loop()
{
// Interactive command and control
// Entering a number from 0 or 1 will write the node 200 (YING) or 201 (YANG) to EEPROM
// Entering T on either node will initiatve a ping-pong test.
if (Serial.available()) {
byte inChar = Serial.read();
uint8_t node = getNodeId();
// Manual Test Mode
if (inChar == 'T' || inChar == 't') {
LOG(F("T received - starting test...\n"));
MyMessage msg = mPong;
msg.sender = (node == YING ? YANG : YING);
sendPingOrPongResponse( msg );
} else if (inChar == '0' or inChar == '1') {
byte nodeID = 200 + (inChar - '0');
setNodeId(nodeID);
} else {
LOG("Invalid input\n");
}
}
}
void receive(const MyMessage &message)
{
LOG(F("Received %s from %s\n"), msgTypeAsCharRepresentation((mysensor_data)message.type),
nodeTypeAsCharRepresentation(message.sender));
delay(250);
sendPingOrPongResponse( message );
}
void sendPingOrPongResponse( MyMessage msg )
{
MyMessage response = (msg.type == V_VAR1 ? mPong : mPing);
LOG(F("Sending %s to %s\n"), msgTypeAsCharRepresentation( (mysensor_data)response.type ),
nodeTypeAsCharRepresentation(msg.sender));
// Set payload to current time in millis to ensure each message is unique
response.set( (uint32_t)millis() );
response.setDestination(msg.sender);
send(response);
}
void setNodeId(byte nodeID)
{
LOG(F("Setting node id to: %i.\n***Please restart the node for changes to take effect.\n"), nodeID);
hwWriteConfig(EEPROM_NODE_ID_ADDRESS, (byte)nodeID);
}
const char * msgTypeAsCharRepresentation( mysensor_data mType )
{
return mType == V_VAR1 ? "Ping" : "Pong";
}
const char * nodeTypeAsCharRepresentation( uint8_t node )
{
return node == YING ? "Ying Node" : "Yang Node";
}