Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include file contains lots of issues #3

Closed
magtimmermans opened this issue Jan 13, 2023 · 3 comments
Closed

include file contains lots of issues #3

magtimmermans opened this issue Jan 13, 2023 · 3 comments

Comments

@magtimmermans
Copy link

After compiling the include file contains errors (Using esphome 2022.12.3):

Compiling /data/ld2410-presence-sensor/.pioenvs/ld2410-presence-sensor/lib67b/ESP8266WiFi/WiFiClient.cpp.o
In file included from src/main.cpp:111:
src/ld2410.h:84:40: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
84 | static constexpr char *const TAG = "ld2410";
| ^~~~~~~~
In file included from src/esphome/core/log.h:8,
from src/esphome/components/api/proto.h:4,
from src/esphome/components/api/api_pb2.h:5,
from src/esphome/components/api/api_connection.h:4,
from src/esphome.h:3,
from src/main.cpp:3:
src/ld2410.h: In member function 'void LD2410::ESP_LOGD_HEX()':
src/ld2410.h:269:32: error: initializer fails to determine size of 'pstr'
269 | ESP_LOGD(TAG, res.c_str());
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:39:76: note: in definition of macro 'FPSTR'
39 | #define FPSTR(pstr_pointer) (reinterpret_cast<const _FlashStringHelper *>(pstr_pointer))
| ^~~~~~~~~~~~
src/esphome/core/log.h:67:36: note: in expansion of macro 'F'
67 | #define ESPHOME_LOG_FORMAT(format) F(format)
| ^
src/esphome/core/log.h:92:59: note: in expansion of macro 'ESPHOME_LOG_FORMAT'
92 | esp_log_printf
(ESPHOME_LOG_LEVEL_DEBUG, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
| ^~~~~~~~~~~~~~~~~~
src/esphome/core/log.h:152:28: note: in expansion of macro 'esph_log_d'
152 | #define ESP_LOGD(tag, ...) esph_log_d(tag, VA_ARGS)
| ^~~~~~~~~~
src/ld2410.h:269:9: note: in expansion of macro 'ESP_LOGD'
269 | ESP_LOGD(TAG, res.c_str());
| ^~~~~~~~
src/ld2410.h:269:32: error: array must be initialized with a brace-enclosed initializer
269 | ESP_LOGD(TAG, res.c_str());
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:39:76: note: in definition of macro 'FPSTR'
39 | #define FPSTR(pstr_pointer) (reinterpret_cast<const _FlashStringHelper *>(pstr_pointer))
| ^~~~~~~~~~~~
src/esphome/core/log.h:67:36: note: in expansion of macro 'F'
67 | #define ESPHOME_LOG_FORMAT(format) F(format)
| ^
src/esphome/core/log.h:92:59: note: in expansion of macro 'ESPHOME_LOG_FORMAT'
92 | esp_log_printf
(ESPHOME_LOG_LEVEL_DEBUG, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
| ^~~~~~~~~~~~~~~~~~
src/esphome/core/log.h:152:28: note: in expansion of macro 'esph_log_d'
152 | #define ESP_LOGD(tag, ...) esph_log_d(tag, VA_ARGS)
| ^~~~~~~~~~
src/ld2410.h:269:9: note: in expansion of macro 'ESP_LOGD'
269 | ESP_LOGD(TAG, res.c_str());
| ^~~~~~~~
src/ld2410.h: In member function 'void LD2410::ESP_LOGD_HEX(std::vector, uint8_t)':
src/ld2410.h:283:32: error: initializer fails to determine size of 'pstr'
283 | ESP_LOGD(TAG, res.c_str());
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:39:76: note: in definition of macro 'FPSTR'
39 | #define FPSTR(pstr_pointer) (reinterpret_cast<const _FlashStringHelper *>(pstr_pointer))
| ^~~~~~~~~~~~
src/esphome/core/log.h:67:36: note: in expansion of macro 'F'
67 | #define ESPHOME_LOG_FORMAT(format) F(format)
| ^
src/esphome/core/log.h:92:59: note: in expansion of macro 'ESPHOME_LOG_FORMAT'
92 | esp_log_printf
(ESPHOME_LOG_LEVEL_DEBUG, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
| ^~~~~~~~~~~~~~~~~~
src/esphome/core/log.h:152:28: note: in expansion of macro 'esph_log_d'
152 | #define ESP_LOGD(tag, ...) esph_log_d(tag, VA_ARGS)
| ^~~~~~~~~~
src/ld2410.h:283:9: note: in expansion of macro 'ESP_LOGD'
283 | ESP_LOGD(TAG, res.c_str());
| ^~~~~~~~
src/ld2410.h:283:32: error: array must be initialized with a brace-enclosed initializer
283 | ESP_LOGD(TAG, res.c_str());
/data/cache/platformio/packages/framework-arduinoespressif8266/cores/esp8266/WString.h:39:76: note: in definition of macro 'FPSTR'
39 | #define FPSTR(pstr_pointer) (reinterpret_cast<const _FlashStringHelper *>(pstr_pointer))
| ^~~~~~~~~~~~
src/esphome/core/log.h:67:36: note: in expansion of macro 'F'
67 | #define ESPHOME_LOG_FORMAT(format) F(format)
| ^
src/esphome/core/log.h:92:59: note: in expansion of macro 'ESPHOME_LOG_FORMAT'
92 | esp_log_printf
(ESPHOME_LOG_LEVEL_DEBUG, tag, LINE, ESPHOME_LOG_FORMAT(format), ##VA_ARGS)
| ^~~~~~~~~~~~~~~~~~
src/esphome/core/log.h:152:28: note: in expansion of macro 'esph_log_d'
152 | #define ESP_LOGD(tag, ...) esph_log_d(tag, VA_ARGS)
| ^~~~~~~~~~
src/ld2410.h:283:9: note: in expansion of macro 'ESP_LOGD'
283 | ESP_LOGD(TAG, res.c_str());
| ^~~~~~~~
Compiling /data/ld2410-presence-sensor/.pioenvs/ld2410-presence-sensor/lib67b/ESP8266WiFi/WiFiClientSecureBearSSL.cpp.o
Compiling /data/ld2410-presence-sensor/.pioenvs/ld2410-presence-sensor/lib67b/ESP8266WiFi/WiFiServer.cpp.o
Compiling /data/ld2410-presence-sensor/.pioenvs/ld2410-presence-sensor/lib67b/ESP8266WiFi/WiFiServerSecureBearSSL.cpp.o
*** [/data/ld2410-presence-sensor/.pioenvs/ld2410-presence-sensor/src/main.cpp.o] Error 1
========================== [FAILED] Took 5.64 seconds ==========================

@amandel
Copy link
Owner

amandel commented Jan 14, 2023

From what I see in your text, I guess you use a ESP8266? Unfortunately the code only works for:

esp32:
  board: esp32dev
  framework:
    type: arduino

@magtimmermans
Copy link
Author

Aha, okay. Then I will search for something else. Thanks

@reversebias
Copy link

I was able to get this working perfectly fine on esp8266 (esp01_1m specifically), with the deletion of those two unused functions: ESP_LOGD_HEX(...). See the diff here: reversebias@bafb4a0

Note that I'm using the hardware UART of the esp8266 (tested both GPIO1/3 and GPIO15/13). No performance issues that I can see either, ie streaming engineering mode, or multiple log sessions + web server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants