Home › Forums › Mayfly Data Logger › RS485 without auto direction control › Reply To: RS485 without auto direction control
Finally some progress when I got some help.
In the modified ThingsSpeak sketch the constructor was the problem.
YosemitechY504 y504_1(y504ModbusAddress1, modbusSerial, modbusSensorPower, max485EnablePin, y504NumberReadings); -> did not work
YosemitechY504 y504_2(y504ModbusAddress2, modbusSerial, rs485AdapterPower, modbusSensorPower, max485EnablePin, y504NumberReadings);->Works. I don’t know how I lost one of the power pins but that explains why it worked better from the beginning.
Back to the original problem…
The logger crashes if I set the EnablePin to >0 and don’t set the -D MS_YOSEMITECHPARENT_DEBUG flag
In setup the program enters and don’t return from varArray.setupSensors();
In YosemitechParent.ccp (line 67-69) the debugStream is null if not in debug.
1 2 3 |
#ifdef MS_YOSEMITECHPARENT_DEBUG_DEEP sensor.setDebugStream(&DEEP_DEBUGGING_SERIAL_OUTPUT); #endif |
In SensorModbusMaster (line 683-690) it ends up with the null pointer
1 2 3 4 5 6 7 8 9 10 |
// This flips the device/receive enable to RECIEVER so the sensor can send text void modbusMaster::recieverEnable(void) { if (_enablePin >= 0) { digitalWrite(_enablePin, LOW); _debugStream->println("RS485 Receiver/Slave Tx Enabled"); // delay(8); } } |