!MCO:PRO:RC=1
-
Hello
!MCO:PRO:RC=1 what does it mean?
23:24:04.518 -> 710797 TSF:MSG:READ,0-0-31,s=9,c=1,t=24,pt=0,l=2,sg=0:62 23:24:04.518 -> 710802 TSF:MSG:ECHO REQ 23:24:04.518 -> 710806 TSF:MSG:SEND,31-31-0-0,s=9,c=1,t=24,pt=0,l=2,sg=0,ft=0,st=OK:62 23:24:04.518 -> 710814 TSF:MSG:SEND,31-31-0-0,s=10,c=1,t=2,pt=2,l=2,sg=0,ft=0,st=OK:0 23:24:04.518 -> 710820 !MCO:PRO:RC=1 23:24:04.518 -> 710822 !MCO:PRO:RC=1 23:24:04.518 -> 710824 !MCO:PRO:RC=1 23:24:04.518 -> 710827 !MCO:PRO:RC=1 23:24:04.518 -> 710830 TSF:MSG:READ,0-0-31,s=10,c=1,t=2,pt=2,l=2,sg=0:0 23:24:04.518 -> 710835 TSF:MSG:ECHO 23:24:41.714 -> 748047 TSF:MSG:SEND,31-31-0-0,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:51.6 23:24:41.714 -> 748058 TSF:MSG:READ,0-0-31,s=0,c=1,t=0,pt=7,l=5,sg=0:51.6 23:24:41.714 -> 748063 TSF:MSG:ECHO
Thanks for your help
Jean-luc
-
@jlb according to https://github.com/mysensors/MySensors/blob/40f4deb18c49b1eb6b91f59e3602e9f5c56a2a1a/core/MySensorsCore.cpp#L61 a recursive call has been detected.
My guess would be that the sketch is calling send() from within receive(), but there could be lots of other reasons. Could you post the full debug log and the full sketch?
-
@mfalkvidd
actually the sketch calls sense () from the inside of receive ()void receive(const MyMessage &message) { if (message.isAck()) { ack = true; //Serial.println("This is an ack from gateway"); } else { if (message.type == V_VAR1 && message.sensor == child_id_watchdog) { // watchdog watchdog = message.getLong(); // recoit nouvelle valeur watchdog de jeedom toutes les minutes dateDernierChangement = millis(); jeton=!jeton; send_state(10,jeton); } if (message.type == V_STATUS && message.sensor == child_id_salle_manger) { etat_salle_manger = message.getBool(); time_out_salle_manger = millis(); } if (message.type == V_STATUS && message.sensor == child_id_sejour) {
I didn't know you shouldn't do it
I moved it to void loop () and everything works perfectlyvoid receive(const MyMessage &message) { if (message.isAck()) { ack = true; //Serial.println("This is an ack from gateway"); } else { if (message.type == V_VAR1 && message.sensor == child_id_watchdog) { // watchdog watchdog = message.getLong(); // recoit nouvelle valeur watchdog de jeedom toutes les minutes dateDernierChangement = millis(); watchdog_recu=true; // sert pour envoyer jeton a jeedom }
in the void loop() if (watchdog_recu == true) { watchdog_recu = false; jeton=!jeton; send_state(10,jeton); // envoi jeton à jeedom pour indiquer que la comm est ok }
thanks again for your help so fast
I wish you a happy new year from Aix en Provence (France)
Jean-luc
-
Great work @jlb, thanks for reporting back.
Not being able to call send() from within receive() is something that trips up a lot of people. I'd like to find a good way to fix it, but I don't know any good way unfortunately. Adding the MCO:PRO:RC message made it a bit easier to see when the problem happens, but it would be even better if there was a way that made it easier to not make the mistake at all. You are very welcome to share ideas if you have any.
Happy new year to you as well!
-
Hi all,
I've got the same message when call wait(xx);
while (CurrentLevel[SensorID] != toLevel) { CurrentLevel[SensorID] += delta; analogWrite(SensorPIN, (int)(CurrentLevel[SensorID] / 100. * 255)); // delay(FADE_DELAY); wait(FADE_DELAY);
23902 TSF:MSG:READ,0-0-1,s=0,c=1,t=3,pt=0,l=1,sg=0:5 23907 !MCO:PRO:RC=1 23909 !MCO:PRO:RC=1 23911 !MCO:PRO:RC=1 23913 !MCO:PRO:RC=1 23915 !MCO:PRO:RC=1 23916 !MCO:PRO:RC=1 23918 !MCO:PRO:RC=1 23920 !MCO:PRO:RC=1 23922 !MCO:PRO:RC=1 23924 !MCO:PRO:RC=1 23926 !MCO:PRO:RC=1 23928 !MCO:PRO:RC=1 23930 !MCO:PRO:RC=1 23931 !MCO:PRO:RC=1 23933 !MCO:PRO:RC=1 23936 !MCO:PRO:RC=1 23938 !MCO:PRO:RC=1 23940 !MCO:PRO:RC=1 23942 !MCO:PRO:RC=1 23944 !MCO:PRO:RC=1 23946 !MCO:PRO:RC=1 23948 !MCO:PRO:RC=1 23949 !MCO:PRO:RC=1 23951 !MCO:PRO:RC=1 23953 !MCO:PRO:RC=1 23955 !MCO:PRO:RC=1 23957 !MCO:PRO:RC=1
When I replace wait with delay the message doesn't appear.
Why is that?
Regards,
Radi
-
Welcome to the forum @Radi-M
delay() will block processing of any incoming messages. My guess is that the sketch has a call to send() within receive(). By blocking, the recursive call is avoided.
If you post the entire sketch it would be possible to give a definitive answer.
-
Hi mfalkvidd,
Thank you for the prompt response.
The code is the following:
//#define MY_DEBUG #define MY_RADIO_NRF24 #define MY_RX_MESSAGE_BUFFER_FEATURE #define MY_RF24_IRQ_PIN 2 #include <MySensors.h> #include <Bounce2.h> #include <elapsedMillis.h> #define SN "Stairs Wall Lights" #define SV "1.2" #define TopLED_ID 0 #define BottomLED_ID 1 #define TopSwitch_ID 2 #define BottomSwitch_ID 3 #define TopSwitchLev_ID 4 #define BotSwitchLev_ID 5 #define TopLED_PIN 3 #define BottomLED_PIN 5 #define TopSwitch_PIN A3 // External switch 1 #define BottomSwitch_PIN A4 // External switch 2 #define FADE_DELAY 10 // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim) #define Light_On 100 #define Light_Off 0 #define HEARTBEAT_TIME 605000 // 10 minutes #define HEARTBEAT_NO_RETURN 3 uint8_t CurrentLevel[2]; // Current dim level... bool LastState[2]; byte updateSensor; MyMessage TopDimmerMsg(TopLED_ID, V_DIMMER); MyMessage TopLightMsg(TopLED_ID, V_LIGHT); MyMessage BotDimmerMsg(BottomLED_ID, V_DIMMER); MyMessage BotLightMsg(BottomLED_ID, V_LIGHT); MyMessage TopSwitchMsg(TopSwitch_ID, V_STATUS); MyMessage BotSwitchMsg(BottomSwitch_ID, V_STATUS); MyMessage TopSwitchLevMsg(TopSwitchLev_ID, V_VAR1); MyMessage BotSwitchLevMsg(BotSwitchLev_ID, V_VAR1); elapsedMillis heartBeatTimer; byte heartBeatReturn; Bounce debouncer1 = Bounce(); Bounce debouncer2 = Bounce(); void(* resetFunc) (void) = 0; //declare reset function @ address 0 void setup() { #ifdef MY_DEBUG Serial.begin(115200); Serial.println("Setup Started."); #endif pinMode(TopSwitch_PIN, INPUT_PULLUP); pinMode(BottomSwitch_PIN, INPUT_PULLUP); LastState[TopLED_ID] = digitalRead(TopSwitch_PIN); LastState[BottomLED_ID] = digitalRead(BottomSwitch_PIN); // switch off lights analogWrite(TopLED_PIN, 0); CurrentLevel[TopLED_ID] = 0; analogWrite(BottomLED_PIN, 0); CurrentLevel[BottomLED_ID] = 0; send(TopSwitchMsg.set(LastState[TopLED_ID])); wait(100); send(BotSwitchMsg.set(LastState[BottomLED_ID])); wait(100); byte b = loadState(TopSwitchLev_ID); #ifdef MY_DEBUG Serial.print("Top Switch level: "); Serial.println(b); #endif if (b == Light_Off) {b = Light_On; saveState(TopSwitchLev_ID, Light_On);} send(TopSwitchLevMsg.set(b)); wait(100); b = loadState(BotSwitchLev_ID); #ifdef MY_DEBUG Serial.print("Bottom Switch level: "); Serial.println(b); #endif if (b == Light_Off) {b = Light_On; saveState(BotSwitchLev_ID, b);} send(BotSwitchLevMsg.set(b)); wait(100); debouncer1.attach(TopSwitch_PIN); debouncer1.interval(5); debouncer2.attach(BottomSwitch_PIN); debouncer2.interval(5); heartBeatTimer = 0; heartBeatReturn = 0; updateSensor = 255; request(TopLED_ID, V_DIMMER); wait(100); request(BottomLED_ID, V_DIMMER); wait(100); #ifdef MY_DEBUG Serial.println("Setup Colplete."); #endif } void presentation() { sendSketchInfo(SN, SV); present(TopLED_ID, S_DIMMER, "Top_Lights"); wait(100); present(BottomLED_ID, S_DIMMER, "Bottom_Lights"); wait(100); present(TopSwitch_ID, S_BINARY, "Top_Lights_Switch"); wait(100); present(BottomSwitch_ID, S_BINARY, "Bottom_Lights_Switch"); wait(100); present(TopSwitchLev_ID, S_CUSTOM, "Top_Lights_Switch_Level"); wait(100); present(BotSwitchLev_ID, S_CUSTOM, "Bottom_Lights_Switch_Level"); wait(100); } void loop() { debouncer1.update(); bool CurrentState = debouncer1.read(); if (CurrentState != LastState[TopLED_ID]) { #ifdef MY_DEBUG Serial.println("Switch 1 pressed."); #endif send(TopSwitchMsg.set(CurrentState)); LastState[TopLED_ID] = CurrentState; if (CurrentLevel[TopLED_ID] > Light_Off) { fadeToLevel(Light_Off, TopLED_ID); } else { byte b = loadState(TopSwitchLev_ID); fadeToLevel(b, TopLED_ID); } } debouncer2.update(); CurrentState = debouncer2.read(); if (CurrentState != LastState[BottomLED_ID]) { #ifdef MY_DEBUG Serial.println("Switch 2 pressed."); #endif send(BotSwitchMsg.set(CurrentState)); LastState[BottomLED_ID] = CurrentState; if (CurrentLevel[BottomLED_ID] > 0) { fadeToLevel(Light_Off, BottomLED_ID); } else { byte b = loadState(BotSwitchLev_ID); fadeToLevel(b, BottomLED_ID); } } if (heartBeatTimer > HEARTBEAT_TIME) { heartBeatTimer = 0; if (!sendHeartbeat()) { #ifdef MY_DEBUG Serial.println("Hearbeat echo NOT received."); #endif heartBeatReturn++; if (heartBeatReturn == HEARTBEAT_NO_RETURN) resetFunc(); } else { #ifdef MY_DEBUG Serial.println("Hearbeat echo received."); #endif heartBeatReturn = 0; request(TopLED_ID, V_DIMMER); wait(200); request(BottomLED_ID, V_DIMMER); wait(200); } } if (updateSensor != 255) { #ifdef MY_DEBUG Serial.print("Sensor Update received: "); Serial.println(updateSensor); #endif if (updateSensor == TopLED_ID) { send(TopLightMsg.set(CurrentLevel[updateSensor] > 0));wait(100); send(TopDimmerMsg.set(CurrentLevel[updateSensor])); } else if (updateSensor == BottomLED_ID){ send(BotLightMsg.set(CurrentLevel[updateSensor] > 0));wait(100); send(BotDimmerMsg.set(CurrentLevel[updateSensor])); } updateSensor = 255; } } void receive(const MyMessage &message) { if (message.type == V_LIGHT) { bool requestedLevel = message.getBool(); #ifdef MY_DEBUG Serial.print("V_Light received: "); Serial.println(message.sensor); #endif int lvl; if (requestedLevel == LOW) lvl = Light_Off; else lvl = Light_On; fadeToLevel(lvl, message.sensor); } else if (message.type == V_DIMMER) { #ifdef MY_DEBUG Serial.print("V_Dimmer received: "); Serial.println(message.sensor); #endif int requestedLevel = message.getInt(); fadeToLevel(requestedLevel, message.sensor); } else if (message.type == V_VAR1) { #ifdef MY_DEBUG Serial.print("V_VAR1 received: "); Serial.println(message.sensor); #endif byte b = message.getByte(); if (b > Light_On) b = Light_On; if (message.sensor == TopSwitchLev_ID) { saveState(TopSwitchLev_ID, b); } else if (message.sensor == BotSwitchLev_ID) { saveState(BotSwitchLev_ID, b); } } } void fadeToLevel(int toLevel, byte SensorID) { #ifdef MY_DEBUG Serial.print("Fade to Level: "); Serial.print(SensorID); Serial.print(":"); Serial.print(CurrentLevel[SensorID]); Serial.print("-->"); Serial.println(toLevel); #endif byte SensorPIN; if (SensorID == TopLED_ID) SensorPIN = TopLED_PIN; else if (SensorID == BottomLED_ID) SensorPIN = BottomLED_PIN; int delta = (toLevel - CurrentLevel[SensorID]) < 0 ? -1 : 1; if (CurrentLevel[SensorID] != toLevel) { updateSensor = SensorID; while (CurrentLevel[SensorID] != toLevel) { CurrentLevel[SensorID] += delta; analogWrite(SensorPIN, (int)(CurrentLevel[SensorID] / 100. * 255)); // delay(FADE_DELAY); wait(FADE_DELAY); } } }
There is no send() inside receive().
Any ideas?
-
Thanks for sharing the sketch @Radi-M
My guess would be that the node receives new messages while it is still fading. If you enable MY_DEBUG your excellent debug prints will give more of informaion on whating.
-
Hi,
The strange behavior is no longer present and I can't replicate the problem. I suspect there was a general communication problem with the gateway.
Anyway, please see the following debug prints.__ __ ____ | \/ |_ _/ ___| ___ _ __ ___ ___ _ __ ___ | |\/| | | | \___ \ / _ \ `_ \/ __|/ _ \| `__/ __| | | | | |_| |___| | __/ | | \__ \ _ | | \__ \ |_| |_|\__, |____/ \___|_| |_|___/\___/|_| |___/ |___/ 2.3.2 16 MCO:BGN:INIT NODE,CP=RNNNA-Q-,FQ=16,REL=255,VER=2.3.2 26 TSM:INIT 28 TSF:WUR:MS=0 34 TSM:INIT:TSP OK 36 TSF:SID:OK,ID=1 38 TSM:FPAR 41 ?TSF:MSG:SEND,1-1-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK: 247 TSF:MSG:READ,0-0-1,s=255,c=3,t=8,pt=1,l=1,sg=0:0 252 TSF:MSG:FPAR OK,ID=0,D=1 2050 TSM:FPAR:OK 2051 TSM:ID 2052 TSM:ID:OK 2054 TSM:UPL 2057 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=24,pt=1,l=1,sg=0,ft=0,st=OK:1 2068 TSF:MSG:READ,0-0-1,s=255,c=3,t=25,pt=1,l=1,sg=0:1 2073 TSF:MSG:PONG RECV,HP=1 2075 TSM:UPL:OK 2077 TSM:READY:ID=1,PAR=0,DIS=1 2081 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=15,pt=6,l=2,sg=0,ft=0,st=OK:0100 2100 TSF:MSG:READ,0-0-1,s=255,c=3,t=15,pt=6,l=2,sg=0:0100 2110 TSF:MSG:SEND,1-1-0-0,s=255,c=0,t=17,pt=0,l=5,sg=0,ft=0,st=OK:2.3.2 2118 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=6,pt=1,l=1,sg=0,ft=0,st=OK:0 2179 TSF:MSG:READ,0-0-1,s=255,c=3,t=6,pt=0,l=1,sg=0:M 2186 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=11,pt=0,l=18,sg=0,ft=0,st=OK:Stairs Wall Lights 2198 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=12,pt=0,l=3,sg=0,ft=0,st=OK:1.2 2209 TSF:MSG:SEND,1-1-0-0,s=0,c=0,t=4,pt=0,l=10,sg=0,ft=0,st=OK:Top_Lights 2318 TSF:MSG:SEND,1-1-0-0,s=1,c=0,t=4,pt=0,l=13,sg=0,ft=0,st=OK:Bottom_Lights 2427 TSF:MSG:SEND,1-1-0-0,s=2,c=0,t=3,pt=0,l=17,sg=0,ft=0,st=OK:Top_Lights_Switch 2537 TSF:MSG:SEND,1-1-0-0,s=3,c=0,t=3,pt=0,l=20,sg=0,ft=0,st=OK:Bottom_Lights_Switch 2648 TSF:MSG:SEND,1-1-0-0,s=4,c=0,t=23,pt=0,l=23,sg=0,ft=0,st=OK:Top_Lights_Switch_Level 2758 TSF:MSG:SEND,1-1-0-0,s=5,c=0,t=23,pt=0,l=25,sg=0,ft=0,st=OK:Bottom_Lights_Switch_Leve 2866 MCO:REG:REQ 2871 TSF:MSG:SEND,1-1-0-0,s=255,c=3,t=26,pt=1,l=1,sg=0,ft=0,st=OK:2 2877 TSF:MSG:READ,0-0-1,s=255,c=3,t=27,pt=1,l=1,sg=0:1 2882 MCO:PIM:NODE REG=1 2884 MCO:BGN:STP Setup Started. 2888 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:0 2995 TSF:MSG:SEND,1-1-0-0,s=3,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:0 Top Switch level: 100 3103 TSF:MSG:SEND,1-1-0-0,s=4,c=1,t=24,pt=1,l=1,sg=0,ft=0,st=OK:100 Bottom Switch level: 100 3211 TSF:MSG:SEND,1-1-0-0,s=5,c=1,t=24,pt=1,l=1,sg=0,ft=0,st=OK:100 3318 TSF:MSG:SEND,1-1-0-0,s=0,c=2,t=3,pt=0,l=0,sg=0,ft=0,st=OK: 3364 TSF:MSG:READ,0-0-1,s=0,c=1,t=3,pt=0,l=1,sg=0:0 V_Dimmer received: 0 Fade to Level: 0:0-->0 3425 TSF:MSG:SEND,1-1-0-0,s=1,c=2,t=3,pt=0,l=0,sg=0,ft=0,st=OK: 3469 TSF:MSG:READ,0-0-1,s=1,c=1,t=3,pt=0,l=1,sg=0:0 V_Dimmer received: 1 Fade to Level: 1:0-->0 Setup Colplete. 3531 MCO:BGN:INIT OK,TSP=1 Switch 1 pressed. 11350 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:1 Fade to Level: 0:0-->100 Sensor Update received: 0 12360 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:1 12466 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=3,pt=1,l=1,sg=0,ft=0,st=OK:100 Switch 1 pressed. 14713 TSF:MSG:SEND,1-1-0-0,s=2,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:0 Fade to Level: 0:100-->0 Sensor Update received: 0 15726 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=2,pt=1,l=1,sg=0,ft=0,st=OK:0 15832 TSF:MSG:SEND,1-1-0-0,s=0,c=1,t=3,pt=1,l=1,sg=0,ft=0,st=OK:0
Thanks