Hi,
i've provide some changes and ended on 88%, however it is still not working.
To find out what is going on, i've split code for the part related to mySensors and the one with LCD. I spot that there is something wrong with mySensors part.
The code started two or three times and now it is not working at all.
There is no prints on serial at all. The debug looks as below.
Have no clue what is going on:(
The code looks now as follow:
// Enable debug prints to serial monitor
#define MY_SPLASH_SCREEN_DISABLED
#define MY_SERIAL_OUTPUT_SIZE (60u)
//#define MY_DEBUG
// Enable and select radio type attached
#define MY_RADIO_NRF24
#define MY_NODE_ID 253
#include <SPI.h>
#include <MySensors.h>
#include <Wire.h>
#include <TimeLib.h>
const byte LCD1_CHILD_ID = 8 ; // LCD line 1
const byte LCD2_CHILD_ID = 9 ; // LCD line 2
const byte LCD3_CHILD_ID = 7 ; // LCD line 3
char lastLCD1[7] = "Line1"; // define & init before first receive
char lastLCD2[7] = "Line2";
char lastLCD3[7] = "Line3";
uint32_t ActTime = 0, DispTime=0;
// timers for loop delays
unsigned long lastUpdate=0, lastRequest=0;
// Initialize messages for sensor network
MyMessage textMsg(0, V_TEXT);
void setup(void){
Serial.begin(115200);
Serial.println(F("Sensor Started"));
}
void presentation()
{
// Send the sketch version information to the gateway and Controller
sendSketchInfo("V_TEXT LCD Sensor", "1.1");
Serial.println(F("presentantion"));
present(LCD1_CHILD_ID, S_INFO, "Text Line 1");
present(LCD2_CHILD_ID, S_INFO, "Text Line 2");
present(LCD3_CHILD_ID, S_INFO, "Text_Line_3");
// Initializations
requestTime(); // get the time from controller (handled by receiveTime)
request(LCD1_CHILD_ID, V_TEXT, 0); // request latest value from controller
request(LCD2_CHILD_ID, V_TEXT, 0); // request latest value from controller
request(LCD3_CHILD_ID, V_TEXT, 0); // request latest value from controller
}
void loop()
{
// timer for loop delays
unsigned long now = millis();
// }// request time and latest value every 15 minutes from controller
if (now-lastRequest > 15*60000)
{
requestTime();
lastRequest = now;
// Serial.println(F("request time from controler"));
request(LCD1_CHILD_ID, V_TEXT, 0); // request latest value from controller
request(LCD2_CHILD_ID, V_TEXT, 0); // request latest value from controller
request(LCD3_CHILD_ID, V_TEXT, 0); // request latest value from controller
}
// Update display every second
if (now-lastUpdate > 1000) {
LCD_local_display();
lastUpdate = now;
}
}
// This is called when a new time value was received
void receiveTime(uint32_t controllerTime)
{
ActTime = controllerTime;
}
void LCD_local_display()
{
// take care of LCD display information
char buf[20];
// display.clearDisplay();
DispTime=ActTime + (millis()-lastRequest)/10000;
if (ActTime!=0) {
// start with location & time on first line
snprintf(buf, sizeof buf, "%02d:%02d:%02d %02d-%02d-%04d", hour(DispTime), minute(DispTime), second(DispTime), day(DispTime), month(DispTime),year(DispTime));
}
Serial.println(buf);
Serial.println(F("Dom: "));
Serial.println(lastLCD1);
Serial.println(lastLCD3);
Serial.println(lastLCD2);
}
void receive(const MyMessage &message)
{
if (message.type!=V_TEXT) // Text messages only
return;
if (message.sensor == LCD1_CHILD_ID ) {
snprintf(lastLCD1, sizeof(lastLCD1), "%5s", message.getString()); // load text into LCD string
}
else if (message.sensor == LCD2_CHILD_ID) {
snprintf(lastLCD2, sizeof(lastLCD2), "%5s", message.getString());
}
else if (message.sensor == LCD3_CHILD_ID) {
snprintf(lastLCD3, sizeof(lastLCD3), "%5s", message.getString());
}
}
and debug is repeating all the time like this:
18:12:27.468 -> 0 MCO:BGN:INIT NODE,CP=RNNNA---,FQ=16,REL=255,VER=2.3.2
18:12:27.468 -> 4 TSM:INIT
18:12:27.468 -> 5 TSF:WUR:MS=0
18:12:27.468 -> 12 TSM:INIT:TSP OK
18:12:27.468 -> 13 TSM:INIT:STATID=253
18:12:27.468 -> 16 TSF:SID:OK,ID=253
18:12:27.468 -> 17 TSM:FPAR
18:12:29.274 -> 1832 ?TSF:MSG:SEND,253-253-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,f3840 !TSM:FPAR:NO REPLY
18:12:31.292 -> 3842 TSM:FPAR
18:12:33.098 -> 5657 ?TSF:MSG:SEND,253-253-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,f7664 !TSM:FPAR:NO REPLY
18:12:35.115 -> 7666 TSM:FPAR
18:12:36.923 -> 9482 ?TSF:MSG:SEND,253-253-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,f11489 !TSM:FPAR:NO REPLY
18:12:38.938 -> 11491 TSM:FPAR
18:12:40.746 -> 13307 ?TSF:MSG:SEND,253-253-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,f15315 !TSM:FPAR:FAIL
18:12:42.762 -> 15318 TSM:FAIL:CNT=1
18:12:42.762 -> 15320 TSM:FAIL:DIS
18:12:42.762 -> 15322 TSF:TDI:TSL
18:12:52.756 -> 25325 TSM:FAIL:RE-INIT
18:12:52.756 -> 25327 TSM:INIT
18:12:52.756 -> 25333 TSM:INIT:TSP OK
18:12:52.756 -> 25335 TSM:INIT:STATID=253
18:12:52.756 -> 25338 TSF:SID:OK,ID=253
18:12:52.756 -> 25340 TSM:FPAR