I recompiled some device code with the new Blynk Library and see behavior change:
I use a BLYNK_WRITE(V12) function to start a calibration process, calibrate(), and “listen” for a second button press within that calibrate process. It used to work fine but now it seems to block any relaunch (no second button press is effected until initial BLYNK_WRITE is completed).
I checked the lib release notes, but couldn’t identify what might be the cause.
Any info on this would be appreciated! Thanks, in advance, for your help.
bool userPress = 0;
bool nowCalibrating = 0;
BLYNK_WRITE(V12) {
if (param.asInt()) { //if button press
if (nowCalibrating) { // if in the midst of calibration then flag the second press
userPress = 1;
return;
} else {
calibrate(); // first press, start calibrating
}
}
}
void calibrate() {
nowCalibrating = 1;
showTerm("Calibrate? Press again to confirm.");
int x = 100;
while ((!userPress) && (--x)) { //wait for press
Blynk.run();
delay(100);
}
if (!userPress) {
showTerm("Calibration aborted.");
nowCalibrating = 0;
return;
}
// do calibration work
}