commit fec6f19309a051de901196dd5b5d45a8d58f16d8 Author: Rémi Heredero Date: Fri Apr 16 21:15:54 2021 +0200 master diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bbdd36c --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.pio +.clang_complete +.gcc-flags.json diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..7c486f1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,67 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < https://docs.platformio.org/page/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < https://docs.platformio.org/page/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < https://docs.platformio.org/page/userguide/cmd_ci.html > +# +# +# Please choose one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# - platformio update +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to be used as a library with examples. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# - platformio update +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..738535b --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,227 @@ +// +// !!! WARNING !!! AUTO-GENERATED FILE! +// PLEASE DO NOT MODIFY IT AND USE "platformio.ini": +// https://docs.platformio.org/page/projectconf/section_env_build.html#build-flags +// +{ + "configurations": [ + { + "name": "PlatformIO", + "includePath": [ + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/include", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/src", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/Reseau", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/Leds", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/DFPlayer", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/Bluetooth", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/.pio/libdeps/esp-wrover-kit/uFire SHT20/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_trace", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_update", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/asio", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bootloader_support", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bt", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/coap", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/console", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/driver", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp-tls", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp32", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_adc_cal", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_event", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_http_client", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_http_server", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_https_ota", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_ringbuf", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/ethernet", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/expat", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/fatfs", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/freemodbus", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/freertos", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/heap", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/idf_test", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/jsmn", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/json", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/libsodium", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/log", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/lwip", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/mbedtls", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/mdns", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/micro-ecc", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/mqtt", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/newlib", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/nghttp", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/nvs_flash", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/openssl", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/protobuf-c", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/protocomm", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/pthread", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/sdmmc", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/smartconfig_ack", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/soc", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/spi_flash", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/spiffs", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/tcp_transport", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/tcpip_adapter", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/ulp", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/vfs", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/wear_levelling", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/wifi_provisioning", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/wpa_supplicant", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/xtensa-debug-module", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp-face", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp32-camera", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/fb_gfx", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/cores/esp32", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/variants/esp32", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/ArduinoOTA/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/AsyncUDP/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/AzureIoT/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/DNSServer/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/EEPROM/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/ESP32/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/ESPmDNS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/FFat/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/FS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/HTTPClient/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/NetBIOS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Preferences/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SD/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SPIFFS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SimpleBLE/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Ticker/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Update/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src", + "C:/Users/remi/.platformio/packages/tool-unity", + "" + ], + "browse": { + "limitSymbolsToIncludedHeaders": true, + "path": [ + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/include", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/src", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/Reseau", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/Leds", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/DFPlayer", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/lib/Bluetooth", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/BLE/src", + "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/.pio/libdeps/esp-wrover-kit/uFire SHT20/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_trace", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_update", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/asio", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bootloader_support", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/bt", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/coap", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/console", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/driver", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp-tls", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp32", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_adc_cal", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_event", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_http_client", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_http_server", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_https_ota", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp_ringbuf", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/ethernet", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/expat", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/fatfs", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/freemodbus", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/freertos", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/heap", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/idf_test", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/jsmn", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/json", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/libsodium", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/log", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/lwip", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/mbedtls", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/mdns", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/micro-ecc", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/mqtt", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/newlib", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/nghttp", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/nvs_flash", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/openssl", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/protobuf-c", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/protocomm", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/pthread", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/sdmmc", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/smartconfig_ack", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/soc", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/spi_flash", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/spiffs", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/tcp_transport", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/tcpip_adapter", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/ulp", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/vfs", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/wear_levelling", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/wifi_provisioning", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/wpa_supplicant", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/xtensa-debug-module", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp-face", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/esp32-camera", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/fb_gfx", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/cores/esp32", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/variants/esp32", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/ArduinoOTA/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/AsyncUDP/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/AzureIoT/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/BluetoothSerial/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/DNSServer/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/EEPROM/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/ESP32/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/ESPmDNS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/FFat/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/FS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/HTTPClient/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/NetBIOS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Preferences/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SD/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SPIFFS/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/SimpleBLE/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Ticker/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/Update/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src", + "C:/Users/remi/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src", + "C:/Users/remi/.platformio/packages/tool-unity", + "" + ] + }, + "defines": [ + "PLATFORMIO=50101", + "ARDUINO_ESP32_DEV", + "ESP32", + "ESP_PLATFORM", + "F_CPU=240000000L", + "HAVE_CONFIG_H", + "MBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"", + "ARDUINO=10805", + "ARDUINO_ARCH_ESP32", + "ARDUINO_VARIANT=\"esp32\"", + "ARDUINO_BOARD=\"Espressif ESP32 Dev Module\"", + "" + ], + "cStandard": "c99", + "cppStandard": "c++11", + "compilerPath": "C:/Users/remi/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc.exe", + "compilerArgs": [ + "-mlongcalls", + "" + ] + } + ], + "version": 4 +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..e80666b --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,7 @@ +{ + // See http://go.microsoft.com/fwlink/?LinkId=827846 + // for the documentation about the extensions.json format + "recommendations": [ + "platformio.platformio-ide" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0581ac2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,34 @@ +// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY +// +// PIO Unified Debugger +// +// Documentation: https://docs.platformio.org/page/plus/debugging.html +// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html + +{ + "version": "0.2.0", + "configurations": [ + { + "type": "platformio-debug", + "request": "launch", + "name": "PIO Debug", + "executable": "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/.pio/build/esp-wrover-kit/firmware.elf", + "projectEnvName": "esp-wrover-kit", + "toolchainBinDir": "C:/Users/remi/.platformio/packages/toolchain-xtensa32/bin", + "internalConsoleOptions": "openOnSessionStart", + "preLaunchTask": { + "type": "PlatformIO", + "task": "Pre-Debug" + } + }, + { + "type": "platformio-debug", + "request": "launch", + "name": "PIO Debug (skip Pre-Debug)", + "executable": "C:/Users/remi/OneDrive/Documents/Professionnel/EscapeWorld/eclairage intelligent/programme/eclairage_intelligent_dev/.pio/build/esp-wrover-kit/firmware.elf", + "projectEnvName": "esp-wrover-kit", + "toolchainBinDir": "C:/Users/remi/.platformio/packages/toolchain-xtensa32/bin", + "internalConsoleOptions": "openOnSessionStart" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..71c961d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "vscode-node-red.url": "http://remoras:1880/", + "vscode-node-red.settings.js": { + + "editorTheme": { + "projects": { + "enabled": true + } + } + } +} \ No newline at end of file diff --git a/include/README b/include/README new file mode 100644 index 0000000..194dcd4 --- /dev/null +++ b/include/README @@ -0,0 +1,39 @@ + +This directory is intended for project header files. + +A header file is a file containing C declarations and macro definitions +to be shared between several project source files. You request the use of a +header file in your project source file (C, C++, etc) located in `src` folder +by including it, with the C preprocessing directive `#include'. + +```src/main.c + +#include "header.h" + +int main (void) +{ + ... +} +``` + +Including a header file produces the same results as copying the header file +into each source file that needs it. Such copying would be time-consuming +and error-prone. With a header file, the related declarations appear +in only one place. If they need to be changed, they can be changed in one +place, and programs that include the header file will automatically use the +new version when next recompiled. The header file eliminates the labor of +finding and changing all the copies as well as the risk that a failure to +find one copy will result in inconsistencies within a program. + +In C, the usual convention is to give header files names that end with `.h'. +It is most portable to use only letters, digits, dashes, and underscores in +header file names, and at most one dot. + +Read more about using header files in official GCC documentation: + +* Include Syntax +* Include Operation +* Once-Only Headers +* Computed Includes + +https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html diff --git a/lib/Bluetooth/Bluetooth.cpp b/lib/Bluetooth/Bluetooth.cpp new file mode 100644 index 0000000..7ece165 --- /dev/null +++ b/lib/Bluetooth/Bluetooth.cpp @@ -0,0 +1,50 @@ +#include +#include +#include +#include +#include + +static BLEAddress *pServerAddress; +BLEScan* pBLEScan; +BLEClient* pClient; + +std::vector beacons; + +unsigned long entry; + +class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { + //Called for each advertising BLE server. + void onResult(BLEAdvertisedDevice advertisedDevice) { + pServerAddress = new BLEAddress(advertisedDevice.getAddress()); + + BeaconBLE tag; + tag.adresse = pServerAddress->toString().c_str(); + tag.qualite = advertisedDevice.getRSSI(); + beacons.push_back(tag); +/* + Serial.println(); + Serial.print("Device found: "); + Serial.print(tag.adresse); + Serial.print(" => "); + Serial.print(tag.qualite); + */ + } +}; // MyAdvertisedDeviceCallbacks + +void setup_ble(){ + Serial.println("Starting Arduino BLE Client application..."); + + BLEDevice::init(""); + + pClient = BLEDevice::createClient(); + Serial.println(" - Created client"); + pBLEScan = BLEDevice::getScan(); + pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); + pBLEScan->setActiveScan(true); +} + +std::vector loop_ble(){ + beacons.clear(); + BLEScanResults scanResults = pBLEScan->start(1); + return beacons; +} diff --git a/lib/Bluetooth/Bluetooth.h b/lib/Bluetooth/Bluetooth.h new file mode 100644 index 0000000..9fd8d53 --- /dev/null +++ b/lib/Bluetooth/Bluetooth.h @@ -0,0 +1,12 @@ +#ifndef BLUETOOTH_H_INCLUDED +#define BLUETOOTH_H_INCLUDED + + struct BeaconBLE { + String adresse; + int qualite; + }; + + void setup_ble(); + std::vector loop_ble(); + +#endif diff --git a/lib/DFPlayer/DFPlayer.cpp b/lib/DFPlayer/DFPlayer.cpp new file mode 100644 index 0000000..2cfb08d --- /dev/null +++ b/lib/DFPlayer/DFPlayer.cpp @@ -0,0 +1,74 @@ +#include +#include +#include +#include + + +class Mp3Notify{ +public: + static void PrintlnSourceAction(DfMp3_PlaySources source, const char* action) + { + if (source & DfMp3_PlaySources_Sd){ + Serial.print("SD Card, "); + } + Serial.println(action); + } + static void OnError(uint16_t errorCode) + { + // see DfMp3_Error for code meaning + Serial.println(); + Serial.print("Com Error "); + Serial.println(errorCode); + } + static void OnPlayFinished(DfMp3_PlaySources source, uint16_t track) + { + Serial.print("Play finished for #"); + Serial.println(track); + } + static void OnPlaySourceOnline(DfMp3_PlaySources source) + { + PrintlnSourceAction(source, "online"); + } + static void OnPlaySourceInserted(DfMp3_PlaySources source) + { + PrintlnSourceAction(source, "inserted"); + } + static void OnPlaySourceRemoved(DfMp3_PlaySources source) + { + PrintlnSourceAction(source, "removed"); + } +}; + +SoftwareSerial secondarySerial(32, 33); // RX, TX +DFMiniMp3 mp3(secondarySerial); + +void setup_dfp(){ + mp3.begin(); + + uint16_t volume = mp3.getVolume(); + Serial.print("volume "); + Serial.println(volume); + mp3.setVolume(10); + + uint16_t count = mp3.getTotalTrackCount(DfMp3_PlaySource_Sd); + Serial.print("files "); + Serial.println(count); +} + +void play(int fichier){ + mp3.loop(); + mp3.playMp3FolderTrack(fichier); +} + +void stop(){ + mp3.loop(); + mp3.stop(); +} + +boolean statut(){ + return (mp3.getStatus() == 513); +} + +void volume(int vol){ + mp3.setVolume(vol); +} diff --git a/lib/DFPlayer/DFPlayer.h b/lib/DFPlayer/DFPlayer.h new file mode 100644 index 0000000..4a3f267 --- /dev/null +++ b/lib/DFPlayer/DFPlayer.h @@ -0,0 +1,10 @@ +#ifndef DFPLAYER_H_INCLUDED +#define DFPLAYER_H_INCLUDED + + void setup_dfp(); + void play(int fichier); + void stop(); + boolean statut(); + void volume(int vol = 10); + +#endif diff --git a/lib/Leds/Leds.cpp b/lib/Leds/Leds.cpp new file mode 100644 index 0000000..22c21b0 --- /dev/null +++ b/lib/Leds/Leds.cpp @@ -0,0 +1,72 @@ +#include +#include +#include + +Adafruit_NeoPixel strip = Adafruit_NeoPixel(LED_NOMBRE, LED_PIN, NEO_GRB + NEO_KHZ800); +#ifdef __AVR__ + #include +#endif + +int last_puissance; +int lr; +int lg; +int lb; +boolean firstOFF(true); +boolean change(true); + +/* + * IMPORTANT !!!! Pour réduire les risque sur le bandeau, ajoutez un condensateur de 1000 uF sur l'alimentation + * Mettez une résistance entre 300 et 500 Ohm sur le DataIn de la première LED + * Minimiser la distance entre l'Arduino et la première led + * Pour préserver le circuit... si vous le voulez, brancher le GND en premier + */ + +void setup_led(){ + // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket + #if defined (__AVR_ATtiny85__) + if (F_CPU == 16000000) clock_prescale_set(clock_div_1); + #endif + // End of trinket special code + + strip.begin(); + strip.show(); // Éteint toutes les LEDs +} + +void LEDoff(){ + if (firstOFF){ + strip.clear(); + strip.show(); + firstOFF = false; + Serial.println("OFF"); + last_puissance = 0; + lr = 0; + lg = 0; + lb = 0; + } +} + +void LEDon(int puissance, int r, int g, int b){ + + if(r!=lr || g!=lg || b!=lb){ + for (int LED=0; LED THIS FILE +| +|- platformio.ini +|--src + |- main.c + +and a contents of `src/main.c`: +``` +#include +#include + +int main (void) +{ + ... +} + +``` + +PlatformIO Library Dependency Finder will find automatically dependent +libraries scanning project source files. + +More information about PlatformIO Library Dependency Finder +- https://docs.platformio.org/page/librarymanager/ldf.html diff --git a/lib/Reseau/Reseau.cpp b/lib/Reseau/Reseau.cpp new file mode 100644 index 0000000..0057fca --- /dev/null +++ b/lib/Reseau/Reseau.cpp @@ -0,0 +1,174 @@ +#include +#include +#include +#include +#include +#include +#include +const byte last_mac = ID; +int id = ID; +byte mac[] = { 0x02, 0x00, 0x00, 0x7A, 0x38, last_mac }; +IPAddress ip (192, 168, 8, 100+id); +IPAddress server(SERVEUR_MQTT); + +uint32_t lastReconnectAttempt = 0; +unsigned long check; + +//Just Header +void callback(char* topic, byte* payload, unsigned int length); +boolean connection(); + +EthernetClient ethClient; +PubSubClient client(server, PORT, callback, ethClient); + +struct TopicParametre { + String topic; + int parametre; + int defaut; + boolean subscribe; + boolean define; + }; +std::vector topic_parametre; +void AddParametre (String topic, int defaut){ + String sujet = String(id)+"/"+topic; + TopicParametre valeure; + valeure.topic = sujet; + valeure.subscribe = false; + valeure.define = false; + valeure.defaut = defaut; + topic_parametre.push_back(valeure); + Serial.println("add"); +} + + +void callback(char* topic, byte* payload, unsigned int length) { + Serial.print("Message arrived ["); + Serial.print(topic); + Serial.print("] "); + for (int i=0;i 20000) { + ESP.restart(); + } + if (!client.connected()) { + Serial.println("=== MQTT NOT CONNECTED ==="); + // Reconnect every 10 seconds + uint32_t t = millis(); + if (t - lastReconnectAttempt > 10000L) { + lastReconnectAttempt = t; + if (connection()) { + lastReconnectAttempt = 0; + } + } + return false; + } + + //NO-USE - Pour tester la connexion avec la carte ethernet + if (Ethernet.linkStatus() == LinkOFF) { + } + else if (Ethernet.linkStatus() == LinkON) { + } + else { + } + +} + +boolean publish(String topic, String msg){ + String sujet = String(id)+"/"+topic; + return (client.publish(sujet.c_str(),msg.c_str()) == 1); +} + +int ReadParametre (String topic){ + //String sujet = String(ID)+"/"+topic; + for(auto val:topic_parametre){ + String sujet = String(id)+"/"+topic; + + if(sujet == val.topic){ + if(val.define){ + return val.parametre; + } else { + return val.defaut; + } + } + } +} + +void ResetValues (){ + for(auto& val:topic_parametre){ + val.define = false; + } +} diff --git a/lib/Reseau/Reseau.h b/lib/Reseau/Reseau.h new file mode 100644 index 0000000..d85b93c --- /dev/null +++ b/lib/Reseau/Reseau.h @@ -0,0 +1,16 @@ +#ifndef RESEAU_H_INCLUDED +#define RESEAU_H_INCLUDED + #define ID 18 + //de 0 à 255 + #define SERVEUR_MQTT 192,168,8,100 + #define PORT 1883 + + boolean setup_reseau (); + boolean loop_reseau(); + + boolean publish(String topic, String msg); + void AddParametre (String topic, int defaut = 0); + int ReadParametre (String topic); + void ResetValues (); + +#endif diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..0d8545d --- /dev/null +++ b/platformio.ini @@ -0,0 +1,20 @@ +; 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 + +[platformio] +default_envs = esp-wrover-kit +description = En développement continu + +[env:esp-wrover-kit] +platform = espressif32 +board = esp32dev +framework = arduino +monitor_speed = 115200 +lib_deps = u-fire/uFire SHT20@^1.1.1 diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..8403a00 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,239 @@ +//Ajout des bibliothèques +#include +#include +#include +#include +#include +#include +#include +#include +#include +uFire_SHT20 sht20; + +//Définition des PINs +#define LED 02 +#define SON1 A15 +#define SON2 14 +#define PIR1 26 +#define PIR2 27 +#define INT1 34 +#define INT2 35 +#define TEST 04 +#define CHAUF 25 + + +int WatchDog; +std::vector tag; +int volume_past; +boolean play_sound; + +unsigned long tps_max; +int tps_last_max; +int analog_past(0); +boolean clign(false); + +int color_r; +int color_g; +int color_b; +int LED_max; +int LED_ampli; +int vol_sound; +boolean chauffage; +boolean pb_test; +float humidity; +float temperature; +float dewpoint; + + +void setup() { + delay(5000); + + //Définition des PINs + pinMode(LED, OUTPUT); + digitalWrite(LED,HIGH); + pinMode(PIR1,INPUT); + pinMode(PIR2,INPUT); + pinMode(TEST,INPUT_PULLUP); + pinMode(INT1,INPUT); + pinMode(INT2,INPUT); + pinMode(CHAUF, OUTPUT); + + //Ouverture du port série pour l'ordi + Serial.begin(115200); + + //Ajout des paramètres d'entrées + AddParametre("BLE/recherche", 1); + AddParametre("LED/ON", 0); + AddParametre("LED/color/r", 245); + AddParametre("LED/color/g", 255); + AddParametre("LED/color/b", 20); + AddParametre("LED/MAX", 40); + AddParametre("LED/ampli", 20); + AddParametre("SON/volume", 20); + AddParametre("TEMP/CHAUFFAGE", 0); + AddParametre("WDG/ESP"); + + //Setup des différentes fonctions + setup_ble(); + while (!setup_reseau()) { + delay(500); + Serial.println("Echec réseau"); + } + setup_led(); + Wire.begin(15,13); + sht20.begin(); + + + delay(random(5000)); + + //Check première connection + WatchDog = random(1000); + publish("WDG/NR", String(WatchDog)); + while (WatchDog != ReadParametre("WDG/ESP")){ + Serial.println("Pas encore connecté"); + loop_reseau(); + delay(100); + } + + //Reset valeurs des paramètres + //ResetValues(); + + //Setup du DFPlayer + setup_dfp(); + + + //Paramètre fixe + color_r = ReadParametre("LED/color/r"); + color_g = ReadParametre("LED/color/g"); + color_b = ReadParametre("LED/color/b"); + LED_max = ReadParametre("LED/MAX"); + LED_ampli = ReadParametre("LED/ampli"); + vol_sound = ReadParametre("SON/volume"); +} + +void loop() { + if(loop_reseau()){ + digitalWrite(LED,LOW); + } else { + digitalWrite(LED,HIGH); + } + + + publish("INT1", String(digitalRead(INT1))); + publish("INT2", String(digitalRead(INT2))); + + + //Lecture des paramètres BLE + LED + int recherche = ReadParametre("BLE/recherche"); + int actif = ReadParametre("LED/ON"); + + if(!actif){ + //Paramètre fixe + color_r = ReadParametre("LED/color/r"); + color_g = ReadParametre("LED/color/g"); + color_b = ReadParametre("LED/color/b"); + LED_max = ReadParametre("LED/MAX"); + LED_ampli = ReadParametre("LED/ampli"); + vol_sound = ReadParametre("SON/volume"); + + chauffage = ReadParametre("TEMP/CHAUFFAGE"); + pb_test = !digitalRead(TEST); + humidity = sht20.humidity(); + temperature = sht20.temperature(); + dewpoint = sht20.dew_point(); + + Serial.print("humidité: "); + Serial.println(humidity); + publish("TEMP/HR",String(humidity)); + Serial.print("Température: "); + Serial.println(temperature); + publish("TEMP/T",String(temperature)); + //Serial.print("Dewpoint: "); + //Serial.println(dewpoint); + publish("TEMP/DP",String(dewpoint)); + + if(volume_past != vol_sound){ + volume(vol_sound); + volume_past = vol_sound; + } + + digitalWrite(CHAUF, chauffage); + + } else { + chauffage = false; + } + + boolean pir_1 = digitalRead(PIR1); + boolean pir_2 = digitalRead(PIR2); + int son1 = random(1000);//analogRead(SON1); + int son2 = analogRead(SON2); + + + // envoie des capteurs de mouvements + publish("PIR1", String(pir_1)); + publish("PIR2", String(pir_2)); + + Serial.println(son1); + + unsigned long now = millis(); + if((son1-analog_past)>0){ + analog_past = son1; + clign = true; + } else if((son1-analog_past)<0){ + analog_past = son1; + clign = false; + } + + if(clign){ + tps_last_max = now - tps_max; + tps_max = now; + } + int x = son1 -2500; + int y = map(x, 0, 1500, 0, LED_ampli); + int val = map(y, 0, LED_ampli, 0, LED_max); + + //Serial.println(son1); + //Serial.println(LED_max); + //Serial.println(LED_ampli); + //Serial.println(val); + //Serial.println(tps_last_max); + //publish("test", String(val)); + +//-------------------- + + if(recherche){ + tag = loop_ble(); + for(auto val:tag){ + publish("BLE/TAG",val.adresse + " => " + val.qualite); + } + + + } + + if(actif){ + Serial.println("TEST"); + //LEDon(val,color_r,color_g,color_b); + delay(100); + if(clign){ + LEDon(LED_max,color_r,color_g,color_b); + Serial.println("ON"); + } else { + LEDon(LED_max-(LED_ampli*LED_max)/100,color_r,color_g,color_b); + Serial.println("OFF"); + } + if(!play_sound){ + play(1); + play_sound = true; + } + digitalWrite(CHAUF, 0); + } else { + LEDoff(); + stop(); + play_sound = false; + } + +Serial.println("--- - --- - ---"); + + + +} diff --git a/test/README b/test/README new file mode 100644 index 0000000..df5066e --- /dev/null +++ b/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PIO Unit Testing and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PIO Unit Testing: +- https://docs.platformio.org/page/plus/unit-testing.html