tobiasschuerg / InfluxDB-Client-for-Arduino

Simple library for sending measurements to an InfluxDB with a single network request. Supports ESP8266 and ESP32.
MIT License
373 stars 93 forks source link

core_version.h doesn't exists #183

Closed juanitomaille closed 1 year ago

juanitomaille commented 2 years ago

My platformio.ini :

[env:esp32Makerfabs] platform = espressif32 board = esp32dev framework = arduino board_build.mcu = esp32s2 upload_protocol = esptool platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32#2.0.0-alpha1 platformio/tool-esptoolpy @ ~1.30100 src_filter = +<> -<.git/> -<.svn/> - - - - -<main_sensor.cpp> -<main_ihm.cpp> -<main_ihm_ili9486.cpp> build_flags = -DLV_CONF_INCLUDE_SIMPLE -DLV_DEMO_CONF_INCLUDE_SIMPLE -Iinclude -Iinclude/logos lib_deps = lovyan03/LovyanGFX@^0.4.11 lvgl/lvgl@^8.1.0 tobiasschuerg/ESP8266 Influxdb@^3.11.0

I had to comment #include "Platform.h" in influxDbClient.cpp and HTTPService.cpp and delete references in line 3 of HTTPService.cpp :+1: static const char UserAgent[] PROGMEM = "influxdb-client-arduino/" INFLUXDB_CLIENT_VERSION " (**[DELETED CONTENT]**)";

I think it's ok now, I will test.

vlastahajek commented 2 years ago

The library successfully compiles in Arduino IDE using both ESP32 Arduino Core 1.0.6 and, the latest, 2.0.2. There is CI compile test using PlatformIO and ESP32 Arduino Core 1.0.6. There must a problem in your compile chain. Try 2.0.2, please.

juanitomaille commented 2 years ago

I've just tried 2.0.2 version. Same error. ...but compilation also breaks because of ESP32S2. I return in 2.0.0-alpha1 advised by my board provider. It's not a big problem for me, your library seems to work great with those modifications.

Thanks.

vlastahajek commented 2 years ago

The problem must be in the toolchain. In #169, there was a similar issue.

juanitomaille commented 2 years ago

Ah OK, I didn't see that before.

I will try to find the problem, thanks

Le mer. 9 mars 2022, 22:10, Vlasta Hajek @.***> a écrit :

The problem must be in the toolchain. In #169 https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino/issues/169, there was a similar issue.

— Reply to this email directly, view it on GitHub https://github.com/tobiasschuerg/InfluxDB-Client-for-Arduino/issues/183#issuecomment-1063373881, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKWW3UR46NIED5TBRKL6DWDU7EHVJANCNFSM5QKMTI7A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.*** com>

cmoscicada commented 2 years ago

You need to change the include library name See below screenshot that I've changed.

2022-04-21_14-59-36

===================== Mt platformio.ini

[common] lib_deps = khoih-prog/ESPAsync_WiFiManager@1.12.2 khoih-prog/ESP_DoubleResetDetector @ 1.3.1 ayushsharma82/AsyncElegantOTA@2.2.6 adafruit/RTClib@2.0.2 bblanchon/ArduinoTrace@1.2.0 ;tobiasschuerg/ESP8266 Influxdb@3.12.0 https://github.com/AENTS/InfluxDB-Client-for-Arduino.git#a1.0.0

[env:EScopeGen1-esp32] platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream board = esp-wrover-kit framework = arduino platform_packages = platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.2 lib_deps = ${common.lib_deps}

gasagna commented 1 year ago

@vlastahajek: I wonder if this issue should really be closed.

I am also affected by this bug, as the board SDK I use does not ship with a core_version.h header file. Actually, this file appears to be generated before a release by a bash script (as seen here in the main arduino-ep32 repo) and it defines variables for the release version (e.g. ARDUINO_ESP32_GIT_DESC). These variables are then used in Platform.h in this repo.

On the other hand, the header file "esp_arduino_version.h" (also mentioned just above here by @cmoscicada ) defines similar variables and is not generated automatically on release, but is part of the arduino-esp32 repo. Can we include this file instead in Platform.h and define the variable INFLUXDB_CLIENT_PLATFORM_VERSION from its content?

gasagna commented 1 year ago

The modified Platform.h might look like this (untested)

#ifndef _PLATFORM_H_
#define _PLATFORM_H_

#define STRHELPER(x) #x
#define STR(x) STRHELPER(x) // stringifier

// form version string
#define VERSION_STR(MAJOR, MINOR, PATCH) STR(MAJOR) "." STR(MINOR) "." STR(PATCH)

#if defined(ESP8266)
# include <core_version.h>
# define INFLUXDB_CLIENT_PLATFORM "ESP8266"
# define INFLUXDB_CLIENT_PLATFORM_VERSION  STR(ARDUINO_ESP8266_GIT_DESC)
#elif defined(ESP32)
# include <esp_arduino_version.h>
# define INFLUXDB_CLIENT_PLATFORM "ESP32"
# define INFLUXDB_CLIENT_PLATFORM_VERSION VERSION_STR(ESP_ARDUINO_VERSION_MAJOR, ESP_ARDUINO_VERSION_MINOR, ESP_ARDUINO_VERSION_PATCH)
#endif

#endif //_PLATFORM_H_

Note that the esp8266 arduino core uses the header core_version.h (see here).

gasagna commented 1 year ago

I have tested the code above and I managed to compile my sketch using the incomplete board definition I am using. Is this change something that would be accepted? I can make a pull request.

vlastahajek commented 1 year ago

I'm quite disappointed by the branched Arduino Cores world. This library was built relying on the official Arduino cores for ESP8266 and ESP32. Then came issues with PlatformIO, where they had a big delay in adopting new releases of Arduino cores. Now there are also unofficial copies of cores.

I'm using Helltec WiFi Lora 32 v2 with official ESP32 Arduino Core and external LoRa/LoRaWAN libraries with no problems.

Anyway, @gasagna, thanks for investigating the solution <esp_arduino_version.h> is included in the SDK since 2.0.0. At this time, I guess the last pre 2.0 release 1.0.6 is ancient now, so there will be no problem.

Feel free to open a PR!