My display output is straight from the example in the Sketch Builder… you should request your code be substituted in
Now this code monkey is activating copy/paste mode Although, in my defense, I was actualy reading up on something simular in the Time library examples:
After much complicated coding, involving detecting “\n”, buffering strings and inputString += inChar bla bla bla; I realised that keeping it stupid simple worked just as well…
This assumes #define BLYNK_PRINT Serial1 running on a MEGA’s 2nd hardware serial port:
//===== Terminal Widget - Debug Redirect =====
void serialEvent1() { // Check for data on 2nd serial port
while (Serial1.available()) {
terminal.print((char)Serial1.read()); // Fires data back out to terminal
}terminal.flush();
} // END serialEvent1 loop
As for getting the logo to fully display… I have given up on that with my current USB link setup, as I think that just adds another layer of serial conversion and lag, resulting in only a partial logo, while basic messages are usually clear.
But as I mentioned waaaayyy back… having device debug errors redirected to an app that probably can’t receive the debug errors, due to broken connection, is really a catch 22 situation. But it was fun to play around with.
PS, in case anyone else wants a nice Blynk Logo on their terminal at bootup, I cleaned up my origional (based on copy/paste of the image on my PC terminal) into this (using the proper way Blynk uses in their library files):
Each “line” is separated by the enter/return key, and auto format makes it look this way.
Old code I guess… The free RAM part was pulled directly from one of the Blynk library files… and I guess it worked that way?? (as evidenced by the screenshot), but eventually I apparently changed it
In file included from C:\Users\wanek\AppData\Local\Temp\arduino_build_504181\sketch\header.h:24:0,
from C:\ARDUINO\PROJECTS\sonoff core\sonoff_core_02\sonoff_core_02.ino:9:
C:\ARDUINO\libraries\Sonoff/SonoffCore.h: In function 'void checkFirstRun()':
C:\ARDUINO\libraries\Sonoff/SonoffCore.h:641:49: error: call of overloaded 'println(const char [11], size_t)' is ambiguous
terminal.println("free RAM: ", BlynkFreeRam());
^
C:\ARDUINO\libraries\Sonoff/SonoffCore.h:641:49: note: candidates are:
In file included from C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Stream.h:26:0,
from C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/HardwareSerial.h:31,
from C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Arduino.h:245,
from C:\Users\wanek\AppData\Local\Temp\arduino_build_504181\sketch\sonoff_core_02.ino.cpp:1:
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:84:16: note: size_t Print::println(unsigned char, int) <near match>
size_t println(unsigned char, int = DEC);
^
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:84:16: note: no known conversion for argument 1 from 'const char [11]' to 'unsigned char'
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:85:16: note: size_t Print::println(int, int) <near match>
size_t println(int, int = DEC);
^
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:85:16: note: no known conversion for argument 1 from 'const char [11]' to 'int'
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:86:16: note: size_t Print::println(unsigned int, int) <near match>
size_t println(unsigned int, int = DEC);
^
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:86:16: note: no known conversion for argument 1 from 'const char [11]' to 'unsigned int'
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:87:16: note: size_t Print::println(long int, int) <near match>
size_t println(long, int = DEC);
^
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:87:16: note: no known conversion for argument 1 from 'const char [11]' to 'long int'
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:88:16: note: size_t Print::println(long unsigned int, int) <near match>
size_t println(unsigned long, int = DEC);
^
C:\Users\wanek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc2\cores\esp8266/Print.h:88:16: note: no known conversion for argument 1 from 'const char [11]' to 'long unsigned int'
Using library Sonoff at version 2.4.0-rc2-51 in folder: C:\ARDUINO\libraries\Sonoff
size_t Unsigned integral type Alias of one of the fundamental unsigned integer types.
It is a type able to represent the size of any object in bytes: size_t is the type returned by the sizeof operator and is widely used in the standard library to represent sizes and counts.
In , it is used as the type of the parameter num in the functions memchr, memcmp, memcpy, memmove, memset, strncat, strncmp, strncpy and strxfrm, which in all cases it is used to specify the maximum number of bytes or characters the function has to affect.
It is also used as the return type for strcspn, strlen, strspn and strxfrm to return sizes and lengths.
Yup… totally clear now… not
But I think it basically runs that get RAM function and fits the resulting number into that variable
I pulled the logo and whatnot from the BlynkProtocol.h file in my IDE Libraries folder. A few different options are available, like a pseudo 3D version.
have this function set in the blynk timer with a 800 ms interval:
void serialEvent() // terminal widget - debug redirect
{
while (Serial.available()) { // check for data on serial port
terminal.print((char)Serial.read()); // fires data back out to terminal
}
terminal.flush();
}
all i got are constant resets after startup… it resets for 4-5 times, after that it remains connected, but no debug data.
Well, a lot of what I was experimenting with was on a Arduino MEGA with multiple Serial ports…
But my next direction to take this will be based on my more recent post and vhymanskyy’s reference to the console object and class redirections, etc… I just haven’t been clearheaded enough to pursue it yet.
yes, i’m fully aware of that
i mainly would like to do just for fun / learning / experimenting
i have lots of sonoff units installed in all kind if remote places (100km), and in those situations every bit of plus info can be useful in case i have to debug or monitor something.
recently, i had a project where ~14 units were installed in a big production facility. as it lately turned out, all the building is made from metal sandwich construction, and the sonoff units were installed on those metal “walls”. thus, the wifi antennas are just ~10mm away from a metal sheet. this causes all kinds of strange disconnections and other anomalies. causing me lots of headache…
it is really strange: the wifi signal on all units is between -70 and - 45 dbm, it seems apparently ok. but there are frequent disconnections, and when a unit is disconnected it can’t reconnect for several minutes.
i’m not sure what is causing this. or the metal walls causing rf interference, or choppy routers? will have to investigate soon.
however, i’m sure the firmware is all right, because i have wrote a core firmware for sonoff, and i use that on all units. in all locations they are working flawlessly, only this place gives me trouble.