Blynk.syncAll was disabled when Blynk 2.0 was initially released.
It will now work with virtual pins (there is currently no support for digital pins in Blynk 2.0), but only if the datastream has this advanced setting enabled…
More info here…
opened 11:27AM - 23 Jun 21 UTC
bug
documentation
web
To replicate this issue, use the following code (ESP32 with static provisioning … for simplicity of testing)
```
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "REDACTED"
#define BLYNK_DEVICE_NAME "REDACTED"
#include <BlynkSimpleEsp32_SSL.h>
char auth[] = "REDACTED";
char ssid[] = "REDACTED";
char pass[] = "REDACTED";
void setup()
{
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
Blynk.run();
}
BLYNK_WRITE(V1)
{
Serial.println("Blynk connected, processing syncAll...");
Blynk.syncAll();
// Uncomment this code, and comment-out the syncAll code above and it works for pin V1
// Serial.println("Blynk connected, processing syncVirtual(V1)...");
// Blynk.syncVirtual(V1);
}
BLYNK_WRITE(V1)
{
float pin_value = param.asFloat();
Serial.println("BLYNK_WRITE(V1) triggered...");
Serial.print("Value = ");
Serial.println(pin_value);
Serial.println();
}
```
Define a datastream for pin V1 and attach a **slider widget** to it in the web dashboard.
(Note that this issue isn't limited to the slider widget, but there is another issue with the slider widget on the web dashboard, and I'll raise a separate issue about this (#140), but this setup will demonstrate that issue)
When the sketch is populated with the correct credentials and uploaded, it connects to Blynk and prints the "Blynk connected, processing syncAll..." message, but `BLYNK_WRITE(V1)` is not triggered.
Moving the slider on the dashboard does trigger `BLYNK_WRITE(V1)`.
If you then modify the BLYNK_WRITE(V1) callback and uncomment the `Blynk.syncVirtual(V1)` code `BLYNK_WRITE(V1)` is triggered on `BLYNK_CONNECTED()`.
Pete.
In this issue I asked the question…
Will Blynk_syncAll
cause BLYNK_WRITE_DEFAULT
to trigger for any datastream that has this option turned on and doesn’t have an explicit BLYNK_WRITE(Vpin)
callback?
I didn’t receive an answer, but my testing has shown that yes, this does work as expected with BLYNK_WRITE_DEFAULT.
Pete.
4 Likes