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

Running BLE-Scanner in Platformio #23

Open
heinpuett opened this issue Apr 29, 2024 · 4 comments
Open

Running BLE-Scanner in Platformio #23

heinpuett opened this issue Apr 29, 2024 · 4 comments
Assignees

Comments

@heinpuett
Copy link

hi there,
i have a problem compiling the sourcecode in platformio.
i think the issue is, that i cannot find the right the right libs.
im using a esp-cam module without cam. espressif-32s.
is there anybodey out there to solve my problem. i spend many hours yet, but i cannot compile it an get it running.
best regards ralf

@gromeck
Copy link
Owner

gromeck commented May 1, 2024

Hi Ralf, a few more details would help?
What output does your compiler produce? What error messages are shown?

@heinpuett
Copy link
Author

hi christian,
sorry for beeing absent for so long, i were on a camper without internet...

here is the platformio.ini:
;-------------------------------------------------------------------------------------------------------------------
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html

[env:esp32dev]
platform = espressif32
board = esp32cam
framework = arduino
lib_deps =
bblanchon/ArduinoJson@^7.0.4
h2zero/NimBLE-Arduino@^1.3.1
knolleary/PubSubClient@^2.8
paulstoffregen/Time@^1.6.1
;-------------------------------------------------------------------------------------------------------------------

and her is what the compiler says:

;-------------------------------------------------------------------------------------------------------------------
Processing esp32dev (platform: espressif32; board: esp32cam; framework: arduino)

Verbose mode can be enabled via -v, --verbose option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32cam.html
PLATFORM: Espressif 32 (6.1.0) > AI Thinker ESP32-CAM
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, 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.20007.0 (2.0.7)
  • tool-esptoolpy @ 1.40500.0 (4.5.0)
  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
    Converting BLE-Scanner.ino
    LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
    LDF Modes: Finder ~ chain, Compatibility ~ soft
    Found 38 compatible libraries
    Scanning dependencies...
    Dependency Graph
    |-- ArduinoJson @ 7.0.4
    |-- NimBLE-Arduino @ 1.4.1
    |-- PubSubClient @ 2.8.0
    |-- Time @ 1.6.1
    |-- Update @ 2.0.0
    |-- WebServer @ 2.0.0
    |-- DNSServer @ 2.0.0
    |-- WiFi @ 2.0.0
    Building in release mode
    Compiling .pio\build\esp32dev\src\BLE-Scanner.ino.cpp.o
    Compiling .pio\build\esp32dev\src\ble-manufacturer.cpp.o
    Compiling .pio\build\esp32dev\src\bluetooth.cpp.o
    Compiling .pio\build\esp32dev\src\config.cpp.o
    Compiling .pio\build\esp32dev\src\eeprom.cpp.o
    Compiling .pio\build\esp32dev\src\http.cpp.o
    Compiling .pio\build\esp32dev\src\led.cpp.o
    Compiling .pio\build\esp32dev\src\mqtt.cpp.o
    src/eeprom.cpp: In function 'void EepromInit(int)':
    src/eeprom.cpp:36:3: error: 'EEPROM' was not declared in this scope
    EEPROM.begin(_eeprom_size);
    ^~~~~~
    src/eeprom.cpp:36:3: note: suggested alternative: 'EIDRM'
    EEPROM.begin(_eeprom_size);
    ^~~~~~
    EIDRM
    src/eeprom.cpp: In function 'void EepromClear()':
    src/eeprom.cpp:65:5: error: 'EEPROM' was not declared in this scope
    EEPROM.write(n, 0xff);
    ^~~~~~
    src/eeprom.cpp:65:5: note: suggested alternative: 'EIDRM'
    EEPROM.write(n, 0xff);
    ^~~~~~
    EIDRM
    src/eeprom.cpp:66:3: error: 'EEPROM' was not declared in this scope
    EEPROM.commit();
    ^~~~~~
    src/eeprom.cpp:66:3: note: suggested alternative: 'EIDRM'
    EEPROM.commit();
    ^~~~~~
    EIDRM
    src/eeprom.cpp: In function 'int EepromRead(int, int, void*)':
    src/eeprom.cpp:80:9: error: 'EEPROM' was not declared in this scope
    if (EEPROM.read(addr + n) != 0xff)
    ^~~~~~
    src/eeprom.cpp:80:9: note: suggested alternative: 'EIDRM'
    if (EEPROM.read(addr + n) != 0xff)
    ^~~~~~
    EIDRM
    src/eeprom.cpp:87:28: error: 'EEPROM' was not declared in this scope
    ((byte *) buffer)[n] = EEPROM.read(addr + n);
    ^~~~~~
    src/eeprom.cpp:87:28: note: suggested alternative: 'EIDRM'
    ((byte ) buffer)[n] = EEPROM.read(addr + n);
    ^~~~~~
    EIDRM
    src/eeprom.cpp: In function 'void EepromWrite(int, int, const void
    )':
    src/eeprom.cpp:102:5: error: 'EEPROM' was not declared in this scope
    EEPROM.write(addr + n, ((byte *) buffer)[n]);
    ^~~~~~
    src/eeprom.cpp:102:5: note: suggested alternative: 'EIDRM'
    EEPROM.write(addr + n, ((byte *) buffer)[n]);
    ^~~~~~
    EIDRM
    src/eeprom.cpp:107:3: error: 'EEPROM' was not declared in this scope
    EEPROM.commit();
    ^~~~~~
    src/eeprom.cpp:107:3: note: suggested alternative: 'EIDRM'
    EEPROM.commit();
    ^~~~~~
    EIDRM
    *** [.pio\build\esp32dev\src\eeprom.cpp.o] Error 1
    In file included from src/http.cpp:26:
    C:/Users/Dell Latitude E7470/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:177:3: error: 'WiFiServer' does not name a type; did you mean 'WebServer'?
    WiFiServer _server;
    ^~~~~~~~~~
    WebServer
    *** [.pio\build\esp32dev\src\http.cpp.o] Error 1
    ==================================================== [FAILED] Took 20.14 seconds ====================================================
  • The terminal process "C:\Users\Dell Latitude E7470.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1.
  • Terminal will be reused by tasks, press any key to close it.

;-------------------------------------------------------------------------------------------------------------------

do you have an idea what might be the problem?

best regards ralf

@gromeck
Copy link
Owner

gromeck commented Jul 2, 2024

Sorry for the late reply.

I have no experience with plaffromio, but did you install the esp32 package?
EEPROM is part of this package -- at least in the Arduion IDE context.

@wprinz
Copy link

wprinz commented Jul 31, 2024

Hi @heinpuett - I ran into similar problems, but in the meantime I was able to compile the code on PlatformIO. Here is the workaround:

  • platformio requires that all "project specific (private) libraries" are located in the lib folder. Thus you need to create for each local lib a subfolder in /lib with the same name as the lib, and then you need to move the .h and .cpp files into that folder, e.g. /util/util.h and /util/util.ccp
  • the case insensitivity on windows causes problems with the local eeprom.h and wifi.h files, as they conflict with EEPROM and WiFi. After renaming these to my_eeprom and my_wifi the compile errors you mention above disappear.
  • Finally platformio seems to include not the standard arduino libs for esp_task_wdt.h. but instead some espressif libs. In these libs esp_task_wdt_init is no longer defined and other API changes have been made. Thus you need to change the following code in watchdog.cpp:

old:

 esp_task_wdt_config_t config;

  config.timeout_ms = timeout * 1000;
  config.idle_core_mask = 1 << 0;
  config.trigger_panic = true;
 

  if ((rc = esp_task_wdt_init(&config)) == ESP_ERR_INVALID_STATE) {
    LogMsg("WATCHDOG: already configured -- trying reconfiguration");
    rc = esp_task_wdt_reconfigure(&config);
  }
  if (rc != ESP_OK) {
    LogMsg("WATCHDOG: configuration of watchdog failed -- restarting");
    ESP.restart();
  }

new:

   if ((rc = esp_task_wdt_init(timeout * 1000, true)) == ESP_OK) {
    LogMsg("WATCHDOG: configuration OK");

  } else
{
    LogMsg("WATCHDOG: configuration of watchdog failed -- restarting");
    ESP.restart();
  }

After these modifications the code compiled with the following platformio.ini file:

[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1   ; replace with our specific board
framework = arduino

lib_ldf_mode = chain+  ; required otherwise the following error occurs: fatal error: TimeLib.h: No such file or directory 

lib_deps = 
	PubSubClient@^2.8
	NimBLE-Arduino@^1.4.0
	Time@^1.6.1

monitor_speed = 115200

I hope this helps!

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