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

mr24hpb1.yaml won't compile for ESP8266 #2

Open
ClassicGOD opened this issue Jul 8, 2023 · 2 comments
Open

mr24hpb1.yaml won't compile for ESP8266 #2

ClassicGOD opened this issue Jul 8, 2023 · 2 comments

Comments

@ClassicGOD
Copy link

While trying to build mr24hpb1.yaml example for ESP8266 I'm getting:

Compiling /data/mmwave/.pioenvs/mmwave/lib67b/ESP8266WiFi/ESP8266WiFiSTA-WPS.cpp.o
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/mr24hpb1.h: In member function 'void MR24HPB1::process()':
src/mr24hpb1.h:57:40: error: initializer fails to determine size of '__pstr__'
   57 |             ESP_LOGD("mr24d", msg.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:149:28: note: in expansion of macro 'esph_log_d'
  149 | #define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__)
      |                            ^~~~~~~~~~
src/mr24hpb1.h:57:13: note: in expansion of macro 'ESP_LOGD'
   57 |             ESP_LOGD("mr24d", msg.c_str());
      |             ^~~~~~~~
src/mr24hpb1.h:57:40: error: array must be initialized with a brace-enclosed initializer
   57 |             ESP_LOGD("mr24d", msg.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:149:28: note: in expansion of macro 'esph_log_d'
  149 | #define ESP_LOGD(tag, ...) esph_log_d(tag, __VA_ARGS__)
      |                            ^~~~~~~~~~
src/mr24hpb1.h:57:13: note: in expansion of macro 'ESP_LOGD'
   57 |             ESP_LOGD("mr24d", msg.c_str());
      |             ^~~~~~~~

It builds fine for ESP32

fixed by changing line 57 of mr24hpb1.h from:
ESP_LOGD("mr24d", msg.c_str());
to:
ESP_LOGD("mr24d", "%s", msg.c_str());

My C++ is rusty as hell, and I've read zero docs so I have no idea if it's correct but it works. I also had to disable logging over UART and use the hardware UART on the ESP8266 to successfully communicate with the sensor but other than that it works perfectly.

@flamme-lord
Copy link

Any update on this?

@Chrisrdouglas
Copy link

Any update on this?

I made a PR for this just now :)

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