Merge pull request #14882 from s-hadinger/berry_log_fix

Berry fix wrong color in console
This commit is contained in:
s-hadinger 2022-02-16 22:27:56 +01:00 committed by GitHub
commit aa96691756
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 5 deletions

View File

@ -96,4 +96,7 @@ public:
};
BerrySupport berry;
// multi-purpose serial logging
extern "C" void serial_debug(const char * berry_buf, ...);
#endif // USE_BERRY

View File

@ -24,7 +24,7 @@
#include <Wire.h>
const uint32_t BERRY_MAX_LOGS = 16; // max number of print output recorded when outside of REPL, used to avoid infinite grow of logs
const uint32_t BERRY_MAX_REPL_LOGS = 1024; // max number of print output recorded when inside REPL
const uint32_t BERRY_MAX_REPL_LOGS = 50; // max number of print output recorded when inside REPL
// /*********************************************************************************************\
// * Return C callback from index
@ -601,7 +601,7 @@ void berry_log(const char * berry_buf) {
if (berry.log.log.length() == 0) {
pre_delimiter = BERRY_CONSOLE_CMD_DELIMITER;
}
if (berry.log.log.length() >= BERRY_MAX_LOGS) {
if (berry.log.log.length() >= max_logs) {
berry.log.log.remove(berry.log.log.head());
}
berry.log.addString(berry_buf, pre_delimiter, "\n");

View File

@ -492,15 +492,15 @@ const char HTTP_SCRIPT_BERRY_CONSOLE[] PROGMEM =
"x.onreadystatechange=function(){"
"if(x.readyState==4&&x.status==200){"
"var d,t1;"
"d=x.responseText.split(/" BERRY_CONSOLE_CMD_DELIMITER "/);" // Field separator
"var d1=d.shift();"
"d=x.responseText.split(/" BERRY_CONSOLE_CMD_DELIMITER "/,2);" // Field separator
"var d1=d.length>1?d[0]:null;"
"if(d1){"
"t1=document.createElement('div');"
"t1.classList.add('br1');"
"t1.innerText=d1;"
"t.appendChild(t1);"
"}"
"d1=d.shift();"
"d1=d.length>1?d[1]:d[0];"
"if(d1){"
"t1=document.createElement('div');"
"t1.classList.add('br2');"