Roomba
Roomba copied to clipboard
Library does not load for espressif units
It seems as when it cannot find a hardware serial 0 or 1, the code brakes for imports in Platformio (which is what is used in the background by Esphome), as far as I can tell the error originates from here:
https://github.com/Apocrathia/Roomba/blob/c19391de107382cd27911c189167f11e9c2dffb4/Roomba.h#L389-L395
just importing the library breaks the code and produces this error:
Compiling .pioenvs/eroomba/src/main.cpp.o
Compiling .pioenvs/eroomba/lib496/Roomba/Roomba.cpp.o
In file included from .piolibdeps/eroomba/Roomba/Roomba.cpp:6:0:
.piolibdeps/eroomba/Roomba/Roomba.h:394:21: error: expected ')' before '*' token
Roomba(Serial_* serial = &serial, Baud baud = Baud57600);
^
.piolibdeps/eroomba/Roomba/Roomba.cpp:8:1: error: prototype for 'Roomba::Roomba(HardwareSerial*, Roomba::Baud)' does not match any in class 'Roomba'
Roomba::Roomba(HardwareSerial* serial, Baud baud)
^
In file included from .piolibdeps/eroomba/Roomba/Roomba.cpp:6:0:
.piolibdeps/eroomba/Roomba/Roomba.h:199:7: error: candidates are: constexpr Roomba::Roomba(Roomba&&)
class Roomba
^
.piolibdeps/eroomba/Roomba/Roomba.h:199:7: error: constexpr Roomba::Roomba(const Roomba&)
.piolibdeps/eroomba/Roomba/Roomba.h:199:7: error: Roomba::Roomba()
*** [.pioenvs/eroomba/lib496/Roomba/Roomba.cpp.o] Error 1
I get an error that includes the same part about the token (.piolibdeps/eroomba/Roomba/Roomba.h:394:21: error: expected ')' before '*' token Roomba(Serial_* serial = &serial, Baud baud = Baud57600);
) - but pointing to another cause it seems:
Compiling /data/roomba_001/.pioenvs/roomba_001/lib4d9/ESP8266WiFi/ESP8266WiFiGeneric.cpp.o
In file included from src/ESPHomeRoombaComponent.h:2:0,
from src/main.cpp:35:
/data/roomba_001/.piolibdeps/roomba_001/Roomba/Roomba.h:394:21: error: expected ')' before '*' token
Roomba(Serial_* serial = &serial, Baud baud = Baud57600);
^
In file included from src/main.cpp:35:0:
src/ESPHomeRoombaComponent.h: In constructor 'RoombaComponent::RoombaComponent(const string&, const string&, uint8_t, uint32_t)':
src/ESPHomeRoombaComponent.h:187:77: error: no matching function for call to 'Roomba::Roomba(HardwareSerial*, Roomba::Baud)'
PollingComponent(updateInterval), roomba(&Serial, Roomba::Baud115200)
^
src/ESPHomeRoombaComponent.h:187:77: note: candidates are:
In file included from src/ESPHomeRoombaComponent.h:2:0,
from src/main.cpp:35:
/data/roomba_001/.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: Roomba::Roomba()
class Roomba
^
/data/roomba_001/.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: candidate expects 0 arguments, 2 provided
/data/roomba_001/.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: constexpr Roomba::Roomba(const Roomba&)
/data/roomba_001/.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: candidate expects 1 argument, 2 provided
/data/roomba_001/.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: constexpr Roomba::Roomba(Roomba&&)
/data/roomba_001/.piolibdeps/roomba_001/Roomba/Roomba.h:199:7: note: candidate expects 1 argument, 2 provided
Compiling /data/roomba_001/.pioenvs/roomba_001/lib4d9/ESP8266WiFi/ESP8266WiFiGratuitous.cpp.o
*** [/data/roomba_001/.pioenvs/roomba_001/src/main.cpp.o] Error 1
Compiling /data/roomba_001/.pioenvs/roomba_001/lib4d9/ESP8266WiFi/ESP8266WiFiMulti.cpp.o
Unfortunately, I'm not really sure what to do - hope the error message can help someone smarter than me with identifying the problem 👍
I have made a fork that just defines the hardware serial property so that we avoid this error, it is not a future proof solution in cases where we are not using the default serial pins. I have tested it with D1 mini and other esp boards.
https://github.com/Ceiku/Roomba
I notice that you are doing this with esphome, as myself. I have just made a Roomba component for it, that talks natively with home assistant. https://github.com/Ceiku/ESPHomeRoombaComponent