Coder Social home page Coder Social logo

nkolban / esp32-snippets Goto Github PK

View Code? Open in Web Editor NEW
2.3K 2.3K 705.0 3.25 MB

Sample ESP32 snippets and code fragments

Home Page: https://leanpub.com/kolban-ESP32

License: Apache License 2.0

Makefile 0.43% C 52.44% HTML 0.46% C++ 43.56% Shell 0.16% JavaScript 1.38% Objective-C 1.55% CMake 0.01%
esp32

esp32-snippets's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp32-snippets's Issues

BLE Sample notify is not working

Hi Neil,
i have two issues with ble sample notify. First one is easy to solve. In line https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLETests/SampleNotify.cpp#L95 is created new BLE2902 descriptor, but by default notification i turned off in it (easy to fix).
But after fixing it there is another issue:
E (3358) BT: btc_gatts_arg_deep_copy 8 no mem
and i cant find solution. And i think so at the end service and/or characteristic does not start.

No support for BLE Client notification indications.

Part of the function of BLE is to be able to send and receive notifications. What this means is that if we (ESP32) are being a BLE client, we should be able to connect to a BLE server and indicate that we wish to receive notifications of changes characteristic values. When the BLE server wishes, it can then indicate that the value has changed. The BLE client should then be asynchronously be informed that this happened and perform some action. During the examination of the sample for issue #45, it was found that this has simply not been implemented. This is a gross oversight and needs remedied quickly.

Arduino BLE: Compilation failures - missing ESP_GATTC_CONNECT_EVT and others

When building an Arduino based BLE application, if you find that you fail at compilation with errors similar to:

ESP_GATTC_CONNECT_EVT was not declared in this scope

or similar issues relating to constants not found we can explain this and the solution is relatively simple.

First, let us review the Arduino ESP32 support story. The goal is to write an Arduino sketch, compile it and then flash it to an ESP32.

A native ESP32 has its own development environment called the ESP-IDF (Espressif IoT Development Framework). The ESP-IDF is what a C or C++ programmer would use to write applications to natively run on an ESP32. It is a "lower" level API than the Arduino framework and is designed specifically for ESP32 programming. This means that an ESP32 application can't be recompiled for other platforms.

Arduino on the other hand is a development tool (IDE) plus a set of libraries that have common implementations across a number of physical devices. A program (a sketch) written to use the Arduino APIs can be compiled for at ATMel processor, an ESP32, and a whole host of other platforms.

The Arduino environment for ESP32 augments the Arduino IDE to provide support for compilation for ESP32s. Specifically, this means three primary things:

  1. A compiler that compiler source code to ESP32 native code
  2. Arduino libraries that map source code calls to Arduino API to ESP32 code
  3. A copy of the ESP-IDF that implements the foundation of ESP32 access

All of this is summary ... let us now get back to the described problem.

The puzzle is to caused by release maintenance for the Arduino ESP32 package. Every few months, Espressif release a new version of the ESP-IDF. Some time after this, the Arduino ESP32 package is then refreshed to include the new ESP-IDF level. At that time, there is now a later version of the Arduino support for ESP32 available beyond what you currently have installed.

The Arduino BLE library (this project) is built to use the latest Arduino ESP32 framework. The latest framework provided extra functions that the Arduino BLE library implementation utilized. The error you are seeing is caused because you are building an Arduino BLE library application on a version of the Arduino ESP32 support that is back level.

What you must do is upgrade/re-install your Arduino ESP32 environment into your Arduino IDE. Once done, you will find that the compilations proceed smoothly.

See the following for Arduino ESP32 installation instructions:

https://github.com/espressif/arduino-esp32#installation-instructions

Distribute the Arduino BLE ZIP file

As of today, we are making users jump through hoops to build the Arduino BLE ZIP file. Let us examine the state of Arduino builds and see how can we correctly distribute the Arduino BLE ZIP. Ideally, we could leverage the package management tools ... lets see if we can.

Service list empty (on nRF Connect) when using SampleServer or SampleNotify examples

When I flash the SampleServer example as is, with Bluetooth enabled in menuconfig, and then connect using the nRF Connect app, the custom service is not shown in the device's tab, but its id in the "scanner" tab.

It only shows Generic Attribute 0x1801 and Generic Access 0x1800 in the device's tab.
Debug log doesn't show any error at all.

curl_multi_perform seems to cause: "Guru Meditation Error of type LoadStoreError occurred on core 0. Exception was unhandled."

I was curious why xTaskCreatePinnedToCore is used in the esp32-snippets rather than curl_multi_perform.

Unfortunately, curl_multi_perform causes it to throw: "Guru Meditation Error of type LoadStoreError occurred on core 0. Exception was unhandled." (running the 10-at-a-time example - although I limit it to 1 at a time).

I think I read that you'd worked with the espressif folks to get curl to compile. Do you know if curl_multi_perform should work - or is that why you chose to use xTaskCreatePinnedToCore? Or, possibly, I'm just doing something wrong...

task_test_SSD1306i2c for Arduino IDE + ESP32

Hi
Thanks for the HIL
but I didn't succeed in compiling a simple example with my environnement
I copier u8g2_esp32_hal.c/.h to the h8g2 lib directory : c:\Users\myname\Documents\Arduino\libraries\U8g2\src\clib
but the compiler complains about the h8g2.h (didn't find it)
though I just compiled and use successfully, the h8g2 lib with a Node MCU (8266) but with ESP32 Lolin32, it didn't
here is my example that dos'nt compile
(my environnement works, because I just compiled installed Web Radio ESP32: and it works great, I can https://github.com/Edzelf/ESP32-Radio

it worked well, but I want to display the canal radio and the song, so how can I correct the code

`//#include <driver/gpio.h>
//#include <driver/spi_master.h>
//#include <esp_log.h>
//#include <freertos/FreeRTOS.h>
//#include <freertos/task.h>
#include <stdio.h>
#include <string.h>
#include <u8g2.h>

//#include "sdkconfig.h"
#include "u8g2_esp32_hal.h"

// SDA - GPIO21
#define PIN_SDA 21

// SCL - GPIO22
#define PIN_SCL 22

static const char *TAG = "ssd1306";

void task_test_SSD1306i2c(void *ignore) {
u8g2_esp32_hal_t u8g2_esp32_hal = U8G2_ESP32_HAL_DEFAULT;
u8g2_esp32_hal.sda = PIN_SDA;
u8g2_esp32_hal.scl = PIN_SCL;
u8g2_esp32_hal_init(u8g2_esp32_hal);

u8g2_t u8g2; // a structure which will contain all the data for one display
u8g2_Setup_ssd1306_128x32_univision_f(
	&u8g2,
	U8G2_R0,
	//u8x8_byte_sw_i2c,
	u8g2_esp32_msg_i2c_cb,
	u8g2_esp32_msg_i2c_and_delay_cb);  // init u8g2 structure
u8x8_SetI2CAddress(&u8g2.u8x8,0x78);

ESP_LOGI(TAG, "u8g2_InitDisplay");
u8g2_InitDisplay(&u8g2); // send init sequence to the display, display is in sleep mode after this,

ESP_LOGI(TAG, "u8g2_SetPowerSave");
u8g2_SetPowerSave(&u8g2, 0); // wake up display
ESP_LOGI(TAG, "u8g2_ClearBuffer");
u8g2_ClearBuffer(&u8g2);
ESP_LOGI(TAG, "u8g2_DrawBox");
u8g2_DrawBox(&u8g2, 0, 26, 80,6);
u8g2_DrawFrame(&u8g2, 0,26,100,6);

ESP_LOGI(TAG, "u8g2_SetFont");
u8g2_SetFont(&u8g2, u8g2_font_ncenB14_tr);
ESP_LOGI(TAG, "u8g2_DrawStr");
u8g2_DrawStr(&u8g2, 2,17,"Hi nkolban!");
ESP_LOGI(TAG, "u8g2_SendBuffer");
u8g2_SendBuffer(&u8g2);

ESP_LOGI(TAG, "All done!");

vTaskDelete(NULL);

}

int val = 0;
void setup() {
Serial.begin(9600);
task_test_SSD1306i2c();
}

void loop() {
// put your main code here, to run repeatedly:
val = hallRead();
// print the results to the serial monitor:
//Serial.print("sensor = ");
Serial.println(val);//to graph
}`

Compile error building curl - following esp32-snippets/curl/build_files/

BTW, thanks for creating the curl build instructions. I followed the instructions at esp32-snippets/curl/build_files/. Unfortunately when I make the project, I get the following error:

CC lib/vauth/cleartext.o
/Users/mike/Dev/esp/i2s/components/curl/lib/vauth/cleartext.c:165:1: fatal error: opening dependency file lib/vauth/cleartext.d: No such file or directory
}
^
compilation terminated.
make[1]: *** [lib/vauth/cleartext.o] Error 1
make: *** [curl-build] Error 2

Example to read from client before notify

Looking for an example, where BLE server (in ESP32) reads from client and then responds with a notify or BLE server reads from client the response received to notify.

Any details on Makefile setup ?

Hi kolban
Love your video's on youtube, but in all your examples, you do a
make flash monitor (I think ?) to kick the whole thing off, however there doesn't appear to be a makefile that I can find in the repo.
Any hints ?

Webserver Mongoose Wrapper Memory leak

Another interesting thing i picked up using mongoose with your CPP wrappers is the esp32 eats into the free heap and doesnt release it.
tried two examples.
1: with a uint8_t encoded home page with size of around 24KB.. the initial call consumes about 50KB ram then after the response most that is released. page refreshes seem stable.
2: have two URL paths that respond with JSON ( to be used on the client side )

  • the first using cJSON to construct the payload then doing the send and then releasing the cJSON
    --this example consumes about 1kb ram for each request from my client without releasing.

  • a simple path that responds with JSON ( built up as a constant )
    -- this also eats ram and doesn't release.

i know not my cJSON constructors as is do delete the objects after construction.

Have you had similar results?

Unable to built Arduino BLE Examples

Hi Niel,

I am naive and use Ardunio IDE in Windows PC to work with ESP32. So far I managed to get ESP32 work with Ardunio for different functionalities. My next critical stage in project is to use ESP BLE capabilities.

Many thanks, your BLE Ardunio support for ESP32 comes at right moment. I would like to try out your Arduino BLE examples.
First I try to follow the instructions at
https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/ArduinoBLE.md
to create BLE library for cpp_utilities.
The problem is since I am a windows user above instructions did not work out for me. Then I tried to get some help from a friend with Linux OS and generate the BLE library for me.

Second I add the BLE library through Ardunio IDE - The library was successfully added.

Third I try to built one of your examples BLE_server
ardunio esp32 ble built error.txt
Arduino ESP32 BLE Built Error.pdf

  • that's where I fail.

Any help Niel?
May be in first place I can't build the library from Linux machine and try to use in in Windows PC? Please can you advise how to make the library for Arduino in Windows env?

Or it is some other problem, this is the error message (attached) I get in Ardunio IDE

Many thanks to guide me,
Raj

Websocket full example

would be grateful if you provide websocket full example (send and receive binary and text; sync and Asynchronous).
Thank you

BLE.h: No file or Directory found

I'm writing a BLE C++ Application following the Kolban's tutorial. I have included all the source files as mentioned in the tutorials, Everyfile is accepted but only one is excluded "BLE.h". the file is present in the include directory but error is still there, I have check the "menuconfig", bluetooth is enabled there.
A little help would be appreciated.

terminal

configuration

eclipse

GPIO interrupt example

Hi there again. i love your code... at the moment i am playing with you GPIO classes and have noticed you allow to enable and disable interrupts.
My question would be, where are the Interrupt ISR's handled as i dont see any way for notification on interrupt triggering. normally you expose a callback function pointer or something

Can't build BLE Arduino examples

Hi,
i tried to build the examples for the Arduino BLE wrapperclasses, but i failed :(
I used this tutorial: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/ArduinoBLE.md

I am able to build the zip library and i can also import it into the Arduino IDE and open the provided examples. When i press compile, he can't find the header files, when i copy all classes&headers from
~/sketchbook/libraries/ESP32_BLE/src
to
~/sketchbook/libraries/ESP32_BLE/

The compiler says a file called sdkconfig is needed.

Seems like i'm missing something,
like the libraries are not stand alone and i need the idf files too or something.
Kind regards

how to use cpp_util in couple with esp-idf/example/blufi

Hi nkolban:
Thanks for your esp32-snippets, they are very useful to me.

I want to use SockServ.h/cpp in esp-idf/example/blufi . So I copied cpp_util/ to eps-idf/components/ .
When I typed command "make", I got the following

$ make CC blufi_example_main.o In file included from /home/roger/esp/myapp/bluetooth/blufi/main/./blufi_example_main.c:38:0: /home/roger/esp/myapp/bluetooth/blufi/main/cpp_utils/SockServ.h:6:18: fatal error: string: No such file or directory compilation terminated. /home/roger/esp/esp-idf/make/component_wrapper.mk:176: recipe for target 'blufi_example_main.o' failed make[1]: *** [blufi_example_main.o] Error 1 /home/roger/esp/esp-idf//make/project.mk:386: recipe for target 'main-build' failed make: *** [main-build] Error 2
Then, I renamed blufi_example_main.c to blufi_example_main.cpp. And got another error:
make[1]: *** No rule to make target '/home/roger/esp/myapp/bluetooth/blufi/main/./blufi_example_main.c', needed by 'blufi_example_main.o'. Stop. /home/roger/esp/esp-idf//make/project.mk:386: recipe for target 'main-build' failed make: *** [main-build] Error 2
So, what should I do ?

Event handler as a class member function?

Hi Kolban,

I was wondering if you could answer another question of mine.

I have been creating a lot of classes but this problem has persisted. I was wondering if the event_handler can be a member function of my class ExampleTask that inherits from Task (your Task implementation).

Thanks!

BLE Central Arduino Example

Hi Neil, as posted on the ESP-Arduino repo, a BLE Central scan for device, connect, enable notifications or other characteristic and read/write the value example would be really useful.

BLE server idf example

Howdy @nkolban ,

im trying to get your BLE c++ wrapper classes to run with idf, do you have something like a helloworld server example? My approach is kinda typed from your video: https://www.youtube.com/watch?v=2_vlF_02VXk&t=324s

My code:
https://pastebin.com/XFCQKFQf

And it compiles well, but i can't find the esp ble device with my phone. After watching your video again and looking inside the BLEDevice.h it seems like this line
BLEDevice::init("SERVERNAME");
should do the trick, but when i add this line, i get lots of compile errors:
https://pastebin.com/Mj2U6cwg

No C++ Application Message on UART

Great tutorial writing C++ Applications and awesome effort writing the book about esp32. Really appreciated.
I have followed your tutorial, the code was compiled and flashed without issue but unfortunately none of the application messages were sent to the UART. Someone mentioned a little tweaking in the ESP_LOG file but I couldn't figure it out.
Can anybody help me out in this issue ?

BLE_scan error! Other 3 work fine

Arduino:1.8.1 (Windows 7), 开发板:"ESP32 Dev Module, QIO, 80MHz, 921600, None"

C:\Users\wangxin\Documents\Arduino\BLE20170813\BLE\examples\BLE20170813\BLE\examples\BLE_scan\BLE_scan.ino: In function 'void setup()':

BLE_scan:23: error: invalid new-expression of abstract class type 'MyAdvertisedDeviceCallbacks'

pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());

                                                                      ^

C:\Users\wangxin\Documents\Arduino\BLE20170813\BLE\examples\BLE20170813\BLE\examples\BLE_scan\BLE_scan.ino:11:7: note: because the following virtual functions are pure within 'MyAdvertisedDeviceCallbacks':

class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {

   ^

In file included from C:\Users\wangxin\Documents\Arduino\libraries\ESP32_BLE\src/BLEScan.h:15:0,

             from C:\Users\wangxin\Documents\Arduino\libraries\ESP32_BLE\src/BLE.h:20,

             from C:\Users\wangxin\Documents\Arduino\BLE20170813\BLE\examples\BLE20170813\BLE\examples\BLE_scan\BLE_scan.ino:6:

C:\Users\wangxin\Documents\Arduino\libraries\ESP32_BLE\src/BLEAdvertisedDevice.h:102:15: note: virtual void BLEAdvertisedDeviceCallbacks::onResult(BLEAdvertisedDevice)

virtual void onResult(BLEAdvertisedDevice advertisedDevice) = 0;

           ^

BLE_scan:25: error: conversion from 'BLEScanResults' to non-scalar type 'std::vector<BLEAdvertisedDevice*>' requested

std::vector<BLEAdvertisedDevice*> foundDevices = pBLEScan->start(30); //scan for 30 seconds

                                                               ^

exit status 1
invalid new-expression of abstract class type 'MyAdvertisedDeviceCallbacks'

Make the BLEServer class constructor private.

Our intent for a BLEServer object is that it be created from a BLEDevice object instance. However, BLEServer is exposed as public meaning a user can create an instance. This is wrong see:

#33 (comment)

Post by @DKlay on 2017-09-02. This issue is being raised to track and correct.

Arduino: BLE Client Notification Error

I put my uuids into the client example and set it up to connect to my peripheral by mac address rather than service as the ones I want aren't advertised, and I get this out with no further data when I expect notifications :

Created client
E (49918) BT: l2cble_start_conn_update, the last connection update command still pending.
E (49918) BT: l2cble_start_conn_update, the last connection update command still pending.
Connected to server
E (50267) BT: l2cble_start_conn_update, staus = 1, line = 509
E (50755) BT: set_read_value unformat.len = 18
The characteristic value was:
E (51039) BT: bta_gattc_cmpl_cback unknown conn_id = 3, ignore data

Have the scan() API return an object of results.

At present, we are returning a std::vector() from scan(). While this is "ok", we can do better by returning an object that is a container of results ... eg.

BLEScanResults
-> getCount() -> Number of results
-> getResult(i) -> Get the ith result

This would provide a nice encaspulation. However, the most important reason (to me) is that it would elminate the need to expose a piece of std::c++ in an Arduino environment.

Unable to build curl w/ssl support

I've tried a variety of approaches and followed a couple different paths over the past few days and cannot get curl to build with ssl support.

I have been using a clone from https://github.com/nkolban/curl-esp32. I have used both the configuration and make files from in esp32-snippets (here) and followed the instructions in your book.

Of course running make in component/curl regenerates curl_config.h so I'm generating curl with make in the component, then changing curl-config.h and building my project which hosts curl. Flags on the make are: --with-ssl --without-zlib. I'm building on OS X. When I build component/curl with these settings, when I try to build my host project the compiler complains 'curl_rule_01' (and _02) is negative so I've changed 8 to 4 on CURL_SIZEOF_LONG and CURL_SIZEOF_CURL_OFF_T in curlbuild.h. Now I have openssl/engine.h not found. I've fiddled with trying to comment out using openssl, but end up with other errors down that path.

Would really appreciate some help getting this to build so I can make a REST call through HTTPS from the ESP32. I realize I haven't given you specific information with error at the point I'm at. I may not be generating quite the right result from the make on the component, or perhaps editing headers at the wrong time. I just don't have a sense of where the root of the problem lies.

If there is a project somewhere that builds curl and uses it for https that builds on OS X and runs on ESP32 I can work with, maybe that's enough, but otherwise please let me know what more info I can provide to hopefully get this to work.

Thanks.

C++ "Hello World" Project

Hi,

I would appreciate it if you can provide the C++ configuration details e.g example "Hello World" project for C++.

This would help fast track myself and others with C++ development on the ESP32.

Keep up the good work.

BR,
Brent

Build error - do not seem to have socketpair as part of components

I followed the instruction on building libcurl (Thank you for the detail steps and video). However I seem to be getting the following error :
/home/user/esp/libcurl4/components/curl/lib/curl_ntlm_wb.c: In function 'Curl_ntlm_wb_cleanup':
/home/user/esp/libcurl4/components/curl/lib/curl_ntlm_wb.c:91:9: error: implicit declaration of function 'kill' [-Werror=implicit-function-declaration]
kill(conn->ntlm_auth_hlpr_pid, SIGTERM);
^
/home/user/esp/libcurl4/components/curl/lib/curl_ntlm_wb.c: In function 'ntlm_wb_init':
/home/user/esp/libcurl4/components/curl/lib/curl_ntlm_wb.c:187:6: error: implicit declaration of function 'socketpair' [-Werror=implicit-function-declaration]
if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) {
^
/home/user/esp/libcurl4/components/curl/lib/curl_ntlm_wb.c:187:17: error: 'AF_UNIX' undeclared (first use in this function)
if(socketpair(AF_UNIX, SOCK_STREAM, 0, sockfds)) {
^
/home/user/esp/libcurl4/components/curl/lib/curl_ntlm_wb.c:187:17: note: each undeclared identifier is reported only once for each function it appears in

Compile error building curl - undefined reference to `access'

Hello. I am quite new to ESP32 and had a problem while compiling the curl functionality for ESP made by Kolban. Special thanks to Kolban for awesome book, snippets and tutorials.

I am receiving following error:
/home/aivarkoodi/git/gen2/esp-idf/developement/curl/build/curl/libcurl.a(mime.o):(.literal.curl_mime_filedata+0x10): undefined reference to access' /home/aivarkoodi/git/gen2/esp-idf/developement/curl/build/curl/libcurl.a(mime.o): In function curl_mime_filedata':
/home/aivarkoodi/git/gen2/esp-idf/developement/curl/components/curl/lib/mime.c:617: undefined reference to `access'
/home/aivarkoodi/git/gen2/esp-idf/make/project.mk:337: recipe for target '/home/aivarkoodi/git/gen2/esp-idf/developement/curl/build/curl.elf' failed

I think it is some sort of linking error related with curl_easy_perform(), because if I remove this function everything compiles nicely.

Bluetooth BLEServer createService error

Hello, maybe you could help me out? In the following code an error comes:
#define SERVICE_UUID "9175cd3a-538b-4689-a588-4ecbc2d9f308"
BLEDevice::init("my_device");
Serial.println("first");
BLEServer *server = new BLEServer();
Serial.println("second");
BLEService *service = server->createService(BLEUUID(SERVICE_UUID));
Serial.println("1");

The error:
first
second
abort() was called at PC 0x400da963 on core 0

Backtrace: 0x400887fc:0x3ffdd810 0x400888fb:0x3ffdd830 0x400da963:0x3ffdd850 0x400dbfd2:0x3ffdd870 0x400dc15e:0x3ffdd890 0x400dc4a9:0x3ffdd8d0 0x400dc4e9:0x3ffdd900 0x400dc4f9:0x3ffdd920 0x400d7d5a:0x3ffdd940 0x400d6951:0x3ffdd960 0x400d58d1:0x3ffdd9a0 0x400f4e85:0x3ffdd9c0 0x400f0ffc:0x3ffdda00

Rebooting...

I have no idea what it causes...

ESP32_BLE.a: No such file or directory

Trying to compile any Arduino BLE examples results in this error: xtensa-esp32-elf-gcc: error: libraries\ESP32_BLE\ESP32_BLE.a: No such file or directory.

BLEClientCallbacks implementation not needed

We have a class called BLEClientCallbacks which is meant to be subclassed to handle client related callbacks. Our first pass at this was to provide a definition that looked like:

public:
	virtual ~BLEClientCallbacks() {};
	virtual void onConnect(BLEClient *pClient);
};

with an implementation of the class which had a no-op onConnect() call. Following this thread post:

https://esp32.com/viewtopic.php?f=13&t=2330&start=40

We changed the definition to:

public:
	virtual ~BLEClientCallbacks() {};
	virtual void onConnect(BLEClient *pClient) = 0;
};

making the onConnect() pure virtual and eliminated the no-op source file.

Building curl

Hi @nkolban ,

With your config files for building curl for ESP IDF - ESP 32, I could get my code working.

But now, after downloading the newest curl from github, I get this issue:
curl/curl#1827

screenshot 2017-08-24 20 38 54

captura de tela 2017-08-25 13 29 05

Would you please help me understand what I am doing wrong and how to use curl with ESP IDF?

I rely on this for my project to work!

Apreciate your help!!

Provide signatures for public functions that can take strings as opposed to BLEUUIDs

There are public functions today that take BLEUUIDs ... provide alternatives/over-rides that accept strings.

For example, where we have a function that looks like:

void foo(BLEUUID uuid)

provide an additional signature that looks like:

void foo(char* uuid) {
   foo(BLEUUID(std::string(uuid)));
}

and

void foo(std::string uuid) {
   foo(BLEUUID(uuid));
}

BLE Client only finds first characteristic

When we request the characteristics of a BLE Server, we must request each one until we get no more. The implementation of BLERemoteService didn't do this. It stopped after reading the first characteristics and, as such, we failed when accessing the 2nd or further characteristic.

WS2812.cpp not working for red colour on ESP32 DEVKIT V1

@nkolban I am using three 144LED/M strips connected in series which are using the WS2812 LED chips. Whether I am doing something wrong, I don't know, but when I run the following code from my main method The LEDs begin to flash irregularly with different colours. The strangest thing is this only happens when the RED colour is set, all other colours work fine. See the linked videos showing the different scenarios. Is there something that I have done incorrectly for it to be doing this?

for(int i=0; i<144; i++){
    //Set strip 1 red
    led.setPixel(i, 255,0,0);

    //Set strip 2 green
    led.setPixel(287-i, 0,255,0);

    //Set strip 3 blue
    led.setPixel(288+i, 0,0,255);

    led.show();
}

Videos:
Using Red-Green-Blue <-- output from code above
Red only
Green only
Blue only

Any advice as to why this could be happening?

RFID library doesn't work

Hi There,

I'm trying to get the RFID module to work with the port that you have written (MFRC522). The module is connected to the ESP32 according to the default configuration (MOSI13, MISO 12, CLK 14 CS 15) and the example code reports an unknown firmware version [0x11].

Still, the module didn't seem to respond to any tag that I have on hand, not even to my public transport pass, that I know for sure does work. I tried with another module, but still, no luck. I then moved to see if the SPI communication was properly happening, and according to my trusted rigol it is.

I thus decided to go with printf-debugging, and it showed me a wired behavior. When a tag is paced close to the module, it gets detected [to say that we manage to escape the PICC_IsNewCardPresent() jail ] but the program gets stuck at detecting the card uid [aka at PICC_ReadCardSerial ]. In case you are wondering I'm referring to DumpInfo.cpp

On a side note, I tried to scan the tags with my phone and they definitely work.

Hope you can give me a clue,
Carlo

ble lib compile errors

Had the following when try to use ReadSampl.cpp from ble tests folder.

I guess it is because the difference between my esp-idf version and the one you have developed on. Can you share the version that you are sure it is working on.

Compiling .pioenvs/esp32dev/lib/cpputils/BLEClientCallbacks.o Compiling .pioenvs/esp32dev/lib/cpputils/BLEDesciptorMap.o lib/cpputils/src/BLE.cpp: In static member function 'static void BLE::gapEventHandler(esp_gap_ble_cb_event_t, esp_ble_gap_cb_param_t*)': lib/cpputils/src/BLE.cpp:118:8: error: 'ESP_GAP_BLE_SEC_REQ_EVT' was not declared in this scope case ESP_GAP_BLE_SEC_REQ_EVT: { ^ lib/cpputils/src/BLE.cpp:119:22: error: '::esp_ble_gap_security_rsp' has not been declared esp_err_t errRc = ::esp_ble_gap_security_rsp(param->ble_security.ble_req.bd_addr, true); ^ lib/cpputils/src/BLE.cpp:119:56: error: 'union esp_ble_gap_cb_param_t' has no member named 'ble_security' esp_err_t errRc = ::esp_ble_gap_security_rsp(param->ble_security.ble_req.bd_addr, true); ^ lib/cpputils/src/BLE.cpp: In static member function 'static void BLE::initServer(std::__cxx11::string)': lib/cpputils/src/BLE.cpp:146:2: error: 'esp_bt_controller_config_t' was not declared in this scope esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); ^ lib/cpputils/src/BLE.cpp:147:44: error: 'bt_cfg' was not declared in this scope esp_err_t errRc = esp_bt_controller_init(&bt_cfg); ^ lib/cpputils/src/BLE.cpp:190:2: error: 'esp_ble_io_cap_t' was not declared in this scope esp_ble_io_cap_t iocap = ESP_IO_CAP_NONE; ^ lib/cpputils/src/BLE.cpp:191:10: error: '::esp_ble_gap_set_security_param' has not been declared errRc = ::esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t)); ^ lib/cpputils/src/BLE.cpp:191:43: error: 'ESP_BLE_SM_IOCAP_MODE' was not declared in this scope errRc = ::esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t)); ^ lib/cpputils/src/BLE.cpp:191:67: error: 'iocap' was not declared in this scope errRc = ::esp_ble_gap_set_security_param(ESP_BLE_SM_IOCAP_MODE, &iocap, sizeof(uint8_t)); ^ lib/cpputils/src/BLE.cpp: In static member function 'static void BLE::initClient()': lib/cpputils/src/BLE.cpp:205:3: error: 'esp_bt_controller_config_t' was not declared in this scope esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); ^ lib/cpputils/src/BLE.cpp:206:45: error: 'bt_cfg' was not declared in this scope esp_err_t errRc = esp_bt_controller_init(&bt_cfg); ^

`
*** [.pioenvs/esp32dev/lib/cpputils/BLE.o] Error 1
Compiling .pioenvs/esp32dev/lib/cpputils/BLEDescriptor.o
lib/cpputils/src/BLECharacteristic.cpp: In constructor 'BLECharacteristic::BLECharacteristic(BLEUUID, uint32_t)':
lib/cpputils/src/BLECharacteristic.cpp:36:23: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties = 0;
^
lib/cpputils/src/BLECharacteristic.cpp: In member function 'void BLECharacteristic::setBroadcastProperty(bool)':
lib/cpputils/src/BLECharacteristic.cpp:345:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties |= ESP_GATT_CHAR_PROP_BIT_BROADCAST;
^
lib/cpputils/src/BLECharacteristic.cpp:347:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties &= ~ESP_GATT_CHAR_PROP_BIT_BROADCAST;
^
lib/cpputils/src/BLECharacteristic.cpp: In member function 'void BLECharacteristic::setIndicateProperty(bool)':
lib/cpputils/src/BLECharacteristic.cpp:369:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties |= ESP_GATT_CHAR_PROP_BIT_INDICATE;
^
lib/cpputils/src/BLECharacteristic.cpp:371:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties &= ~ESP_GATT_CHAR_PROP_BIT_INDICATE;
^
lib/cpputils/src/BLECharacteristic.cpp: In member function 'void BLECharacteristic::setNotifyProperty(bool)':
lib/cpputils/src/BLECharacteristic.cpp:379:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties |= ESP_GATT_CHAR_PROP_BIT_NOTIFY;
^
lib/cpputils/src/BLECharacteristic.cpp:381:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties &= ~ESP_GATT_CHAR_PROP_BIT_NOTIFY;
^
lib/cpputils/src/BLECharacteristic.cpp: In member function 'void BLECharacteristic::setReadProperty(bool)':
lib/cpputils/src/BLECharacteristic.cpp:389:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties |= ESP_GATT_CHAR_PROP_BIT_READ;
^
lib/cpputils/src/BLECharacteristic.cpp:391:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties &= ~ESP_GATT_CHAR_PROP_BIT_READ;
^
lib/cpputils/src/BLECharacteristic.cpp: In member function 'void BLECharacteristic::setWriteNoResponseProperty(bool)':
lib/cpputils/src/BLECharacteristic.cpp:429:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties |= ESP_GATT_CHAR_PROP_BIT_WRITE_NR;
^
lib/cpputils/src/BLECharacteristic.cpp:431:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties &= ~ESP_GATT_CHAR_PROP_BIT_WRITE_NR;
^
lib/cpputils/src/BLECharacteristic.cpp: In member function 'void BLECharacteristic::setWriteProperty(bool)':
lib/cpputils/src/BLECharacteristic.cpp:439:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties |= ESP_GATT_CHAR_PROP_BIT_WRITE;
^
lib/cpputils/src/BLECharacteristic.cpp:441:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties &= ~ESP_GATT_CHAR_PROP_BIT_WRITE;
^

lib/cpputils/src/BLECharacteristic.cpp: In member function 'void BLECharacteristic::setWriteProperty(bool)':
lib/cpputils/src/BLECharacteristic.cpp:439:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties |= ESP_GATT_CHAR_PROP_BIT_WRITE;
^
lib/cpputils/src/BLECharacteristic.cpp:441:16: error: invalid conversion from 'int' to 'esp_gatt_char_prop_t' [-fpermissive]
m_properties &= ~ESP_GATT_CHAR_PROP_BIT_WRITE;
^
*** [.pioenvs/esp32dev/lib/cpputils/BLECharacteristic.o] Error 1
lib/cpputils/src/BLEDescriptor.cpp: In member function 'void BLEDescriptor::executeCreate(BLECharacteristic*)':
lib/cpputils/src/BLEDescriptor.cpp:67:12: error: invalid conversion from 'int' to 'esp_gatt_perm_t' [-fpermissive]
&control);
^
In file included from lib/cpputils/src/BLEService.h:13:0,
from lib/cpputils/src/BLEDescriptor.cpp:16:
/Users/rami/.platformio/packages/framework-espidf/components/bt/bluedroid/api/include/esp_gatts_api.h:393:11: note: initializing argument 3 of 'esp_err_t esp_ble_gatts_add_char_descr(uint16_t, esp_bt_uuid_t*, esp_gatt_perm_t, esp_att
r_value_t*, esp_attr_control_t*)'
esp_err_t esp_ble_gatts_add_char_descr (uint16_t service_handle,
^
*** [.pioenvs/esp32dev/lib/cpputils/BLEDescriptor.o] Error 1
========================== [ERROR] Took 7.49 seconds ==========================

`

problem making i2c scanner

Hi

I'm trying to make i2c scanner through Eclipse, but it won't make. If I try to make esp-idf i2c main example then it compiles and runs fine. The error I'm getting with i2c scanner is following:
'make all CC main.o AR libmain.a LD app-template.elf C:/esp32idf/workspace/myap/build/esp32\libesp32.a(cpu_start.o):(.literal.main_task+0x8): undefined reference to app_main'
C:/esp32idf/workspace/myap/build/esp32\libesp32.a(cpu_start.o): In function main_task': C:/esp32idf/esp-idf/components/esp32/cpu_start.c:284: undefined reference to app_main'
collect2.exe: error: ld returned 1 exit status
make: *** [C:\esp32idf\esp-idf/make/project.mk:323: /c/esp32idf/workspace/myap/build/app-template.elf] Error 1`'

Been searching everywhere for answer, but nothing comes up. Maybe anyone here can help me?

Crash instancing BLEServer

In BLE server for Arduino, creating a BLEServer like this BLEServer *pServer = new BLEServer(); everything works fine, but instancing BLEServer pServer; it compiles, create the server but crash in the client connection:

Guru Meditation Error of type LoadProhibited occurred on core  0. Exception was unhandled.
Register dump:
PC      : 0x400d4879  PS      : 0x00060d30  A0      : 0x800d4049  A1      : 0x3ffdccb0  
A2      : 0x3ffdb0d0  A3      : 0x0000000e  A4      : 0x00000004  A5      : 0x3ffdcd30  
A6      : 0x00000000  A7      : 0x00060023  A8      : 0x00060023  A9      : 0x3ffe1510  
A10     : 0x00000003  A11     : 0x00060d23  A12     : 0x00060d23  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x0000000c  SAR     : 0x00000018  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000028  LBEG    : 0x4000c349  LEND    : 0x4000c36b  LCOUNT  : 0xffffffff  

Backtrace: 0x400d4879:0x3ffdccb0 0x400d4046:0x3ffdccd0 0x400d2a9d:0x3ffdcd10 0x400f203d:0x3ffdcd30 0x400edf60:0x3ffdcd70

CPU halted.
Decoding 8 results
0x400d4879: BLEServiceMap::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at C:\Users\Note\Documents\Arduino\hardware\esp32\esp32\libraries\BLE\src/BLEServiceMap.cpp line 92
0x400d4879: BLEServiceMap::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at C:\Users\Note\Documents\Arduino\hardware\esp32\esp32\libraries\BLE\src/BLEServiceMap.cpp line 92
0x400d4046: BLEServer::handleGATTServerEvent(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at C:\Users\Note\Documents\Arduino\hardware\esp32\esp32\libraries\BLE\src/BLEServer.cpp line 115
0x400d2a9d: BLE::gattServerEventHandler(esp_gatts_cb_event_t, unsigned char, esp_ble_gatts_cb_param_t*) at C:\Users\Note\Documents\Arduino\hardware\esp32\esp32\libraries\BLE\src/BLE.cpp line 218
0x400f203d: btc_gatts_cb_to_app at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c line 53
:  (inlined by) btc_gatts_cb_handler at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/bt/bluedroid/btc/profile/std/gatt/btc_gatts.c line 854
0x400edf60: btc_task at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/bt/bluedroid/btc/core/btc_task.c line 85

Makefile.arduino

Hello Neil, great job you are doing with esp32

In the last commit, you change the name of BLE.h and BLE.cpp to BLEDevice.h and BLEDevice.cpp, but in Makefile.arduino you forgot to change those names.

Thank you and best regards.

Webserver example

hi there.
does anyone have a webserver example for me based on the code snippets here.

NodeMCU-32s does not work using your arduino library

Serial output info:
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:10472
entry 0x40078a28
Starting BLE work!

Brownout detector was triggered

ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:10472
entry 0x40078a28
Starting BLE work!

Brownout detector was triggered

ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:10472
entry 0x40078a28
Starting BLE work!

Brownout detector was triggered

ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:10472
entry 0x40078a28

could you help me find what's wrong, thank you.

Return a value when a connection fails

When we are being a BLE Client, we need to return an indication that a request to connect to a named BLE server has failed. This is likely going to be a simple bool return code on the client connect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.