I want to create some 'linked' Christmas decorations and had a choice of a wire, wifi, wifi mesh and Bluetooth mesh. Having just done some work integrating C into FC for esp32 - I went with BT Mesh.
(Second time typing this after I got hit by the 'and it's gone' website feature

So - I'd consider this fairly advanced - so if you want to play along, get a nice fresh mug of tea first

1) Create a new esp32 project in fc - save (for this I'll assume you've called it 'mesh' - but use whatever you like and type that where you see mesh.)
2) Save and compile to create it's directory structure.
3) Find the directory with the esp32 examples (so my esp directory is esp-idf and the directory is \examples\bluetooth\esp_ble_mesh\ble_mesh_node\onoff_server and copy all the files in this directory and main to your project directory (this will be called 'mesh')
4) In 'mesh' edit CMakeLists.txt - the final line should be project(esp-project) (instead of project(onoff_server) )
5) In mesh/main edit CMakeLists.txt to read:
Code: Select all
set(COMPONENT_SRCS "esp-project.c" "main.c"
"board.c")
set(COMPONENT_ADD_INCLUDEDIRS ".")
register_component()
7) Create a file main.h (should probably rename these)
Code: Select all
#ifndef main_h_
#define main_h_
void start_app();
#endif
8) In your FC project - supplementary code add
Code: Select all
#include "esp_ble_mesh_defs.h"
#include "esp_ble_mesh_common_api.h"
#include "esp_ble_mesh_networking_api.h"
#include "esp_ble_mesh_provisioning_api.h"
#include "esp_ble_mesh_config_model_api.h"
#include "esp_ble_mesh_generic_model_api.h"
#include "esp_ble_mesh_local_data_operation_api.h"
#include "ble_mesh_example_init.h"
#include "board.h"
#include "main.h"
9) Add a C block to call start_app()
Code: Select all
start_app();
Note this necessitate a new partition map

10) Now we hit a snag - FC should compile this okay - but fails with error 1 when it tries to upload. Compiling using idf.py works well - but need to use FC to compile to hex to create new C file (I expected compile to C to do this - so try this too)
11) Open a cmd prompt.
12) cd 'mesh'
13) esp-idf\export
14) esp-idf\tools\idf.py menuconfig - set esp32 flash to 4mb if using esp32-wroom Check ble-mesh enabled
15) esp-idf\tools\idf.py clean
16) esp-idf\tools\idf.py build (if building outwith fc)
17) - if all is good then esp-idf\tools\idf.py -p COMn flash (where n is for com port esp32 is attached to)
18) Install nrfMesh on a phone and test - you should be able to control LEDs attached (see board.h for pins) or just use
Martin