Blynk.syncAll() work-around

I think this category is the best. I have, like some other ppl, been pulling my hair out because of the inability to synchronize all virtual pins in one go. This will result in a buffer overflow on some platforms. I’ve “created” a little work around until the issue can be fixed:

BLYNK_CONNECTED()
{
  // Sync pins with a little delay
  int syncPins[] = { V26, V27, V28, V29, V22, V21, V31, V24, V25, V15, V32 };
  
  for(int i=0;i<sizeof(syncPins)/sizeof(int);i++)
  {
    displayMessage("Syncing: " + String(syncPins[i]), "");
    Blynk.syncVirtual(syncPins[i]);
    delay(5);
  }
}

This will synchronize the vPins with a little delay (I know, bad me…), but it will prevent a buffer overflow. I’m not sure as to how many pins you can do like this, but probably 1ms is al ready enough to prevent the buffers filling up.

2 Likes

Hey, what hardware did you use to run this example?

Arduino Mega with ESP 01 as a shield. After buffer overflow with it starts reconnecting, buffer overflow, reconnecting etc.

Ahhh this exaplins the reason why I dont use syncAll… its just constantly reconnects

Yeah … but it’s kind of essential for my project to have synchronized stuff, due to bridge functions etc. So this will take care of that problem, for now anyway :slight_smile:

1 Like

Me too, I reverted to using a sequence of timers to call virtualSync… but will use this from now on!

Cheers!

Um, i call syncVirtual at the start of the relevant functions, seems to work… But only a few pins each function…

Hey, we just added syncVirtual() support for multiple pins!
It will be ready for use with next library & server deployment.

2 Likes

What syntax will it follow?

syncVirtual(V1, V2, V3 …)

1 Like

Is there a slight delay or pause between each call?

1 Like