OK so I am migrating from Blynk1 to Blynk2 and though the edgent facility with OTA firmware upgrades would be nice.
However when using Blynkedgent.h it is not possible to disable debug prints (compile errors come up if you don’t include a #define BLYNK_PRINT Serial)
What I notice is that the edgent code somewhere is reading the serial input! (not just using it for debug output)
So this very simple example will miss random serial input (the character input is simply output somewhere by the Blynkedgent.run code and never received by my code.
I can remove the issue by #define BLYNK_PRINT Serial1
But sadly in my real project I need Seral and Serial 1 on an ESP8266 and there are no more serial to divert the edgent debug output to.
If I use the basic Blynk code, it a) doesn’t corrupt the serial input and b) debug prints can be disabled
Any ideas?
Here is stripped down code to demonstrate the issue
#define BLYNK_TEMPLATE_ID "***********"
#define BLYNK_DEVICE_NAME "**********"
#define BLYNK_FIRMWARE_VERSION "1.1.0"
#define BLYNK_PRINT Serial //Enable define for basic level Blynk debug info
#define ESP_SDK_VERSION_NUMBER 0x020202 //Kludge as I have a later version but Blynk never detects this
#define USE_NODE_MCU_BOARD
#include <Arduino.h>
#include "BlynkEdgent.h"
//**************************************************************************************************
void setup() {
Serial.begin(9600);
Serial.println("Blynk Rx Corruption Test");
delay(1000);
BlynkEdgent.begin();
}
void loop() {
if ((Serial.available()>0)) {
Serial.println(Serial.read());
}
BlynkEdgent.run(); //Note corrupts Rx buffer
}
Here is example output, note last line where first ‘a’ was simply echoed back by something but not detected by my code
Blynk Rx Corruption Test
[1283]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ \/ '_/
/____/_/\_, /_//_/_/\_\
/___/ v1.1.0 on ESP8266
#StandWithUkraine https://bit.ly/swua
>[5374] Using Dynamic IP: 192.168.1.222
[5486] Current time: Tue Sep 20 15:18:03 2022
[5486] Connecting to blynk.cloud:443
[6441] Ready (ping: 11ms).
a97
a97
aaa97