Hw resets on multiple "Blynk.setProperty" commands

hm, if these 9 lines takes ~1 second, than with the full code it probably can take near 2.3 seconds, because:

  • there is also the terminal read / write part what you commented out
  • in this part: if (updateName == 1), i originally have a function which validates data string length and saves in to eeprom

all this can potentially sum up to above 2 seconds, i think. (i can not use serial monitor to test, because somehow on the sonoff + usb ttl module i couldn’t make the serial monitor to work)

edit: this project is also on local server

@Costas, now i have just tested what you’ve posted above, without the other parts, but still it resets the mcu every time. i do not understand.

@Dmitriy, something is definitely off with this Blynk.setProperty function. @mars was right, the only way i can make it work, is like this:

    Blynk.setProperty(V_RELAY_1_STATE, "label", unitName + " RLY 1");
    yield();
    Blynk.run();
    Blynk.setProperty(V_RELAY_2_STATE, "label", unitName + " RLY 2");
    yield();
    Blynk.run();
    Blynk.setProperty(V_RELAY_3_STATE, "label", unitName + " RLY 3");
    yield();
    Blynk.run();
    Blynk.setProperty(V_RELAY_4_STATE, "label", unitName + " RLY 4");
    yield();
    Blynk.run();
    Blynk.setProperty(V_MOTION_LED,    "label", unitName + " LED");
    yield();
    Blynk.run();
    Blynk.setProperty(V_MOTION_STATE,  "label", unitName + " ALARM");
    yield();
    Blynk.run();
    Blynk.setProperty(V_MESSAGE,       "label", unitName + " NFO");
    yield();
    Blynk.run();
    Blynk.setProperty(V_RESTART_CAUSE, "label", unitName + " LR");
    yield();
    Blynk.run();
    Blynk.setProperty(V_SEND_RTC,      "label", unitName + " RTC");
    yield();
    Blynk.run();

this way it is working reliably.

but, for example if i try it like this (or any other way), it crashes the esp:

    Blynk.setProperty(V_RELAY_1_STATE, "label", unitName + " RLY 1");
    Blynk.setProperty(V_RELAY_2_STATE, "label", unitName + " RLY 2");
    yield();
    Blynk.run();
    Blynk.setProperty(V_RELAY_3_STATE, "label", unitName + " RLY 3");
    Blynk.setProperty(V_RELAY_4_STATE, "label", unitName + " RLY 4");
    yield();
    Blynk.run();
    Blynk.setProperty(V_MOTION_LED,    "label", unitName + " LED");
    Blynk.setProperty(V_MOTION_STATE,  "label", unitName + " ALARM");
    yield();
    Blynk.run();
    Blynk.setProperty(V_MESSAGE,       "label", unitName + " NFO");
    Blynk.setProperty(V_RESTART_CAUSE, "label", unitName + " LR");
    yield();
    Blynk.run();
    Blynk.setProperty(V_SEND_RTC,      "label", unitName + " RTC");
    yield();
    Blynk.run();

hmm, thanks for this insight. it is really strange way to do :slight_smile: but sounds like could work. i will give it a try. we run a private blynk cloud server for some of our projects.

as i’m not a linux / server guru, i will talk to the server admin, lets see if he has any urge towards this :smile:

however, we must find a way to not to restart the server, that is too bad practice to restart for this. maybe an app restart should do…

I prefer virtualWrite rather than terminal.print but it does the same.

Maybe your EEPROM routine is the issue. In fact it must be the issue because the ESP and Blynk can handle 9 consecutive setProperty calls under the right conditions.

yes, i suspected too the eeprom. but i’ve commented out completely that part.

with only the 9 blynk.setproperty line in the function still crashed every time, until i put yield and blynk.run after EVERY setproperty line.

this is very strange issue, couldn’t understand why it works for you, and why don’t works for me? also @mars reported crashes with these functions.

if i had more time, maybe i would investigate further, but i have to finish this project for monday.

by the way, on what board did you tested?

I’m using a WeMos D1 Mini.

Do you have all the widgets set as PUSH or the default of 1 sec?

you mean those widgets where i would like to change the labels?

most of them is set to push, and rtc is set to 1 sec.

but previously you said it was handling 4 or 5 calls to setProperty?

after i tested more throughly, with 3 consecutive calls were ALLWAYS worked (without yield or blynk.run)

with 4 consecutive calls sometimes worked, but mostly crashed.

but if i wanted to do all 9 calls, the only way it worked was by adding BOTH yield + blynk.run after every call.

i have tried adding only yield or only blynk.run, didn’t worked.

I would set them ALL to PUSH, the default is just for beginners that haven’t really learnt how to Blynk.

As far as I know RTC doesn’t have a label to change.

Perhaps it’s not RTC but a value display widget that displays RTC.

yes, by rtc i mean a value widget labeled rtc, of course.

i do not think the push or 1 sec matters in this case, because i commented out that specific setproperty line in several scenarios, and it was the same crash.

i wonder if it could be some ram runout error?
if too much setproperty calls are executed, it runs out of ram and crashes?

but calling yield + blynk.run somehow frees up the respective ram and prevents from crashing?

this could explain why it works on your esp, and it crashes on mine. i have a bigger code running on that esp. (at compile the ide says 27% ram and 43% flash is used)

The reading of the terminal, writing back to the terminal and sending the 9 setProperty calls takes just 3 to 4ms.

but you said ~1sec on previous post just for the 9 calls without terminal…

My sketch is 26% and 45% so I don’t think that’s the issue.

That’s the time it takes for the app to receive the info from thousands of miles away but the ESP only takes 3 or 4ms to process the entire terminal function. It’s the 3 or 4ms that comes in to play for the WDT.

i see. than i’m out of clues. i tested this issue on several boards, so defective board is not the case.

It’s A way of doing it :wink: , I do a lot of work around at work for me and colleagues when the standard functions in AutoCAD or MagiCAD (our primary tools of work) are failing at certain tasks :stuck_out_tongue:

Not to say it’s the best but you have to work with what you got until you have poked the sleeping bear into reaction (looking at you @Dmitriy :bear:)

what are you drawing in autocad?

i also use it sometimes, on a super basic level. i designed some custom bicycle parts, and one of my friends, who works in a big factory had fabricated them on a huge cnc machine from 7000 series aluminum :slight_smile:

it was an interesting experience to see how the virtual drawing becomes hardware…

1 Like