Sorry for bother yours.
I was trying to do this:
Terminal.write("\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
Terminal.write("\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
Using variables in place of the constants, but this is impossible. I tried everything, but the Arduino esp32 compiler have the same error: error: conversion from 'const uint8_t*' {aka 'const unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((const uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: black, foreground: green
mmsj300:313:53: error: conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
I Have tried putting the (const uint8_t*) before the strings e etc, but nothing works... I see the implementation, but using (uint8_t*) also not working.
Can someone help me please ?
That cant be my fault, I need to know how to call the Terminal.write with variables, i do this in another's programs with another libraries all the times, and here are impossible..
PS: I have read all the examples, anyone have any consideration about use variables in the Terminal.write, only char (buf[i]), any time not have examples with strings variables.
Terminal.write definition:
size_t Terminal::write(const uint8_t * buffer, size_t size)
{
for (int i = 0; i < size; i)
write(*(buffer ));
return size;
}
please help me.
Complete Error Message:
mmsj300:313:53: error: conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: candidate: 'StringSumHelper::StringSumHelper(long long unsigned int)' <near match>
StringSumHelper(unsigned long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: candidate: 'StringSumHelper::StringSumHelper(long long int)' <near match>
StringSumHelper(long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: candidate: 'StringSumHelper::StringSumHelper(long unsigned int)' <near match>
StringSumHelper(unsigned long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: candidate: 'StringSumHelper::StringSumHelper(long int)' <near match>
StringSumHelper(long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned int)' <near match>
StringSumHelper(unsigned int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: candidate: 'StringSumHelper::StringSumHelper(int)' <near match>
StringSumHelper(int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned char)' <near match>
StringSumHelper(unsigned char num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: candidate: 'StringSumHelper::StringSumHelper(char)' <near match>
StringSumHelper(char c) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: candidate: 'StringSumHelper::StringSumHelper(const char*)' <near match>
StringSumHelper(const char *p) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: conversion of argument 1 would be ill-formed:
mmsj300:313:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const char*' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:186:34: note: initializing argument 1 of 'StringSumHelper& operator (const StringSumHelper&, const String&)'
friend StringSumHelper & operator (const StringSumHelper &lhs, const String &rhs);
^~~~~~~~
mmsj300:314:52: error: conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const StringSumHelper' is ambiguous
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: candidate: 'StringSumHelper::StringSumHelper(long long unsigned int)' <near match>
StringSumHelper(unsigned long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:393:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: candidate: 'StringSumHelper::StringSumHelper(long long int)' <near match>
StringSumHelper(long long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:390:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: candidate: 'StringSumHelper::StringSumHelper(long unsigned int)' <near match>
StringSumHelper(unsigned long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:381:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: candidate: 'StringSumHelper::StringSumHelper(long int)' <near match>
StringSumHelper(long num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:378:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'long int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned int)' <near match>
StringSumHelper(unsigned int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:375:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: candidate: 'StringSumHelper::StringSumHelper(int)' <near match>
StringSumHelper(int num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:372:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'int' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: candidate: 'StringSumHelper::StringSumHelper(unsigned char)' <near match>
StringSumHelper(unsigned char num) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:369:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'unsigned char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: candidate: 'StringSumHelper::StringSumHelper(char)' <near match>
StringSumHelper(char c) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:366:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'char' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: candidate: 'StringSumHelper::StringSumHelper(const char*)' <near match>
StringSumHelper(const char *p) :
^~~~~~~~~~~~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:363:9: note: conversion of argument 1 would be ill-formed:
mmsj300:314:24: error: invalid conversion from 'uint8_t*' {aka 'unsigned char*'} to 'const char*' [-fpermissive]
Terminal.write((uint8_t*)"\e[" String(vxx) ";" String(vyy) "H"); // move cursor to x, y
^~~~~~~~~~~~~~~
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:165,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/WString.h:186:34: note: initializing argument 1 of 'StringSumHelper& operator (const StringSumHelper&, const String&)'
friend StringSumHelper & operator (const StringSumHelper &lhs, const String &rhs);
^~~~~~~~
mmsj300:334:72: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" String(bcor) ";" String(fcor) "m"); // background: black, foreground: green
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate expects 2 arguments, 1 provided
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: candidate: 'virtual size_t fabgl::Terminal::write(uint8_t)'
size_t write(uint8_t c);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: no known conversion for argument 1 from 'StringSumHelper' to 'uint8_t' {aka 'unsigned char'}
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate: 'void fabgl::Terminal::write(uint8_t, bool)'
void write(uint8_t c, bool fromISR);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate expects 2 arguments, 1 provided
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Stream.h:26,
from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:166,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate: 'size_t Print::write(const char*, size_t)'
size_t write(const char *buffer, size_t size)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate expects 2 arguments, 1 provided
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: candidate: 'size_t Print::write(const char*)'
size_t write(const char *str)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: no known conversion for argument 1 from 'StringSumHelper' to 'const char*'
mmsj300:335:71: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" String(vxx) ";" String(vyy) "H"); // move cursor
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate expects 2 arguments, 1 provided
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: candidate: 'virtual size_t fabgl::Terminal::write(uint8_t)'
size_t write(uint8_t c);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: no known conversion for argument 1 from 'StringSumHelper' to 'uint8_t' {aka 'unsigned char'}
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate: 'void fabgl::Terminal::write(uint8_t, bool)'
void write(uint8_t c, bool fromISR);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate expects 2 arguments, 1 provided
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Stream.h:26,
from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:166,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate: 'size_t Print::write(const char*, size_t)'
size_t write(const char *buffer, size_t size)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate expects 2 arguments, 1 provided
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: candidate: 'size_t Print::write(const char*)'
size_t write(const char *str)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: no known conversion for argument 1 from 'StringSumHelper' to 'const char*'
mmsj300:343:72: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" String(fcor) ";" String(bcor) "m"); // background: black, foreground: green
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate expects 2 arguments, 1 provided
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: candidate: 'virtual size_t fabgl::Terminal::write(uint8_t)'
size_t write(uint8_t c);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1201:10: note: no known conversion for argument 1 from 'StringSumHelper' to 'uint8_t' {aka 'unsigned char'}
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate: 'void fabgl::Terminal::write(uint8_t, bool)'
void write(uint8_t c, bool fromISR);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1209:8: note: candidate expects 2 arguments, 1 provided
In file included from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Stream.h:26,
from C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Arduino.h:166,
from C:\Users\moahr\AppData\Local\Temp\arduino_build_152019\sketch\mmsj300.ino.cpp:1:
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate: 'size_t Print::write(const char*, size_t)'
size_t write(const char *buffer, size_t size)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:70:12: note: candidate expects 2 arguments, 1 provided
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: candidate: 'size_t Print::write(const char*)'
size_t write(const char *str)
^~~~~
C:\Users\moahr\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.4\cores\esp32/Print.h:62:12: note: no known conversion for argument 1 from 'StringSumHelper' to 'const char*'
mmsj300:344:71: error: no matching function for call to 'fabgl::Terminal::write(StringSumHelper&)'
Terminal.write("\e[" String(vxx) ";" String(vyy) "H"); // move cursor
^
In file included from E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/fabgl.h:314,
from D:\Projetos\ESP32\MMSJ300\firmware\mmsj300\mmsj300.ino:27:
E:\Program Files (x86)\Arduino\libraries\FabGL-master\src/terminal.h:1192:10: note: candidate: 'virtual size_t fabgl::Terminal::write(const uint8_t*, size_t)'
size_t write(const uint8_t * buffer, size_t size);
^~~~~
E:\Program Files (x86)\Arduino\libraries\FabGL-master\
CodePudding user response:
You have two problems:
The first is that you should not cast any literal string. The StringSumHelper
class have a const char *
constructor that could be used, and literal strings will be converted to a const char *
by default.
So doing e.g.
Terminal.write("\e[" String(bcor) ";" String(fcor) "m"); // background: defined, foreground: defined
should work fine.
The second problem is that there's no proper Terminal::write
function to use. You should declare (and define) it to use a String
argument:
size_t Terminal::write(const String& string)
You could create this function as an overload that calls the variant with a pointer and a size:
size_t Terminal::write(const String& string)
{
return write(static_cast<const uint8_t*>(string.c_str()), string.length());
}
CodePudding user response:
If Terminal
inherits Print
, this will work
Terminal.write(("\e[" String(bcor) ";" String(fcor) "m").c_str());
Otherwise you have to put a message in a local variable
auto string = "\e[" String(bcor) ";" String(fcor) "m";
Terminal.write(static_cast<const uint8_t*>(string.c_str()), string.length());
CodePudding user response:
I have found the solution... using .c_str() like this:
Terminal.write(("\e[" String(bcor) ";" String(fcor) "m").c_str()); // background: defined, foreground: defined
I do not like use c_str(), but only unique solution was this... until now.