tobiasschuerg / InfluxDB-Client-for-Arduino

Simple library for sending measurements to an InfluxDB with a single network request. Supports ESP8266 and ESP32.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

core_version.h doesn't exists

juanitomaille opened this issue · comments

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 👍
static const char UserAgent[] PROGMEM = "influxdb-client-arduino/" INFLUXDB_CLIENT_VERSION " (**[DELETED CONTENT]**)";

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

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.

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.

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

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}

@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?

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).

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.

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!