pboschi / HCPBridgeMqtt

emulates Hoermann HAP 1 HCP (HCP2) on ESP8622, ESP32 and Arduino.
18 stars 3 forks source link

Unable to build/upload using VSCode #2

Closed stomko11 closed 1 year ago

stomko11 commented 1 year ago

Hello. I downloaded your code and opened it using VSCode (using Platformio IDE), however I am unable to build/upload. I get bunch of errors. Am I missing something? Here is complete output I get:

Processing esp32 (platform: espressif32; board: nodemcu-32s; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/nodemcu-32s.html
PLATFORM: Espressif 32 (3.4.0) > NodeMCU-32S
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.10006.210326 (1.0.6)
 - tool-esptoolpy @ 1.30100.210531 (3.1.0)
 - toolchain-xtensa32 @ 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ deep+, Compatibility ~ soft
Found 41 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESPAsyncWiFiManager @ 0.31.0+sha.3b9a58a
|   |-- WiFi @ 1.0
|   |-- ESPAsyncWebServer-esphome @ 3.0.0
|   |   |-- AsyncTCP-esphome @ 2.0.0
|   |   |-- FS @ 1.0
|   |   |-- WiFi @ 1.0
|   |-- FS @ 1.0
|   |-- AsyncTCP @ 1.1.1
|   |-- DNSServer @ 1.1.0
|   |   |-- WiFi @ 1.0
|-- ESPAsyncWebServer-esphome @ 3.0.0
|   |-- AsyncTCP-esphome @ 2.0.0
|   |-- FS @ 1.0
|   |-- WiFi @ 1.0
|-- DallasTemperature @ 3.11.0
|   |-- OneWire @ 2.3.7
|-- Adafruit BME280 Library @ 2.2.2
|   |-- Adafruit BusIO @ 1.14.1
|   |   |-- Wire @ 1.0.1
|   |   |-- SPI @ 1.0
|   |-- Wire @ 1.0.1
|   |-- SPI @ 1.0
|   |-- Adafruit Unified Sensor @ 1.1.8
|-- ArduinoJson @ 6.20.1
|-- EspSoftwareSerial @ 8.0.0
|-- AsyncElegantOTA @ 2.2.7
|-- AsyncMqttClient @ 0.9.0
|   |-- AsyncTCP @ 1.1.1
|-- OneWire @ 2.3.7
|-- WiFi @ 1.0
|-- AsyncTCP @ 1.1.1
|-- Update @ 1.0
|-- FS @ 1.0
|-- Ticker @ 1.1
|-- DNSServer @ 1.1.0
|   |-- WiFi @ 1.0
Building in release mode
Compiling .pio\build\esp32\src\hciemulator.cpp.o
In file included from C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:52:0,
                 from C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:35,
                 from src/hciemulator.h:4,
                 from src/hciemulator.cpp:1:
C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.h:26:20: error: expected identifier before numeric constant
 #define SERIAL_5N1 0x8000010
                    ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:48:5: note: in expansion of macro 'SERIAL_5N1'
     SERIAL_5N1 = PARITY_NONE,
     ^
C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.h:26:20: error: expected '}' before numeric constant
 #define SERIAL_5N1 0x8000010
                    ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:48:5: note: in expansion of macro 'SERIAL_5N1'
     SERIAL_5N1 = PARITY_NONE,
     ^
C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.h:26:20: error: expected unqualified-id before numeric constant
 #define SERIAL_5N1 0x8000010
                    ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:48:5: note: in expansion of macro 'SERIAL_5N1'
     SERIAL_5N1 = PARITY_NONE,
     ^
In file included from src/hciemulator.h:6:0,
                 from src/hciemulator.cpp:1:
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:96:38: error: expected class-name before ',' token
 class UART : private GpioCapabilities, public Stream {
                                      ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:116:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config,
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:119:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config,
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:123:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config,
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:127:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config = SERIAL_8N1) {
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:191:32: error: 'Parity' has not been declared
     size_t write(uint8_t byte, Parity parity);
                                ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:196:54: error: 'Parity' has not been declared
     size_t write(const uint8_t* buffer, size_t size, Parity parity);
                                                      ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:197:51: error: 'Parity' has not been declared
     size_t write(const char* buffer, size_t size, Parity parity) {
                                                   ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:288:5: error: 'Parity' does not name a type
     Parity m_parityMode;
     ^
In file included from src/hciemulator.h:6:0,
                 from src/hciemulator.cpp:1:
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:316:1: error: expected declaration before '}' token
 }; // namespace EspSoftwareSerial
 ^
Compiling .pio\build\esp32\src\main.cpp.o
Archiving .pio\build\esp32\lib4a5\libWiFi.a
In file included from src/main.cpp:3:0:
.pio/libdeps/esp32/AsyncElegantOTA/src/AsyncElegantOTA.h:4:2: warning: #warning AsyncElegantOTA.loop(); is deprecated, please remove it from loop() if defined. This function will be removed in a future release. [-Wcpp]
 #warning AsyncElegantOTA.loop(); is deprecated, please remove it from loop() if defined. This function will be removed in a future release.
  ^
Compiling .pio\build\esp32\lib63e\AsyncTCP-esphome\AsyncTCP.cpp.o
*** [.pio\build\esp32\src\hciemulator.cpp.o] Error 1
In file included from C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:52:0,
                 from C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:35,
                 from src/main.cpp:1:
C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.h:26:20: error: expected identifier before numeric constant
 #define SERIAL_5N1 0x8000010
                    ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:48:5: note: in expansion of macro 'SERIAL_5N1'
     SERIAL_5N1 = PARITY_NONE,
     ^
C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.h:26:20: error: expected '}' before numeric constant
 #define SERIAL_5N1 0x8000010
                    ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:48:5: note: in expansion of macro 'SERIAL_5N1'
     SERIAL_5N1 = PARITY_NONE,
     ^
C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-uart.h:26:20: error: expected unqualified-id before numeric constant
 #define SERIAL_5N1 0x8000010
                    ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:48:5: note: in expansion of macro 'SERIAL_5N1'
     SERIAL_5N1 = PARITY_NONE,
     ^
In file included from src/hciemulator.h:6:0,
                 from src/main.cpp:13:
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:96:38: error: expected class-name before ',' token
 class UART : private GpioCapabilities, public Stream {
                                      ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:116:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config,
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:119:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config,
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:123:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config,
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:127:31: error: 'Config' has not been declared
     void begin(uint32_t baud, Config config = SERIAL_8N1) {
                               ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:191:32: error: 'Parity' has not been declared
     size_t write(uint8_t byte, Parity parity);
                                ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:196:54: error: 'Parity' has not been declared
     size_t write(const uint8_t* buffer, size_t size, Parity parity);
                                                      ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:197:51: error: 'Parity' has not been declared
     size_t write(const char* buffer, size_t size, Parity parity) {
                                                   ^
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:288:5: error: 'Parity' does not name a type
     Parity m_parityMode;
     ^
In file included from src/hciemulator.h:6:0,
                 from src/main.cpp:13:
.pio/libdeps/esp32/EspSoftwareSerial/src/SoftwareSerial.h:316:1: error: expected declaration before '}' token
 }; // namespace EspSoftwareSerial
 ^
*** [.pio\build\esp32\src\main.cpp.o] Error 1
========================================================================================= [FAILED] Took 11.03 seconds =========================================================================================

 *  The terminal process "C:\Users\user\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

In addition, I noticed that in configuration.h, wifi configuration has following variables:

// WIFI
const char* AP_PASSWD = "password";
const char HOSTNAME[] = "HCPBRIDGE";

Where do I define SSID?

m-vanson commented 1 year ago

I'm getting the same errors which I'm working on right now.

The SSID is in the code: wifiManager.autoConnect(YOUR-SSID-HERE,AP_PASSWD); // password protected ap

If it can't connect, it will start an AP for you to which you can connect and configure WIFI

m-vanson commented 1 year ago

I found a fix for the compilation errors.

For some reason, the included library in VSCode has some errors. If you go to this page: https://github.com/plerup/espsoftwareserial/tree/main/src

And copy 'n paste the code into to following files (replace):

Now the project should build an upload (I have the webpage working, have yet to try it with the door)

stomko11 commented 1 year ago

I did resolve it by downgrading EspSoftwareSerial library from v.8 to v. 6.17.1 and it compiled fine