diff --git a/Firmware/BentoFlow/platformio.ini b/Firmware/BentoFlow/platformio.ini index 24cecae1..aa093bc9 100644 --- a/Firmware/BentoFlow/platformio.ini +++ b/Firmware/BentoFlow/platformio.ini @@ -9,10 +9,10 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = esp32 +default_envs = bentoflow [base] -board = clarinet +board = lightbulb framework = arduino lib_deps = https://github.com/adafruit/Adafruit_BNO055.git#1.4.3 @@ -26,7 +26,7 @@ lib_deps = https://github.com/jshaw/SimplexNoise WebServer fastled/FastLED @ ^3.5.0 - benkuper/OSC @ ^1.0.0 + https://github.com/benkuper/OSC bblanchon/ArduinoJson @ ^6.21.2 monitor_speed = 115200 @@ -57,7 +57,7 @@ lib_deps = https://github.com/jshaw/SimplexNoise WebServer fastled/FastLED @ ^3.5.0 - benkuper/OSC @ ^1.0.0 + https://github.com/benkuper/OSC bblanchon/ArduinoJson @ ^6.21.2 [env:bentoflow] diff --git a/Firmware/BentoFlow/src/common/config/config_lamp.h b/Firmware/BentoFlow/src/common/config/config_lamp.h index 6d66c5bf..d7952d59 100644 --- a/Firmware/BentoFlow/src/common/config/config_lamp.h +++ b/Firmware/BentoFlow/src/common/config/config_lamp.h @@ -11,7 +11,7 @@ // main leds config #define LED_COUNT 30 -#define LED_DATA_PIN 15 +#define LED_DATA_PIN 5 #define LED_TYPE WS2812B #define LED_COLOR_ORDER GRB #define LED_MAX_BRIGHTNESS 200 diff --git a/Firmware/BentoFlowCreator/.vscode/arduino.json b/Firmware/BentoFlowCreator/.vscode/arduino.json deleted file mode 100644 index c0dd59bf..00000000 --- a/Firmware/BentoFlowCreator/.vscode/arduino.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "sketch": "BentoFlowCreator.ino", - "configuration": "PSRAM=disabled,PartitionScheme=default,CPUFreq=240,FlashMode=qio,FlashFreq=80,FlashSize=4M,UploadSpeed=921600,LoopCore=1,EventsCore=1,DebugLevel=none", - "board": "esp32:esp32:esp32", - "port": "COM29", - "output": "../ArduinoOutput" -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/.vscode/c_cpp_properties.json b/Firmware/BentoFlowCreator/.vscode/c_cpp_properties.json deleted file mode 100644 index 1fa8b171..00000000 --- a/Firmware/BentoFlowCreator/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,598 +0,0 @@ -{ - "version": 4, - "configurations": [ - { - "name": "Win32", - "compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x64/cl.exe", - "compilerArgs": [], - "intelliSenseMode": "msvc-x64", - "includePath": [ - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.6.3\\**", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\**", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.2\\**", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\**", - "${workspaceFolder}/**", - "${workspaceFolder}", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\1.0.6\\**", - "C:\\Program Files (x86)\\Arduino\\libraries\\**", - "D:\\Documents\\Arduino\\libraries\\**", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.7.4\\**" - ], - "forcedInclude": [], - "cStandard": "c11", - "cppStandard": "c++17", - "defines": [ - "_DEBUG", - "UNICODE", - "_UNICODE", - "USBCON" - ] - }, - { - "name": "Arduino", - "compilerPath": "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\bin\\xtensa-esp32-elf-g++", - "compilerArgs": [ - "-mlongcalls", - "-Wno-frame-address", - "-ffunction-sections", - "-fdata-sections", - "-Wno-error=unused-function", - "-Wno-error=unused-variable", - "-Wno-error=deprecated-declarations", - "-Wno-unused-parameter", - "-Wno-sign-compare", - "-freorder-blocks", - "-Wwrite-strings", - "-fstack-protector", - "-fstrict-volatile-bitfields", - "-Wno-error=unused-but-set-variable", - "-fno-jump-tables", - "-fno-tree-switch-conversion", - "-std=gnu++11", - "-fexceptions", - "-fno-rtti" - ], - "intelliSenseMode": "gcc-x64", - "includePath": [ - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\config", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\newlib\\platform_include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\freertos\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\freertos\\include\\esp_additions\\freertos", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\freertos\\port\\xtensa\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\freertos\\include\\esp_additions", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_hw_support\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_hw_support\\include\\soc", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_hw_support\\include\\soc\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_hw_support\\port\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\heap\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\log\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\lwip\\include\\apps", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\lwip\\include\\apps\\sntp", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\lwip\\lwip\\src\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\lwip\\port\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\lwip\\port\\esp32\\include\\arch", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\soc\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\soc\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\soc\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\hal\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\hal\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\hal\\platform_port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_rom\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_rom\\include\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_rom\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_common\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_system\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_system\\port\\soc", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_system\\port\\public_compat", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\xtensa\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\xtensa\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\driver\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\driver\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_pm\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_ringbuf\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\efuse\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\efuse\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\vfs\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_wifi\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_event\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_netif\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_eth\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\tcpip_adapter\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_phy\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_phy\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_ipc\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\app_trace\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_timer\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\mbedtls\\port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\mbedtls\\mbedtls\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\mbedtls\\esp_crt_bundle\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\app_update\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\spi_flash\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\bootloader_support\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\nvs_flash\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\pthread\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_gdbstub\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_gdbstub\\xtensa", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_gdbstub\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\espcoredump\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\espcoredump\\include\\port\\xtensa", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\wpa_supplicant\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\wpa_supplicant\\port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\wpa_supplicant\\esp_supplicant\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\ieee802154\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\console", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\asio\\asio\\asio\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\asio\\port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\bt\\common\\osi\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\bt\\include\\esp32\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\bt\\common\\api\\include\\api", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\bt\\common\\btc\\profile\\esp\\blufi\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\bt\\common\\btc\\profile\\esp\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\bt\\host\\bluedroid\\api\\include\\api", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\cbor\\port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\unity\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\unity\\unity\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\cmock\\CMock\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\coap\\port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\coap\\libcoap\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\nghttp\\port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\nghttp\\nghttp2\\lib\\includes", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-tls", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-tls\\esp-tls-crypto", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_adc_cal\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_hid\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\tcp_transport\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_http_client\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_http_server\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_https_ota\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_lcd\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_lcd\\interface", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\protobuf-c\\protobuf-c", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\protocomm\\include\\common", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\protocomm\\include\\security", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\protocomm\\include\\transports", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\mdns\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_local_ctrl\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\sdmmc\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_serial_slave_link\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_websocket_client\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\expat\\expat\\expat\\lib", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\expat\\port\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\wear_levelling\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\fatfs\\diskio", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\fatfs\\vfs", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\fatfs\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\freemodbus\\common\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\idf_test\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\idf_test\\include\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\jsmn\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\json\\cJSON", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\libsodium\\libsodium\\src\\libsodium\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\libsodium\\port_include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\mqtt\\esp-mqtt\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\openssl\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\perfmon\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\spiffs\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\ulp\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\wifi_provisioning\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\button\\button\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\json_parser", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\json_parser\\jsmn\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\json_generator", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_schedule\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_rainmaker\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\qrcode\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\ws2812_led", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_littlefs\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp_littlefs\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\dotprod\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\support\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\windows\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\windows\\hann\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\windows\\blackman\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\windows\\blackman_harris\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\windows\\blackman_nuttall\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\windows\\nuttall\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\windows\\flat_top\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\iir\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\fir\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\math\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\math\\add\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\math\\sub\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\math\\mul\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\math\\addc\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\math\\mulc\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\math\\sqrt\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\matrix\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\fft\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\dct\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\conv\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\common\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\kalman\\ekf\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-dsp\\modules\\kalman\\ekf_imu13states\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\tool", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\typedef", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\image", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\math", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\nn", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\layer", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\detect", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp-face\\include\\model_zoo", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp32-camera\\driver\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\esp32-camera\\conversions\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\tools\\sdk\\esp32\\include\\fb_gfx\\include", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\cores\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\variants\\esp32", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\Preferences\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\WiFi\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\ESPmDNS\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\SPI\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\SD\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\FS\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\WebServer\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\Wire\\src", - "D:\\Documents\\Arduino\\libraries\\Wasm3\\src", - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\libraries\\SPIFFS\\src", - "c:\\users\\bkupe\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\xtensa-esp32-elf\\include\\c++\\8.4.0", - "c:\\users\\bkupe\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\xtensa-esp32-elf\\include\\c++\\8.4.0\\xtensa-esp32-elf", - "c:\\users\\bkupe\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\xtensa-esp32-elf\\include\\c++\\8.4.0\\backward", - "c:\\users\\bkupe\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\lib\\gcc\\xtensa-esp32-elf\\8.4.0\\include", - "c:\\users\\bkupe\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\lib\\gcc\\xtensa-esp32-elf\\8.4.0\\include-fixed", - "c:\\users\\bkupe\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\xtensa-esp32-elf\\sys-include", - "c:\\users\\bkupe\\appdata\\local\\arduino15\\packages\\esp32\\tools\\xtensa-esp32-elf-gcc\\gcc8_4_0-esp-2021r2\\xtensa-esp32-elf\\include" - ], - "forcedInclude": [ - "C:\\Users\\bkupe\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.1\\cores\\esp32\\Arduino.h" - ], - "cStandard": "c11", - "cppStandard": "c++11", - "defines": [ - "HAVE_CONFIG_H", - "MBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"", - "UNITY_INCLUDE_CONFIG_H", - "WITH_POSIX", - "_GNU_SOURCE", - "IDF_VER=\"v4.4-dev-3569-g6a7d83af19-dirty\"", - "ESP_PLATFORM", - "F_CPU=240000000L", - "ARDUINO=10816", - "ARDUINO_ESP32_DEV", - "ARDUINO_ARCH_ESP32", - "ARDUINO_BOARD=\"ESP32_DEV\"", - "ARDUINO_VARIANT=\"esp32\"", - "ARDUINO_PARTITION_default", - "ESP32", - "CORE_DEBUG_LEVEL=0", - "ARDUINO_RUNNING_CORE=1", - "ARDUINO_EVENT_RUNNING_CORE=1", - "ARDUINO_USB_CDC_ON_BOOT=0", - "__DBL_MIN_EXP__=(-1021)", - "__FLT32X_MAX_EXP__=1024", - "__cpp_attributes=200809", - "__UINT_LEAST16_MAX__=0xffff", - "__ATOMIC_ACQUIRE=2", - "__FLT_MIN__=1.1754943508222875e-38F", - "__GCC_IEC_559_COMPLEX=0", - "__cpp_aggregate_nsdmi=201304", - "__UINT_LEAST8_TYPE__=unsigned char", - "__INTMAX_C(c)=c ## LL", - "__CHAR_BIT__=8", - "__UINT8_MAX__=0xff", - "__WINT_MAX__=0xffffffffU", - "__FLT32_MIN_EXP__=(-125)", - "__cpp_static_assert=200410", - "__ORDER_LITTLE_ENDIAN__=1234", - "__SIZE_MAX__=0xffffffffU", - "__WCHAR_MAX__=0xffff", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1", - "__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1", - "__DBL_DENORM_MIN__=double(4.9406564584124654e-324L)", - "__GCC_ATOMIC_CHAR_LOCK_FREE=2", - "__GCC_IEC_559=0", - "__FLT32X_DECIMAL_DIG__=17", - "__FLT_EVAL_METHOD__=0", - "__cpp_binary_literals=201304", - "__FLT64_DECIMAL_DIG__=17", - "__GCC_ATOMIC_CHAR32_T_LOCK_FREE=2", - "__cpp_variadic_templates=200704", - "__UINT_FAST64_MAX__=0xffffffffffffffffULL", - "__SIG_ATOMIC_TYPE__=int", - "__DBL_MIN_10_EXP__=(-307)", - "__FINITE_MATH_ONLY__=0", - "__cpp_variable_templates=201304", - "__GNUC_PATCHLEVEL__=0", - "__FLT32_HAS_DENORM__=1", - "__UINT_FAST8_MAX__=0xffffffffU", - "__has_include(STR)=__has_include__(STR)", - "__DEC64_MAX_EXP__=385", - "__INT8_C(c)=c", - "__INT_LEAST8_WIDTH__=8", - "__UINT_LEAST64_MAX__=0xffffffffffffffffULL", - "__SHRT_MAX__=0x7fff", - "__LDBL_MAX__=1.7976931348623157e+308L", - "__UINT_LEAST8_MAX__=0xff", - "__GCC_ATOMIC_BOOL_LOCK_FREE=2", - "__UINTMAX_TYPE__=long long unsigned int", - "__DEC32_EPSILON__=1E-6DF", - "__FLT_EVAL_METHOD_TS_18661_3__=0", - "__CHAR_UNSIGNED__=1", - "__UINT32_MAX__=0xffffffffU", - "__GXX_EXPERIMENTAL_CXX0X__=1", - "__LDBL_MAX_EXP__=1024", - "__WINT_MIN__=0U", - "__INT_LEAST16_WIDTH__=16", - "__SCHAR_MAX__=0x7f", - "__WCHAR_MIN__=0", - "__INT64_C(c)=c ## LL", - "__DBL_DIG__=15", - "__GCC_ATOMIC_POINTER_LOCK_FREE=2", - "__SIZEOF_INT__=4", - "__SIZEOF_POINTER__=4", - "__GCC_ATOMIC_CHAR16_T_LOCK_FREE=2", - "__USER_LABEL_PREFIX__", - "__STDC_HOSTED__=1", - "__LDBL_HAS_INFINITY__=1", - "__XTENSA_EL__=1", - "__FLT32_DIG__=6", - "__FLT_EPSILON__=1.1920928955078125e-7F", - "__GXX_WEAK__=1", - "__SHRT_WIDTH__=16", - "__LDBL_MIN__=2.2250738585072014e-308L", - "__DEC32_MAX__=9.999999E96DF", - "__cpp_threadsafe_static_init=200806", - "__FLT32X_HAS_INFINITY__=1", - "__INT32_MAX__=0x7fffffff", - "__INT_WIDTH__=32", - "__SIZEOF_LONG__=4", - "__UINT16_C(c)=c", - "__PTRDIFF_WIDTH__=32", - "__DECIMAL_DIG__=17", - "__FLT64_EPSILON__=2.2204460492503131e-16F64", - "__INTMAX_WIDTH__=64", - "__FLT64_MIN_EXP__=(-1021)", - "__has_include_next(STR)=__has_include_next__(STR)", - "__LDBL_HAS_QUIET_NAN__=1", - "__FLT64_MANT_DIG__=53", - "__GNUC__=8", - "__GXX_RTTI=1", - "__cpp_delegating_constructors=200604", - "__FLT_HAS_DENORM__=1", - "__SIZEOF_LONG_DOUBLE__=8", - "__BIGGEST_ALIGNMENT__=16", - "__STDC_UTF_16__=1", - "__FLT64_MAX_10_EXP__=308", - "__FLT32_HAS_INFINITY__=1", - "__DBL_MAX__=double(1.7976931348623157e+308L)", - "__cpp_raw_strings=200710", - "__INT_FAST32_MAX__=0x7fffffff", - "__DBL_HAS_INFINITY__=1", - "__DEC32_MIN_EXP__=(-94)", - "__INTPTR_WIDTH__=32", - "__FLT32X_HAS_DENORM__=1", - "__INT_FAST16_TYPE__=int", - "__LDBL_HAS_DENORM__=1", - "__cplusplus=201402L", - "__cpp_ref_qualifiers=200710", - "__DEC128_MAX__=9.999999999999999999999999999999999E6144DL", - "__INT_LEAST32_MAX__=0x7fffffff", - "__DEC32_MIN__=1E-95DF", - "__DEPRECATED=1", - "__cpp_rvalue_references=200610", - "__DBL_MAX_EXP__=1024", - "__WCHAR_WIDTH__=16", - "__FLT32_MAX__=3.4028234663852886e+38F32", - "__DEC128_EPSILON__=1E-33DL", - "__PTRDIFF_MAX__=0x7fffffff", - "__FLT32_HAS_QUIET_NAN__=1", - "__GNUG__=8", - "__LONG_LONG_MAX__=0x7fffffffffffffffLL", - "__SIZEOF_SIZE_T__=4", - "__cpp_rvalue_reference=200610", - "__cpp_nsdmi=200809", - "__SIZEOF_WINT_T__=4", - "__LONG_LONG_WIDTH__=64", - "__cpp_initializer_lists=200806", - "__FLT32_MAX_EXP__=128", - "__cpp_hex_float=201603", - "__GXX_ABI_VERSION=1013", - "__FLT_MIN_EXP__=(-125)", - "__cpp_lambdas=200907", - "__INT_FAST64_TYPE__=long long int", - "__FP_FAST_FMAF=1", - "__FLT64_DENORM_MIN__=4.9406564584124654e-324F64", - "__DBL_MIN__=double(2.2250738585072014e-308L)", - "__FLT32X_EPSILON__=2.2204460492503131e-16F32x", - "__FLT64_MIN_10_EXP__=(-307)", - "__DEC128_MIN__=1E-6143DL", - "__REGISTER_PREFIX__", - "__UINT16_MAX__=0xffff", - "__DBL_HAS_DENORM__=1", - "__FLT32_MIN__=1.1754943508222875e-38F32", - "__UINT8_TYPE__=unsigned char", - "__NO_INLINE__=1", - "__FLT_MANT_DIG__=24", - "__LDBL_DECIMAL_DIG__=17", - "__VERSION__=\"8.4.0\"", - "__UINT64_C(c)=c ## ULL", - "__cpp_unicode_characters=200704", - "__cpp_decltype_auto=201304", - "__GCC_ATOMIC_INT_LOCK_FREE=2", - "__FLT32_MANT_DIG__=24", - "__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__", - "__SCHAR_WIDTH__=8", - "__INT32_C(c)=c", - "__DEC64_EPSILON__=1E-15DD", - "__ORDER_PDP_ENDIAN__=3412", - "__DEC128_MIN_EXP__=(-6142)", - "__FLT32_MAX_10_EXP__=38", - "__INT_FAST32_TYPE__=int", - "__UINT_LEAST16_TYPE__=short unsigned int", - "__INT16_MAX__=0x7fff", - "__cpp_rtti=199711", - "__SIZE_TYPE__=unsigned int", - "__UINT64_MAX__=0xffffffffffffffffULL", - "__INT8_TYPE__=signed char", - "__cpp_digit_separators=201309", - "__ELF__=1", - "__xtensa__=1", - "__FLT_RADIX__=2", - "__INT_LEAST16_TYPE__=short int", - "__LDBL_EPSILON__=2.2204460492503131e-16L", - "__UINTMAX_C(c)=c ## ULL", - "__SIG_ATOMIC_MAX__=0x7fffffff", - "__GCC_ATOMIC_WCHAR_T_LOCK_FREE=2", - "__SIZEOF_PTRDIFF_T__=4", - "__FLT32X_MANT_DIG__=53", - "__FLT32X_MIN_EXP__=(-1021)", - "__DEC32_SUBNORMAL_MIN__=0.000001E-95DF", - "__INT_FAST16_MAX__=0x7fffffff", - "__FLT64_DIG__=15", - "__UINT_FAST32_MAX__=0xffffffffU", - "__UINT_LEAST64_TYPE__=long long unsigned int", - "__FLT_HAS_QUIET_NAN__=1", - "__FLT_MAX_10_EXP__=38", - "__LONG_MAX__=0x7fffffffL", - "__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL", - "__FLT_HAS_INFINITY__=1", - "__cpp_unicode_literals=200710", - "__UINT_FAST16_TYPE__=unsigned int", - "__DEC64_MAX__=9.999999999999999E384DD", - "__INT_FAST32_WIDTH__=32", - "__CHAR16_TYPE__=short unsigned int", - "__PRAGMA_REDEFINE_EXTNAME=1", - "__SIZE_WIDTH__=32", - "__INT_LEAST16_MAX__=0x7fff", - "__DEC64_MANT_DIG__=16", - "__INT64_MAX__=0x7fffffffffffffffLL", - "__UINT_LEAST32_MAX__=0xffffffffU", - "__FLT32_DENORM_MIN__=1.4012984643248171e-45F32", - "__GCC_ATOMIC_LONG_LOCK_FREE=2", - "__SIG_ATOMIC_WIDTH__=32", - "__INT_LEAST64_TYPE__=long long int", - "__INT16_TYPE__=short int", - "__INT_LEAST8_TYPE__=signed char", - "__DEC32_MAX_EXP__=97", - "__INT_FAST8_MAX__=0x7fffffff", - "__INTPTR_MAX__=0x7fffffff", - "__cpp_sized_deallocation=201309", - "__cpp_range_based_for=200907", - "__FLT64_HAS_QUIET_NAN__=1", - "__FLT32_MIN_10_EXP__=(-37)", - "__EXCEPTIONS=1", - "__LDBL_MANT_DIG__=53", - "__DBL_HAS_QUIET_NAN__=1", - "__FLT64_HAS_INFINITY__=1", - "__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)", - "__cpp_return_type_deduction=201304", - "__INTPTR_TYPE__=int", - "__UINT16_TYPE__=short unsigned int", - "__WCHAR_TYPE__=short unsigned int", - "__SIZEOF_FLOAT__=4", - "__UINTPTR_MAX__=0xffffffffU", - "__INT_FAST64_WIDTH__=64", - "__DEC64_MIN_EXP__=(-382)", - "__cpp_decltype=200707", - "__FLT32_DECIMAL_DIG__=9", - "__INT_FAST64_MAX__=0x7fffffffffffffffLL", - "__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1", - "__FLT_DIG__=6", - "__UINT_FAST64_TYPE__=long long unsigned int", - "__INT_MAX__=0x7fffffff", - "__INT64_TYPE__=long long int", - "__FLT_MAX_EXP__=128", - "__DBL_MANT_DIG__=53", - "__cpp_inheriting_constructors=201511", - "__INT_LEAST64_MAX__=0x7fffffffffffffffLL", - "__FP_FAST_FMAF32=1", - "__DEC64_MIN__=1E-383DD", - "__WINT_TYPE__=unsigned int", - "__UINT_LEAST32_TYPE__=unsigned int", - "__SIZEOF_SHORT__=2", - "__LDBL_MIN_EXP__=(-1021)", - "__FLT64_MAX__=1.7976931348623157e+308F64", - "__WINT_WIDTH__=32", - "__INT_LEAST8_MAX__=0x7f", - "__FLT32X_MAX_10_EXP__=308", - "__WCHAR_UNSIGNED__=1", - "__LDBL_MAX_10_EXP__=308", - "__ATOMIC_RELAXED=0", - "__DBL_EPSILON__=double(2.2204460492503131e-16L)", - "__XTENSA_WINDOWED_ABI__=1", - "__UINT8_C(c)=c", - "__FLT64_MAX_EXP__=1024", - "__INT_LEAST32_TYPE__=int", - "__SIZEOF_WCHAR_T__=2", - "__INT_FAST8_TYPE__=int", - "__GNUC_STDC_INLINE__=1", - "__FLT64_HAS_DENORM__=1", - "__FLT32_EPSILON__=1.1920928955078125e-7F32", - "__DBL_DECIMAL_DIG__=17", - "__STDC_UTF_32__=1", - "__INT_FAST8_WIDTH__=32", - "__DEC_EVAL_METHOD__=2", - "__FLT32X_MAX__=1.7976931348623157e+308F32x", - "__XTENSA__=1", - "__ORDER_BIG_ENDIAN__=4321", - "__cpp_runtime_arrays=198712", - "__UINT64_TYPE__=long long unsigned int", - "__UINT32_C(c)=c ## U", - "__INTMAX_MAX__=0x7fffffffffffffffLL", - "__cpp_alias_templates=200704", - "__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__", - "__FLT_DENORM_MIN__=1.4012984643248171e-45F", - "__INT8_MAX__=0x7f", - "__LONG_WIDTH__=32", - "__UINT_FAST32_TYPE__=unsigned int", - "__CHAR32_TYPE__=unsigned int", - "__FLT_MAX__=3.4028234663852886e+38F", - "__cpp_constexpr=201304", - "__INT32_TYPE__=int", - "__SIZEOF_DOUBLE__=8", - "__cpp_exceptions=199711", - "__FLT_MIN_10_EXP__=(-37)", - "__FLT64_MIN__=2.2250738585072014e-308F64", - "__INT_LEAST32_WIDTH__=32", - "__INTMAX_TYPE__=long long int", - "__DEC128_MAX_EXP__=6145", - "__FLT32X_HAS_QUIET_NAN__=1", - "__ATOMIC_CONSUME=1", - "__GNUC_MINOR__=4", - "__INT_FAST16_WIDTH__=32", - "__UINTMAX_MAX__=0xffffffffffffffffULL", - "__DEC32_MANT_DIG__=7", - "__FLT32X_DENORM_MIN__=4.9406564584124654e-324F32x", - "__DBL_MAX_10_EXP__=308", - "__LDBL_DENORM_MIN__=4.9406564584124654e-324L", - "__INT16_C(c)=c", - "__cpp_generic_lambdas=201304", - "__STDC__=1", - "__FLT32X_DIG__=15", - "__PTRDIFF_TYPE__=int", - "__ATOMIC_SEQ_CST=5", - "__UINT32_TYPE__=unsigned int", - "__FLT32X_MIN_10_EXP__=(-307)", - "__UINTPTR_TYPE__=unsigned int", - "__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD", - "__DEC128_MANT_DIG__=34", - "__LDBL_MIN_10_EXP__=(-307)", - "__SIZEOF_LONG_LONG__=8", - "__cpp_user_defined_literals=200809", - "__GCC_ATOMIC_LLONG_LOCK_FREE=1", - "__FLT32X_MIN__=2.2250738585072014e-308F32x", - "__LDBL_DIG__=15", - "__FLT_DECIMAL_DIG__=9", - "__UINT_FAST16_MAX__=0xffffffffU", - "__GCC_ATOMIC_SHORT_LOCK_FREE=2", - "__INT_LEAST64_WIDTH__=64", - "__UINT_FAST8_TYPE__=unsigned int", - "__cpp_init_captures=201304", - "__ATOMIC_ACQ_REL=4", - "__ATOMIC_RELEASE=3", - "USBCON" - ] - } - ] -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/.vscode/settings.json b/Firmware/BentoFlowCreator/.vscode/settings.json deleted file mode 100644 index 91e005dc..00000000 --- a/Firmware/BentoFlowCreator/.vscode/settings.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "C_Cpp.intelliSenseEngineFallback": "Disabled", - "files.associations": { - "ios": "cpp", - "istream": "cpp", - "ostream": "cpp", - "xstring": "cpp", - "*.tcc": "cpp", - "fstream": "cpp", - "sstream": "cpp", - "list": "cpp", - "memory": "cpp", - "random": "cpp", - "xlocnum": "cpp", - "algorithm": "cpp", - "array": "cpp", - "atomic": "cpp", - "cctype": "cpp", - "chrono": "cpp", - "clocale": "cpp", - "cmath": "cpp", - "concepts": "cpp", - "condition_variable": "cpp", - "cstdarg": "cpp", - "cstddef": "cpp", - "cstdint": "cpp", - "cstdio": "cpp", - "cstdlib": "cpp", - "cstring": "cpp", - "ctime": "cpp", - "cwchar": "cpp", - "cwctype": "cpp", - "deque": "cpp", - "exception": "cpp", - "functional": "cpp", - "initializer_list": "cpp", - "iomanip": "cpp", - "iosfwd": "cpp", - "iostream": "cpp", - "iterator": "cpp", - "limits": "cpp", - "locale": "cpp", - "map": "cpp", - "mutex": "cpp", - "new": "cpp", - "numeric": "cpp", - "optional": "cpp", - "queue": "cpp", - "ratio": "cpp", - "set": "cpp", - "shared_mutex": "cpp", - "stdexcept": "cpp", - "streambuf": "cpp", - "string": "cpp", - "system_error": "cpp", - "thread": "cpp", - "tuple": "cpp", - "type_traits": "cpp", - "typeinfo": "cpp", - "unordered_map": "cpp", - "unordered_set": "cpp", - "utility": "cpp", - "vector": "cpp", - "xfacet": "cpp", - "xhash": "cpp", - "xiosbase": "cpp", - "xlocale": "cpp", - "xlocbuf": "cpp", - "xlocinfo": "cpp", - "xlocmes": "cpp", - "xlocmon": "cpp", - "xloctime": "cpp", - "xmemory": "cpp", - "xstddef": "cpp", - "xtr1common": "cpp", - "xtree": "cpp", - "xutility": "cpp", - "string_view": "cpp", - "cinttypes": "cpp", - "regex": "cpp", - "ranges": "cpp" - }, - "C_Cpp.errorSquiggles": "Disabled", - - "arduino.defaultBaudRate": 115200 -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/BentoFlowCreator.ino b/Firmware/BentoFlowCreator/BentoFlowCreator.ino deleted file mode 100644 index 087bf2f0..00000000 --- a/Firmware/BentoFlowCreator/BentoFlowCreator.ino +++ /dev/null @@ -1,14 +0,0 @@ - -#include "src/MainManager.h" -MainManager mainManager("1.2.4"); - -void setup() -{ - delay(50); // - mainManager.init(); -} - -void loop() -{ - mainManager.update(); -} diff --git a/Firmware/BentoFlowCreator/BentoFlowCreator.vcxproj b/Firmware/BentoFlowCreator/BentoFlowCreator.vcxproj deleted file mode 100644 index b6379903..00000000 --- a/Firmware/BentoFlowCreator/BentoFlowCreator.vcxproj +++ /dev/null @@ -1,163 +0,0 @@ - - - - - Release - Win32 - - - Debug - Win32 - - - - {C5F80730-F44F-4478-BDAE-6634EFC2CA88} - - - BentoFlowCreator - - - - Application - true - MultiByte - - - - - Application - false - true - MultiByte - - - - - Application - true - MultiByte - - - - - Application - false - true - MultiByte - - - - - - - - - - - - - - - - - - - - - - - - - Level3 - Disabled - true - true - true - $(ProjectDir)..\BentoFlowCreator;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire\src\utility;$(ProjectDir)..\..\..\..\..\Arduino\libraries\FastLED;C:\Program Files (x86)\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries;$(ProjectDir)..\..\..\..\..\Arduino\libraries;C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino;C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\yun;C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include;C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr;C:\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.8.1\include;C:\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.2\include;C:\Program Files (x86)\Arduino\hardware\tools\avr\lib\gcc\avr\4.9.3\include;%(AdditionalIncludeDirectories) - $(ProjectDir)__vm\.BentoFlowCreator.vsarduino.h;%(ForcedIncludeFiles) - false - __AVR_ATmega32u4__;__AVR_ATmega32U4__;F_CPU=16000000L;ARDUINO=10808;ARDUINO_AVR_YUN;ARDUINO_ARCH_AVR;USB_VID=0x2341;USB_PID=0x8041;__cplusplus=201103L;_VMICRO_INTELLISENSE;%(PreprocessorDefinitions) - - - true - true - true - - - - - Level3 - Disabled - true - %(AdditionalIncludeDirectories) - %(ForcedIncludeFiles) - true - %(PreprocessorDefinitions) - - - true - - - - - - - - CppCode - - - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - CppCode - - - - - VisualMicroDebugger - - - - - \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/BentoFlowCreator.vcxproj.filters b/Firmware/BentoFlowCreator/BentoFlowCreator.vcxproj.filters deleted file mode 100644 index 15296d08..00000000 --- a/Firmware/BentoFlowCreator/BentoFlowCreator.vcxproj.filters +++ /dev/null @@ -1,70 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/__vm/.BentoFlowCreator.vsarduino.h b/Firmware/BentoFlowCreator/__vm/.BentoFlowCreator.vsarduino.h deleted file mode 100644 index 81aa3950..00000000 --- a/Firmware/BentoFlowCreator/__vm/.BentoFlowCreator.vsarduino.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - Editor: https://www.visualmicro.com/ - visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten - the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project - all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!). - note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again - - Hardware: ESP32 Dev Module, Platform=esp32, Package=esp32 -*/ - -#if defined(_VMICRO_INTELLISENSE) - -#ifndef _VSARDUINO_H_ -#define _VSARDUINO_H_ -#define __ESP32_ESp32__ -#define __ESP32_ESP32__ -#define ESP_PLATFORM -#define HAVE_CONFIG_H -#define F_CPU 240000000L -#define ARDUINO 10808 -#define ARDUINO_ESP32_DEV -#define ARDUINO_ARCH_ESP32 -#define ESP32 -#define CORE_DEBUG_LEVEL 0 -#define __cplusplus 201103L -#undef __cplusplus -#define __cplusplus 201103L -#define __STDC__ -#define __ARM__ -#define __arm__ -#define __inline__ -#define __asm__(x) -#define __asm__ -#define __extension__ -#define __ATTR_PURE__ -#define __ATTR_CONST__ -#define __volatile__ - - -#define __ASM -#define __INLINE -#define __attribute__(noinline) - -//#define _STD_BEGIN -//#define EMIT -#define WARNING -#define _Lockit -#define __CLR_OR_THIS_CALL -#define C4005 -#define _NEW - -// -//typedef int uint8_t; -//#define __ARMCC_VERSION 400678 -//#define PROGMEM -//#define string_literal -// -//#define prog_void -//#define PGM_VOID_P int -// - -typedef int _read; -typedef int _seek; -typedef int _write; -typedef int _close; -typedef int __cleanup; - -//#define inline - -#define __builtin_clz -#define __builtin_clzl -#define __builtin_clzll -#define __builtin_labs -#define __builtin_va_list -typedef int __gnuc_va_list; - -#define __ATOMIC_ACQ_REL - -#define __CHAR_BIT__ -#define _EXFUN() - -typedef unsigned char byte; -extern "C" void __cxa_pure_virtual() {;} - - -typedef long __INTPTR_TYPE__ ; -typedef long __UINTPTR_TYPE__ ; -typedef long __SIZE_TYPE__ ; -typedef long __PTRDIFF_TYPE__; - - - - -#include -#include - -//#include "..\generic\Common.h" -//#include "..\generic\pins_arduino.h" - -//#undef F -//#define F(string_literal) ((const PROGMEM char *)(string_literal)) -//#undef PSTR -//#define PSTR(string_literal) ((const PROGMEM char *)(string_literal)) -//current vc++ does not understand this syntax so use older arduino example for intellisense -//todo:move to the new clang/gcc project types. -#define interrupts() sei() -#define noInterrupts() cli() - -#include "BentoFlowCreator.ino" -#endif -#endif diff --git a/Firmware/BentoFlowCreator/__vm/Compile.vmps.xml b/Firmware/BentoFlowCreator/__vm/Compile.vmps.xml deleted file mode 100644 index 356859f7..00000000 --- a/Firmware/BentoFlowCreator/__vm/Compile.vmps.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/__vm/Configuration.Release.vmps.xml b/Firmware/BentoFlowCreator/__vm/Configuration.Release.vmps.xml deleted file mode 100644 index fbfe4aae..00000000 --- a/Firmware/BentoFlowCreator/__vm/Configuration.Release.vmps.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/MainManager.cpp b/Firmware/BentoFlowCreator/src/MainManager.cpp deleted file mode 100644 index 10696d01..00000000 --- a/Firmware/BentoFlowCreator/src/MainManager.cpp +++ /dev/null @@ -1,528 +0,0 @@ -#include "MainManager.h" - -MainManager * MainManager::instance = nullptr; -MainManager::MainManager(String fwVersion) : Component("root"), - fwVersion(fwVersion), - initTimer(2000) -{ - instance = this; -} - -void MainManager::init() -{ - -#ifdef HAS_DISPLAY - display.init(); -#endif - -#ifdef GROUND_PIN_COUNT - for (int i = 0; i < GROUND_PIN_COUNT; i++) - { - pinMode(groundPins[i], OUTPUT); - digitalWrite(groundPins[i], LOW); - gpio_hold_en((gpio_num_t)groundPins[i]); - } - gpio_deep_sleep_hold_en(); -#endif - -#ifdef HIGH_PIN_COUNT - for (int i = 0; i < HIGH_PIN_COUNT; i++) - { - pinMode(highPins[i], OUTPUT); - digitalWrite(highPins[i], HIGH); - gpio_hold_en((gpio_num_t)highPins[i]); - } - gpio_deep_sleep_hold_en(); -#endif - - - - ((EventBroadcaster *)&comm)->addListener(std::bind(&MainManager::communicationEvent, this, std::placeholders::_1)); - ((EventBroadcaster *)&comm)->addListener(std::bind(&MainManager::connectionEvent, this, std::placeholders::_1)); - comm.init(); - - leds.init(); - -#ifdef SLEEP_PIN -#ifdef KEEP_SLEEP_PIN_HIGH - pinMode(SLEEP_PIN, OUTPUT); - digitalWrite(SLEEP_PIN, HIGH); -#endif -#endif - - battery.init(); - battery.addListener(std::bind(&MainManager::batteryEvent, this, std::placeholders::_1)); - - buttons.init(); - buttons.addListener(std::bind(&MainManager::buttonEvent, this, std::placeholders::_1)); - - touch.init(); - touch.addListener(std::bind(&MainManager::touchEvent, this, std::placeholders::_1)); - - pwm.init(); - - imu.addListener(std::bind(&MainManager::imuEvent, this, std::placeholders::_1)); - - leds.rgbManager.addListener(std::bind(&MainManager::rgbLedsEvent, this, std::placeholders::_1)); - - cap.init(); - cap.addListener(std::bind(&MainManager::capacitiveEvent, this, std::placeholders::_1)); - - files.addListener(std::bind(&MainManager::fileEvent, this, std::placeholders::_1)); - - scripts.init(); - - initTimer.addListener(std::bind(&MainManager::timerEvent, this, std::placeholders::_1)); - - NDBG("Board is "+String(ARDUINO_BOARD)); -} - -void MainManager::update() -{ - initTimer.update(); - - files.update(); - - if (files.isUploading) - return; - - comm.update(); - - imu.update(); - - buttons.update(); - battery.update(); - touch.update(); - cap.update(); - - //tmp call this from ledmanager - //scripts.update(); - - pwm.update(); - -// TSTART() - leds.update(); -// TFINISH("Leds") - -#ifdef POWEROFF_IF_NOTCONNECTED - if (comm.wifiManager.state == ConnectionState::ConnectionError) - { - if (!battery.isCharging) - { - NDBG("Not connected and battery not charging, poweroff"); - - sleep(CRGB::Yellow); - } - } -#endif -} - -void touchCallback() {} - -void MainManager::sleep(CRGB color) -{ - NDBG("Sleep now ! "); - imu.shutdown(); - - comm.sendMessage(name, "sleep", nullptr, 0); - leds.shutdown(color); // to replace with battery color - pwm.shutdown(); - - delay(500); - -#ifdef SLEEP_PIN - pinMode(SLEEP_PIN, OUTPUT); - -#ifdef INFINITE_LOOP_ON_SLEEP - while (true) - digitalWrite(SLEEP_PIN, SLEEP_PIN_SLEEP_VAL); -#else - digitalWrite(SLEEP_PIN, SLEEP_PIN_SLEEP_VAL); -#endif // INFINITE LOOP - -#endif // SLEEP_PIN - -#ifdef SLEEP_WAKEUP_BUTTON - esp_sleep_enable_ext0_wakeup(SLEEP_WAKEUP_BUTTON, SLEEP_WAKEUP_STATE); -#else -#if defined TOUCH_WAKEUP_PIN - // Configure Touchpad as wakeup source - touchAttachInterrupt(TOUCH_WAKEUP_PIN, touchCallback, 110); - esp_sleep_enable_touchpad_wakeup(); -#endif -#endif - -#ifdef ESP8266 - ESP.deepSleep(5e6); -#else - esp_deep_sleep_start(); -#endif -} - -void MainManager::connectionEvent(const ConnectionEvent &e) -{ - - - - NDBG("Connection Event : " + connectionStateNames[e.type] + (e.type == Connected ? "(" + comm.wifiManager.getIP() + ")" : "")); - - if(!leds.playerMode.isPlaying) { - leds.setConnectionState(e.type); - } - - if (e.source == "wifi") - { - if (e.type == Connected || e.type == Hotspot) - { - NDBG("Connected with IP " + comm.wifiManager.getIP()); - comm.oscManager.setEnabled(true); - } - else - { - comm.oscManager.setEnabled(false); - } - - if (e.type == Connected || e.type == ConnectionError || e.type == Disabled || e.type == Hotspot) - { - initTimer.start(); - } - } -} - -void MainManager::communicationEvent(const CommunicationEvent &e) -{ - Component *c = Component::getComponentForName(e.target); - - if (c != nullptr) - { - bool result = c->handleCommand(e.command, e.data, e.numData); - if (!result) - NDBG("Command not handled : " + e.target + "." + e.command); - } - else - { - NDBG("Target not found : " + e.target); - } -} - -void MainManager::batteryEvent(const BatteryEvent &e) -{ - var data[1]; - data[0].type = 'f'; - data[0].value.f = e.value; - comm.sendMessage(battery.name, BatteryEvent::eventNames[(int)e.type], data, 1); - - if (e.type == BatteryEvent::CriticalLevel) - { - NDBG("Critical battery level detected => sleeping"); - sleep(CRGB::Red); - } -} - -void MainManager::buttonEvent(const ButtonEvent &e) -{ - int numBTData = (e.type == ButtonEvent::MultiPress || e.type == ButtonEvent::Pressed) ? 2 : 1; - var *data = (var *)malloc((numBTData) * sizeof(var)); - - data[0].value.i = e.id; - data[0].type = 'i'; - - if (numBTData > 1) - { - data[1].value.i = e.value; - data[1].type = 'i'; - } - - comm.sendMessage(buttons.name, ButtonEvent::eventNames[(int)e.type], data, numBTData); - - switch (e.type) - { - case ButtonEvent::Pressed: - if (e.value == 1) - { - if (comm.wifiManager.state == Connecting) - comm.wifiManager.disable(); - } - NDBG("Button " + String(e.id) + " " + String(e.value)); - break; - - case ButtonEvent::VeryLongPress: - { - NDBG("Very long press detected: sleeping"); - -#ifndef NO_SLEEP_BUTTON -#ifdef SLEEP_BUTTON_ID - int sleepBTID = SLEEP_BUTTON_ID; -#else - int sleepBTID = 0; -#endif - - if (e.id == sleepBTID) - sleep(); // only first button can sleep -#endif - } - - case ButtonEvent::MultiPress: - if (comm.wifiManager.state == Disabled || comm.wifiManager.state == ConnectionError) - { - if (e.value == 2) - { - leds.playerMode.stop(); - } - else if (e.value >= 3) - { - leds.playerMode.load("demo" + String(e.value - 3)); - leds.playerMode.loopShow = true; - leds.playerMode.play(); - } - } - break; - } -} - -void MainManager::touchEvent(const TouchEvent &e) -{ - int numBTData = (e.type == TouchEvent::MultiPress || e.type == TouchEvent::Pressed) ? 2 : 1; - var *data = (var *)malloc((numBTData) * sizeof(var)); - - data[0].value.i = e.id; - data[0].type = 'i'; - - if (numBTData > 1) - { - data[1].value.i = e.value; - data[1].type = 'i'; - } - - comm.sendMessage(touch.name, TouchEvent::eventNames[(int)e.type], data, numBTData); - - switch (e.type) - { - case TouchEvent::Pressed: - if (e.value == 1) - { - if (comm.wifiManager.state == Connecting) - comm.wifiManager.disable(); - } - NDBG("Touch " + String(e.id) + " " + String(e.value)); - break; - - case TouchEvent::VeryLongPress: - { - -#ifndef NO_SLEEP_TOUCH -#ifdef SLEEP_TOUCH_ID - int sleepBTID = SLEEP_BUTTON_ID; -#else - int sleepBTID = 0; -#endif - - if (e.id == sleepBTID) - sleep(); // only first button can sleep -#endif - } - - case TouchEvent::MultiPress: - if (comm.wifiManager.state == Disabled || comm.wifiManager.state == ConnectionError) - { - if (e.value == 2) - { - leds.playerMode.stop(); - } - else if (e.value >= 3) - { - leds.playerMode.load("demo" + String(e.value - 3)); - leds.playerMode.loopShow = true; - leds.playerMode.play(); - } - } - break; - } -} - -void MainManager::imuEvent(const IMUEvent &e) -{ - switch (e.type) - { - case IMUEvent::OrientationUpdate: - case IMUEvent::LinearAccelUpdate: - case IMUEvent::AccelUpdate: - case IMUEvent::GyroUpdate: - case IMUEvent::Gravity: - case IMUEvent::CalibrationStatus: - { - var data[3]; - for (int i = 0; i < e.numData; i++) - { - data[i].type = 'f'; - data[i].value.f = e.data[i]; - } - - comm.sendMessage(imu.name, IMUEvent::eventNames[(int)e.type], data, 3); - } - break; - - case IMUEvent::ActivityUpdate: - { - var data[1]; - data[0].type = 'f'; - data[0].value.f = imu.activity; - comm.sendMessage(imu.name, IMUEvent::eventNames[(int)e.type], data, 1); - } - break; - - - case IMUEvent::ProjectedAngleUpdate: - { - var data[1]; - data[0].type = 'f'; - data[0].value.f = imu.projectedAngle; - comm.sendMessage(imu.name, IMUEvent::eventNames[(int)e.type], data, 1); - } - break; - - case IMUEvent::SpinUpdate: - { - var data[1]; - data[0].type = 'f'; - data[0].value.f = imu.spin; - comm.sendMessage(imu.name, IMUEvent::eventNames[(int)e.type], data, 1); - } - break; - - case IMUEvent::ThrowState: - { - var data[1]; - data[0].type = 'i'; - data[0].value.i = imu.throwState; - comm.sendMessage(imu.name, IMUEvent::eventNames[(int)e.type], data, 1); - } - break; - - case IMUEvent::Debug: - { - var data[4]; - for (int i = 0; i < e.numData; i++) - { - data[i].type = 'f'; - data[i].value.f = e.data[i]; - } - - comm.sendMessage(imu.name, IMUEvent::eventNames[(int)e.type], data, 4); - } - break; - } -} - -void MainManager::capacitiveEvent(const CapacitiveEvent &e) -{ -#ifdef CAPACITIVE_COUNT - switch (e.type) - { - case CapacitiveEvent::ValuesUpdate: - { - var data[CAPACITIVE_COUNT]; - for (int i = 0; i < e.numData; i++) - { - data[i].type = 'f'; - data[i].value.f = e.data[i]; - } - - comm.sendMessage(cap.name, CapacitiveEvent::eventNames[(int)e.type], data, CAPACITIVE_COUNT); - } - break; - - case CapacitiveEvent::TouchUpdate: - { - var data[2]; - data[0].type = 'i'; - data[0].value.i = e.index; - data[1].type = 'i'; - data[1].value.i = (int)e.value; - - comm.sendMessage(cap.name, CapacitiveEvent::eventNames[(int)e.type], data, 2); - } - break; - } -#endif -} - -void MainManager::rgbLedsEvent(const RGBLedsEvent &e) -{ - switch (e.type) - { - case RGBLedsEvent::BrightnessStatus: - { - var data[1]; - for (int i = 0; i < e.numData; i++) - { - data[i].type = 'f'; - data[i].value.f = e.data[i]; - } - - comm.sendMessage(leds.rgbManager.name, RGBLedsEvent::eventNames[(int)e.type], data, 1); - } - break; - - } -} - -void MainManager::fileEvent(const FileEvent &e) -{ -#ifdef HAS_FILES - if (e.type == FileEvent::UploadStart) - { -#ifdef LED_COUNT - leds.setMode(LedManager::System); - leds.sysLedMode.uploadFeedback = true; -#endif - comm.oscManager.setEnabled(false); - } - else if (e.type == FileEvent::UploadProgress) - { -#ifdef LED_COUNT - leds.sysLedMode.showUploadProgress(e.data.floatValue()); -#endif - } - else if (e.type == FileEvent::UploadComplete) - { -#ifdef LED_COUNT - leds.sysLedMode.uploadFeedback = false; - leds.setMode(LedManager::Stream); -#endif - comm.oscManager.setEnabled(true); - } - else if (e.type == FileEvent::FileList) - { - var data[1]; - data[0].type = 's'; - data[0].value.s = e.data.value.s; - - comm.sendMessage(files.name, FileEvent::eventNames[(int)e.type], data, 1); - NDBG("FileList Event in Main Manager"); - } -#endif -} - -void MainManager::timerEvent(const TimerEvent &e) -{ - NDBG("Timer Event, init fileSystem and IMU"); - files.init(); - imu.init(); -} - -bool MainManager::handleCommand(String command, var *data, int numData) -{ - if (checkCommand(command, "sleep", numData, 0)) - { - sleep(); - return true; - } - else if (checkCommand(command, "restart", numData, 0)) - { - ESP.restart(); - return true; - } - - return false; -} diff --git a/Firmware/BentoFlowCreator/src/MainManager.h b/Firmware/BentoFlowCreator/src/MainManager.h deleted file mode 100644 index 0d4481fa..00000000 --- a/Firmware/BentoFlowCreator/src/MainManager.h +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include - -#include "communication/CommunicationManager.h" -#include "leds/LedManager.h" -#include "files/FileManager.h" -#include "sensors/battery/BatteryManager.h" -#include "sensors/button/ButtonManager.h" -#include "sensors/touch/TouchManager.h" -#include "sensors/imu/IMUManager.h" -#include "sensors/capacitive/CapacitiveManager.h" -#include "pwm/PWMManager.h" -#include "scripts/ScriptManager.h" - -class MainManager : public Component { -public: - MainManager(String fwVersion); - ~MainManager() {} - - static MainManager * instance; - - long tstart; - long tend; - - String hardwareID; - String fwVersion; - -#ifdef HAS_DISPLAY - DisplayManager display; -#endif - - CommunicationManager comm; - LedManager leds; - PWMManager pwm; - FileManager files; - - BatteryManager battery; - ButtonManager buttons; - TouchManager touch; - IMUManager imu; - CapacitiveManager cap; - ScriptManager scripts; - - Timer initTimer; //to init blocking stuff after connection - - void init(); - void update(); - - void sleep(CRGB color = CRGB::Cyan); - - void connectionEvent(const ConnectionEvent &e); - void communicationEvent(const CommunicationEvent &e); - - void batteryEvent(const BatteryEvent &e); - void buttonEvent(const ButtonEvent &e); - void touchEvent(const TouchEvent &e); - void imuEvent(const IMUEvent &e); - void capacitiveEvent(const CapacitiveEvent &e); - void rgbLedsEvent(const RGBLedsEvent &e); - - void fileEvent(const FileEvent &e); - void timerEvent(const TimerEvent &e); - - bool handleCommand(String command, var *data, int numData) override; - }; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/Common.cpp b/Firmware/BentoFlowCreator/src/common/Common.cpp deleted file mode 100644 index f929208a..00000000 --- a/Firmware/BentoFlowCreator/src/common/Common.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "Common.h" - -#ifdef ESP32 -#include -#elif defined ESP8266 -#include -#endif - -String getDeviceID() -{ - byte mac[6]; - WiFi.macAddress(mac); - - String result = ""; - for(int i=0;i<6;i++) - { - result += (i > 0?":":"") + String(mac[i], HEX); - } - - result.toUpperCase(); - return result; - - //uint64_t did = ESP.getEfuseMac(); - //return String((uint32_t)(did >> 32)) + String((uint32_t)(did & 0xffffffff)); -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/Common.h b/Firmware/BentoFlowCreator/src/common/Common.h deleted file mode 100644 index da8caca9..00000000 --- a/Firmware/BentoFlowCreator/src/common/Common.h +++ /dev/null @@ -1,31 +0,0 @@ -//This file includes all common classes and definitions so it's the only one to include from other files - -#pragma once -#ifndef COMMON_H -#define COMMON_H - -#include "config/Config.h" - -#include "Component.h" -#include "events/EventBroadcaster.h" - -#ifdef ESP32 -#define USE_PREFERENCES -#include -#elif defined ESP8266 -#define USE_SETTINGS_MANAGER -#include "settings/SettingsManager.h" -#endif - -#include "Timer.h" - -#define TSTART() { tstart = micros(); } -#define TFINISH(s) { tend = micros(); Serial.print(s " in "); Serial.print(tend-tstart); Serial.println(" us"); } - - -enum ConnectionState { Off, Connecting, Connected, ConnectionError, Disabled, Hotspot, PingAlive, PingDead, CONNECTION_STATES_MAX }; -const String connectionStateNames[CONNECTION_STATES_MAX] {"Off", "Connecting", "Connected", "ConnectionError", "Disabled", "Hotspot", "PingAlive","PingDead" }; - -String getDeviceID(); - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/Component.cpp b/Firmware/BentoFlowCreator/src/common/Component.cpp deleted file mode 100644 index f5d6cf50..00000000 --- a/Firmware/BentoFlowCreator/src/common/Component.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "Component.h" -int Component::numRegisteredComponents = 0; -Component *Component::registeredComponents[64]; - -Component::Component(const String &name) : name(name) -{ - registeredComponents[numRegisteredComponents++] = this; -} - -Component *Component::getComponentForName(String _name) -{ - for (int i = 0; i < numRegisteredComponents; i++) - if (registeredComponents[i]->name == _name) - return registeredComponents[i]; - - return nullptr; -}; - -bool Component::checkCommand(const String &command, const String &checkCommand, int numData, int expected) -{ - if(command != checkCommand) return false; - if(numData >= expected) return true; - NDBG(command+" expects "+expected+" arguments, "+numData+" given"); - return false; -} diff --git a/Firmware/BentoFlowCreator/src/common/Component.h b/Firmware/BentoFlowCreator/src/common/Component.h deleted file mode 100644 index c40444d3..00000000 --- a/Firmware/BentoFlowCreator/src/common/Component.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once - -#include -#include "DebugHelpers.h" - -struct var -{ - char type; - union - { - int i; - float f; - char * s; - } value; - - int intValue() const - { - switch (type) - { - case 'i': - return value.i; - case 'f': - return (int)value.f; - case 's': - return String(value.s).toInt(); - } - return 0; - } - - float floatValue() const - { - switch (type) - { - case 'i': - return (float)value.i; - case 'f': - return value.f; - case 's': - return String(value.s).toFloat(); - } - - return 0; - } - - String stringValue() const - { - switch (type) - { - case 'i': - return String(value.i); - case 'f': - return String(value.f); - case 's': - return value.s; - } - return ""; - } -}; - -class Component -{ -public: - Component(const String &name); - virtual ~Component() {} - - String name; - - static Component * registeredComponents[64]; - static int numRegisteredComponents; - static Component * getComponentForName(String _name); - - virtual bool handleCommand(String command, var * data, int numData) { return false; } - bool checkCommand(const String &command, const String &checkCommand, int numData, int expected); -}; diff --git a/Firmware/BentoFlowCreator/src/common/DebugHelpers.h b/Firmware/BentoFlowCreator/src/common/DebugHelpers.h deleted file mode 100644 index 1efb3a20..00000000 --- a/Firmware/BentoFlowCreator/src/common/DebugHelpers.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#define SERIAL_DEBUG 1 - -#if SERIAL_DEBUG -#define DBG(msg) Serial.println(msg) -#define NDBG(msg) Serial.println("["+name+"] "+msg) -#else -#define DBG(msg) -#define NDBG(msg) -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/Timer.h b/Firmware/BentoFlowCreator/src/common/Timer.h deleted file mode 100644 index 86452267..00000000 --- a/Firmware/BentoFlowCreator/src/common/Timer.h +++ /dev/null @@ -1,42 +0,0 @@ -#include "events/EventBroadcaster.h" - -class Timer; -class TimerEvent -{ -public: - TimerEvent(Timer * timer) : timer(timer) {} - Timer * timer; -}; - -class Timer : public EventBroadcaster { -public: - Timer(long time) : isRunning(false), timeAtStart(0), time(time) - {} - - ~Timer() {} - - bool isRunning; - long timeAtStart; - long time; - - void start() - { - timeAtStart = millis(); - isRunning = true; - } - - void stop() - { - isRunning = false; - } - - void update() - { - if(!isRunning) return; - if(millis() > timeAtStart + time) - { - isRunning = false; - sendEvent(TimerEvent(this)); - } - } -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/Config.h b/Firmware/BentoFlowCreator/src/common/config/Config.h deleted file mode 100644 index eadb70b7..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/Config.h +++ /dev/null @@ -1,96 +0,0 @@ -#pragma once - -#ifndef CONFIG_H -#define CONFIG_H - -// #define CREATOR_PROTO_V0 -// #define CREATOR_PROTO_V1 - #define CREATOR_PROTO_V2 -// #define CREATOR_TAB_HOOP -// #define LT_BALL -// #define LT_HOOP -// #define CLARINET -// #define SAX -// #define GUITAR -// #define GLOVE -// #define GENERIC_PWM -// #define DMX -// #define DRESS -// #define FLAIR -// #define SIMPLE_ESP8266 -// #define SIMPLE_ESP32 -// #define RING -// #define SUPERSTAFF -// #define LAMP -// #define ASPI -// #define POWERLED -// #define BIKE - -//#define CYRWHEEL - - -//#define BOX -//#define MAKEY - -#if defined CREATOR_PROTO_V0 -#include "config_protov0.h" -#elif defined CREATOR_PROTO_V1 -#include "config_protov1.h" -#elif defined CREATOR_PROTO_V2 -#include "config_protov2.h" -#elif defined CREATOR_TAB_HOOP -#include "config_tab_hoop.h" -#elif defined LT_HOOP -#include "config_lthoop.h" -#elif defined LT_BALL -#include "config_ltball.h" -#elif defined CLARINET -#include "config_clarinet.h" -#elif defined SAX -#include "config_sax.h" -#elif defined GUITAR -#include "config_guitar.h" -#elif defined BOX -#include "config_box.h" -#elif defined MAKEY -#include "config_makey.h" -#elif defined GLOVE -#include "config_glove.h" -#elif defined GENERIC_PWM -#include "config_genericpwm.h" -#elif defined DMX -#include "config_dmx.h" -#elif defined DRESS -#include "config_dress.h" -#elif defined FLAIR -#include "config_flair.h" -#elif defined SIMPLE_ESP8266 -#include "config_simpleESP8266.h" -#elif defined RING -#include "config_ring.h" -#elif defined SUPERSTAFF -#include "config_tab_superstaff.h" -#elif defined POWERLED -#include "config_tab_powerled.h" -#elif defined CYRWHEEL -#include "config_tab_cyrwheel.h" -#elif defined LAMP -#include "config_lamp.h" -#elif defined ASPI -#include "config_aspi.h" -#elif defined BIKE -#include "config_bike.h" -#elif defined SIMPLE_ESP32 -#include "config_simpleESP32.h" -#endif - -#ifdef LED_INVERT_DIRECTION - #define LEDMAP(index) (LED_COUNT-1-index) -#elif !defined LEDMAP - #define LEDMAP(index) index -#endif - -//#pragma message("Compiling for " __DEVICE_TYPE__) - - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_LauryTab1.h b/Firmware/BentoFlowCreator/src/common/config/config_LauryTab1.h deleted file mode 100644 index d9006665..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_LauryTab1.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "SimpleESP32" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 32 -#define LED_DATA_PIN 26 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 200 -#define LED_DEFAULT_BRIGHTNESS .5 -//#define LED_USE_FET -//#define LED_FET_PIN 33 - -//SLEEP -#define BUTTON_INVERTED -//#define SLEEP_WAKEUP_BUTTON GPIO_NUM_4 -//#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_COUNT 0 -#define BUTTON_INPUT_MODE INPUT_PULLUP -//const int buttonPins[BUTTON_COUNT]{ 37, 39 }; - -/* -#define TOUCH_COUNT 2 -const int touchPins[TOUCH_COUNT]{37, 39}; -#define TOUCH_WAKEUP_PIN T0 //TOUCH_PAD_NUM0 //touch pad 0 is pin 4 -*/ - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -//#define GROUND_PIN_COUNT 2 -//const int groundPins[GROUND_PIN_COUNT]{13}; - -//battery -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_aspi.cpp b/Firmware/BentoFlowCreator/src/common/config/config_aspi.cpp deleted file mode 100644 index cc1cc0db..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_aspi.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "config_aspi.h" -#include -#include "../DebugHelpers.h" - -int ledIndexMap[LED_COUNT]; - -void generateLedIndexMap() -{ - for(int i=0;i "+String(ledIndexMap[i])); - } -} - -int getLedAtIndex(int index) -{ - return ledIndexMap[index]; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_aspi.h b/Firmware/BentoFlowCreator/src/common/config/config_aspi.h deleted file mode 100644 index c8c98afa..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_aspi.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Aspi" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 104 -#define LED_DATA_PIN 26 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 200 -#define LED_DEFAULT_BRIGHTNESS .5 -//#define LED_USE_FET -//#define LED_FET_PIN 33 - - -#define GENERATE_LED_INDEX_MAP -#define STRIP_LED_COUNT 26 -#define NUM_STRIPS 4 - - -void generateLedIndexMap(); -int getLedAtIndex(int index); - -#define LEDMAP(index) getLedAtIndex(index) - -//SLEEP -#define BUTTON_INVERTED -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_39 -#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_COUNT 2 -#define BUTTON_INPUT_MODE INPUT_PULLUP -const int buttonPins[BUTTON_COUNT]{ 39, 37 }; - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_bike.h b/Firmware/BentoFlowCreator/src/common/config/config_bike.h deleted file mode 100644 index ae079617..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_bike.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Bike" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 122 -#define LED_DATA_PIN 15 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 200 -#define LED_DEFAULT_BRIGHTNESS .5 -//#define LED_USE_FET -//#define LED_FET_PIN 33 - -//SLEEP -//#define BUTTON_INVERTED -//#define SLEEP_WAKEUP_BUTTON GPIO_NUM_4 -//#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_COUNT 0 -#define BUTTON_INPUT_MODE INPUT_PULLUP -//const int buttonPins[BUTTON_COUNT]{ 4, 14 }; - -//#define TOUCH_COUNT 1 -//const int touchPins[TOUCH_COUNT]{4}; -//#define TOUCH_WAKEUP_PIN T0 //TOUCH_PAD_NUM0 //touch pad 0 is pin 4 - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -//#define GROUND_PIN_COUNT 2 -//const int groundPins[GROUND_PIN_COUNT]{13}; - - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_box.h b/Firmware/BentoFlowCreator/src/common/config/config_box.h deleted file mode 100644 index 80d00f33..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_box.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Box" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 2 -#define LED_SEPARATE_CHANNELS 1 -#define LED_PWM_FREQUENCY 5000 -#define LED_PWM_RESOLUTION 10 -//#define PWMVAL(i) map(i, 0, 255, 0, 1023) - -//SLEEP -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_26 -#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_INVERTED -#define BUTTON_INPUT_MODE INPUT_PULLUP - - -#define BUTTON_COUNT 2 -#define BUTTON_INPUT_MODE INPUT_PULLUP -const int buttonPins[BUTTON_COUNT]{ 26, 32 }; - -#define GROUND_PIN_COUNT 1 -const int groundPins[GROUND_PIN_COUNT] { 15 }; - -#define HIGH_PIN_COUNT 1 -const int highPins[HIGH_PIN_COUNT] { 13 }; - -//apparently helps having stable fastLED with TinyPICO and WS2812C -//#define FASTLED_FORCE_LOOPDELAY -struct RGBLedPins -{ - int rPin; - int gPin; - int bPin; -}; - -const RGBLedPins rgbLedPins[LED_COUNT] -{ - {25, -1, -1}, - {14, -1, -1}, -}; - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_clarinet.h b/Firmware/BentoFlowCreator/src/common/config/config_clarinet.h deleted file mode 100644 index 0e4882a9..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_clarinet.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Clarinet" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 75 -#define LED_DATA_PIN 15 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 150 -#define LED_DEFAULT_BRIGHTNESS .3 -#define LED_USE_FET -#define LED_FET_PIN 33 - - -//battery -#define BATTERY_CHARGE_PIN 34 -#define BATTERY_PIN 35 -#define BATTERY_DEFAULT_MIN 880 -#define BATTERY_DEFAULT_MAX 1100 - -//SLEEP -#define BUTTON_INVERTED -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_4 -#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_COUNT 2 -#define BUTTON_INPUT_MODE INPUT_PULLUP -const int buttonPins[BUTTON_COUNT]{ 4, 14 }; - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_dmx.h b/Firmware/BentoFlowCreator/src/common/config/config_dmx.h deleted file mode 100644 index 3ebe170f..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_dmx.h +++ /dev/null @@ -1,16 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "DMX" - -//#define ESP8266 -#define ESP32 - -#define BUTTON_COUNT 0 - -// main leds config -#define LED_COUNT 1 -#define LED_USE_DMX -const int dmxStartChannels[LED_COUNT] {1}; - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_dress.h b/Firmware/BentoFlowCreator/src/common/config/config_dress.h deleted file mode 100644 index d293bf8c..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_dress.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Dress" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 1860 -#define LED_NUM_STRIPS 5 - -#define LED_PIN1 12 //purple -#define LED_PIN2 32 //blue -#define LED_PIN3 19 //green -#define LED_PIN4 27 //grey -#define LED_PIN5 33 //white - -#define LED_COUNT1 119 //shoulderLeft -#define LED_COUNT2 119 //shoulderRight -#define LED_COUNT3 328 //crown -#define LED_COUNT4 742 //body back > front -#define LED_COUNT5 552 //skirt - -#define LED_START1 0 -#define LED_START2 LED_START1 + LED_COUNT1 -#define LED_START3 LED_START2 + LED_COUNT2 -#define LED_START4 LED_START3 + LED_COUNT3 -#define LED_START5 LED_START4 + LED_COUNT4 -#define LED_START6 LED_START5 + LED_COUNT5 - -#define LED_COLOR_ORDER GRB -#define LED_TYPE WS2812B - -#define BUTTON_COUNT 0 - -#define HAS_FILES -#define SDSPEED 10000000 -#define SD_MISO 21 -#define SD_MOSI 13 -#define SD_SCK 14 -#define SD_CS 15 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_flair.h b/Firmware/BentoFlowCreator/src/common/config/config_flair.h deleted file mode 100644 index 3ad8a93c..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_flair.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Flair" -#ifndef ESP8266 -#define ESP8266 -#endif - -// main leds config -#define LED_COUNT 18 -#define LED_DATA_PIN 13 -//#define LED_CLK_PIN 14 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER BGR - -//main power -//#define SLEEP_WAKEUP_BUTTON GPIO_NUM_13 -//#define SLEEP_WAKEUP_STATE HIGH - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 4 }; diff --git a/Firmware/BentoFlowCreator/src/common/config/config_genericpwm.h b/Firmware/BentoFlowCreator/src/common/config/config_genericpwm.h deleted file mode 100644 index 31084193..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_genericpwm.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Generic PWM" -#define ESP8266 - -#define BUTTON_COUNT 0 - -// main leds config -#define LED_COUNT 2 -#define LED_SEPARATE_CHANNELS 1 -#define PWMVAL(i) map(i, 0, 255, 1023, 0) -#define NO_ANIMATIONS - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -struct RGBLedPins -{ - int rPin; - int gPin; - int bPin; -}; - -const RGBLedPins rgbLedPins[LED_COUNT] -{ - {5,2,4}, - {14,12,13}, -}; - diff --git a/Firmware/BentoFlowCreator/src/common/config/config_glove.h b/Firmware/BentoFlowCreator/src/common/config/config_glove.h deleted file mode 100644 index cdf5c12d..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_glove.h +++ /dev/null @@ -1,31 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Glove" -#define ESP32 - -#define BUTTON_COUNT 6 -#define BUTTON_INPUT_MODE INPUT_PULLUP -#define BUTTON_REF_PULLDOWN 13 -const int buttonPins[BUTTON_COUNT]{ 23, 2, 12,21,27,14}; //4 last buttons are glove, 26 is palm but not working right now - -#define BUTTON_INVERTED -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_2 -#define SLEEP_WAKEUP_STATE LOW - -#define HAS_IMU -//#define I2C_CLOCK 10000 // not sure what this is for. -#define SDA_PIN 4 // i2c lines -#define SCL_PIN 15 // i2c lines -#define IMU_REMAP_CONFIG Adafruit_BNO055::REMAP_CONFIG_P2 -#define IMU_REMAP_SIGN Adafruit_BNO055::REMAP_SIGN_P2 - -#define INT_PIN 0 // the interupt pin for the IMU MPU prosessor. -#define IMU_RESET 0 // toggl this pin to reset the IMU before connectiong to it after a reset. -#define BNO055_SAMPLERATE_DELAY_MS (100) - -#define HAS_DISPLAY -#define DISPLAY_LINES 4 -#define DISPLAY_SDA 4 -#define DISPLAY_SCL 15 -#define DISPLAY_RESET 16 -#define DISPLAY_REFRESH_RATE 20 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_guitar.h b/Firmware/BentoFlowCreator/src/common/config/config_guitar.h deleted file mode 100644 index 88ea610d..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_guitar.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Guitar" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 324 -#define LED_DATA_PIN 15 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 150 -#define LED_DEFAULT_BRIGHTNESS .3 -#define LED_USE_FET -#define LED_FET_PIN 33 - -//battery -/*#define BATTERY_CHARGE_PIN 34 -#define BATTERY_PIN 35 -#define BATTERY_DEFAULT_MIN 880 -#define BATTERY_DEFAULT_MAX 1100 -*/ - -//SLEEP -#define BUTTON_INVERTED -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_4 -#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_COUNT 2 -#define BUTTON_INPUT_MODE INPUT_PULLUP -const int buttonPins[BUTTON_COUNT]{ 14, 4 }; - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_lamp.cpp b/Firmware/BentoFlowCreator/src/common/config/config_lamp.cpp deleted file mode 100644 index 1712cf51..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_lamp.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "Config.h" -#ifdef LAMP -#include - - -int getBatteryRawValue() -{ - analogRead(BATTERY_PIN); // Just to get the ADC setup - return adc1_get_raw(BATT_CHANNEL); -} - -float getBatteryVoltage(int raw) -{ - esp_adc_cal_characteristics_t chars; - - // Get ADC calibration values - esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_11db, ADC_WIDTH_BIT_12, DEFAULT_VREF, &chars); - - // Convert to calibrated mv then volts - uint32_t mv = esp_adc_cal_raw_to_voltage(raw, &chars) * (LOWER_DIVIDER + UPPER_DIVIDER) / LOWER_DIVIDER; - return (float)mv / 1000.0; -} - -bool isChargingBattery() -{ - int measuredVal = 0; - for (int i = 0; i < 10; i++) - { - int v = digitalRead(BATTERY_CHARGE_PIN); - measuredVal += v; - } - - return (measuredVal == 0); -} - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_lamp.h b/Firmware/BentoFlowCreator/src/common/config/config_lamp.h deleted file mode 100644 index 986845b1..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_lamp.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Lamp" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 30 -#define LED_DATA_PIN 15 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 200 -#define LED_DEFAULT_BRIGHTNESS .5 -#define LED_USE_FET -#define LED_FET_PIN 33 - -//SLEEP -#define BUTTON_INVERTED -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_4 -#define SLEEP_WAKEUP_STATE LOW - -// button pin - #define BUTTON_COUNT 1 - #define BUTTON_INPUT_MODE INPUT_PULLUP - const int buttonPins[BUTTON_COUNT]{ 4 }; - -//#define TOUCH_COUNT 1 -//const int touchPins[TOUCH_COUNT]{4}; -//#define TOUCH_WAKEUP_PIN T0 //TOUCH_PAD_NUM0 //touch pad 0 is pin 4 - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -#define GROUND_PIN_COUNT 1 -const int groundPins[GROUND_PIN_COUNT]{ 14 }; - -//TinyPICO code - -// Battery divider resistor values -#define UPPER_DIVIDER 442 -#define LOWER_DIVIDER 160 -#define DEFAULT_VREF 1100 // Default reference voltage in mv -#define BATT_CHANNEL ADC1_CHANNEL_7 // Battery voltage ADC input - -//battery -#define BATTERY_CHARGE_PIN 34 -#define BATTERY_PIN 35 -#define BATTERY_VOLTAGE_MIN 3.5f -#define BATTERY_VOLTAGE_MAX 4.2f - -#define CUSTOM_BATTERY_READ - -#include "driver/adc.h" -#include "esp_adc_cal.h" - -int getBatteryRawValue(); -float getBatteryVoltage(int raw); - -bool isChargingBattery(); - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_ltball.h b/Firmware/BentoFlowCreator/src/common/config/config_ltball.h deleted file mode 100644 index 852a4c7e..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_ltball.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Lightrix Ball" -#define ESP8266 - -// main leds config -#define LED_COUNT 5 -#define LED_DATA_PIN 13 -#define LED_CLK_PIN 14 -#define LED_TYPE APA102 -#define LED_COLOR_ORDER BGR - -//main power -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_13 -#define SLEEP_WAKEUP_STATE HIGH - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 4 }; diff --git a/Firmware/BentoFlowCreator/src/common/config/config_lthoop.h b/Firmware/BentoFlowCreator/src/common/config/config_lthoop.h deleted file mode 100644 index 6aac44bd..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_lthoop.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Lightrix Hoop" -#define ESP8266 - -// main leds config -#define LED_COUNT 250 -#define LED_DATA_PIN 13 -#define LED_CLK_PIN 14 -#define LED_TYPE APA102 -#define LED_COLOR_ORDER BGR - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 5 }; -#define BUTTON_INVERTED - -#define SLEEP_PIN 5 -#define SLEEP_PIN_SLEEP_VAL LOW -#define INFINITE_LOOP_ON_SLEEP \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_makey.h b/Firmware/BentoFlowCreator/src/common/config/config_makey.h deleted file mode 100644 index d168b28d..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_makey.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Makey" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 1 -#define LED_TYPE WS2812B -#define LED_DATA_PIN 15 -#define LED_COLOR_ORDER RGB - -// button pin -#define NO_SLEEP_BUTTON - -#define BUTTON_INVERTED -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 25 }; - -#define HIGH_PIN_COUNT 2 -const int highPins[HIGH_PIN_COUNT] { 26, 13}; - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_protov1.h b/Firmware/BentoFlowCreator/src/common/config/config_protov1.h deleted file mode 100644 index 9dc39937..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_protov1.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Flowtoys Creator Club" -#define ESP8266 - -// main leds config -#define LED_COUNT 32 -#define LED_EN_PIN 26 // pin for enabling the LED power. HIGH for on and LOW for off. -#define LED_DATA_PIN 5 -#define LED_CLK_PIN 18 -#define LED_TYPE SK9822 -#define LED_COLOR_ORDER BGR - -//main power -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_13 -#define SLEEP_WAKEUP_STATE HIGH - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 23 }; - -//battery sense (no battery sensing) - -// ir config -#define IR_TX_PIN 17 // drive with PWM HIGH is on and LOW is off. - -// SD config -#define SDSPEED 27000000 - -#define SD_EN 32 // drive LOW to turn on and set to HIGH-Z for off. - -#define SD_MISO 27 -#define SD_MOSI 25 -#define SD_SCK 33 -#define SD_CS 2 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_protov2.h b/Firmware/BentoFlowCreator/src/common/config/config_protov2.h deleted file mode 100644 index 33f2b955..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_protov2.h +++ /dev/null @@ -1,70 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Flowtoys Creator Club" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 32 -#define LED_EN_PIN 27 // pin for enabling the LED power. HIGH for on and LOW for off. -#define LED_DATA_PIN 25 -#define LED_CLK_PIN 26 -#define LED_TYPE SK9822 -#define LED_COLOR_ORDER BGR -#define LED_INVERT_DIRECTION -#define LED_MAX_BRIGHTNESS 60 - -//main power -#define KEEP_SLEEP_PIN_HIGH -#define SLEEP_PIN 12 // pin for turning the LDO on and off. LOW for off and HIGH for on. -#define SLEEP_PIN_SLEEP_VAL LOW -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_32 -#define SLEEP_WAKEUP_STATE HIGH - -//setting low will colapse the power and the club will only turn on from USB or button press. - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 32 }; - -//battery sence -#define BATTERY_PIN 35 // takes the measurment from the battery sence. -#define BATTERY_DEFAULT_MIN 222 -#define BATTERY_DEFAULT_MAX 335 - -#define HAS_IMU -//#define I2C_CLOCK 10000 // not sure what this is for. -#define SDA_PIN 23 // i2c lines -#define SCL_PIN 22 // i2c lines -#define IMU_REMAP_CONFIG Adafruit_BNO055::REMAP_CONFIG_P0 -#define IMU_REMAP_SIGN Adafruit_BNO055::REMAP_SIGN_P0 - -#define INT_PIN 33 // the interupt pin for the IMU MPU prosessor. -#define IMU_RESET 21 // toggl this pin to reset the IMU before connectiong to it after a reset. -#define IMU_ADDR 0x28 -#define BNO055_SAMPLERATE_DELAY_MS (100) - -// ir config -#define HAS_IR - -#define IR_TX_PIN 17 // drive with PWM HIGH is on and LOW is off. -#define IR_MAX_POWER 25 // 10% -#define IR_CHANNEL 0 -#define IR_PWM_RESOLUTION 8 //8 = value range from 0 to 255 -#define IR_FREQ 5000 - -// SD config -#define HAS_FILES - -#define SDSPEED 27000000 - -#define SD_EN 16 // drive LOW to turn on and set to HIGH-Z for off. -#define SD_POWER_VALUE LOW - -#define SD_MISO 19 -#define SD_MOSI 13 -#define SD_SCK 14 -#define SD_CS 15 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_ring.h b/Firmware/BentoFlowCreator/src/common/config/config_ring.h deleted file mode 100644 index 42d9ac52..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_ring.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Ring" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 116 -#define LED_DATA_PIN 15 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 200 -#define LED_DEFAULT_BRIGHTNESS .5 - -//SLEEP -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_27 -#define SLEEP_WAKEUP_STATE HIGH - -// button pin -#define BUTTON_INVERTED -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT_PULLDOWN -const int buttonPins[BUTTON_COUNT]{ 27 }; - - -#define HIGH_PIN_COUNT 1 -const int highPins[HIGH_PIN_COUNT] { 26 }; - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - - -#define CAPACITIVE_COUNT 7 - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_sax.h b/Firmware/BentoFlowCreator/src/common/config/config_sax.h deleted file mode 100644 index 762ef5f6..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_sax.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "Sax" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 153 -#define LED_DATA_PIN 15 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 200 -#define LED_DEFAULT_BRIGHTNESS .5 - -//SLEEP -#define BUTTON_INVERTED -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_4 -#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_COUNT 2 -#define BUTTON_INPUT_MODE INPUT_PULLUP -const int buttonPins[BUTTON_COUNT]{ 14, 4 }; - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_simpleESP32.h b/Firmware/BentoFlowCreator/src/common/config/config_simpleESP32.h deleted file mode 100644 index 222cf253..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_simpleESP32.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#ifndef CONFIG_FILE -#define CONFIG_FILE - -#define DEVICE_TYPE "SimpleESP32" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 200 -#define LED_DATA_PIN 15 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -#define LED_MAX_BRIGHTNESS 200 -#define LED_DEFAULT_BRIGHTNESS .5 -//#define LED_USE_FET -//#define LED_FET_PIN 33 - -//SLEEP -#define BUTTON_INVERTED -//#define SLEEP_WAKEUP_BUTTON GPIO_NUM_4 -//#define SLEEP_WAKEUP_STATE LOW - -// button pin -#define BUTTON_COUNT 0 -#define BUTTON_INPUT_MODE INPUT_PULLUP -//const int buttonPins[BUTTON_COUNT]{ 37, 39 }; - -/* -#define TOUCH_COUNT 2 -const int touchPins[TOUCH_COUNT]{37, 39}; -#define TOUCH_WAKEUP_PIN T0 //TOUCH_PAD_NUM0 //touch pad 0 is pin 4 -*/ - -//apparently helps having stable fastLED with TinyPICO and WS2812C -#define FASTLED_FORCE_LOOPDELAY - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -//#define GROUND_PIN_COUNT 2 -//const int groundPins[GROUND_PIN_COUNT]{13}; - -//battery -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_simpleESP8266.h b/Firmware/BentoFlowCreator/src/common/config/config_simpleESP8266.h deleted file mode 100644 index 09347df9..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_simpleESP8266.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Simple ESP8266" -#define ESP8266 - -// main leds config -#define LED_COUNT 52 -//#define LED_EN_PIN 26 // pin for enabling the LED power. HIGH for on and LOW for off. -#define LED_DATA_PIN 14 -//#define LED_CLK_PIN 18 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB - - -#define LED_MAX_BRIGHTNESS 80 -#define LED_DEFAULT_BRIGHTNESS .5 - -#define HAS_FILES -#define FILES_USE_INTERNAL_MEMORY - -//main power -//#define SLEEP_WAKEUP_BUTTON GPIO_NUM_13 -//#define SLEEP_WAKEUP_STATE HIGH - -// button pin -#define BUTTON_COUNT 0 -//#define BUTTON_INPUT_MODE INPUT -//const int buttonPins[BUTTON_COUNT]{ 23 }; - -//battery sense (no battery sensing) - -// ir config -//#define IR_TX_PIN 17 // drive with PWM HIGH is on and LOW is off. - -// SD config - -// #define SDSPEED 27000000 -// #define SD_EN 32 // drive LOW to turn on and set to HIGH-Z for off. -// #define SD_MISO 27 -// #define SD_MOSI 25 -// #define SD_SCK 33 -// #define SD_CS 2 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_tab_cyrwheel.h b/Firmware/BentoFlowCreator/src/common/config/config_tab_cyrwheel.h deleted file mode 100644 index 021471e7..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_tab_cyrwheel.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Creator CyrWheel" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 1080 -#define LED_EN_PIN 27 // pin for enabling the LED power. HIGH for on and LOW for off. -#define LED_DATA_PIN 25 -#define LED_CLK_PIN 26 -#define LED_TYPE APA102 -#define LED_COLOR_ORDER RGB -//#define LED_INVERT_DIRECTION - -//out of 1 -#define LED_DEFAULT_BRIGHTNESS .4 - -//out of 255 -#define LED_MAX_BRIGHTNESS 150 - -//main power -#define KEEP_SLEEP_PIN_HIGH -#define SLEEP_PIN 12 // pin for turning the LDO on and off. LOW for off and HIGH for on. -#define SLEEP_PIN_SLEEP_VAL LOW -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_36 -#define SLEEP_WAKEUP_STATE HIGH - -//setting low will colapse the power and the club will only turn on from USB or button press. - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 36 }; - -//battery sence -#define BATTERY_PIN 35 // takes the measurment from the battery sence. - -#define HAS_IMU -//#define I2C_CLOCK 10000 // not sure what this is for. -#define SDA_PIN 23 // i2c lines -#define SCL_PIN 22 // i2c lines -#define IMU_REMAP_CONFIG Adafruit_BNO055::REMAP_CONFIG_P0 -#define IMU_REMAP_SIGN Adafruit_BNO055::REMAP_SIGN_P0 - -#define INT_PIN 34 // the interupt pin for the IMU MPU prosessor. -#define IMU_RESET 21 // toggl this pin to reset the IMU before connectiong to it after a reset. -#define IMU_ADDR 0x28 -#define BNO055_SAMPLERATE_DELAY_MS (100) - -// ir config -//#define HAS_IR - -// #define IR_TX_PIN 17 // drive with PWM HIGH is on and LOW is off. -// #define IR_MAX_POWER 25 // 10% -// #define IR_CHANNEL 0 -// #define IR_PWM_RESOLUTION 8 //8 = value range from 0 to 255 -// #define IR_FREQ 5000 - -// SD config -#define HAS_FILES - -#define SDSPEED 27000000 - -#define SD_EN 33 // drive LOW to turn on and set to HIGH-Z for off. -#define SD_POWER_VALUE LOW - -#define SD_MISO 19 -#define SD_MOSI 13 -#define SD_SCK 14 -#define SD_CS 15 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_tab_hoop.h b/Firmware/BentoFlowCreator/src/common/config/config_tab_hoop.h deleted file mode 100644 index c157842b..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_tab_hoop.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Flowtoys Creator Hoop" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 363 -#define LED_EN_PIN 27 // pin for enabling the LED power. HIGH for on and LOW for off. -#define LED_DATA_PIN 25 -//#define LED_CLK_PIN 26 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -//#define LED_INVERT_DIRECTION - -//out of 1 -#define LED_DEFAULT_BRIGHTNESS .2 - -//out of 255 -#define LED_MAX_BRIGHTNESS 255 - -//main power -#define KEEP_SLEEP_PIN_HIGH -#define SLEEP_PIN 12 // pin for turning the LDO on and off. LOW for off and HIGH for on. -#define SLEEP_PIN_SLEEP_VAL LOW -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_36 -#define SLEEP_WAKEUP_STATE HIGH - -//setting low will colapse the power and the club will only turn on from USB or button press. - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{ 36 }; - -//battery sence -#define BATTERY_PIN 35 // takes the measurment from the battery sence. - -#define HAS_IMU -//#define I2C_CLOCK 10000 // not sure what this is for. -#define SDA_PIN 23 // i2c lines -#define SCL_PIN 22 // i2c lines -#define IMU_REMAP_CONFIG Adafruit_BNO055::REMAP_CONFIG_P0 -#define IMU_REMAP_SIGN Adafruit_BNO055::REMAP_SIGN_P0 - -#define INT_PIN 34 // the interupt pin for the IMU MPU prosessor. -#define IMU_RESET 21 // toggl this pin to reset the IMU before connectiong to it after a reset. -#define IMU_ADDR 0x28 -#define BNO055_SAMPLERATE_DELAY_MS (100) - -// ir config -//#define HAS_IR - -// #define IR_TX_PIN 17 // drive with PWM HIGH is on and LOW is off. -// #define IR_MAX_POWER 25 // 10% -// #define IR_CHANNEL 0 -// #define IR_PWM_RESOLUTION 8 //8 = value range from 0 to 255 -// #define IR_FREQ 5000 - -// SD config -#define HAS_FILES - -#define SDSPEED 27000000 - -#define SD_EN 33 // drive LOW to turn on and set to HIGH-Z for off. -#define SD_POWER_VALUE LOW - -#define SD_MISO 19 -#define SD_MOSI 13 -#define SD_SCK 14 -#define SD_CS 15 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_tab_powerled.h b/Firmware/BentoFlowCreator/src/common/config/config_tab_powerled.h deleted file mode 100644 index 3bc46496..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_tab_powerled.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Creator PowerLed" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 60 -#define LED_EN_PIN 27 // pin for enabling the LED power. HIGH for on and LOW for off. -#define LED_DATA_PIN 25 -//#define LED_CLK_PIN 26 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER RGB -//#define LED_INVERT_DIRECTION - -//out of 1 -#define LED_DEFAULT_BRIGHTNESS .5 - -//out of 255 -#define LED_MAX_BRIGHTNESS 255 - -//main power -#define KEEP_SLEEP_PIN_HIGH -#define SLEEP_PIN 12 // pin for turning the LDO on and off. LOW for off and HIGH for on. -#define SLEEP_PIN_SLEEP_VAL LOW -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_36 -#define SLEEP_WAKEUP_STATE HIGH - -//setting low will colapse the power and the club will only turn on from USB or button press. - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{36}; - -//battery sence -#define BATTERY_PIN 35 // takes the measurment from the battery sence. - -#define HAS_IMU -//#define I2C_CLOCK 10000 // not sure what this is for. -#define SDA_PIN 23 // i2c lines -#define SCL_PIN 22 // i2c lines -#define IMU_REMAP_CONFIG Adafruit_BNO055::REMAP_CONFIG_P0 -#define IMU_REMAP_SIGN Adafruit_BNO055::REMAP_SIGN_P0 - -#define INT_PIN 34 // the interupt pin for the IMU MPU prosessor. -#define IMU_RESET 21 // toggl this pin to reset the IMU before connectiong to it after a reset. -#define IMU_ADDR 0x28 -#define BNO055_SAMPLERATE_DELAY_MS (100) - -//PWM config -#define PWM_COUNT 4 -const int pwmPins[PWM_COUNT]{32, 9, 10, 4}; -#define PWM_FREQUENCY 5000 -#define PWM_RESOLUTION 10 -#define PWMVAL(i) i*1023 - -// ir config -//#define HAS_IR - -// #define IR_TX_PIN 17 // drive with PWM HIGH is on and LOW is off. -// #define IR_MAX_POWER 25 // 10% -// #define IR_CHANNEL 0 -// #define IR_PWM_RESOLUTION 8 //8 = value range from 0 to 255 -// #define IR_FREQ 5000 - -// SD config -#define HAS_FILES - -#define SDSPEED 27000000 - -#define SD_EN 33 // drive LOW to turn on and set to HIGH-Z for off. -#define SD_POWER_VALUE LOW - -#define SD_MISO 19 -#define SD_MOSI 13 -#define SD_SCK 14 -#define SD_CS 15 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/config/config_tab_superstaff.h b/Firmware/BentoFlowCreator/src/common/config/config_tab_superstaff.h deleted file mode 100644 index 19846a2c..00000000 --- a/Firmware/BentoFlowCreator/src/common/config/config_tab_superstaff.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#define DEVICE_TYPE "Creator SuperStaff" - -#ifndef ESP32 -#define ESP32 -#endif - -// main leds config -#define LED_COUNT 144 -#define LED_EN_PIN 27 // pin for enabling the LED power. HIGH for on and LOW for off. -#define LED_DATA_PIN 25 -//#define LED_CLK_PIN 26 -#define LED_TYPE WS2812B -#define LED_COLOR_ORDER GRB -//#define LED_INVERT_DIRECTION - -//out of 1 -#define LED_DEFAULT_BRIGHTNESS .2 - -//out of 255 -#define LED_MAX_BRIGHTNESS 200 - -//main power -#define KEEP_SLEEP_PIN_HIGH -#define SLEEP_PIN 12 // pin for turning the LDO on and off. LOW for off and HIGH for on. -#define SLEEP_PIN_SLEEP_VAL LOW -#define SLEEP_WAKEUP_BUTTON GPIO_NUM_36 -#define SLEEP_WAKEUP_STATE HIGH - -#define POWEROFF_IF_NOTCONNECTED - -//setting low will colapse the power and the club will only turn on from USB or button press. - -// button pin -#define BUTTON_COUNT 1 -#define BUTTON_INPUT_MODE INPUT -const int buttonPins[BUTTON_COUNT]{36}; - -//battery sence -#define BATTERY_PIN 35 // takes the measurment from the battery sence. -#define BATTERY_CHARGE_PIN 39 - -#define HAS_IMU -//#define I2C_CLOCK 10000 // not sure what this is for. -#define SDA_PIN 23 // i2c lines -#define SCL_PIN 22 // i2c lines -#define IMU_REMAP_CONFIG Adafruit_BNO055::REMAP_CONFIG_P0 -#define IMU_REMAP_SIGN Adafruit_BNO055::REMAP_SIGN_P0 - -#define INT_PIN 34 // the interupt pin for the IMU MPU prosessor. -#define IMU_RESET 21 // toggl this pin to reset the IMU before connectiong to it after a reset. -#define IMU_ADDR 0x28 -#define BNO055_SAMPLERATE_DELAY_MS (100) - -// ir config -//#define HAS_IR - -// #define IR_TX_PIN 17 // drive with PWM HIGH is on and LOW is off. -// #define IR_MAX_POWER 25 // 10% -// #define IR_CHANNEL 0 -// #define IR_PWM_RESOLUTION 8 //8 = value range from 0 to 255 -// #define IR_FREQ 5000 - -// SD config -#define HAS_FILES - -#define SDSPEED 27000000 - -#define SD_EN 33 // drive LOW to turn on and set to HIGH-Z for off. -#define SD_POWER_VALUE LOW - -#define SD_MISO 19 -#define SD_MOSI 13 -#define SD_SCK 14 -#define SD_CS 15 \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/common/events/EventBroadcaster.h b/Firmware/BentoFlowCreator/src/common/events/EventBroadcaster.h deleted file mode 100644 index ed753545..00000000 --- a/Firmware/BentoFlowCreator/src/common/events/EventBroadcaster.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once -#include - -template -class EventBroadcaster -{ -public: - EventBroadcaster(); - virtual ~EventBroadcaster() {} - - typedef std::function onEvent; - onEvent listeners[8]; - void addListener(onEvent func); - -protected: - virtual void sendEvent(const T &data = T()); - -private: - int numListeners; -}; - -template -EventBroadcaster::EventBroadcaster() : numListeners(0) -{ -} - -template -void EventBroadcaster::sendEvent(const T &data) -{ - for (int i = 0; i < numListeners; i++) - { - listeners[i](data); - } -} - -template -void EventBroadcaster::addListener(onEvent func) -{ - if (numListeners == 8) - return; - - - listeners[numListeners] = func; - numListeners++; -} diff --git a/Firmware/BentoFlowCreator/src/common/settings/Macro.h b/Firmware/BentoFlowCreator/src/common/settings/Macro.h deleted file mode 100644 index 585ba90e..00000000 --- a/Firmware/BentoFlowCreator/src/common/settings/Macro.h +++ /dev/null @@ -1,5 +0,0 @@ -//==================[ CONFIG ]================= -#define JSON_LEN 1500 -#define SM_KEY_NOT_FOUND 1 -#define SM_ERROR -1 -#define SM_SUCCESS 0 diff --git a/Firmware/BentoFlowCreator/src/common/settings/SettingsManager.cpp b/Firmware/BentoFlowCreator/src/common/settings/SettingsManager.cpp deleted file mode 100644 index 6ead3837..00000000 --- a/Firmware/BentoFlowCreator/src/common/settings/SettingsManager.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/* - - SettingsManager - - Copyright (C) 2017 by Sergiu Toporjinschi - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation version 3. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - All rights reserved - -*/ - -//#include "../DebugHelpers.h" -#include "SettingsManager.h" - - -/** - Reads the content of settings file given by path/name -*/ -int SettingsManager::readSettings(const char *fileName) { - // DBG("Reading settings from: " + String(fileName)); - unsigned int loaded = SM_SUCCESS; - openSPIFFS(); - File file = SPIFFS.open(fileName, "r"); - if (!file) { - // DBG("Could not open file"); - SPIFFS.end(); - loaded = SM_ERROR; - } else { - char js[JSON_LEN] = {0}; - getFileContent(js, file); - // DBG("File content : "+String(js)); - loaded = loadJson(js); - file.close(); - SPIFFS.end(); - } - // DBG("Closing file"); - return loaded; -} - -/** - Writes the content of settings to a file given by path/name -*/ -int SettingsManager::writeSettings(const char *fileName) { - return writeSettings(fileName, doc.as()); -} - -/** - Writes the content of settings to a file given by path/name -*/ -int SettingsManager::writeSettings(const char *fileName, JsonVariant conf) { - // DBG("Writing settings to: "+String(fileName)); - openSPIFFS(); - - File file = SPIFFS.open(fileName, "w"); - if (!file) { - // DBG("Could not write in file"); - SPIFFS.end(); - return SM_ERROR; - } else { - serializeJson(conf, file); - delay(20); - // DBG("File written"); - } - file.close(); - SPIFFS.end(); - // DBG("File and SPIFFS closed"); - return SM_SUCCESS; -} - -/** - Reads the file content -*/ -void SettingsManager::getFileContent(char *content, File &file) { - char jsonChars[7] = "{},:[]"; - char lastChr = '\0'; - while (file.available()) { - char chr = (char)file.read(); - if (chr == 10 || chr == '\r' || chr == '\t' || (strchr(jsonChars, lastChr) != NULL && chr == ' ') || (int)chr == 255) { - continue; - } - if ((int)lastChr == 32 && strchr(jsonChars, chr) != NULL) { - content[strlen(content) - 1] = '\000'; - } - content[strlen(content)] = chr; - content[strlen(content) + 1] = '\000'; - lastChr = chr; - } -} - -/** - Loads a json and is stored in json structure -*/ -int SettingsManager::loadJson(const char *payload) { - doc.clear(); - DeserializationError err = deserializeJson(doc, payload); - if (err) { - // DBG("Could not deserialize payload: "+String(err.c_str())); - return SM_ERROR; - } - root = doc.as(); - return SM_SUCCESS; -} - -/** - Open file -*/ -void SettingsManager::openSPIFFS() { - if (!SPIFFS.begin()) { - delay(20); - // DBG("Could not mount SPIFFS file system"); - } else { - // DBG("SPIFFS file system, open"); - } -} - -/** - Returns the JsonVariant of a given key -*/ -JsonVariant SettingsManager::getJsonVariant(const char *key, bool addIfMissing) { - // DBG("-> Searching for key: "+String(key)); - //Maybe i'm lucky ... - JsonVariant val = root.getMember(key); - if (!val.isNull()) { - // DBG("Key found in root: "+String(key)); - return val; - } - char _key[100] = {0}; - strcpy(_key, key); - char *k = strchr(_key, '.'); - - //if it does not have any . then is not existing - if (k == nullptr) { - if (addIfMissing) { - // DBG("Adding not existing key: "+String(key)); - return root.getOrAddMember(key); - } else { - // DBG("Key not found "+String(key)); - return JsonVariant(); - } - } - - //for sure it has at least one . - char *crs = &_key[0]; - JsonVariant node = root; - while (k != nullptr) { - //replace the . with \0 to split the string - k[0] = '\0'; - if (strlen(crs) > 0) { - if (!node.getMember(crs).isNull()) { - node = node.getMember(crs); - } else if (!addIfMissing) { - // DBG("Key not found: "+String(crs)); - return JsonVariant(); - } else { - // DBG("Adding not existing key: "+String(crs)); - node = node.getOrAddMember(crs); - } - } - k++; - crs = k; - k = strchr(crs, '.'); - if (k == nullptr) { - if (node.getMember(crs).isNull() && addIfMissing) { - // DBG("Adding not existing key: "+String(crs)); - node = node.getOrAddMember(crs); - } else { - node = node.getMember(crs); - } - break; - } - } - return node; -}; - -/** - Returns the JsonObject stored to a specific key -*/ -JsonObject SettingsManager::getJsonObject(const char *key, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (!item.isNull()) { - return item.as(); - } else if (addIfMissing) { - return item.getOrAddMember(key); - } else { - return JsonObject(); - } -} - -/** - Returns the JsonArray stored to a specific key -*/ -JsonArray SettingsManager::getJsonArray(const char *key, bool addIfMissing) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else if (addIfMissing) { - return item.getOrAddMember(key); - } else { - return JsonArray(); - } -} - -signed int SettingsManager::getInt(const char *key, const signed int defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -unsigned int SettingsManager::getUInt(const char *key, const unsigned int defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -signed short SettingsManager::getShort(const char *key, const signed short defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -unsigned short SettingsManager::getUShort(const char *key, const unsigned short defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -signed long SettingsManager::getLong(const char *key, const signed long defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -unsigned long SettingsManager::getULong(const char *key, const unsigned long defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -char SettingsManager::getCChar(const char *key, const char defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - const char *x = item.as(); - return x[0]; - } else { - return defaultValue; - } -} - -signed char SettingsManager::getSChar(const char *key, const signed char defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -unsigned char SettingsManager::getUChar(const char *key, const unsigned char defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -const char *SettingsManager::getChar(const char *key, const char *defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -String SettingsManager::getString(const char *key, const String defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -float SettingsManager::getFloat(const char *key, const float defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -double SettingsManager::getDouble(const char *key, const double defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -bool SettingsManager::getBool(const char *key, const bool defaultValue) { - JsonVariant item = getJsonVariant(key); - if (!item.isNull()) { - return item.as(); - } else { - return defaultValue; - } -} - -int SettingsManager::setInt(const char *key, const signed int value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setShort(const char *key, const signed short value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setLong(const char *key, const signed long value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setCChar(const char *key, const char value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setChar(const char *key, const char *value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setString(const char *key, const String value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setFloat(const char *key, const float value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setDouble(const char *key, const double value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} - -int SettingsManager::setBool(const char *key, const bool value, bool addIfMissing) { - JsonVariant item = getJsonVariant(key, addIfMissing); - if (addIfMissing || !item.isNull()) { - return item.set(value) ? SM_SUCCESS : SM_ERROR; - } else { - // DBG("null node"); - return SM_KEY_NOT_FOUND; - } -} diff --git a/Firmware/BentoFlowCreator/src/common/settings/SettingsManager.h b/Firmware/BentoFlowCreator/src/common/settings/SettingsManager.h deleted file mode 100644 index 80a6f850..00000000 --- a/Firmware/BentoFlowCreator/src/common/settings/SettingsManager.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - - SettingsManager - - Copyright (C) 2017 by Sergiu Toporjinschi - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation version 3. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - All rights reserved - -*/ - -#pragma once -#include -#include "Config.h" - -#ifdef ESP32 -# include "SPIFFS.h" -#endif - -#ifdef ESP8266 -# include "FS.h" -#endif - -#include "Macro.h" -#include "../ArduinoJson/ArduinoJson.h" -#include - -class SettingsManager { - public: - SettingsManager(){}; - int readSettings(const char *fileName); - int readSettings(const String fileName) { - return readSettings(fileName.c_str()); - }; - int writeSettings(const char *fileName); - int writeSettings(const char *fileName, JsonVariant conf); - - signed int getInt(const char *key, const signed int defaultValue = 0); - unsigned int getUInt(const char *key, const unsigned int defaultValue = 0); - - signed short getShort(const char *key, const signed short defaultValue = 0); - unsigned short getUShort(const char *key, const unsigned short defaultValue = 0); - - signed long getLong(const char *key, const signed long defaultValue = 0L); - unsigned long getULong(const char *key, const unsigned long defaultValue = 0L); - - char getCChar(const char *key, const char defaultValue = '\0'); - signed char getSChar(const char *key, const signed char defaultValue = '\0'); - unsigned char getUChar(const char *key, const unsigned char defaultValue = '\0'); - - const char *getChar(const char *key, const char *defaultValue); - String getString(const char *key, const String defaultValue = ""); - float getFloat(const char *key, const float defaultValue = 0.0f); - double getDouble(const char *key, const double defaultValue = (double)(0.0)); - bool getBool(const char *key, const bool defaultValue = false); - - int setInt(const char *key, const signed int value, bool addIfMissing = 1); - int setShort(const char *key, const signed short value, bool addIfMissing = 1); - int setLong(const char *key, const signed long value, bool addIfMissing = 1); - int setCChar(const char *key, const char value, bool addIfMissing = 1); - int setChar(const char *key, const char *value, bool addIfMissing = 1); - int setString(const char *key, const String value, bool addIfMissing = 1); - int setFloat(const char *key, const float value, bool addIfMissing = 1); - int setDouble(const char *key, const double value, bool addIfMissing = 1); - int setBool(const char *key, const bool value, bool addIfMissing = 1); - - JsonVariant getJsonVariant(const char *key, bool addIfMissing = 0); - JsonObject getJsonObject(const char *key, bool addIfMissing = 0); - JsonArray getJsonArray(const char *key, bool addIfMissing = 0); - - JsonObject getRoot() { - return root; - }; - int loadJson(const char *payload); - - private: - DynamicJsonDocument doc = DynamicJsonDocument(1300); - JsonObject root; - void getFileContent(char *content, File &file); - void openSPIFFS(); -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/CommunicationManager.cpp b/Firmware/BentoFlowCreator/src/communication/CommunicationManager.cpp deleted file mode 100644 index 6567fb83..00000000 --- a/Firmware/BentoFlowCreator/src/communication/CommunicationManager.cpp +++ /dev/null @@ -1,159 +0,0 @@ - -#include "CommunicationManager.h" - -CommunicationManager::CommunicationManager() : Component("comm"), - oscManager(&wifiManager) -{ -} - -void CommunicationManager::init() -{ -#ifdef HAS_DISPLAY - displayManager.init(); -#endif - - serialManager.addListener(std::bind(&CommunicationManager::serialMessageEvent, this, std::placeholders::_1)); - serialManager.init(); - - wifiManager.addListener(std::bind(&CommunicationManager::wifiConnectionEvent, this, std::placeholders::_1)); - wifiManager.init(); - - oscManager.addListener(std::bind(&CommunicationManager::oscMessageEvent, this, std::placeholders::_1)); - oscManager.init(); -} - -void CommunicationManager::update() -{ -#ifdef HAS_DISPLAY - displayManager.update(); -#endif - - serialManager.update(); - wifiManager.update(); - oscManager.update(); -} - -void CommunicationManager::serialMessageEvent(const SerialEvent &e) -{ - switch (e.type) - { - case SerialEvent::MessageReceived: - { - const int maxData = 16; - var *data = (var *)malloc(maxData * sizeof(var)); //max 16 arguments - int index = 0; - - //COUNT - char *pch = strtok((char *)e.data.c_str(), ","); - while (pch != NULL && index < maxData) - { - String s = String(pch); - - bool isNumber = true; - for (byte i = 0; i < s.length(); i++) - { - char c = s.charAt(i); - if (c != '.' && c != '-' && c != '+' && !isDigit(c)) - { - isNumber = false; - break; - } - } - - if (isNumber) - { - float f = s.toFloat(); - int i = s.toInt(); - - if (f == i && s.indexOf('.') == -1) - { - data[index].value.i = i; - data[index].type = 'i'; - } - else - { - data[index].value.f = f; - data[index].type = 'f'; - } - } - else - { - data[index].value.s = pch; - data[index].type = 's'; - } - - pch = strtok(NULL, ","); - index++; - } - - EventBroadcaster::sendEvent(CommunicationEvent(CommunicationEvent::MessageReceived, serialManager.name, e.target, e.command, data, index)); - free(data); - } - break; - } -} - -void CommunicationManager::wifiConnectionEvent(const WifiManagerEvent &e) -{ - NDBG("Connection event update " + connectionStateNames[wifiManager.state]); - EventBroadcaster::sendEvent(ConnectionEvent(wifiManager.state, - wifiManager.name, - (wifiManager.state == Connected || wifiManager.state == Hotspot) ? wifiManager.getIP() : "")); -} - -void CommunicationManager::oscMessageEvent(const OSCEvent &e) -{ - if (e.type == OSCEvent::AliveChanged) - { - EventBroadcaster::sendEvent(ConnectionEvent(oscManager.isAlive ? ConnectionState::PingAlive : ConnectionState::PingDead, oscManager.name)); - } - if (e.type == OSCEvent::MessageReceived) - { - char addr[32]; - e.msg->getAddress(addr, 1); //remove the first slash - String tc(addr); - int tcIndex = tc.indexOf('/'); - - int numData = e.msg->size(); - var *data = (var *)malloc(numData * sizeof(var)); - int numUsedData = 0; - - char tmpStr[32][32]; //contains potential strings - - for (int i = 0; i < e.msg->size(); i++) - { - switch (e.msg->getType(i)) - { - case 'i': - data[i].value.i = e.msg->getInt(i); - data[i].type = 'i'; - numUsedData++; - break; - case 'f': - data[i].value.f = e.msg->getFloat(i); - data[i].type = 'f'; - numUsedData++; - break; - case 's': - e.msg->getString(i, tmpStr[i]); - data[i].value.s = tmpStr[i]; - data[i].type = 's'; - numUsedData++; - break; - - default: - break; - } - } - - EventBroadcaster::sendEvent(CommunicationEvent(CommunicationEvent::MessageReceived, oscManager.name, tc.substring(0, tcIndex), tc.substring(tcIndex + 1), data, numUsedData)); - - free(data); - } -} - -void CommunicationManager::sendMessage(String source, String command, var *data, int numData) -{ - serialManager.sendMessage(source, command, data, numData); - oscManager.sendMessage(source, command, data, numData); -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/CommunicationManager.h b/Firmware/BentoFlowCreator/src/communication/CommunicationManager.h deleted file mode 100644 index b2319512..00000000 --- a/Firmware/BentoFlowCreator/src/communication/CommunicationManager.h +++ /dev/null @@ -1,73 +0,0 @@ -#pragma once - -#include "display/DisplayManager.h" -#include "wifi/WifiManager.h" -#include "serial/SerialManager.h" -#include "osc/OSCManager.h" - -class ConnectionEvent -{ -public: - ConnectionEvent(ConnectionState type, String source, String info = "") : type(type), source(source), info(info) {} - ConnectionState type; - String source; - String info; -}; - -class CommunicationEvent -{ -public: - enum Type - { - MessageReceived, - TYPES_MAX - }; - const String typeNames[TYPES_MAX]{"MessageReceived"}; - - CommunicationEvent(Type type, String source, String target, String command, var *data, int numData) : - type(type), source(source), target(target), command(command), data(data), numData(numData) - { - } - - Type type; - String source; - String target; - String command; - var *data; - int numData; - - String toString() const - { - String s = "*" + typeNames[type] + "* source : " + source + ", target : " + target + ", command : "+command+", data : "; - for (int i = 0; i < numData; i++) - s += (i > 0 ? ", " : "") + data[i].stringValue()+ "("+data[i].type+")"; - - return s; - } -}; - -class CommunicationManager : public Component, - public EventBroadcaster, - public EventBroadcaster -{ -public: - CommunicationManager(); - ~CommunicationManager() {} - -#ifdef HAS_DISPLAY - DisplayManager displayManager; -#endif - - WifiManager wifiManager; - SerialManager serialManager; - OSCManager oscManager; - - void init(); - void update(); - - void serialMessageEvent(const SerialEvent &e); - void wifiConnectionEvent(const WifiManagerEvent &e); - void oscMessageEvent(const OSCEvent &e); - - void sendMessage(String source, String command, var * data, int numData); -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/display/DisplayManager.cpp b/Firmware/BentoFlowCreator/src/communication/display/DisplayManager.cpp deleted file mode 100644 index da365527..00000000 --- a/Firmware/BentoFlowCreator/src/communication/display/DisplayManager.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include "DisplayManager.h" - -#ifdef HAS_DISPLAY - -#include "../../sensors/button/ButtonManager.h" -#include "../../sensors/imu/IMUManager.h" -#include "../wifi/WifiManager.h" -#include "../../common/DebugHelpers.h" - -DisplayManager::DisplayManager() : Component("display"), - outputEnabled(true), - display(0x3C, DISPLAY_SDA, DISPLAY_SCL), - messageIndex(0), - timeAtLastUpdate(0) -{ - for (int i = 0; i < DISPLAY_LINES; i++) - messages[i] = ""; -} - -void DisplayManager::init() -{ - buttons = (ButtonManager *)Component::getComponentForName("buttons"); - wifi = (WifiManager *)Component::getComponentForName("wifi"); - imu = (IMUManager *)Component::getComponentForName("imu"); - - pinMode(DISPLAY_RESET, OUTPUT); - digitalWrite(DISPLAY_RESET, LOW); // set GPIO16 low to reset OLED - delay(50); - digitalWrite(DISPLAY_RESET, HIGH); - delay(50); - - display.init(); - display.flipScreenVertically(); - display.setFont(ArialMT_Plain_10); - delay(50); - - NDBG("Init Display"); -} - -void DisplayManager::update() -{ - if (!outputEnabled) - return; - - long time = millis(); - if (time > timeAtLastUpdate + 1000 / DISPLAY_REFRESH_RATE) - { - updateInternal(); - timeAtLastUpdate = time; - } -} - -void DisplayManager::updateInternal() -{ - display.clear(); - String ws = connectionStateNames[wifi->state]; - if(wifi->state == ConnectionState::Connected) ws += " "+wifi->getIP(); - - display.setTextAlignment(TEXT_ALIGN_RIGHT); - display.drawString(128, 50, ws); - -#ifdef BUTTON_COUNT - for (int i = 0; i < BUTTON_COUNT; i++) - { - display.setColor(WHITE); - display.drawCircle(6+i*12, 6, 4); - if(buttons->isPressed[i]) display.fillCircle(6+i*12, 6, 2); - } -#endif - - display.display(); -} - -void DisplayManager::sendMessage(String source, String command, var *data, int numData) -{ - if (!outputEnabled) - return; - - String msg = source + "." + command; - for (int i = 0; i < numData; i++) - msg += " " + data[i].stringValue(); - - - logMessage(msg); -} - -void DisplayManager::logMessage(String msg) -{ - messageIndex = (messageIndex + 1) % DISPLAY_LINES; - messages[messageIndex] = msg; - - display.clear(); - for (int i = 0; i < DISPLAY_LINES; i++) - { - int line = (i + messageIndex) % DISPLAY_LINES; - display.drawString(0, line * 15, messages[line]); - } - - display.display(); -} - -bool DisplayManager::handleCommand(String command, var *data, int numData) -{ - if (checkCommand(command, "outputEnabled", numData, 1)) - { - outputEnabled = data[0].intValue() == 1; - return true; - } - - return false; -} - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/display/DisplayManager.h b/Firmware/BentoFlowCreator/src/communication/display/DisplayManager.h deleted file mode 100644 index 97cbc4c1..00000000 --- a/Firmware/BentoFlowCreator/src/communication/display/DisplayManager.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "../../common/Common.h" - -#ifdef HAS_DISPLAY -#include "SSD1306.h" - -class ButtonManager; -class IMUManager; -class WifiManager; - -class DisplayManager : public Component -{ -public: - DisplayManager(); - ~DisplayManager() {} - - bool outputEnabled; - - ButtonManager * buttons; - WifiManager * wifi; - IMUManager * imu; - - String messages[DISPLAY_LINES]; - int messageIndex; - - long timeAtLastUpdate; - - SSD1306Wire display; //Set OLED to default address 0x3C, and pins 4 and 15, with reset at pin 16 - - void init(); - void update(); - void updateInternal(); - - void sendMessage(String source, String command, var * data, int numData); - - void logMessage(String msg); - - bool handleCommand(String command, var * data, int numData) override; -}; - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/osc/OSCManager.cpp b/Firmware/BentoFlowCreator/src/communication/osc/OSCManager.cpp deleted file mode 100644 index c83a941b..00000000 --- a/Firmware/BentoFlowCreator/src/communication/osc/OSCManager.cpp +++ /dev/null @@ -1,234 +0,0 @@ -#include "OSCManager.h" -#include "../wifi/WifiManager.h" - -OSCManager::OSCManager(WifiManager *wifi) : Component("osc"), - wifi(wifi), - enabled(false), - pingTimeout(5000), - isAlive(false) -{ -} - -void OSCManager::init() -{ - -#ifdef USE_PREFERENCES - prefs.begin(name.c_str(), true); - remoteHost = prefs.getString("remoteHost", ""); - prefs.end(); - -#elif defined USE_SETTINGS_MANAGER - //init once with a json if it doesn't exist yet - prefs.readSettings(String("/" + name + ".json").c_str()); - remoteHost = prefs.getString("remoteHost", ""); - prefs.loadJson(String("{\"remoteHost\":\"" + remoteHost + "\"}").c_str()); - prefs.writeSettings(String("/" + name + ".json").c_str()); - - //actually read the settings - prefs.readSettings(String("/" + name + ".json").c_str()); - remoteHost = prefs.getString("remoteHost", ""); -#endif - - - NDBG("Init"); -} - -void OSCManager::update() -{ - if (!enabled) - return; - - if (pingEnabled && millis() > timeSinceLastReceivedPing + pingTimeout) - { - setAlive(false); - } - - receiveOSC(); -} - -void OSCManager::setEnabled(bool value) -{ - if (enabled == value) - return; - - enabled = value; - - if (enabled) - { - udp.begin(localPort); - udp.flush(); - setAlive(true); - timeSinceLastReceivedPing = millis(); - - if (MDNS.begin((String(DEVICE_TYPE) + " - " + getDeviceID()).c_str())) - { - NDBG("OSC Zeroconf started"); - MDNS.addService("osc", "udp", 9000); - } - else - { - NDBG("Error setting up MDNS responder!"); - } - - } - else - { - udp.flush(); - udp.stop(); - setAlive(false); - - MDNS.end(); - } -} - -void OSCManager::setAlive(bool value) -{ - if (isAlive == value) - return; - isAlive = value; - //NDBG("Set alive "+String(isAlive)); - sendEvent(OSCEvent(OSCEvent::AliveChanged)); -} - -void OSCManager::receiveOSC() -{ - OSCMessage msg; - int size; - if ((size = udp.parsePacket()) > 0) - { - while (size--) - msg.fill(udp.read()); - if (!msg.hasError()) - processMessage(msg); - } -} - -void OSCManager::processMessage(OSCMessage &msg) -{ - if (msg.match("/yo")) - { - char hostData[32]; - msg.getString(0, hostData, 32); - - // NDBG("Yo received : "+String(hostData)); - - saveRemoteHost(hostData); - - - OSCMessage msg("/wassup"); - - msg.add(wifi->getIP().c_str()); - msg.add(getDeviceID().c_str()); - msg.add(DEVICE_TYPE); - - sendMessage(msg); - } - else if (msg.match("/ping")) - { - // NDBG("Received ping"); - setAlive(true); - pingEnabled = true; - timeSinceLastReceivedPing = millis(); - - if (msg.size() > 0) - { - char hostData[32]; - msg.getString(0, hostData, 32); - saveRemoteHost(hostData); - } - - OSCMessage msg("/pong"); - msg.add(getDeviceID().c_str()); - sendMessage(msg); - } - else - { - sendEvent(OSCEvent(OSCEvent::MessageReceived, &msg)); - } -} - -void OSCManager::saveRemoteHost(String ip) -{ - - remoteHost = ip; - //NDBG("Got yo request from : " + remoteHost); - -#ifdef USE_PREFERENCES - prefs.begin(name.c_str()); - prefs.putString("remoteHost", remoteHost); - prefs.end(); -#elif defined USE_SETTINGS_MANAGER - prefs.setString("remoteHost", remoteHost); - prefs.writeSettings(String("/" + name + ".json").c_str()); -#endif -} - -void OSCManager::sendMessage(OSCMessage &msg) -{ - if (!enabled) - { - //NDBG("Send OSC message, osc not enabled"); - return; - } - - if (remoteHost.length() == 0) - { - //NDBG("Send OSC message, remoteHost not set"); - return; - } - char addr[32]; - msg.getAddress(addr); - //NDBG("Send OSC message to "+ remoteHost + " : " + String(addr)); - udp.beginPacket((char *)remoteHost.c_str(), (uint16_t)remotePort); - msg.send(udp); - udp.endPacket(); - msg.empty(); -} - -void OSCManager::sendMessage(String address) -{ - if (!enabled) - return; - - OSCMessage m(address.c_str()); - sendMessage(m); -} - -void OSCManager::sendMessage(String source, String command, var *data, int numData) -{ - if (!enabled) - return; - - OSCMessage msg(("/" + source + "/" + command).c_str()); - msg.add(getDeviceID().c_str()); - for (int i = 0; i < numData; i++) - { - switch (data[i].type) - { - case 'f': - msg.add(data[i].floatValue()); - break; - - case 'i': - msg.add(data[i].intValue()); - break; - - case 's': - msg.add(data[i].stringValue().c_str()); - break; - } - } - sendMessage(msg); -} - -bool OSCManager::handleCommand(String command, var *data, int numData) -{ - - if (checkCommand(command, "enabled", numData, 1)) - { - setEnabled(data[0].intValue() == 1); - return true; - } - - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/osc/OSCManager.h b/Firmware/BentoFlowCreator/src/communication/osc/OSCManager.h deleted file mode 100644 index 9a5f4d07..00000000 --- a/Firmware/BentoFlowCreator/src/communication/osc/OSCManager.h +++ /dev/null @@ -1,77 +0,0 @@ -#pragma once - -#include "../../common/Common.h" - -#include -#include "OSC/OSCMessage.h" -#include "OSC/OSCBoards.h" - -#ifdef ESP32 -#include -#elif defined ESP8266 -#include -#endif - -class OSCEvent -{ -public: - enum Type - { - MessageReceived, - AliveChanged - }; - - OSCEvent(Type t, OSCMessage *m = nullptr) : type(t), msg(m) {} - - Type type; - OSCMessage *msg; - OSCMessage &getMessage() { return *msg; } -}; - -class WifiManager; //forward declaration - -class OSCManager : public Component, public EventBroadcaster -{ -public: - OSCManager(WifiManager *wifi); - ~OSCManager() {} - - WifiManager *wifi; - - bool enabled; - -#ifdef USE_PREFERENCES - Preferences prefs; -#elif defined USE_SETTINGS_MANAGER - SettingsManager prefs; -#endif - - WiFiUDP udp; - - const int localPort = 9000; // input port - String remoteHost; - const int remotePort = 10000; // output port - - long timeSinceLastReceivedPing; - long pingTimeout; - bool pingEnabled; //only activate ping check if received a first ping - - bool isAlive; - - void init(); - void update(); - - void setEnabled(bool value); - void setAlive(bool value); - - void receiveOSC(); - void processMessage(OSCMessage &m); - - void saveRemoteHost(String ip); - - void sendMessage(OSCMessage &m); - void sendMessage(String address); - void sendMessage(String source, String command, var *data, int numData); - - bool handleCommand(String command, var *data, int numData) override; -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/serial/SerialManager.cpp b/Firmware/BentoFlowCreator/src/communication/serial/SerialManager.cpp deleted file mode 100644 index cd625d25..00000000 --- a/Firmware/BentoFlowCreator/src/communication/serial/SerialManager.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include "SerialManager.h" - -SerialManager::SerialManager() : - Component("serial"), - outputEnabled(false) -{ - memset(buffer, 0, 512); -} - -void SerialManager::init() -{ - Serial.begin(115200); - NDBG("Init"); -} - -void SerialManager::update() -{ - while (Serial.available()) - { - char c = Serial.read(); - if (c == '\n') - { - processMessage(buffer); - memset(buffer, 0, 512); - bufferIndex = 0; - }else - { - if(bufferIndex < 512) buffer[bufferIndex] = c; - bufferIndex++; - } - - } -} - -void SerialManager::processMessage(String buffer) -{ - if(buffer.substring(0,2) == "yo") - { - Serial.println("wassup "+getDeviceID()+" \""+String(DEVICE_TYPE)+"\""); - return; - } - - int splitIndex = buffer.indexOf(' '); - - String tc = buffer.substring(0, splitIndex); - int tcIndex = tc.indexOf('.'); - String args = splitIndex != -1 ?buffer.substring(splitIndex + 1):""; - - sendEvent(SerialEvent(SerialEvent::MessageReceived, tc.substring(0,tcIndex), tc.substring(tcIndex+1), args)); -} - - -void SerialManager::sendMessage(String source, String command, var * data, int numData) -{ - if(!outputEnabled) return; - - String msg = source+"."+command; - for(int i=0;i -{ -public: - SerialManager(); - ~SerialManager(){} - - char buffer[512]; - byte bufferIndex; - - bool outputEnabled; - - void init(); - void update(); - - void processMessage(String buffer); - - void sendMessage(String source, String command, var * data, int numData); - - bool handleCommand(String command, var * data, int numData) override; -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/wifi/WifiManager.cpp b/Firmware/BentoFlowCreator/src/communication/wifi/WifiManager.cpp deleted file mode 100644 index 930669ee..00000000 --- a/Firmware/BentoFlowCreator/src/communication/wifi/WifiManager.cpp +++ /dev/null @@ -1,168 +0,0 @@ - -#include "WifiManager.h" - -WifiManager::WifiManager() : Component("wifi"), - state(Off), - lastConnectTime(0) -{ -} - -void WifiManager::init() -{ - NDBG("Init"); - -#if defined USE_SETTINGS_MANAGER - // init once with a json if it doesn't exist yet - prefs.readSettings(String("/" + name + ".json").c_str()); - String ssid = prefs.getString("ssid"); - String pass = prefs.getString("pass"); - prefs.loadJson(String("{\"ssid\":\"" + ssid + "\",\"pass\":\"" + pass + "\"}").c_str()); - prefs.writeSettings(String("/" + name + ".json").c_str()); -#endif - - connect(); -} - -void WifiManager::update() -{ - long curTime = millis(); - if (curTime > lastConnectTime + timeBetweenTries) - { - switch (state) - { - case Connecting: - { - -#if defined ESP32 - if (WiFi.isConnected()) -#elif defined ESP8266 - if (WiFi.status() == WL_CONNECTED) -#endif - setState(Connected); - timeAtConnect = -1; - } - - if (curTime > timeAtConnect + connectionTimeout) - { - setState(ConnectionError); - } - break; - - case Connected: - if (!WiFi.isConnected()) - { - NDBG("Lost connection ! will reconnect soon..."); - if(timeAtConnect == -1) - { - timeAtConnect = millis(); - }else if(curTime > timeAtConnect + connectionTimeout) - { - connect(); - } - } - break; - - default: - break; - } - } -} - -void WifiManager::setState(ConnectionState s) -{ - if (state == s) - return; - - state = s; - sendEvent(); -} - -void WifiManager::connect() -{ - lastConnectTime = millis(); - timeAtConnect = millis(); - - if (state == Connected || state == Hotspot) - WiFi.disconnect(); - - WiFi.mode(WIFI_STA); - -#ifdef ESP32 - WiFi.setAutoConnect(true); - WiFi.setAutoReconnect(true); - WiFi.setSleep(false); - WiFi.setTxPower(WIFI_POWER_19dBm); -#endif - -#ifdef USE_PREFERENCES - prefs.begin(name.c_str(), true); - String ssid = prefs.getString("ssid", ""); - String pass = prefs.getString("pass", ""); - prefs.end(); -#elif defined USE_SETTINGS_MANAGER - prefs.readSettings(String("/" + name + ".json").c_str()); - String ssid = prefs.getString("ssid"); - String pass = prefs.getString("pass"); -#endif - - NDBG("Connecting to " + ssid + " : " + pass + "..."); - WiFi.begin(ssid.c_str(), pass.c_str()); - - setState(Connecting); -} - -void WifiManager::disconnect() -{ - WiFi.disconnect(); - setState(Off); -} - -void WifiManager::disable() -{ - WiFi.disconnect(); - setState(Disabled); -} - -void WifiManager::saveWifiConfig(String ssid, String pass) -{ -#ifdef USE_PREFERENCES - prefs.begin(name.c_str()); - prefs.putString("ssid", ssid); - prefs.putString("pass", pass); - prefs.end(); -#elif defined USE_SETTINGS_MANAGER - prefs.setString("ssid", ssid); - prefs.setString("pass", pass); - prefs.writeSettings(String("/" + name + ".json").c_str()); -#endif - - connect(); -} - -String WifiManager::getIP() -{ - if (state == Connected) - return String(WiFi.localIP()[0]) + - "." + String(WiFi.localIP()[1]) + - "." + String(WiFi.localIP()[2]) + - "." + String(WiFi.localIP()[3]); - - else if (state == Hotspot) - return String(WiFi.softAPIP()[0]) + - "." + String(WiFi.softAPIP()[1]) + - "." + String(WiFi.softAPIP()[2]) + - "." + String(WiFi.softAPIP()[3]); - - return "[noip]"; -} - -bool WifiManager::handleCommand(String command, var *data, int numData) -{ - if (checkCommand(command, "setCredentials", numData, 2)) - { - saveWifiConfig(data[0].stringValue(), data[1].stringValue()); - return true; - } - - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/communication/wifi/WifiManager.h b/Firmware/BentoFlowCreator/src/communication/wifi/WifiManager.h deleted file mode 100644 index 3722c52f..00000000 --- a/Firmware/BentoFlowCreator/src/communication/wifi/WifiManager.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include "../../common/Common.h" - -#ifdef ESP32 -#include -#elif defined ESP8266 -#include -#endif - -class WifiManagerEvent -{ -public: - WifiManagerEvent() {} -}; - -class WifiManager : - public Component, - public EventBroadcaster -{ -public: - - WifiManager(); - ~WifiManager() {} - - ConnectionState state; - -#ifdef USE_PREFERENCES - Preferences prefs; -#elif defined USE_SETTINGS_MANAGER - SettingsManager prefs; -#endif - - const long timeBetweenTries = 500; //ms -#ifdef ESP32 - const long connectionTimeout = 5000; //ms -#else - const long connectionTimeout = 10000; //ms -#endif - - long timeAtConnect; - long lastConnectTime; - - void setState(ConnectionState s); - - void init(); - - void connect(); - void disconnect(); - void disable(); - - void update(); - - void saveWifiConfig(String ssid, String pass); - String getIP(); - - bool handleCommand(String command, var * data, int numData) override; -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/files/FileManager.cpp b/Firmware/BentoFlowCreator/src/files/FileManager.cpp deleted file mode 100644 index 97157d21..00000000 --- a/Firmware/BentoFlowCreator/src/files/FileManager.cpp +++ /dev/null @@ -1,367 +0,0 @@ -#include "FileManager.h" - -const String FileEvent::eventNames[FileEvent::TYPES_MAX]{"uploadStart", "uploadProgress", "uploadComplete", "uploadCancel", "list"}; -bool FileManager::sdIsDetected = false; - -#ifdef HAS_FILES -#ifndef FILES_USE_INTERNAL_MEMORY -SPIClass FileManager::spiSD(HSPI); -#endif -#endif - -FileManager::FileManager() : Component("files"), - isUploading(false), - serverIsEnabled(false) -#ifdef HAS_FILES - , - server(80) -#endif -{ -#ifdef HAS_FILES - server.onNotFound(std::bind(&FileManager::handleNotFound, this)); - server.on("/upload", HTTP_POST, std::bind(&FileManager::returnOK, this), std::bind(&FileManager::handleFileUpload, this)); -#endif -} - -void FileManager::init() -{ - if (sdIsDetected) - return; - -#ifdef HAS_FILES - NDBG("Init"); - -#ifdef FILES_USE_INTERNAL_MEMORY - -#ifdef ESP32 - if(SPIFFS.begin(true))// Start the SPI Flash Files System -#else - if(SPIFFS.begin()) -#endif - { - sdIsDetected = true; - NDBG("SPIFFS initialized."); - listDir("/", 0); - } else - { - NDBG("Error initializing SPIFFS"); - } - -#else - -#ifdef SD_EN - pinMode(SD_EN, OUTPUT); - digitalWrite(SD_EN, SD_POWER_VALUE); -#endif - - pinMode(SD_SCK, INPUT_PULLUP); - pinMode(SD_MISO, INPUT_PULLUP); - pinMode(SD_MOSI, INPUT_PULLUP); - pinMode(SD_CS, INPUT_PULLUP); - - spiSD.begin(SD_SCK, SD_MISO, SD_MOSI, SD_CS); //SCK,MISO,MOSI,ss - - if (SD.begin(SD_CS, spiSD, SDSPEED)) - { - NDBG("SD Card initialized."); - listDir("/", 0); - sdIsDetected = true; - } - else - { - NDBG("SD Card Initialization failed."); - } -#endif //FILES_USE_INTERNAL_MEMORY - - initServer(); - -#endif //HAS_FILES -} - -void FileManager::update() -{ -#ifdef HAS_FILES - if (!serverIsEnabled) - return; - server.handleClient(); -#endif -} - -#ifdef HAS_FILES -File FileManager::openFile(String fileName, bool forWriting, bool deleteIfExists) -{ - - if (forWriting && deleteIfExists) - deleteFileIfExists(fileName); - - if (!fileName.startsWith("/")) - fileName = "/" + fileName; - -#ifdef FILES_USE_INTERNAL_MEMORY - File f = SPIFFS.open(fileName, forWriting ? "w" : "r"); // Open it -#else - File f = SD.open(fileName.c_str(), forWriting ? FILE_WRITE : FILE_READ); -#endif - - DBG("Open file : " + String(f.name())); - return f; - return File(); -} - -void FileManager::deleteFileIfExists(String path) -{ - if (!sdIsDetected) - return; - -#ifdef FILES_USE_INTERNAL_MEMORY - DBG("Delete if exists : "+path); - if (SPIFFS.exists(path)) - { - DBG("File exists, remove : "+path); - SPIFFS.remove(path); - } -#else - if (SD.exists(path.c_str())) - { - SD.remove(path.c_str()); - DBG("Removed file " + path); - } -#endif -} - -String FileManager::listDir(const char *dirname, uint8_t levels) -{ - String result = ""; - -#ifdef FILES_USE_INTERNAL_MEMORY - File root = SPIFFS.open("/","r"); -#else - File root = SD.open(dirname); -#endif - - if (!root) - { - DBG("Failed to open directory"); - return result; - } - - if (!root.isDirectory()) - { - DBG("Not a directory"); - return result; - } - - File file = root.openNextFile(); - while (file) - { - if (file.isDirectory()) - { - DBG(" DIR : " + String(file.name())); - if (levels) - { - result += listDir(file.name(), levels - 1); - } - } - else - { - DBG(" FILE: " + String(file.name())); - result += String(file.name()) + ","; - DBG(" SIZE: " + String(file.size())); - } - file = root.openNextFile(); - } - - return result; -} -#endif //HAS_FILES - -//SERVER -void FileManager::initServer() -{ -#ifdef HAS_FILES - server.begin(); - NDBG("HTTP server started"); - serverIsEnabled = true; -#endif -} - -void FileManager::closeServer() -{ -#ifdef HAS_FILES - server.close(); - NDBG("HTTP server closed"); - serverIsEnabled = false; -#endif -} - -void FileManager::handleFileUpload() -{ -#ifdef HAS_FILES - if (server.uri() != "/upload") - { - return; - } - - HTTPUpload &upload = server.upload(); - - if (upload.status == UPLOAD_FILE_START) - { - uploadedBytes = 0; - //totalBytes = server.header("Content-Length").toInt(); - - uploadingFile = openFile(upload.filename, true, true); - if (uploadingFile) - { - var data; - data.type = 's'; - data.value.s = (char *)uploadingFile.name(); - sendEvent(FileEvent(FileEvent::UploadStart, data)); - } - else - { - NDBG("ERROR WHEN CREATING THE FILE"); - } - - isUploading = true; - } - else if (upload.status == UPLOAD_FILE_WRITE) - { - if (uploadingFile) - { - if (uploadedBytes == 0 && upload.buf[0] == 13 && upload.buf[1] == 10) - { - NDBG("Remove new line nonsense"); - uploadingFile.write(upload.buf + 2, upload.currentSize - 2); - } - else - { - uploadingFile.write(upload.buf, upload.currentSize); - } - - uploadedBytes += upload.currentSize; - float p = uploadedBytes * 1.0f / 1000000; - if (uploadedBytes % 8000 < 4000) - { - var data; - data.type = 'f'; - data.value.f = p; - sendEvent(FileEvent(FileEvent::UploadProgress, data)); - } - } - } - else if (upload.status == UPLOAD_FILE_END) - { - - if (uploadingFile) - { - String n = uploadingFile.name(); - NDBG("Upload total size " + String(upload.totalSize) + " < > " + String(uploadingFile.size())); - uploadingFile.close(); - - var data; - data.type = 's'; - data.value.s = (char *)uploadingFile.name(); - sendEvent(FileEvent(FileEvent::UploadComplete, data)); - isUploading = false; - } - else - { - NDBG("Upload finish ERROR"); - isUploading = false; - } - } - else if (upload.status == UPLOAD_FILE_ABORTED) - { - NDBG("ABOORT !!!!!!!!!!"); - uploadingFile.close(); - isUploading = false; - } -#endif -} - -void FileManager::returnOK() -{ -#ifdef HAS_FILES - server.send(200, "text/plain", "ok"); -#endif -} - -void FileManager::returnFail(String msg) -{ -#ifdef HAS_FILES - NDBG("Failed here"); - server.send(500, "text/plain", msg + "\r\n"); -#endif -} - -void FileManager::handleNotFound() -{ -#ifdef HAS_FILES - NDBG("Not found here"); - server.send(404, "text/plain", "[notfound]"); -#endif -} - -void FileManager::setSDEnabled(bool enable) -{ -#ifdef SD_EN - if (enable) { - digitalWrite(SD_EN, LOW); - NDBG("Enabling SD card"); - } else { - digitalWrite(SD_EN, HIGH); - NDBG("Disabled SD card"); - } -#endif -} - -bool FileManager::handleCommand(String command, var *data, int numData) -{ -#ifdef HAS_FILES - - if (checkCommand(command, "delete", numData, 1)) - { - deleteFileIfExists(data[0].stringValue()); - return true; - } - else if (checkCommand(command, "enable", numData, 1)) - { - setSDEnabled(data[0].intValue() == 1); - return true; - } - else if (checkCommand(command, "deleteFolder", numData, 0)) - { - if (numData > 0) - { - DBG("Deleting folder " + data[0].stringValue()); -#ifdef FILES_USE_INTERNAL_MEMORY - SPIFFS.rmdir(data[0].stringValue()); -#else - SD.rmdir(data[0].stringValue()); -#endif - } - else - { - DBG("Deleting all files"); -#ifdef FILES_USE_INTERNAL_MEMORY - SPIFFS.rmdir("/"); -#else - SD.rmdir("/"); -#endif - } - - return true; - } - else if (checkCommand(command, "list", numData, 0)) - { - var data; - data.type = 's'; - data.value.s = (char *)listDir("/", 0).c_str(); - - sendEvent(FileEvent(FileEvent::FileList, data)); - return true; - } -#endif //HAS_FILES - - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/files/FileManager.h b/Firmware/BentoFlowCreator/src/files/FileManager.h deleted file mode 100644 index 839a7a82..00000000 --- a/Firmware/BentoFlowCreator/src/files/FileManager.h +++ /dev/null @@ -1,91 +0,0 @@ -#pragma once - -#include "../common/Common.h" - -#ifdef HAS_FILES -#ifdef ESP32 -#include -#include -#include -#ifdef FILES_USE_INTERNAL_MEMORY -#include -#endif -#elif defined ESP8266 -#include -#endif - -#endif - -class FileEvent -{ -public: - enum Type - { - UploadStart, - UploadProgress, - UploadComplete, - UploadCancel, - FileList, - TYPES_MAX - }; - static const String eventNames[TYPES_MAX]; - - FileEvent(Type t, var data) : type(t), data(data) {} - - Type type; - var data; -}; - -class FileManager : public Component, public EventBroadcaster -{ -public: - FileManager(); - ~FileManager() {} - -#ifdef HAS_FILES - -#ifdef FILES_USE_INTERNAL_MEMORY - -#else - static SPIClass spiSD; -#endif - - File uploadingFile; - -#ifdef ESP32 - WebServer server; -#elif defined ESP8266 - ESP8266WebServer server; -#endif -#endif - - static bool sdIsDetected; - bool serverIsEnabled; - int uploadedBytes; - bool isUploading; - - void init(); - void update(); - - //File manipulation -#ifdef HAS_FILES - static File openFile(String fileName, bool forWriting = false, bool deleteIfExists = true); - static void deleteFileIfExists(String path); - - static String listDir(const char *dirname, uint8_t levels); - -#endif - - //Server handling - void initServer(); - void closeServer(); - void handleFileUpload(); - void returnOK(); - void returnFail(String msg); - void handleNotFound(); - - // SD card enable - void setSDEnabled(bool enable); - - bool handleCommand(String command, var *data, int numData) override; -}; diff --git a/Firmware/BentoFlowCreator/src/leds/LedManager.cpp b/Firmware/BentoFlowCreator/src/leds/LedManager.cpp deleted file mode 100644 index 6b68f6a3..00000000 --- a/Firmware/BentoFlowCreator/src/leds/LedManager.cpp +++ /dev/null @@ -1,222 +0,0 @@ -#include "LedManager.h" -#include "../MainManager.h" - -LedManager::LedManager() : Component("leds"), - mode(Mode::Direct), - connectionIsAlive(false), -#ifdef LED_COUNT - currentMode(nullptr), - sysLedMode(rgbManager.leds, LED_COUNT), - streamMode(rgbManager.leds, LED_COUNT), - playerMode(rgbManager.leds, LED_COUNT), -#endif - connectedTimer(2000) -{ - -#ifdef LED_COUNT - playerMode.addListener(std::bind(&LedManager::playerEvent, this, std::placeholders::_1)); - connectedTimer.addListener(std::bind(&LedManager::timerEvent, this, std::placeholders::_1)); -#endif -} - -void LedManager::init() -{ -#ifdef LED_COUNT - -#ifdef GENERATE_LED_INDEX_MAP - generateLedIndexMap(); -#endif - - rgbManager.init(); - rgbManager.addListener(std::bind(&LedManager::rgbLedsEvent, this, std::placeholders::_1)); - sysLedMode.init(); - irManager.init(); -#endif - - setMode(System); -} - -void LedManager::update() -{ -#ifdef LED_COUNT - // if (mode == System) rgbManager.clear(); - - bool shouldUpdateLeds = true; - - if (connectionIsAlive || playerMode.isPlaying) - { - if (currentMode != nullptr) - shouldUpdateLeds = currentMode->update(); - } - else - { - rgbManager.point(CHSV(0, 255, cos(millis() / 200.0f) * 127 + 127), .5f, .05f); - shouldUpdateLeds = true; - } - - MainManager::instance->scripts.update(); - // if (shouldUpdateLeds) - - rgbManager.update(); - - irManager.update(); - - connectedTimer.update(); -#endif -} - -void LedManager::setMode(Mode m) -{ - NDBG("LED Set mode "+String((int)m)); - -#ifdef LED_COUNT - if (m == mode) - return; - - if (currentMode != nullptr) - { - currentMode->stop(); - } - - mode = m; - - switch (mode) - { - case Direct: - currentMode = nullptr; - break; - - case System: - currentMode = &sysLedMode; - break; - - case Stream: - currentMode = &streamMode; - break; - - case Player: - currentMode = &playerMode; - break; - - default: - break; - } - - rgbManager.clear(); - - if (currentMode != nullptr) - { - currentMode->start(); - } -#endif -} - -void LedManager::shutdown(CRGB color) -{ -#ifndef NO_ANIMATIONS - -#ifdef LED_COUNT - CRGB initLeds[LED_COUNT]; - memcpy(initLeds, rgbManager.leds, LED_COUNT * sizeof(CRGB)); - - rgbManager.setLedEnabled(true); - for (int i = 0; i < 255; i++) - { - for (int led = 0; led < LED_COUNT; led++) - rgbManager.setLed(led, blend(initLeds[led], color, i)); - - rgbManager.update(); - FastLED.delay(1); - } - - FastLED.delay(50); - - for (float i = 0; i <= 1; i += .01f) - { - rgbManager.fillRange(color, i, 1, true); - rgbManager.update(); - FastLED.delay(2); - } - - rgbManager.clear(); - delay(30); - rgbManager.update(); - rgbManager.shutdown(); - -#endif // LED_COUNT - -#endif // NO_ANIMATIONS - - delay(100); -} - -void LedManager::setConnectionState(ConnectionState state) -{ -#ifdef LED_COUNT - if (state == PingDead || state == PingAlive || state == Connected || state == Connecting) - { - connectionIsAlive = state == PingAlive || state == Connected || state == Connecting; - rgbManager.clear(); - if (state == PingAlive || state == PingDead) - return; - } - - setMode(System); - sysLedMode.setConnectionState(state); - - if (state == Connected || state == Hotspot) - connectedTimer.start(); - else - connectedTimer.stop(); -#endif -} - -#ifdef LED_COUNT -void LedManager::rgbLedsEvent(const RGBLedsEvent &e) -{ - if (e.type == RGBLedsEvent::ASK_FOCUS) - setMode(Direct); -} - -void LedManager::playerEvent(const PlayerEvent &e) -{ - if (e.type == PlayerEvent::Load || e.type == PlayerEvent::Play) - { - setMode(Player); - } -} -#endif - -void LedManager::timerEvent(const TimerEvent &e) -{ - if (e.timer == &connectedTimer) - setMode(Stream); -} - -bool LedManager::handleCommand(String command, var *data, int numData) -{ -#ifdef LED_COUNT - if (checkCommand(command, "mode", numData, 1)) - { - if (data[0].type == 's') - { - if (data[0].stringValue() == "direct") - setMode(Direct); - else if (data[0].stringValue() == "system") - setMode(System); - else if (data[0].stringValue() == "stream") - setMode(Stream); - else if (data[0].stringValue() == "player") - setMode(Player); - } - else - { - setMode((Mode)data[0].intValue()); - } - - return true; - } -#endif - - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/LedManager.h b/Firmware/BentoFlowCreator/src/leds/LedManager.h deleted file mode 100644 index 2fef9693..00000000 --- a/Firmware/BentoFlowCreator/src/leds/LedManager.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "system/SystemLedMode.h" -#include "stream/StreamMode.h" -#include "player/PlayerMode.h" - -#include "output/RGBLedsManager.h" -#include "output/IRLedsManager.h" - -class LedManager : public Component { -public: - LedManager(); - ~LedManager(){} - - enum Mode { Direct, System, Stream, Player }; - Mode mode; - - //source -#ifdef LED_COUNT - LedMode * currentMode; - SystemLedMode sysLedMode; - StreamMode streamMode; - PlayerMode playerMode; - //out - RGBLedsManager rgbManager; -#endif - - IRLedsManager irManager; - - //timers - Timer connectedTimer; - - //ping feedback - bool connectionIsAlive; - - void init(); - void update(); - - void setMode(Mode m); - - void shutdown(CRGB color); - - void setConnectionState(ConnectionState state); - -#ifdef LED_COUNT - void rgbLedsEvent(const RGBLedsEvent &e); - void playerEvent(const PlayerEvent &e); -#endif - - bool handleCommand(String command, var *data, int numData) override; - void timerEvent(const TimerEvent &e); -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/LedMode.h b/Firmware/BentoFlowCreator/src/leds/LedMode.h deleted file mode 100644 index 831df88d..00000000 --- a/Firmware/BentoFlowCreator/src/leds/LedMode.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once -#include "../common/Common.h" -#include "output/LedHelpers.h" - -class LedMode : public Component -{ -public: - LedMode(const String &name, CRGB * leds, int numLeds) : Component(name), isActive(false), leds(leds), numLeds(numLeds) {} - virtual ~LedMode() {} - - bool isActive; - - CRGB * leds; - int numLeds; - - virtual void init() {} - virtual bool update() { return false; } - - virtual void start() { NDBG("Start"); isActive = true; } - virtual void stop() { NDBG("Stop"); isActive = false; } -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/output/DMX/ESPDMX.cpp b/Firmware/BentoFlowCreator/src/leds/output/DMX/ESPDMX.cpp deleted file mode 100644 index e7db87cf..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/DMX/ESPDMX.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// - - - - - -// ESPDMX - A Arduino library for sending and receiving DMX using the builtin serial hardware port. -// ESPDMX.cpp: Library implementation file -// -// Copyright (C) 2015 Rick -// This work is licensed under a GNU style license. -// -// Last change: Marcel Seerig -// -// Documentation and samples are available at https://github.com/Rickgg/ESP-Dmx -// - - - - - - -/* ----- LIBRARIES ----- */ -#include "ESPDMX.h" - -#ifdef LED_USE_DMX - -#ifdef ESP8266 - -#define dmxMaxChannel 512 -#define defaultMax 32 - -#define DMXSPEED 250000 -#define DMXFORMAT SERIAL_8N2 -#define BREAKSPEED 83333 -#define BREAKFORMAT SERIAL_8N1 - -bool dmxStarted = false; -int sendPin = 2; //dafault on ESP8266 - -//DMX value array and size. Entry 0 will hold startbyte -uint8_t dmxData[dmxMaxChannel] = {}; -int chanSize; - - -void DMXESPSerial::init() { - chanSize = defaultMax; - - Serial1.begin(DMXSPEED); - pinMode(sendPin, OUTPUT); - dmxStarted = true; -} - -// Set up the DMX-Protocol -void DMXESPSerial::init(int chanQuant) { - - if (chanQuant > dmxMaxChannel || chanQuant <= 0) { - chanQuant = defaultMax; - } - - chanSize = chanQuant; - - Serial1.begin(DMXSPEED); - pinMode(sendPin, OUTPUT); - dmxStarted = true; -} - -// Function to read DMX data -uint8_t DMXESPSerial::read(int Channel) { - if (dmxStarted == false) init(); - - if (Channel < 1) Channel = 1; - if (Channel > dmxMaxChannel) Channel = dmxMaxChannel; - return(dmxData[Channel]); -} - -// Function to send DMX data -void DMXESPSerial::write(int Channel, uint8_t value) { - if (dmxStarted == false) init(); - - if (Channel < 1) Channel = 1; - if (Channel > chanSize) Channel = chanSize; - if (value < 0) value = 0; - if (value > 255) value = 255; - - dmxData[Channel] = value; -} - -void DMXESPSerial::end() { - delete dmxData; - chanSize = 0; - Serial1.end(); - dmxStarted == false; -} - -void DMXESPSerial::update() { - if (dmxStarted == false) init(); - - //Send break - digitalWrite(sendPin, HIGH); - Serial1.begin(BREAKSPEED, BREAKFORMAT); - Serial1.write(0); - Serial1.flush(); - delay(1); - Serial1.end(); - - //send data - Serial1.begin(DMXSPEED, DMXFORMAT); - digitalWrite(sendPin, LOW); - Serial1.write(dmxData, chanSize); - Serial1.flush(); - delay(1); - Serial1.end(); -} - -// Function to update the DMX bus -#endif - - -#endif // LED_USE_DMX \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/output/DMX/ESPDMX.h b/Firmware/BentoFlowCreator/src/leds/output/DMX/ESPDMX.h deleted file mode 100644 index 02e117cf..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/DMX/ESPDMX.h +++ /dev/null @@ -1,37 +0,0 @@ -// - - - - - -// ESPDMX - A Arduino library for sending and receiving DMX using the builtin serial hardware port. -// ESPDMX.cpp: Library implementation file -// -// Copyright (C) 2015 Rick -// This work is licensed under a GNU style license. -// -// Last change: Marcel Seerig -// -// Documentation and samples are available at https://github.com/Rickgg/ESP-Dmx -// - - - - - - -#pragma once -#include "../../../common/Common.h" - -#ifdef LED_USE_DMX - -#ifdef ESP8266 - -#include - -// ---- Methods ---- - -class DMXESPSerial { -public: - void init(); - void init(int MaxChan); - uint8_t read(int Channel); - void write(int channel, uint8_t value); - void update(); - void end(); -}; - -#endif - - -#endif // LED_USE_DMX diff --git a/Firmware/BentoFlowCreator/src/leds/output/DMX/SparkFunDMX.cpp b/Firmware/BentoFlowCreator/src/leds/output/DMX/SparkFunDMX.cpp deleted file mode 100644 index 553b27ca..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/DMX/SparkFunDMX.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/****************************************************************************** -DMXESPSerial.h -Arduino Library for the SparkFun ESP32 LED to DMX Shield -Andy England @ SparkFun Electronics -7/22/2019 - -Development environment specifics: -Arduino IDE 1.6.4 - -This code is released under the [MIT License](http://opensource.org/licenses/MIT). -Please review the LICENSE.md file included with this example. If you have any questions -or concerns with licensing, please contact techsupport@sparkfun.com. -Distributed as-is; no warranty is given. -******************************************************************************/ - -/* ----- LIBRARIES ----- */ -#include "SparkFunDMX.h" - -#ifdef LED_USE_DMX - -#ifdef ESP32 - -#include - -#define dmxMaxChannel 513 -#define defaultMax 32 - -#define DMXSPEED 250000 -#define DMXFORMAT SERIAL_8N2 - -int enablePin = 21; //dafault on ESP32 -int rxPin = 16; -int txPin = 17; - -//DMX value array and size. Entry 0 will hold startbyte -uint8_t dmxData[dmxMaxChannel] = {}; -int chanSize; -int currentChannel = 0; - -HardwareSerial DMXSerial(2); - -/* Interrupt Timer for DMX Receive */ -hw_timer_t * timer = NULL; -portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED; - -volatile int _interruptCounter; -volatile bool _startCodeDetected = false; - -volatile bool ledPin = false; - -/* Start Code is detected by 21 low interrupts */ -void IRAM_ATTR onTimer() { - if (digitalRead(rxPin) == 1) - { - _interruptCounter = 0; //If the RX Pin is high, we are not in an interrupt - } - else - { - _interruptCounter++; - } - if (_interruptCounter > 9) - { - portENTER_CRITICAL_ISR(&timerMux); - _startCodeDetected = true; - DMXSerial.begin(DMXSPEED, DMXFORMAT, rxPin, txPin); - portEXIT_CRITICAL_ISR(&timerMux); - _interruptCounter = 0; - } -} - -void DMXESPSerial::initRead(int chanQuant) { - - timer = timerBegin(0, 1, true); - timerAttachInterrupt(timer, &onTimer, true); - timerAlarmWrite(timer, 320, true); - timerAlarmEnable(timer); - _READWRITE = _READ; - if (chanQuant > dmxMaxChannel || chanQuant <= 0) - { - chanQuant = defaultMax; - } - chanSize = chanQuant; - pinMode(13, OUTPUT); - pinMode(enablePin, OUTPUT); - digitalWrite(enablePin, LOW); - pinMode(rxPin, INPUT); -} - -// Set up the DMX-Protocol -void DMXESPSerial::initWrite (int chanQuant) { - - DBG("DMXESPSerial init"); - _READWRITE = _WRITE; - if (chanQuant > dmxMaxChannel || chanQuant <= 0) { - chanQuant = defaultMax; - } - - chanSize = chanQuant + 1; //Add 1 for start code - - DMXSerial.begin(DMXSPEED, DMXFORMAT, rxPin, txPin); - pinMode(enablePin, OUTPUT); - digitalWrite(enablePin, HIGH); - - DBG("DMXESPSerial is initialized"); -} - -// Function to read DMX data -uint8_t DMXESPSerial::read(int Channel) { - if (Channel > chanSize) Channel = chanSize; - return(dmxData[Channel - 1]); //subtract one to account for start byte -} - -// Function to send DMX data -void DMXESPSerial::write(int Channel, uint8_t value) { - if (Channel < 0) Channel = 0; - if (Channel > chanSize) chanSize = Channel; - dmxData[0] = 0; - dmxData[Channel] = value; //add one to account for start byte -} - -void DMXESPSerial::update() { - if (_READWRITE == _WRITE) - { - DMXSerial.begin(DMXSPEED, DMXFORMAT, rxPin, txPin);//Begin the Serial port - pinMatrixOutDetach(txPin, false, false); //Detach our - pinMode(txPin, OUTPUT); - digitalWrite(txPin, LOW); //88 uS break - delayMicroseconds(88); - digitalWrite(txPin, HIGH); //4 Us Mark After Break - delayMicroseconds(1); - pinMatrixOutAttach(txPin, U2TXD_OUT_IDX, false, false); - - DMXSerial.write(dmxData, chanSize); - DMXSerial.flush(); - DMXSerial.end();//clear our DMX array, end the Hardware Serial port - } - else if (_READWRITE == _READ)//In a perfect world, this function ends serial communication upon packet completion and attaches RX to a CHANGE interrupt so the start code can be read again - { - if (_startCodeDetected == true) - { - while (DMXSerial.available()) - { - dmxData[currentChannel++] = DMXSerial.read(); - } - if (currentChannel > chanSize) //Set the channel counter back to 0 if we reach the known end size of our packet - { - - portENTER_CRITICAL(&timerMux); - _startCodeDetected = false; - DMXSerial.flush(); - DMXSerial.end(); - portEXIT_CRITICAL(&timerMux); - currentChannel = 0; - } - } - } -} - -// Function to update the DMX bus - -#endif - -#endif // LED_USE_DMX \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/output/DMX/SparkFunDMX.h b/Firmware/BentoFlowCreator/src/leds/output/DMX/SparkFunDMX.h deleted file mode 100644 index 26cf7ea3..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/DMX/SparkFunDMX.h +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************** -SparkFunDMX.h -Arduino Library for the SparkFun ESP32 LED to DMX Shield -Andy England @ SparkFun Electronics -7/22/2019 - -Development environment specifics: -Arduino IDE 1.6.4 - -This code is released under the [MIT License](http://opensource.org/licenses/MIT). -Please review the LICENSE.md file included with this example. If you have any questions -or concerns with licensing, please contact techsupport@sparkfun.com. -Distributed as-is; no warranty is given. -******************************************************************************/ - -#pragma once - -#include "../../../common/Common.h" - -#ifdef LED_USE_DMX - -#ifdef ESP32 - -#include - -// ---- Methods ---- - -class DMXESPSerial { -public: - void initRead(int maxChan); - void initWrite(int maxChan); - void init(int maxChan = 32) { initWrite(maxChan); } - uint8_t read(int Channel); - void write(int channel, uint8_t value); - void update(); -private: - uint8_t _startCodeValue = 0xFF; - bool _READ = true; - bool _WRITE = false; - bool _READWRITE; -}; - -#endif - -#endif // LED_USE_DMX \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/output/IRLedsManager.cpp b/Firmware/BentoFlowCreator/src/leds/output/IRLedsManager.cpp deleted file mode 100644 index 728a4cfa..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/IRLedsManager.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "IRLedsManager.h" - -IRLedsManager::IRLedsManager() : Component("ir"), brightness(0) { - -} - -IRLedsManager::~IRLedsManager() { - -} - -void IRLedsManager::init() { -#ifdef HAS_IR - ledcSetup(IR_CHANNEL, IR_FREQ, IR_PWM_RESOLUTION); - ledcAttachPin(IR_TX_PIN, IR_CHANNEL); - ledcWrite(IR_CHANNEL, 0); -#endif -} - -void IRLedsManager::update() { - -} - -void IRLedsManager::setBrightness(float value) { - if(brightness == value) return; - brightness = min(max(value,0.f),1.f); -#ifdef HAS_IR - ledcWrite(IR_CHANNEL, (int)(brightness * IR_MAX_POWER)); -#endif -} - -bool IRLedsManager::handleCommand(String command, var * data, int numData) { - NDBG("Handle command : "+command); - if (checkCommand(command, "brightness", numData, 1)) - { - setBrightness(data[0].floatValue()); - return true; - } - - return false; -} diff --git a/Firmware/BentoFlowCreator/src/leds/output/IRLedsManager.h b/Firmware/BentoFlowCreator/src/leds/output/IRLedsManager.h deleted file mode 100644 index 98e2bbfe..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/IRLedsManager.h +++ /dev/null @@ -1,15 +0,0 @@ -#include "../../common/Common.h" - -class IRLedsManager : public Component { -public: - IRLedsManager(); - ~IRLedsManager(); - - float brightness; - - void init(); - void update(); - - void setBrightness(float value); - bool handleCommand(String command, var * data, int numData) override; -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/output/LedHelpers.cpp b/Firmware/BentoFlowCreator/src/leds/output/LedHelpers.cpp deleted file mode 100644 index f9088289..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/LedHelpers.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "LedHelpers.h" -#include "../../common/DebugHelpers.h" -#include "../../common/config/Config.h" - -void LedHelpers::clear(CRGB *leds, int numLeds) -{ -#ifdef LED_COUNT - memset(leds, 0, numLeds * sizeof(CRGB)); -#endif -} - -void LedHelpers::fillAll(CRGB *leds, int numLeds, CRGB c) -{ - LedHelpers::fillRange(leds, numLeds, c, 0, 1); -} - -void LedHelpers::fillRange(CRGB *leds, int numLeds, CRGB c, float start, float end, bool doClear) -{ -#ifdef LED_COUNT - if (doClear) - clear(leds, numLeds); - - int s = max(min(start, end), 0.f) * (numLeds - 1); - int e = min(max(start, end), 1.f) * (numLeds - 1); - - for (int i = s; i <= e; i++) - { - leds[LEDMAP(i)] += c; - } -#endif -} - -void LedHelpers::point(CRGB *leds, int numLeds, CRGB c, float pos, float radius, bool doClear) -{ -#ifdef LED_COUNT - - if (doClear) - clear(leds, numLeds); - - if (radius == 0) - return; - - for (int i = 0; i < numLeds; i++) - { - float rel = i * 1.0f / max(numLeds - 1,1); - float fac = max(1 - (std::abs((float)(pos - rel)) / radius), 0.f); - leds[LEDMAP(i)] += CRGB(c.r * fac, c.g * fac, c.b * fac); - } -#endif -} - - -void LedHelpers::setLed(CRGB *leds, int index, CRGB c) -{ -#ifdef LED_COUNT - leds[LEDMAP(index)] = c; -#endif -} diff --git a/Firmware/BentoFlowCreator/src/leds/output/LedHelpers.h b/Firmware/BentoFlowCreator/src/leds/output/LedHelpers.h deleted file mode 100644 index 8c7a1d63..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/LedHelpers.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#ifdef LED_SEPARATE_CHANNELS -#elif defined LED_USE_DMX -#ifdef ESP8266 -#include "DMX/ESPDMX.h" -#elif defined ESP32 -#include "DMX/SparkfunDMX.h" -#endif // 8266/32 -#else -#endif -#include "FastLED/FastLED.h" - -class LedHelpers -{ -public: - static void clear(CRGB * leds, int numLeds); - static void fillAll(CRGB * leds, int numLeds, CRGB c); - static void fillRange(CRGB * leds, int numLeds, CRGB c, float start, float end, bool clear = true); - static void point(CRGB * leds, int numLeds, CRGB c, float pos, float radius, bool clear = true); - static void setLed(CRGB * leds, int index, CRGB c); - static void show(); -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/output/RGBLedsManager.cpp b/Firmware/BentoFlowCreator/src/leds/output/RGBLedsManager.cpp deleted file mode 100644 index e0d128be..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/RGBLedsManager.cpp +++ /dev/null @@ -1,305 +0,0 @@ -#include "RGBLedsManager.h" - -const String RGBLedsEvent::eventNames[RGBLedsEvent::TYPES_MAX]{"askFocus", "brightnessStatus"}; - -RGBLedsManager::RGBLedsManager() : Component("rgb"), - globalBrightness(1), - ledEnabled(false) -#ifdef LED_USE_DMX - , - timeSinceLastSend(0) -#endif -{ -#ifdef LED_DEFAULT_BRIGHTNESS - globalBrightness = LED_DEFAULT_BRIGHTNESS; -#endif -} - -void RGBLedsManager::init() -{ -#ifdef LED_COUNT -#ifdef LED_SEPARATE_CHANNELS - for (int i = 0; i < LED_COUNT; i++) - { - const RGBLedPins l = rgbLedPins[i]; - if (l.rPin >= 0) - pinMode(l.rPin, OUTPUT); - if (l.gPin >= 0) - pinMode(l.gPin, OUTPUT); - if (l.bPin >= 0) - pinMode(l.bPin, OUTPUT); -#ifdef ESP32 - int startChannel = i * 3; - if (l.rPin >= 0) - ledcSetup(startChannel, LED_PWM_FREQUENCY, LED_PWM_RESOLUTION); - if (l.gPin >= 0) - ledcSetup(startChannel + 1, LED_PWM_FREQUENCY, LED_PWM_RESOLUTION); - if (l.bPin >= 0) - ledcSetup(startChannel + 2, LED_PWM_FREQUENCY, LED_PWM_RESOLUTION); - - if (l.rPin >= 0) - ledcAttachPin(l.rPin, startChannel); - if (l.gPin >= 0) - ledcAttachPin(l.gPin, startChannel + 1); - if (l.bPin >= 0) - ledcAttachPin(l.bPin, startChannel + 2); -#endif - } -#elif defined LED_USE_DMX - - dmx.init(); -#else - - #ifdef LED_FET_PIN - pinMode(LED_FET_PIN, OUTPUT); - #endif - - setLedEnabled(true); - -#if defined LED_CLK_PIN - FastLED.addLeds(leds, LED_COUNT).setCorrection(TypicalLEDStrip); -#else -#ifdef LED_NUM_STRIPS -#if LED_NUM_STRIPS >= 1 - FastLED.addLeds(leds + LED_START1, LED_COUNT1).setCorrection(TypicalLEDStrip); - -#if LED_NUM_STRIPS >= 2 - FastLED.addLeds(leds + LED_START2, LED_COUNT2).setCorrection(TypicalLEDStrip); - -#if LED_NUM_STRIPS >= 3 - FastLED.addLeds(leds + LED_START3, LED_COUNT3).setCorrection(TypicalLEDStrip); - -#if LED_NUM_STRIPS >= 4 - FastLED.addLeds(leds + LED_START4, LED_COUNT4).setCorrection(TypicalLEDStrip); - -#if LED_NUM_STRIPS >= 5 - FastLED.addLeds(leds + LED_START5, LED_COUNT5).setCorrection(TypicalLEDStrip); - -#endif //5 -#endif //4 -#endif //3 -#endif //2 -#endif //1 -#else - FastLED.addLeds(leds, LED_COUNT).setCorrection(TypicalLEDStrip); -#endif -#endif - -#if defined LED2_TYPE -#if defined LED2_CLK_PIN - FastLED.addLeds(leds, LED2_COUNT).setCorrection(TypicalLEDStrip); -#else - FastLED.addLeds(leds, LED2_COUNT).setCorrection(TypicalLEDStrip); -#endif //LED2_CLK -#endif //LED2 - -#endif - -#ifdef USE_PREFERENCES - prefs.begin(name.c_str()); - setBrightness(prefs.getFloat("brightness", globalBrightness), false); - prefs.end(); -#elif defined USE_SETTINGS_MANAGER - //init once with a json if it doesn't exist yet - prefs.readSettings(String("/" + name + ".json").c_str()); - float brightness = prefs.getFloat("brightness", globalBrightness); - prefs.loadJson(String("{\"brightness\":\"" + String(brightness) + "\"}").c_str()); - prefs.writeSettings(String("/" + name + ".json").c_str()); - - //actually read the data - prefs.readSettings(String("/" + name + ".json").c_str()); - setBrightness(prefs.getFloat("brightness", globalBrightness), false); -#endif - -#endif //LED_COUNT -} - -void RGBLedsManager::update() -{ -#ifdef LED_COUNT -#ifdef LED_SEPARATE_CHANNELS - for (int i = 0; i < LED_COUNT; i++) - { -#ifndef PWMVAL - int startChannel = i * 3; - ledcWrite(startChannel, map(leds[i].r * globalBrightness, 0, 255, 0, 1023)); - ledcWrite(startChannel + 1, map(leds[i].g * globalBrightness, 0, 255, 0, 1023)); - ledcWrite(startChannel + 2, map(leds[i].b * globalBrightness, 0, 255, 0, 1023)); -#else - const RGBLedPins l = rgbLedPins[i]; - analogWrite(l.rPin, PWMVAL(leds[i].r * globalBrightness)); - analogWrite(l.gPin, PWMVAL(leds[i].g * globalBrightness)); - analogWrite(l.bPin, PWMVAL(leds[i].b * globalBrightness)); -#endif - } -#elif defined LED_USE_DMX - - long t = millis(); - if (t > timeSinceLastSend + updateBreakTime) - { - for (int i = 0; i < LED_COUNT; i++) - { - dmx.write(dmxStartChannels[i], leds[i].r * globalBrightness); - dmx.write(dmxStartChannels[i] + 1, leds[i].g * globalBrightness); - dmx.write(dmxStartChannels[i] + 2, leds[i].b * globalBrightness); - } - - dmx.update(); - timeSinceLastSend = t; - } - -#else - - // NDBG("FastLed.show()"); - /*if(ledEnabled) */ - FastLED.show(); - -#endif -#endif //LED_COUNT -} - -void RGBLedsManager::shutdown() -{ - setLedEnabled(false); -} - -void RGBLedsManager::setBrightness(float value, bool save) -{ - globalBrightness = min(max(value, 0.f), 1.f); - -#ifdef LED_COUNT -#ifdef LED_SEPARATE_CHANNELS -#elif defined LED_USE_DMX -#else - FastLED.setBrightness((int)(globalBrightness * LED_MAX_BRIGHTNESS)); - FastLED.show(); -#endif - if (save) - { -#ifdef USE_PREFERENCES - prefs.begin(name.c_str()); - prefs.putFloat("brightness", globalBrightness); - prefs.end(); -#elif defined USE_SETTINGS_MANAGER - prefs.readSettings(String("/" + name + ".json").c_str()); - prefs.setFloat("brightness", globalBrightness); -#endif - } -#endif //LED_COUNT -} - -void RGBLedsManager::setLedEnabled(bool val) -{ - ledEnabled = val; -#ifdef LED_EN_PIN - NDBG("Set Led Enabled : "+String(val)); - pinMode(LED_EN_PIN, OUTPUT); //enable LEDs - digitalWrite(LED_EN_PIN, val); -#endif - -#ifdef LED_USE_FET - NDBG("Set Led Enabled (FET) : "+String(val)); - digitalWrite(LED_FET_PIN, val); - pinMode(LED_DATA_PIN, val ? OUTPUT : INPUT); -#endif -} - -bool RGBLedsManager::handleCommand(String command, var *data, int numData) -{ -#ifdef LED_COUNT - if (checkCommand(command, "enabled", numData, 1)) - { - setLedEnabled(data[0].intValue()); - return true; - } - else if (checkCommand(command, "brightness", numData, 1)) - { - setBrightness(data[0].floatValue(), true); - return true; - } - else if (checkCommand(command, "fill", numData, 3)) - { - CRGB c((int)(data[0].floatValue() * 255), (int)(data[1].floatValue() * 255), (int)(data[2].floatValue() * 255)); - if (numData >= 4) - c.nscale8((int)(data[3].floatValue() * 255)); - sendEvent(RGBLedsEvent(RGBLedsEvent::ASK_FOCUS)); - fillAll(c); - return true; - } - else if (checkCommand(command, "range", numData, 5)) - { - bool hasAlpha = numData >= 6; - CRGB c((int)(data[0].floatValue() * 255), (int)(data[1].floatValue() * 255), (int)(data[2].floatValue() * 255)); - if (hasAlpha) - c.nscale8((int)(data[3].floatValue() * 255)); - fillRange(c, data[hasAlpha ? 4 : 3].floatValue(), data[hasAlpha ? 5 : 4].floatValue()); - sendEvent(RGBLedsEvent(RGBLedsEvent::ASK_FOCUS)); - return true; - } - else if (checkCommand(command, "point", numData, 5)) - { - bool hasAlpha = numData >= 6; - CRGB c((int)(data[0].floatValue() * 255), (int)(data[1].floatValue() * 255), (int)(data[2].floatValue() * 255)); - if (hasAlpha) - c.nscale8((int)(data[3].floatValue() * 255)); - point(c, data[hasAlpha ? 4 : 3].floatValue(), data[hasAlpha ? 5 : 4].floatValue()); - sendEvent(RGBLedsEvent(RGBLedsEvent::ASK_FOCUS)); - return true; - } - else if (checkCommand(command, "brightnessStatus", numData, 0)) - { - float msgData[1] = { globalBrightness }; - - sendEvent(RGBLedsEvent(RGBLedsEvent::BrightnessStatus, msgData, 1)); - return true; - } -#endif - - return false; -} - -//Helpers -void RGBLedsManager::clear() -{ -#ifdef LED_COUNT -#if defined LED_SEPARATE_CHANNELS || defined LED_USE_DMX - for (int i = 0; i < LED_COUNT; i++) - leds[i] = CRGB::Black; -#else - FastLED.clear(); -#endif -#endif //LED_COUNT -} - -void RGBLedsManager::fillAll(CRGB c) -{ - fillRange(c, 0, 1); -} - -void RGBLedsManager::fillRange(CRGB c, float start, float end, bool doClear) -{ -#ifdef LED_COUNT - if (doClear) - clear(); - LedHelpers::fillRange(leds, LED_COUNT, c, start, end); -#endif -} - -void RGBLedsManager::point(CRGB c, float pos, float fade, bool doClear) -{ -#ifdef LED_COUNT - if (doClear) - clear(); - LedHelpers::point(leds, LED_COUNT, c, pos, fade, doClear); -#endif -} - -void RGBLedsManager::setLed(int index, CRGB c) -{ -#ifdef LED_COUNT - - if (index < 0 || index >= LED_COUNT) - return; - leds[index] = c; -#endif -} diff --git a/Firmware/BentoFlowCreator/src/leds/output/RGBLedsManager.h b/Firmware/BentoFlowCreator/src/leds/output/RGBLedsManager.h deleted file mode 100644 index 2c3ce2c3..00000000 --- a/Firmware/BentoFlowCreator/src/leds/output/RGBLedsManager.h +++ /dev/null @@ -1,60 +0,0 @@ -#pragma once - -#include "../../common/Common.h" -#include "LedHelpers.h" - -class RGBLedsEvent -{ -public: - enum Type { ASK_FOCUS, BrightnessStatus, TYPES_MAX }; - static const String eventNames[TYPES_MAX]; - - RGBLedsEvent(Type t, float * data = nullptr, int numData = 0) : type(t), data(data), numData(numData) {} - - Type type; - float * data; - int intData; - int numData; -}; - -class RGBLedsManager : public Component, public EventBroadcaster -{ -public: - RGBLedsManager(); - -#ifdef LED_COUNT - CRGB leds[LED_COUNT]; - #ifdef LED_USE_DMX - DMXESPSerial dmx; - const int updateBreakTime = 20; //40ms break time - long timeSinceLastSend; - #endif -#endif - - float globalBrightness; - bool ledEnabled; - - void init(); - void update(); - void shutdown(); - - void setBrightness(float value, bool save = false); - bool handleCommand(String command, var *data, int numData) override; - - void setLedEnabled(bool val); - - //Helpers - void clear(); - void fillAll(CRGB c); - void fillRange(CRGB c, float start, float end, bool clear = true); - void point(CRGB c, float pos, float radius, bool clear = true); - - void setLed(int index, CRGB c); - -private: -#ifdef USE_PREFERENCES - Preferences prefs; -#elif defined USE_SETTINGS_MANAGER - SettingsManager prefs; -#endif -}; diff --git a/Firmware/BentoFlowCreator/src/leds/player/PlayerMode.cpp b/Firmware/BentoFlowCreator/src/leds/player/PlayerMode.cpp deleted file mode 100644 index cb13f0eb..00000000 --- a/Firmware/BentoFlowCreator/src/leds/player/PlayerMode.cpp +++ /dev/null @@ -1,371 +0,0 @@ - -#include "PlayerMode.h" - -#ifdef LED_COUNT - -PlayerMode::PlayerMode(CRGB *leds, int numLeds) : LedMode("player", leds, numLeds), - fps(0), - totalTime(0), - totalFrames(0), - groupID(-1), - localID(-1), - idMode(false), - loopShow(false), - isPlaying(false), - curTimeMs(0), - prevTimeMs(0), - timeSinceLastSeek(0), - timeToSeek(0) -{ -} - -PlayerMode::~PlayerMode() -{ - //free(ledBuffer); -} - -void PlayerMode::init() -{ -} - -bool PlayerMode::update() -{ -#ifdef HAS_FILES - if (!curFile) - return false; - - if (idMode) - { - showIdFrame(); - return true; - } - - if (timeToSeek != -1 && millis() > timeSinceLastSeek + 20) - { - seek(timeToSeek); - timeToSeek = -1; - timeSinceLastSeek = millis(); - } - - if (!isPlaying) - { - showBlackFrame(); - return true; - } - - return playFrame(); -#else - showBlackFrame(); - return true; -#endif -} - -bool PlayerMode::playFrame() -{ -#ifdef HAS_FILES - if (curFile.available() < FRAME_SIZE) - { - DBG("End of show"); - if (loopShow) - { - DBG("Loop"); - sendEvent(PlayerEvent(PlayerEvent::Loop)); - play(0); - } - else - { - isPlaying = false; - return false; - } - } - - long mil = millis(); - curTimeMs += mil - prevTimeMs; - prevTimeMs = mil; - - long fPos = curFile.position(); - long pos = msToBytePos(curTimeMs); - - if (pos < 0) - return false; - if (pos < fPos) - return false; //waiting for frame - - int skippedFrames = 0; - while (fPos < pos) - { - skippedFrames++; - curFile.read((uint8_t *)leds, FRAME_SIZE); - fPos = curFile.position(); - if (curFile.available() < FRAME_SIZE) - { - DBG("Player overflowed, should not be here"); - return false; - } - } - - if(skippedFrames > 0) - { - DBG("Skipped frame " + String(skippedFrames)); - } - - if (fPos != pos) - { - DBG("Error, position is " + String(fPos) + ", expected " + String(pos)); - } - - curFile.read((uint8_t *)leds, FRAME_SIZE); - - //showCurrentFrame(); -#endif - - return true; -} - -void PlayerMode::showBlackFrame() -{ - LedHelpers::clear(leds, numLeds); -} - -void PlayerMode::showIdFrame() -{ - if (groupID == -1 || localID == -1) - return; - LedHelpers::fillRange(leds, numLeds, groupColor, .9f, 1); - CRGB c = rgb2hsv_approximate(CHSV(localID * 255.0f / 12, 255, 255)); - LedHelpers::fillRange(leds, numLeds, c, 0, localID * 1.f / numLeds, false); - //updateLeds(); -} - -/* -void PlayerMode::showCurrentFrame() -{ - for (int i = 0; i < numLeds; i++) - { - leds[LEDMAP(i)] = CRGB(buffer[i * COLOR_SIZE + 2], buffer[i * COLOR_SIZE + 1], buffer[i * COLOR_SIZE + 0]); - } - updateLeds(); -} -*/ - -void PlayerMode::start() -{ - LedMode::start(); -} - -void PlayerMode::stop() -{ - LedMode::stop(); - stopPlaying(); -} - -void PlayerMode::load(String path) -{ - showBlackFrame(); - -#ifdef HAS_FILES - DBG("Load file " + path); - DBG("Reading meta data"); - metaDataFile = FileManager::openFile(path + ".meta", false); //false is for reading - if (!metaDataFile) - { - DBG("Error reading metadata"); - } - else - { - DeserializationError error = deserializeJson(metaData, metaDataFile); - if (error) - { - Serial.print(F("deserializeJson() failed: ")); - Serial.println(error.c_str()); - } - else - { - fps = metaData["fps"]; - groupID = metaData["group"]; - localID = metaData["id"]; - - groupColor = CRGB((float)(metaData["groupColor"][0]) * 255, - (float)(metaData["groupColor"][1]) * 255, - (float)(metaData["groupColor"][2]) * 255); - - Serial.println("Loaded meta, id " + String(groupID) + ":" + String(localID) + " at " + String(fps) + " fps."); - } - - metaDataFile.close(); - } - - DBG("Loading colors.."); - curFile = FileManager::openFile(path + ".colors", false); //false is for reading - if (!curFile) - { - DBG("Error playing file " + path); - } - else - { - long totalBytes = curFile.size(); - totalFrames = bytePosToFrame(totalBytes); - totalTime = bytePosToSeconds(totalBytes); - curTimeMs = 0; - isPlaying = false; - DBG("File loaded, " + String(totalBytes) + " bytes" + ", " + String(totalFrames) + " frames, " + String(totalTime) + " time"); - } - - sendEvent(PlayerEvent(PlayerEvent::Play)); -#endif -} - -void PlayerMode::play(float atTime) -{ -#ifdef HAS_FILES - DBG("Play " + String(atTime)); - if (!curFile) - return; - - isPlaying = true; - - seek(atTime, false); - prevTimeMs = millis(); - - sendEvent(PlayerEvent(PlayerEvent::Play)); -#endif -} - -void PlayerMode::seek(float t, bool doSendEvent) -{ -#ifdef HAS_FILES - if (!curFile) - return; - - DBG("Seek to " + String(t)); - curTimeMs = secondsToMs(t); - prevTimeMs = millis(); - - curFile.seek(msToBytePos(max(curTimeMs, (long)0))); - - if (curTimeMs < 0) - { - showBlackFrame(); - } - else if (!isPlaying) - { - curFile.read((uint8_t*)leds, FRAME_SIZE); - //showCurrentFrame(); - } - - if (doSendEvent) - sendEvent(PlayerEvent(PlayerEvent::Play)); -#endif -} - -void PlayerMode::pause() -{ -#ifdef HAS_FILES - DBG("Pause"); - isPlaying = false; - sendEvent(PlayerEvent(PlayerEvent::Pause)); -#endif -} - -void PlayerMode::stopPlaying() -{ -#ifdef HAS_FILES - DBG("Stop"); - isPlaying = false; - showBlackFrame(); - sendEvent(PlayerEvent(PlayerEvent::Stop)); -#endif -} - -void PlayerMode::togglePlayPause() -{ - if (!isPlaying) - pause(); - else - play(); -} - -bool PlayerMode::handleCommand(String command, var *data, int numData) -{ - if (checkCommand(command, "load", numData, 1)) - { - load(data[0].stringValue()); - idMode = numData > 1 ? data[1].intValue() : false; - return true; - } - - if (checkCommand(command, "play", numData, 0)) - { - if (numData > 0 && data[0].type == 's') - { - load(data[0].stringValue()); - play(numData > 1 ? data[1].floatValue() : 0); - } - else - { - play(numData > 0 ? data[0].floatValue() : 0); - } - - if (numData > 1) - { - loopShow = data[1].intValue() == 1; - } - - idMode = false; - return true; - } - - if (checkCommand(command, "pause", numData, 0)) - { - pause(); - return true; - } - - if (checkCommand(command, "resume", numData, 0)) - { - play(); - return true; - } - - if (checkCommand(command, "stop", numData, 0)) - { - stopPlaying(); - return true; - } - - if (checkCommand(command, "seek", numData, 1)) - { - timeToSeek = data[0].floatValue(); - return true; - } - - if (checkCommand(command, "id", numData, 1)) - { - idMode = data[0].intValue(); - NDBG("ID Mode " + String(idMode)); - - if (idMode) - { - showIdFrame(); - isPlaying = false; - } - else - { - showBlackFrame(); - } - return true; - } - - if (checkCommand(command, "delete", numData, 1)) - { -#ifdef HAS_FILES - FileManager::deleteFileIfExists(String(data[0].stringValue()) + ".colors"); - FileManager::deleteFileIfExists(String(data[0].stringValue()) + ".meta"); -#endif - return true; - } - - return true; -} - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/player/PlayerMode.h b/Firmware/BentoFlowCreator/src/leds/player/PlayerMode.h deleted file mode 100644 index ecf31784..00000000 --- a/Firmware/BentoFlowCreator/src/leds/player/PlayerMode.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - - -#include "../LedMode.h" -#include "../../files/FileManager.h" -#include "../../common/ArduinoJson/ArduinoJson.h" - -#ifdef LED_COUNT - -#define COLOR_SIZE 3 -#define FRAME_SIZE (LED_COUNT * COLOR_SIZE) - -class PlayerEvent -{ -public: - enum Type - { - Load, - Play, - Pause, - Stop, - Seek, - Loop - }; - PlayerEvent(Type t) : type(t) {} - Type type; -}; - -class PlayerMode : public LedMode, public EventBroadcaster -{ - -public: - PlayerMode(CRGB *leds, int numLeds); - ~PlayerMode(); - - //file -#ifdef HAS_FILES - File curFile; - File metaDataFile; -#endif - - StaticJsonDocument<200> metaData; - - //info - int fps; - float totalTime; - long totalFrames; - int groupID; - int localID; - CRGB groupColor; - - //control - bool idMode; - bool loopShow; - - //playing - bool isPlaying; - long curTimeMs; - long prevTimeMs; - long timeSinceLastSeek; - float timeToSeek; //used to limit seeking - - //byte buffer[FRAME_SIZE]; - - void init() override; - bool update() override; - - bool playFrame(); - void showBlackFrame(); - void showIdFrame(); - void showCurrentFrame(); - - //void updateLeds(); - - void start() override; - void stop() override; - - //play control - void load(String path); - void play(float atTime = 0); - void seek(float t, bool doSendEvent = true); - void pause(); - void stopPlaying(); - void togglePlayPause(); - - bool handleCommand(String command, var *data, int numData) override; - - //Time computation helpers - #ifdef LED_COUNT - long msToBytePos(long t) const { return msToFrame(t) * FRAME_SIZE; } //rgba - long msToFrame(long timeMs) const { return timeMs * fps / 1000; } - long frameToMs(long frame) const { return frame * 1000 / fps; } - float frameToSeconds(long frame) const { return frame * 1.0f / fps; }; - float msToSeconds(long timeMs) const { return timeMs / 1000.0f; } - long secondsToMs(float s) const { return s * 1000; } - long secondsToFrame(float s) const { return s * fps; } - long bytePosToFrame(long pos) const { return pos / FRAME_SIZE; } - long bytePosToMs(long pos) const { return frameToMs(bytePosToFrame(pos)); } - long bytePosToSeconds(long pos) const { return frameToSeconds(bytePosToFrame(pos)); } - #endif -}; - -#endif //LED_COUNT \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/stream/StreamMode.cpp b/Firmware/BentoFlowCreator/src/leds/stream/StreamMode.cpp deleted file mode 100644 index 6007e2e7..00000000 --- a/Firmware/BentoFlowCreator/src/leds/stream/StreamMode.cpp +++ /dev/null @@ -1,98 +0,0 @@ -#include "StreamMode.h" - -#ifdef LED_COUNT - -StreamMode::StreamMode(CRGB *leds, int numLeds) : LedMode("stream", leds, numLeds), - //ledBufferIndex(0), - //colorBufferIndex(0) - byteIndex(0), - hasOverflowed(false) -{ - //streamBuffer = (uint8_t *)malloc(MAX_PACKET_SIZE); -} - -StreamMode::~StreamMode() -{ - // free(streamBuffer); -} - -void StreamMode::init() -{ -} - -bool StreamMode::update() -{ - long curTime = millis(); - if (curTime > lastReceiveTime + (1000 / receiveRate)) - { - lastReceiveTime = curTime; - return receiveUDP(); - } - return false; -} - -bool StreamMode::receiveUDP() -{ - while (int packetSize = udp.parsePacket()) - { - int numRead = udp.read(streamBuffer, MAX_PACKET_SIZE); - - //DBG("Packet size : " + String(packetSize) + ", numRead : "+String(numRead)); - - if(numRead == 0) return false; - bool isFinal = streamBuffer[numRead - 1] == 255; - - if(isFinal) - { - if(hasOverflowed) //if had overflowed, discard current packet and reset for next one - { - DBG("Discard overflowed packet, reset for next one"); - byteIndex = 0; - hasOverflowed = false; - return false; - } - - numRead--; - } - - if(byteIndex+numRead > numLeds * 3) - { - DBG("Stream OVERFLOW, end index would reach " +String(byteIndex+numRead)); - hasOverflowed = true; - }else - { - //DBG(" > Copying at "+String(byteIndex)); - memcpy((uint8_t *)leds+byteIndex, streamBuffer, numRead); - } - - byteIndex += numRead; - if (isFinal) - { - byteIndex = 0; - return true; - } - } - - return false; -} - -void StreamMode::start() -{ - LedMode::start(); - udp.begin(8888); - udp.flush(); -} - -void StreamMode::stop() -{ - LedMode::stop(); - udp.flush(); - udp.stop(); -} - -bool StreamMode::handleCommand(String command, var *data, int numData) -{ - return false; -} - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/stream/StreamMode.h b/Firmware/BentoFlowCreator/src/leds/stream/StreamMode.h deleted file mode 100644 index 361ba1d5..00000000 --- a/Firmware/BentoFlowCreator/src/leds/stream/StreamMode.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - - -#include "../LedMode.h" -#include - -#ifdef LED_COUNT -#define MAX_PACKET_SIZE 1000 - -class StreamMode : public LedMode { - -public: - StreamMode(CRGB * leds, int numLeds); - ~StreamMode(); - - WiFiUDP udp; - - //tempo - const int receiveRate = 50; //receive at 60fps max - long lastReceiveTime; - - uint8_t streamBuffer[MAX_PACKET_SIZE]; - int byteIndex; - bool hasOverflowed; - //uint8_t colorBuffer[3]; - //int colorBufferIndex; - //int ledBufferIndex; - - void init() override; - bool update() override; - - bool receiveUDP(); - - void start() override; - void stop() override; - - - bool handleCommand(String command, var *data, int numData) override; -}; - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/system/SystemLedMode.cpp b/Firmware/BentoFlowCreator/src/leds/system/SystemLedMode.cpp deleted file mode 100644 index ff81700b..00000000 --- a/Firmware/BentoFlowCreator/src/leds/system/SystemLedMode.cpp +++ /dev/null @@ -1,113 +0,0 @@ - -#include "SystemLedMode.h" - -#ifdef LED_COUNT - -SystemLedMode::SystemLedMode(CRGB *leds, int numLeds) : LedMode("systemLedMode", leds, numLeds), - connectionState(Off), - timeAtStateChange(millis()), - pointPos(0), - uploadProgress(0), - uploadFeedback(false) -{ -} - -void SystemLedMode::init() -{ -} - -bool SystemLedMode::update() -{ - LedHelpers::clear(leds, numLeds); - -#ifndef NO_ANIMATIONS - - float relT = millis() / 1000.0f - timeAtStateChange; - const float animTime = 2.0f; //2 second anim time - - if (connectionState == Off || connectionState != Connecting && relT > animTime) - return true; - - CRGB color = CRGB::Cyan; - - //default behavior (connecting) on which we will add animation for connected behavior - float t = millis() / 1000.0f - timeAtConnecting; - float pos = cos((t + PI) * 5) * .5f + .5f; - -#ifdef LED_INVERT_DIRECTION - pos = 1-pos; -#endif - - float radius = .3 - (cos(pos * PI * 2) * .5f + .5f) * .25f; - - color.nscale8(min(t, 1.f) * 255); - - if (connectionState != Connecting) - { - CRGB targetColor; - switch (connectionState) - { - case Connected: - targetColor = CRGB::Green; - break; - case ConnectionError: - targetColor = CRGB::Red; - break; - case Disabled: - targetColor = CRGB::Purple; - break; - case Hotspot: - targetColor = CRGB::Yellow; - break; - } - - float blendFac = min(relT * 2, 1.f); - radius = max(radius, relT * 2); //increase radius to 1 in one second - float fade = 1 - min(max((relT - 1) / .5f, 0.f), 1.f); - targetColor.nscale8(fade * 255); - - color = blend(color, targetColor, blendFac * 255); - } - - LedHelpers::point(leds, numLeds, color, pos, radius, true); - -#endif - - #ifdef FASTLED_FORCE_LOOPDELAY - FastLED.delay(1); - #endif - - return true; -} - -void SystemLedMode::setConnectionState(ConnectionState state) -{ - connectionState = state; - timeAtStateChange = millis() / 1000.0f; - if (connectionState == Connecting) - timeAtConnecting = timeAtStateChange; -} - -void SystemLedMode::showUploadProgress(float value) -{ - -#ifndef NO_ANIMATIONS - uploadProgress = fmodf(value*2,1); - int curPage = floor(value*2); - uploadFeedback = true; - - if(curPage > 0) LedHelpers::fillRange(leds, numLeds, CHSV((curPage-1)*40,255,255), uploadProgress, 1); - else LedHelpers::clear(leds, numLeds); - LedHelpers::fillRange(leds, numLeds, CHSV(curPage*40,255,255), 0, uploadProgress, false); - LedHelpers::point(leds, numLeds, CRGB::White, uploadProgress, .1f, false); - -#if !defined LEDS_SEPARATE_CHANNELS && !defined LED_USE_DMX - FastLED.show(); //force here because no update in leds when uploading apparently - FastLED.delay(1); -#endif - -#endif - -} - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/leds/system/SystemLedMode.h b/Firmware/BentoFlowCreator/src/leds/system/SystemLedMode.h deleted file mode 100644 index 3c2bbb9e..00000000 --- a/Firmware/BentoFlowCreator/src/leds/system/SystemLedMode.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once -#include "../LedMode.h" - -#ifdef LED_COUNT - -class SystemLedMode : public LedMode { -public: - SystemLedMode(CRGB * leds, int numLeds); - ~SystemLedMode() {} - - ConnectionState connectionState; - float timeAtStateChange; - float timeAtConnecting; - const long stateAnimationTime = 1000; - - float pointPos; - - bool uploadFeedback; - float uploadProgress; - - void init() override; - bool update() override; - - void setBatteryColor(CRGB color); - void setConnectionState(ConnectionState state); - void showUploadProgress(float value); -}; - -#endif //LED_COUNT \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/pwm/PWMManager.cpp b/Firmware/BentoFlowCreator/src/pwm/PWMManager.cpp deleted file mode 100644 index 5fc45e7a..00000000 --- a/Firmware/BentoFlowCreator/src/pwm/PWMManager.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#include "PWMManager.h" - -PWMManager::PWMManager() : Component("pwm") -{ - -} - -void PWMManager::init() -{ -#ifdef PWM_COUNT -#ifdef ESP32 - for (int i = 0; i < PWM_COUNT; i++) - { - if (pwmPins[i] > 0) - { - ledcSetup(i, PWM_FREQUENCY, PWM_RESOLUTION); - ledcAttachPin(pwmPins[i], i); - } - } -#endif -#endif -} - -void PWMManager::update() -{ -#ifdef PWM_COUNT - -#endif -} - -void PWMManager::setPWM(int index, float value) -{ -#ifdef PWM_COUNT - ledcWrite(index, PWMVAL(value)); -#endif -} - -void PWMManager::shutdown() -{ -#ifdef PWM_COUNT - for (int i = 0; i < PWM_COUNT; i++) setPWM(i, 0); -#endif -} - - -bool PWMManager::handleCommand(String command, var *data, int numData) -{ -#ifdef PWM_COUNT - if (checkCommand(command, "set", numData, 2)) - { - setPWM(data[0].intValue(), data[1].floatValue()); - return true; - } -#endif - - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/pwm/PWMManager.h b/Firmware/BentoFlowCreator/src/pwm/PWMManager.h deleted file mode 100644 index 4f8cfd13..00000000 --- a/Firmware/BentoFlowCreator/src/pwm/PWMManager.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#pragma once -#include "../common/Common.h" - -class PWMManager : public Component { -public: - PWMManager(); - ~PWMManager(){} - - //source -#ifdef PWM_COUNT - float values[PWM_COUNT]; -#endif - - void init(); - void update(); - - void setPWM(int index, float value); - - void shutdown(); - - bool handleCommand(String command, var *data, int numData) override; -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/scripts/ScriptManager.cpp b/Firmware/BentoFlowCreator/src/scripts/ScriptManager.cpp deleted file mode 100644 index a7fe3d6d..00000000 --- a/Firmware/BentoFlowCreator/src/scripts/ScriptManager.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include "ScriptManager.h" -#include "../files/FileManager.h" - -ScriptManager *ScriptManager::instance = nullptr; - -ScriptManager::ScriptManager() : Component("scripts"), - isRunning(false), - runtime(NULL), - initFunc(NULL), - updateFunc(NULL), - stopFunc(NULL) -{ - instance = this; -} - -void ScriptManager::init() -{ - NDBG("Script Manager init."); - env = m3_NewEnvironment(); - if (!env) - NDBG("Script environment error"); -} - -void ScriptManager::update() -{ - if (isRunning) - { - // TSTART() - if (updateFunc != NULL) - { - m3_CallV(updateFunc); - } - // TFINISH("Script ") - } -} - -void ScriptManager::launchScript(String path) -{ - if (isRunning) - { - NDBG("Script is running, stop before load"); - stop(); - } - - NDBG("Load script " + path + "..."); - - File f = FileManager::openFile("/" + path + ".wasm", false); // false is for reading - if (!f) - { - NDBG("Error reading file " + path); - return; - } - - long totalBytes = f.size(); -#ifdef SCRIPT_MAX_SIZE - if (totalBytes > SCRIPT_MAX_SIZE) - { - NDBG("Script size is more than max size"); - return; - } -#endif - scriptSize = totalBytes; - - f.read(scriptData, scriptSize); - - NDBG("Read " + String(scriptSize) + " bytes"); - - launchWasm(); -} - -void ScriptManager::launchWasm() -{ - NDBG("Launching wasm..."); - if (isRunning) - stop(); - -#if WASM_ASYNC - xTaskCreate(&ScriptManager::launchWasmTaskStatic, "wasm3", NATIVE_STACK_SIZE, NULL, 5, NULL); -#else - launchWasmTask(); -#endif - - NDBG("Wasm task launched..."); -} - -#if WASM_ASYNC -void ScriptManager::launchWasmTaskStatic(void *v) -{ - instance->launchWasmTask(); -} -#endif - -void ScriptManager::launchWasmTask() -{ - M3Result result = m3Err_none; - IM3Module module; - - if (runtime != NULL) - { - NDBG("New run free Runtime"); - m3_FreeRuntime(runtime); - } - - runtime = m3_NewRuntime(env, WASM_STACK_SLOTS, NULL); - if (!runtime) - { - NDBG("Script runtime setup error"); - return; - } - -#ifdef WASM_MEMORY_LIMIT - runtime->memoryLimit = WASM_MEMORY_LIMIT; -#endif - - result = m3_ParseModule(env, &module, scriptData, scriptSize); - if (result) - { - DBG("ParseModule error " + String(result)); - return; - } - - result = m3_LoadModule(runtime, module); - if (result) - { - DBG("LoadModule error " + String(result)); - return; - } - - result = LinkArduino(runtime); - if (result) - { - DBG("LinkArduino error " + String(result)); - return; - } - - String foundFunc; - - result = m3_FindFunction(&initFunc, runtime, "init"); - if (initFunc != NULL) - foundFunc += "init"; - // if (result) - // { - // DBG("FindFunction init error " + String(result)); - // return; - // } - - result = m3_FindFunction(&updateFunc, runtime, "update"); - if (updateFunc != NULL) - foundFunc += " / update"; - - // if (result) - // { - // DBG("FindFunction update error " + String(result)); - // return; - // } - - result = m3_FindFunction(&stopFunc, runtime, "stop"); - if (stopFunc != NULL) - foundFunc += " / stop"; - - // if (result) - // { - // DBG("FindFunction stop error " + String(result)); - // } - - NDBG("Found functions : " + foundFunc); - - isRunning = true; - - if (initFunc != NULL) - result = m3_CallV(initFunc); - -#if WASM_ASYNC - vTaskDelete(NULL); -#endif -} - -M3Result ScriptManager::LinkArduino(IM3Runtime runtime) -{ - IM3Module module = runtime->modules; - const char *arduino = "arduino"; - - m3_LinkRawFunction(module, arduino, "millis", "i()", &m3_arduino_millis); - m3_LinkRawFunction(module, arduino, "delay", "v(i)", &m3_arduino_delay); - m3_LinkRawFunction(module, arduino, "printFloat", "v(f)", &m3_printFloat); - m3_LinkRawFunction(module, arduino, "printInt", "v(i)", &m3_printInt); - - m3_LinkRawFunction(module, arduino, "clearLeds", "v()", &m3_clearLeds); - m3_LinkRawFunction(module, arduino, "fillLeds", "v(i)", &m3_fillLeds); - m3_LinkRawFunction(module, arduino, "fillLedsRGB", "v(iii)", &m3_fillLedsRGB); - m3_LinkRawFunction(module, arduino, "fillLedsHSV", "v(iii)", &m3_fillLedsHSV); - m3_LinkRawFunction(module, arduino, "setLed", "v(ii)", &m3_setLed); - m3_LinkRawFunction(module, arduino, "getLed", "i(i)", &m3_getLed); - - m3_LinkRawFunction(module, arduino, "setLedRGB", "v(iiii)", &m3_setLedRGB); - m3_LinkRawFunction(module, arduino, "setLedHSV", "v(iiii)", &m3_setLedHSV); - m3_LinkRawFunction(module, arduino, "pointRGB", "v(ffiii)", &m3_pointRGB); - m3_LinkRawFunction(module, arduino, "pointHSV", "v(ffiii)", &m3_pointHSV); - m3_LinkRawFunction(module, arduino, "getOrientation", "f(i)", &m3_getOrientation); - m3_LinkRawFunction(module, arduino, "getYaw", "f()", &m3_getYaw); - m3_LinkRawFunction(module, arduino, "getPitch", "f()", &m3_getPitch); - m3_LinkRawFunction(module, arduino, "getRoll", "f()", &m3_getRoll); - m3_LinkRawFunction(module, arduino, "getProjectedAngle", "f()", &m3_getProjectedAngle); - m3_LinkRawFunction(module, arduino, "setProjectedAngleOffset", "v(ff)", &m3_setProjectedAngleOffset); - m3_LinkRawFunction(module, arduino, "setIMUEnabled", "v(i)", &m3_setIMUEnabled); - m3_LinkRawFunction(module, arduino, "getThrowState", "i()", &m3_getThrowState); - m3_LinkRawFunction(module, arduino, "updateLeds", "v()", &m3_updateLeds); - m3_LinkRawFunction(module, arduino, "getButtonState", "i(i)", &m3_getButtonState); - m3_LinkRawFunction(module, arduino, "getActivity", "f()", &m3_getActivity); - m3_LinkRawFunction(module, arduino, "getSpin", "f()", &m3_getSpin); - - m3_LinkRawFunction(module, arduino, "setBatterySendEnabled", "v(i)", &m3_setBatterySendEnabled); - m3_LinkRawFunction(module, arduino, "randomInt", "i(ii)", &m3_randomInt); - m3_LinkRawFunction(module, arduino, "noise", "f(ff)", &m3_noise); - - return m3Err_none; -} - -void ScriptManager::stop() -{ - if (isRunning) { - NDBG("Stopping script"); - - if (stopFunc != NULL) - m3_CallV(stopFunc); - - isRunning = false; - m3_FreeRuntime(runtime); - runtime = NULL; - } else { - NDBG("Not stopping script, because non was running"); - } -} - -void ScriptManager::shutdown() -{ - stop(); - m3_FreeEnvironment(env); - env = NULL; -} - -bool ScriptManager::handleCommand(String command, var *data, int numData) -{ - if (checkCommand(command, "load", numData, 1)) - { - launchScript(data[0].stringValue()); - return true; - } - if (checkCommand(command, "stop", numData, 0)) - { - stop(); - return true; - } - - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/scripts/ScriptManager.h b/Firmware/BentoFlowCreator/src/scripts/ScriptManager.h deleted file mode 100644 index 7a9cffe9..00000000 --- a/Firmware/BentoFlowCreator/src/scripts/ScriptManager.h +++ /dev/null @@ -1,54 +0,0 @@ - -#pragma once -#include "../common/Common.h" -#include "wasmFunctions.h" - -#define SCRIPT_MAX_SIZE 32000 - -#define WASM_STACK_SLOTS 2048 -#define NATIVE_STACK_SIZE (32 * 1024) - -#define WASM_MEMORY_LIMIT 4096*4 - -#define WASM_ASYNC 0 - - -class ScriptManager : public Component -{ -public: - ScriptManager(); - ~ScriptManager() {} - - static ScriptManager *instance; - unsigned char scriptData[SCRIPT_MAX_SIZE]; - long scriptSize; - - bool isRunning; - IM3Runtime runtime; - IM3Environment env; - - IM3Function initFunc; - IM3Function updateFunc; - IM3Function stopFunc; - - long tstart; - long tend; - - void init(); - void update(); - - void launchScript(String name); - - void launchWasm(); - void shutdown(); - - void stop(); - - #if WASM_ASYNC - static void launchWasmTaskStatic(void *); -#endif - void launchWasmTask(); - - static M3Result LinkArduino(IM3Runtime runtime); - bool handleCommand(String command, var *data, int numData) override; -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/scripts/wasmFunctions.cpp b/Firmware/BentoFlowCreator/src/scripts/wasmFunctions.cpp deleted file mode 100644 index 713ef9ca..00000000 --- a/Firmware/BentoFlowCreator/src/scripts/wasmFunctions.cpp +++ /dev/null @@ -1,267 +0,0 @@ -#include "wasmFunctions.h" -#include "../common/Common.h" -#include "../MainManager.h" -#include "SimplexNoise/SimplexNoise.h" - -SimplexNoise sn; - - -m3ApiRawFunction(m3_arduino_millis) -{ - m3ApiReturnType(uint32_t); - - m3ApiReturn(millis()); -} - -m3ApiRawFunction(m3_arduino_delay) -{ - m3ApiGetArg(uint32_t, ms); - delay(ms); - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_printFloat) -{ - m3ApiGetArg(float, val); - DBG("Print from script : "+String(val)); - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_printInt) -{ - m3ApiGetArg(uint32_t, val); - DBG("Print from script : "+String(val)); - m3ApiSuccess(); -} - - -m3ApiRawFunction(m3_clearLeds) -{ - // MainManager::instance->leds.setMode(LedManager::Mode::Stream); - MainManager::instance->leds.rgbManager.clear(); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_fillLeds) -{ - m3ApiGetArg(uint32_t, color); - // MainManager::instance->leds.setMode(LedManager::Mode::Stream); - MainManager::instance->leds.rgbManager.fillAll(CRGB(color)); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_fillLedsRGB) -{ - m3ApiGetArg(uint32_t, r); - m3ApiGetArg(uint32_t, g); - m3ApiGetArg(uint32_t, b); - // MainManager::instance->leds.setMode(LedManager::Mode::Stream); - MainManager::instance->leds.rgbManager.fillAll(CRGB((uint8_t)r, (uint8_t)g, (uint8_t)b)); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_fillLedsHSV) -{ - m3ApiGetArg(uint32_t, h); - m3ApiGetArg(uint32_t, s); - m3ApiGetArg(uint32_t, v); - // MainManager::instance->leds.setMode(LedManager::Mode::Stream); - MainManager::instance->leds.rgbManager.fillAll(CHSV((uint8_t)h, (uint8_t)s, (uint8_t)v)); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_setLed) -{ - m3ApiGetArg(uint32_t, index); - m3ApiGetArg(uint32_t, color); - // MainManager::instance->leds.setMode(LedManager::Mode::Stream); - MainManager::instance->leds.rgbManager.setLed(index, CRGB(color)); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_getLed) -{ - m3ApiReturnType(uint32_t) - m3ApiGetArg(uint32_t, index); - - if(index < LED_COUNT) - { - CRGB c = MainManager::instance->leds.rgbManager.leds[index]; - uint32_t val = c.r << 16 | c.g << 8 | c.b; - m3ApiReturn(val); - } - - m3ApiReturn(0) -} - -m3ApiRawFunction(m3_setLedRGB) -{ - m3ApiGetArg(uint32_t, index); - m3ApiGetArg(uint32_t, r); - m3ApiGetArg(uint32_t, g); - m3ApiGetArg(uint32_t, b); - // MainManager::instance->leds.setMode(LedManager::Mode::Stream); - MainManager::instance->leds.rgbManager.setLed(index, CRGB((uint8_t)r, (uint8_t)g, (uint8_t)b)); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_setLedHSV) -{ - m3ApiGetArg(uint32_t, index); - m3ApiGetArg(uint32_t, h); - m3ApiGetArg(uint32_t, s); - m3ApiGetArg(uint32_t, v); - // MainManager::instance->leds.setMode(LedManager::Mode::Stream); - MainManager::instance->leds.rgbManager.setLed(index, CHSV((uint8_t)h, (uint8_t)s, (uint8_t)v)); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_pointRGB) -{ - m3ApiGetArg(float, pos); - m3ApiGetArg(float, radius); - m3ApiGetArg(uint32_t, h); - m3ApiGetArg(uint32_t, s); - m3ApiGetArg(uint32_t, v); - - MainManager::instance->leds.rgbManager.point(CRGB((uint8_t)h, (uint8_t)s, (uint8_t)v), pos, radius, false); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_pointHSV) -{ - m3ApiGetArg(float, pos); - m3ApiGetArg(float, radius); - m3ApiGetArg(uint32_t, h); - m3ApiGetArg(uint32_t, s); - m3ApiGetArg(uint32_t, v); - MainManager::instance->leds.rgbManager.point(CHSV((uint8_t)h, (uint8_t)s, (uint8_t)v), pos, radius, false); - - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_getOrientation) -{ - m3ApiReturnType(float); - m3ApiGetArg(uint32_t, oi); - - float v = oi < 3 ? MainManager::instance->imu.orientation[oi] : -1; - - m3ApiReturn(v); -} - -m3ApiRawFunction(m3_getYaw) -{ - m3ApiReturnType(float); - m3ApiReturn(MainManager::instance->imu.orientation[0]); -} - -m3ApiRawFunction(m3_getPitch) -{ - m3ApiReturnType(float); - m3ApiReturn(MainManager::instance->imu.orientation[1]); -} -m3ApiRawFunction(m3_getRoll) -{ - m3ApiReturnType(float); - m3ApiReturn(MainManager::instance->imu.orientation[2]); -} - - -m3ApiRawFunction(m3_getThrowState) -{ - m3ApiReturnType(uint32_t); - m3ApiReturn((uint32_t)MainManager::instance->imu.throwState); -} - - -m3ApiRawFunction(m3_getProjectedAngle) -{ - m3ApiReturnType(float); - m3ApiReturn(MainManager::instance->imu.projectedAngle); -} - -m3ApiRawFunction(m3_setProjectedAngleOffset) -{ - m3ApiGetArg(float, yaw); - m3ApiGetArg(float, angle); - MainManager::instance->imu.setProjectAngleOffset(yaw, angle); - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_setIMUEnabled) -{ - m3ApiGetArg(uint32_t, en); - MainManager::instance->imu.setEnabled((bool)en); - m3ApiSuccess(); -} - - -m3ApiRawFunction(m3_updateLeds) -{ - MainManager::instance->leds.rgbManager.update(); - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_getButtonState) -{ - m3ApiReturnType(uint32_t); - - m3ApiGetArg(uint32_t, btIndex); - - #ifdef BUTTON_COUNT - int v = btIndex < BUTTON_COUNT ? MainManager::instance->buttons.isPressed[btIndex] : 0; - #else - int v = 0; - #endif - - m3ApiReturn((uint32_t)v); -} - -m3ApiRawFunction(m3_getActivity) -{ - m3ApiReturnType(float); - m3ApiReturn(MainManager::instance->imu.activity); -} - -m3ApiRawFunction(m3_getSpin) -{ - m3ApiReturnType(float); - m3ApiReturn(MainManager::instance->imu.spin); -} - -m3ApiRawFunction(m3_setBatterySendEnabled) -{ - m3ApiGetArg(uint32_t, en); - MainManager::instance->battery.setSendEnabled((bool)en); - m3ApiSuccess(); -} - -m3ApiRawFunction(m3_randomInt) -{ - m3ApiReturnType(uint32_t); - m3ApiGetArg(uint32_t, min); - m3ApiGetArg(uint32_t, max); - - m3ApiReturn((uint32_t) random(min, max+1)); -} - -m3ApiRawFunction(m3_noise) -{ - m3ApiReturnType(float); - m3ApiGetArg(float, x); - m3ApiGetArg(float, y); - - float n = (float) sn.noise(x,y); - n = (n+1) /2; // convert to value range [0..1] - - m3ApiReturn(n); -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/scripts/wasmFunctions.h b/Firmware/BentoFlowCreator/src/scripts/wasmFunctions.h deleted file mode 100644 index 5d25593b..00000000 --- a/Firmware/BentoFlowCreator/src/scripts/wasmFunctions.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include - - - -m3ApiRawFunction(m3_arduino_millis); -m3ApiRawFunction(m3_arduino_delay); -m3ApiRawFunction(m3_printFloat); -m3ApiRawFunction(m3_printInt); -m3ApiRawFunction(m3_clearLeds); -m3ApiRawFunction(m3_fillLeds); -m3ApiRawFunction(m3_fillLedsRGB); -m3ApiRawFunction(m3_fillLedsHSV); -m3ApiRawFunction(m3_setLed); -m3ApiRawFunction(m3_getLed); -m3ApiRawFunction(m3_setLedRGB); -m3ApiRawFunction(m3_setLedHSV); -m3ApiRawFunction(m3_pointRGB); -m3ApiRawFunction(m3_pointHSV); -m3ApiRawFunction(m3_getOrientation); -m3ApiRawFunction(m3_getYaw); -m3ApiRawFunction(m3_getPitch); -m3ApiRawFunction(m3_getRoll); -m3ApiRawFunction(m3_getThrowState); -m3ApiRawFunction(m3_getProjectedAngle); -m3ApiRawFunction(m3_setProjectedAngleOffset); -m3ApiRawFunction(m3_setIMUEnabled); -m3ApiRawFunction(m3_updateLeds); -m3ApiRawFunction(m3_getButtonState); -m3ApiRawFunction(m3_getActivity); -m3ApiRawFunction(m3_getSpin); -m3ApiRawFunction(m3_setBatterySendEnabled); -m3ApiRawFunction(m3_randomInt); -m3ApiRawFunction(m3_noise); diff --git a/Firmware/BentoFlowCreator/src/sensors/battery/BatteryManager.cpp b/Firmware/BentoFlowCreator/src/sensors/battery/BatteryManager.cpp deleted file mode 100644 index 77e917bf..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/battery/BatteryManager.cpp +++ /dev/null @@ -1,190 +0,0 @@ -#include "BatteryManager.h" - -const String BatteryEvent::eventNames[BatteryEvent::TYPES_MAX]{"level", "voltage", "rawValue", "criticalLevel", "charging", "reset", "sendEnabled"}; - -BatteryManager::BatteryManager() : Component("battery"), - voltage(4.1f), - rawValue(0), - value(1), - isCharging(false), - sendEnabled(true), - timeSinceLastBatteryRead(0), - isCriticalBattery(false), - timeAtCriticalBattery(0) -{ -} - -void BatteryManager::init() -{ - -#ifdef BATTERY_CHARGE_PIN - pinMode(BATTERY_CHARGE_PIN, INPUT); -#endif - -#ifdef BATTERY_PIN - analogSetPinAttenuation(BATTERY_PIN, ADC_0db); - -#ifdef USE_PREFERENCES - prefs.begin(name.c_str()); - setMax(prefs.getInt("max", defaultMaxVal), false); - prefs.end(); -#elif defined USE_SETTINGS_MANAGER - //init once with a json if it doesn't exist yet - prefs.readSettings(String("/" + name + ".json").c_str()); - float max = prefs.getInt("max", defaultMaxVal); - prefs.loadJson(String("{\"max\":\"" + String(max) + "\"}").c_str()); - prefs.writeSettings(String("/" + name + ".json").c_str()); - - //actually read the data - prefs.readSettings(String("/" + name + ".json").c_str()); - setMax(prefs.getInt("max", defaultMaxVal), false); -#endif - -#endif // BATTERY_PIN -} - -void BatteryManager::update() -{ -#ifdef BATTERY_PIN - - long curTime = millis(); - - if (curTime > timeSinceLastBatteryRead + batteryReadTime) - { - timeSinceLastBatteryRead = curTime; - - -#ifdef CUSTOM_BATTERY_READ - rawValue = getBatteryRawValue(); - voltage = getBatteryVoltage(rawValue); - value = (voltage - BATTERY_VOLTAGE_MIN) * (BATTERY_VOLTAGE_MAX - BATTERY_VOLTAGE_MIN); - isCharging = isChargingBattery(); -#else - rawValue = analogRead(BATTERY_PIN) / 4; - voltage = (rawValue - defaultMinVal) * (3.8 - 3.2) / (defaultMaxVal - defaultMinVal) + 3.2; - updateValue(rawValue); - updateMax(rawValue); - updateCharge(); -#endif - - if (sendEnabled) { - sendEvent(BatteryEvent(BatteryEvent::Level, value)); - sendEvent(BatteryEvent(BatteryEvent::Voltage, voltage)); - sendEvent(BatteryEvent(BatteryEvent::RawValue, rawValue)); - } - -#ifdef BATTERY_CHARGE_PIN - sendEvent(BatteryEvent(BatteryEvent::Charging, isCharging)); -#endif - - bool batteryIsOK = voltage > 3.3; //value > criticalBatteryThreshold; - if (batteryIsOK) - { - timeAtCriticalBattery = 0; - isCriticalBattery = false; - } - else - { - if (timeAtCriticalBattery == 0) - timeAtCriticalBattery = curTime; - else if (curTime > timeAtCriticalBattery + criticalBatteryTimethreshold) - { - isCriticalBattery = true; - sendEvent(BatteryEvent(BatteryEvent::CriticalLevel, value)); - } - } - - - } - -#endif -} - -void BatteryManager::updateMax(int currentValue) -{ - if (currentValue - 10 > maxVal) - { - setMax(currentValue - 10, true); - } -} - -void BatteryManager::setMax(int newMax, bool save) -{ - maxVal = max(newMax, 0); - - if (save) - { -#ifdef USE_PREFERENCES - prefs.begin(name.c_str()); - prefs.putInt("max", maxVal); - prefs.end(); -#elif defined USE_SETTINGS_MANAGER - prefs.readSettings(String("/" + name + ".json").c_str()); - prefs.setInt("max", maxVal); -#endif - } -} - -void BatteryManager::resetMax() -{ - maxVal = defaultMaxVal; - setMax(defaultMaxVal, true); - - sendEvent(BatteryEvent(BatteryEvent::Reset, maxVal)); -} - -void BatteryManager::updateValue(int newValue) -{ - long sum = 0L; - prevRawValues[curPos] = newValue; - - for (int i = 0; i < PREV_VALUES_SIZE; i++) - { - sum += prevRawValues[i]; - } - - int avgRawValue = (int)(((float)sum) / PREV_VALUES_SIZE); - value = (avgRawValue - minVal) * 1.0f / (maxVal - minVal); - - curPos = (curPos + 1) % PREV_VALUES_SIZE; -} - -void BatteryManager::updateCharge() -{ -#ifdef BATTERY_CHARGE_PIN - /* - int measuredVal = 0; - for (int i = 0; i < 10; i++) - { - int v = digitalRead(BATTERY_CHARGE_PIN); - measuredVal += v; - } - */ - isCharging = analogRead(BATTERY_CHARGE_PIN); //measuredVal == 0; -#endif -} - -void BatteryManager::setSendEnabled(bool value) -{ - if (sendEnabled == value) - return; - - sendEnabled = value; -} - -bool BatteryManager::handleCommand(String command, var *data, int numData) -{ -#ifdef BATTERY_PIN - if (checkCommand(command, "reset", numData, 0)) - { - resetMax(); - return true; - } else if (checkCommand(command, "sendEnabled", numData, 1)) - { - sendEnabled = data[0].intValue() == 1; - return true; - } -#endif - - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/sensors/battery/BatteryManager.h b/Firmware/BentoFlowCreator/src/sensors/battery/BatteryManager.h deleted file mode 100644 index f67d068a..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/battery/BatteryManager.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once -#include "../../common/Common.h" - -#define PREV_VALUES_SIZE 10 - -class BatteryEvent -{ -public: - enum Type { Level, Voltage, RawValue, CriticalLevel, Charging, Reset, SendEnabled, TYPES_MAX}; - - static const String eventNames[TYPES_MAX]; - - BatteryEvent(Type type, float value) : type(type), value(value) {} - Type type; - float value; -}; - -class BatteryManager : public Component, public EventBroadcaster { -public: - BatteryManager(); - ~BatteryManager(){} - - int rawValue; - float value; - float voltage; - - int prevRawValues[PREV_VALUES_SIZE]; - int curPos = 0; - - bool isCharging; - bool sendEnabled; - -#ifndef BATTERY_DEFAULT_MIN -#define BATTERY_DEFAULT_MIN 222 //TESTED: 3.2V -#endif - -#ifndef BATTERY_DEFAULT_MAX -#define BATTERY_DEFAULT_MAX 335 // TESTED: 3.8V -#endif - - const int defaultMinVal = BATTERY_DEFAULT_MIN; - const int defaultMaxVal = BATTERY_DEFAULT_MAX; - - int minVal = defaultMinVal; - int maxVal = defaultMaxVal; - - bool isCriticalBattery; - - const float criticalBatteryThreshold = 0.0f; - const long criticalBatteryTimethreshold = 5000; // 5s - long timeAtCriticalBattery; - - const long batteryReadTime = 1000; - long timeSinceLastBatteryRead; - - void init(); - void update(); - - bool handleCommand(String command, var *data, int numData) override; - - void updateValue(int currentValue); - void updateMax(int currentValue); - void updateCharge(); - void setMax(int value, bool save = false); - void resetMax(); - void setSendEnabled(bool value); - - - -private: -#ifdef USE_PREFERENCES - Preferences prefs; -#elif defined USE_SETTINGS_MANAGER - SettingsManager prefs; -#endif -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/sensors/button/ButtonManager.cpp b/Firmware/BentoFlowCreator/src/sensors/button/ButtonManager.cpp deleted file mode 100644 index 38b87985..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/button/ButtonManager.cpp +++ /dev/null @@ -1,106 +0,0 @@ - -#include "ButtonManager.h" - -const String ButtonEvent::eventNames[ButtonEvent::TYPES_MAX]{"pressed", "shortPress", "longPress", "veryLongPress", "multiPress"}; - -ButtonManager::ButtonManager() : Component("buttons") -{ - for (int i = 0; i < BUTTON_COUNT; i++) - { - isPressed[i] = false; - debounceCount[i] = 0; - multiPressCount[i] = 0; - timeAtPress[i] = 0; - } -} - -void ButtonManager::init() -{ - -#if BUTTON_COUNT > 0 - for (int i = 0; i < BUTTON_COUNT; i++) - { - pinMode(buttonPins[i], BUTTON_INPUT_MODE); - isPressed[i] = digitalRead(buttonPins[i]); -#ifdef BUTTON_INVERTED - isPressed[i] = !isPressed[i]; - NDBG("Button "+String(i)+" init : "+isPressed[i]); -#endif - } -#endif //BUTTON_COUNT > 0 -} - -void ButtonManager::update() -{ -#if BUTTON_COUNT > 0 - for (int i = 0; i < BUTTON_COUNT; i++) - { - bool v = digitalRead(buttonPins[i]); -#ifdef BUTTON_INVERTED - v = !v; -#endif - if (v) - debounceCount[i] = min(debounceCount[i] + 1, buttonPressDebounce); - else - debounceCount[i] = max(debounceCount[i] - 1, 0); - - bool newPressed = isPressed[i]; - if (isPressed[i] && debounceCount[i] == 0) - newPressed = false; - - if (!isPressed[i] && debounceCount[i] == buttonPressDebounce) - newPressed = true; - - if (newPressed != isPressed[i]) //button state changed - { - isPressed[i] = newPressed; - isLongPressed[i] = false; - isVeryLongPressed[i] = false; - - if (isPressed[i]) - { - timeAtPress[i] = millis(); - sendEvent(ButtonEvent(ButtonEvent::Pressed, i, 1)); - - multiPressCount[i]++; - sendEvent(ButtonEvent(ButtonEvent::MultiPress, i, multiPressCount[i])); - } - else - { - if (millis() < timeAtPress[i] + shortPressTime) - { - sendEvent(ButtonEvent(ButtonEvent::ShortPress, i)); - } - - sendEvent(ButtonEvent(ButtonEvent::Pressed, i, 0)); - } - } - else - { - if (isPressed[i]) - { - if (!isLongPressed[i] && millis() > timeAtPress[i] + longPressTime) - { - isLongPressed[i] = true; - sendEvent(ButtonEvent(ButtonEvent::LongPress, i)); - } - - if (!isVeryLongPressed[i] && millis() > timeAtPress[i] + veryLongPressTime) - { - isVeryLongPressed[i] = true; - sendEvent(ButtonEvent(ButtonEvent::VeryLongPress, i)); - } - } - - if (millis() > timeAtPress[i] + multiPressTime) - { - if(multiPressCount[i] > 0) - { - multiPressCount[i] = 0; - sendEvent(ButtonEvent(ButtonEvent::MultiPress, i, multiPressCount[i])); - } - } - } - } -#endif //MULTI BUTTON -} diff --git a/Firmware/BentoFlowCreator/src/sensors/button/ButtonManager.h b/Firmware/BentoFlowCreator/src/sensors/button/ButtonManager.h deleted file mode 100644 index 32cfd728..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/button/ButtonManager.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once -#include "../../common/Common.h" - -class ButtonEvent -{ -public: - enum Type - { - Pressed, - ShortPress, - LongPress, - VeryLongPress, - MultiPress, - TYPES_MAX - }; - - static const String eventNames[TYPES_MAX]; - - ButtonEvent(Type type, int id, int value = 1) : type(type), id(id), value(value) {} - - Type type; - int id; - int value; -}; - -class ButtonManager : - public Component, - public EventBroadcaster -{ -public: - ButtonManager(); - ~ButtonManager(){} - - bool isPressed[BUTTON_COUNT]; - bool isLongPressed[BUTTON_COUNT]; - bool isVeryLongPressed[BUTTON_COUNT]; - - void init(); - void update(); - -private : - const int longPressTime = 500; //more than 500ms is long press - const int veryLongPressTime = 1500; //more than 1500ms is very long press - const int shortPressTime = 500; //less than 500ms is short press - const int multiPressTime = 300; //each new press shorter than 500ms after the previous one will increase the multiclick - - const int buttonPressDebounce = 5; //denoising, needs five reads to validate a change - int debounceCount[BUTTON_COUNT]; - - long timeAtPress[BUTTON_COUNT]; - int multiPressCount[BUTTON_COUNT]; - -}; \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/sensors/capacitive/Adafruit_MPR121.cpp b/Firmware/BentoFlowCreator/src/sensors/capacitive/Adafruit_MPR121.cpp deleted file mode 100644 index a9141e34..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/capacitive/Adafruit_MPR121.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/*! - * @file Adafruit_MPR121.cpp - * - * @mainpage Adafruit MPR121 arduino driver - * - * @section intro_sec Introduction - * - * This is a library for the MPR121 I2C 12-chan Capacitive Sensor - * - * Designed specifically to work with the MPR121 sensor from Adafruit - * ----> https://www.adafruit.com/products/1982 - * - * These sensors use I2C to communicate, 2+ pins are required to - * interface - * - * Adafruit invests time and resources providing this open source code, - * please support Adafruit and open-source hardware by purchasing - * products from Adafruit! - * - * @section author Author - * - * Written by Limor Fried/Ladyada for Adafruit Industries. - * - * @section license License - * - * BSD license, all text here must be included in any redistribution. - */ - - -#include "Adafruit_MPR121.h" -#ifdef CAPACITIVE_COUNT - -// uncomment to use autoconfig ! -//#define AUTOCONFIG // use autoconfig (Yes it works pretty well!) - -/*! - * @brief Default constructor - */ -Adafruit_MPR121::Adafruit_MPR121() {} - -/*! - * @brief Begin an MPR121 object on a given I2C bus. This function resets - * the device and writes the default settings. - * @param i2caddr - * the i2c address the device can be found on. Defaults to 0x5A. - * @param *theWire - * Wire object - * @param touchThreshold - * touch detection threshold value - * @param releaseThreshold - * release detection threshold value - * @returns true on success, false otherwise - */ -bool Adafruit_MPR121::begin(uint8_t i2caddr, TwoWire *theWire, - uint8_t touchThreshold, uint8_t releaseThreshold) { - - if (i2c_dev) { - delete i2c_dev; - } - i2c_dev = new Adafruit_I2CDevice(i2caddr, theWire); - - if (!i2c_dev->begin()) { - return false; - } - - // soft reset - writeRegister(MPR121_SOFTRESET, 0x63); - delay(1); - for (uint8_t i = 0; i < 0x7F; i++) { - // Serial.print("$"); Serial.print(i, HEX); - // Serial.print(": 0x"); Serial.println(readRegister8(i)); - } - - writeRegister(MPR121_ECR, 0x0); - - uint8_t c = readRegister8(MPR121_CONFIG2); - - if (c != 0x24) - return false; - - setThresholds(touchThreshold, releaseThreshold); - writeRegister(MPR121_MHDR, 0x01); - writeRegister(MPR121_NHDR, 0x01); - writeRegister(MPR121_NCLR, 0x0E); - writeRegister(MPR121_FDLR, 0x00); - - writeRegister(MPR121_MHDF, 0x01); - writeRegister(MPR121_NHDF, 0x05); - writeRegister(MPR121_NCLF, 0x01); - writeRegister(MPR121_FDLF, 0x00); - - writeRegister(MPR121_NHDT, 0x00); - writeRegister(MPR121_NCLT, 0x00); - writeRegister(MPR121_FDLT, 0x00); - - writeRegister(MPR121_DEBOUNCE, 0); - writeRegister(MPR121_CONFIG1, 0x10); // default, 16uA charge current - writeRegister(MPR121_CONFIG2, 0x20); // 0.5uS encoding, 1ms period - -#ifdef AUTOCONFIG - writeRegister(MPR121_AUTOCONFIG0, 0x0B); - - // correct values for Vdd = 3.3V - writeRegister(MPR121_UPLIMIT, 200); // ((Vdd - 0.7)/Vdd) * 256 - writeRegister(MPR121_TARGETLIMIT, 180); // UPLIMIT * 0.9 - writeRegister(MPR121_LOWLIMIT, 130); // UPLIMIT * 0.65 -#endif - - // enable X electrodes and start MPR121 - byte ECR_SETTING = - B10000000 + 12; // 5 bits for baseline tracking & proximity disabled + X - // amount of electrodes running (12) - writeRegister(MPR121_ECR, ECR_SETTING); // start with above ECR setting - - return true; -} - -/*! - * @brief DEPRECATED. Use Adafruit_MPR121::setThresholds(uint8_t touch, - * uint8_t release) instead. - * @param touch - * see Adafruit_MPR121::setThresholds(uint8_t touch, uint8_t - * *release) - * @param release - * see Adafruit_MPR121::setThresholds(uint8_t touch, *uint8_t - * release) - */ -void Adafruit_MPR121::setThreshholds(uint8_t touch, uint8_t release) { - setThresholds(touch, release); -} - -/*! - * @brief Set the touch and release thresholds for all 13 channels on the - * device to the passed values. The threshold is defined as a - * deviation value from the baseline value, so it remains constant - * even baseline value changes. Typically the touch threshold is a little bigger - * than the release threshold to touch debounce and hysteresis. For typical - * touch application, the value can be in range 0x05~0x30 for example. The - * setting of the threshold is depended on the actual application. For the - * operation details and how to set the threshold refer to application note - * AN3892 and MPR121 design guidelines. - * @param touch - * the touch threshold value from 0 to 255. - * @param release - * the release threshold from 0 to 255. - */ -void Adafruit_MPR121::setThresholds(uint8_t touch, uint8_t release) { - // set all thresholds (the same) - for (uint8_t i = 0; i < 12; i++) { - writeRegister(MPR121_TOUCHTH_0 + 2 * i, touch); - writeRegister(MPR121_RELEASETH_0 + 2 * i, release); - } -} - -/*! - * @brief Read the filtered data from channel t. The ADC raw data outputs - * run through 3 levels of digital filtering to filter out the high - * frequency and low frequency noise encountered. For detailed information on - * this filtering see page 6 of the device datasheet. - * @param t - * the channel to read - * @returns the filtered reading as a 10 bit unsigned value - */ -uint16_t Adafruit_MPR121::filteredData(uint8_t t) { - if (t > 12) - return 0; - return readRegister16(MPR121_FILTDATA_0L + t * 2); -} - -/*! - * @brief Read the baseline value for the channel. The 3rd level filtered - * result is internally 10bit but only high 8 bits are readable - * from registers 0x1E~0x2A as the baseline value output for each channel. - * @param t - * the channel to read. - * @returns the baseline data that was read - */ -uint16_t Adafruit_MPR121::baselineData(uint8_t t) { - if (t > 12) - return 0; - uint16_t bl = readRegister8(MPR121_BASELINE_0 + t); - return (bl << 2); -} - -/** - * @brief Read the touch status of all 13 channels as bit values in a 12 - * bit integer. - * @returns a 12 bit integer with each bit corresponding to the touch status - * of a sensor. For example, if bit 0 is set then channel 0 of the - * device is currently deemed to be touched. - */ -uint16_t Adafruit_MPR121::touched(void) { - uint16_t t = readRegister16(MPR121_TOUCHSTATUS_L); - return t & 0x0FFF; -} - -/*! - * @brief Read the contents of an 8 bit device register. - * @param reg the register address to read from - * @returns the 8 bit value that was read. - */ -uint8_t Adafruit_MPR121::readRegister8(uint8_t reg) { - Adafruit_BusIO_Register thereg = Adafruit_BusIO_Register(i2c_dev, reg, 1); - - return (thereg.read()); -} - -/*! - * @brief Read the contents of a 16 bit device register. - * @param reg the register address to read from - * @returns the 16 bit value that was read. - */ -uint16_t Adafruit_MPR121::readRegister16(uint8_t reg) { - Adafruit_BusIO_Register thereg = - Adafruit_BusIO_Register(i2c_dev, reg, 2, LSBFIRST); - - return (thereg.read()); -} - -/*! - @brief Writes 8-bits to the specified destination register - @param reg the register address to write to - @param value the value to write -*/ -void Adafruit_MPR121::writeRegister(uint8_t reg, uint8_t value) { - // MPR121 must be put in Stop Mode to write to most registers - bool stop_required = true; - - // first get the current set value of the MPR121_ECR register - Adafruit_BusIO_Register ecr_reg = - Adafruit_BusIO_Register(i2c_dev, MPR121_ECR, 1); - - uint8_t ecr_backup = ecr_reg.read(); - if ((reg == MPR121_ECR) || ((0x73 <= reg) && (reg <= 0x7A))) { - stop_required = false; - } - - if (stop_required) { - // clear this register to set stop mode - ecr_reg.write(0x00); - } - - Adafruit_BusIO_Register the_reg = Adafruit_BusIO_Register(i2c_dev, reg, 1); - the_reg.write(value); - - if (stop_required) { - // write back the previous set ECR settings - ecr_reg.write(ecr_backup); - } -} - -#endif \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/sensors/capacitive/Adafruit_MPR121.h b/Firmware/BentoFlowCreator/src/sensors/capacitive/Adafruit_MPR121.h deleted file mode 100644 index 19006c53..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/capacitive/Adafruit_MPR121.h +++ /dev/null @@ -1,112 +0,0 @@ -/*! - * @file Adafruit_MPR121.h - * - * This is a library for the MPR121 12-Channel Capacitive Sensor - * - * Designed specifically to work with the MPR121 board. - * - * Pick one up today in the adafruit shop! - * ------> https://www.adafruit.com/product/1982 - * - * These sensors use I2C to communicate, 2+ pins are required to interface - * - * Adafruit invests time and resources providing this open source code, - * please support Adafruit andopen-source hardware by purchasing products - * from Adafruit! - * - * Limor Fried/Ladyada (Adafruit Industries). - * - * BSD license, all text above must be included in any redistribution - */ - -#pragma once - -#include "Arduino.h" -#include "../../common/Common.h" - -#ifdef CAPACITIVE_COUNT -#include -#include - -// The default I2C address -#define MPR121_I2CADDR_DEFAULT 0x5A ///< default I2C address -#define MPR121_TOUCH_THRESHOLD_DEFAULT 12 ///< default touch threshold value -#define MPR121_RELEASE_THRESHOLD_DEFAULT 6 ///< default relese threshold value - -/*! - * Device register map - */ -enum { - MPR121_TOUCHSTATUS_L = 0x00, - MPR121_TOUCHSTATUS_H = 0x01, - MPR121_FILTDATA_0L = 0x04, - MPR121_FILTDATA_0H = 0x05, - MPR121_BASELINE_0 = 0x1E, - MPR121_MHDR = 0x2B, - MPR121_NHDR = 0x2C, - MPR121_NCLR = 0x2D, - MPR121_FDLR = 0x2E, - MPR121_MHDF = 0x2F, - MPR121_NHDF = 0x30, - MPR121_NCLF = 0x31, - MPR121_FDLF = 0x32, - MPR121_NHDT = 0x33, - MPR121_NCLT = 0x34, - MPR121_FDLT = 0x35, - - MPR121_TOUCHTH_0 = 0x41, - MPR121_RELEASETH_0 = 0x42, - MPR121_DEBOUNCE = 0x5B, - MPR121_CONFIG1 = 0x5C, - MPR121_CONFIG2 = 0x5D, - MPR121_CHARGECURR_0 = 0x5F, - MPR121_CHARGETIME_1 = 0x6C, - MPR121_ECR = 0x5E, - MPR121_AUTOCONFIG0 = 0x7B, - MPR121_AUTOCONFIG1 = 0x7C, - MPR121_UPLIMIT = 0x7D, - MPR121_LOWLIMIT = 0x7E, - MPR121_TARGETLIMIT = 0x7F, - - MPR121_GPIODIR = 0x76, - MPR121_GPIOEN = 0x77, - MPR121_GPIOSET = 0x78, - MPR121_GPIOCLR = 0x79, - MPR121_GPIOTOGGLE = 0x7A, - - MPR121_SOFTRESET = 0x80, -}; - -//.. thru to 0x1C/0x1D - -/*! - * @brief Class that stores state and functions for interacting with MPR121 - * proximity capacitive touch sensor controller. - */ -class Adafruit_MPR121 { -public: - // Hardware I2C - Adafruit_MPR121(); - - bool begin(uint8_t i2caddr = MPR121_I2CADDR_DEFAULT, TwoWire *theWire = &Wire, - uint8_t touchThreshold = MPR121_TOUCH_THRESHOLD_DEFAULT, - uint8_t releaseThreshold = MPR121_RELEASE_THRESHOLD_DEFAULT); - - uint16_t filteredData(uint8_t t); - uint16_t baselineData(uint8_t t); - - uint8_t readRegister8(uint8_t reg); - uint16_t readRegister16(uint8_t reg); - void writeRegister(uint8_t reg, uint8_t value); - uint16_t touched(void); - // Add deprecated attribute so that the compiler shows a warning - void setThreshholds(uint8_t touch, uint8_t release) - __attribute__((deprecated)); - void setThresholds(uint8_t touch, uint8_t release); - -private: - Adafruit_I2CDevice *i2c_dev = NULL; -}; - - -#endif // CAPACITIVE def diff --git a/Firmware/BentoFlowCreator/src/sensors/capacitive/CapacitiveManager.cpp b/Firmware/BentoFlowCreator/src/sensors/capacitive/CapacitiveManager.cpp deleted file mode 100644 index c188c8c9..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/capacitive/CapacitiveManager.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#include "CapacitiveManager.h" - -const String CapacitiveEvent::eventNames[CapacitiveEvent::TYPES_MAX]{"touch", "values"}; - -CapacitiveManager::CapacitiveManager() : Component("capacitive"), - isConnected(false), - isEnabled(true), - sendLevel(2), - capSendTime(20), //50fps - timeSinceCapLastSent(0), - lastTouchStates(0) -{ -} - -CapacitiveManager::~CapacitiveManager() -{ -} - -void CapacitiveManager::init() -{ -#ifdef CAPACITIVE_COUNT - NDBG("Init"); - if (isConnected) - return; - - if (!cap.begin(0x5A)) - { - Serial.println("MPR121 not found, check wiring?"); - isConnected = false; - return; - } - - isConnected = true; - NDBG("Capacitive is connected."); - -#ifdef USE_PREFERENCES -//prefs.begin(name.c_str()); -//prefs.end(); -#endif - -#endif -} - -void CapacitiveManager::update() -{ - if (!isEnabled || !isConnected) - return; - -#ifdef CAPACITIVE_COUNT - - uint16_t touchStates = cap.touched(); - - for (int i = 0; i < CAPACITIVE_COUNT; i++) - { - bool t = touchStates & (1 << i); - setTouch(i, t); - values[i] = cap.filteredData(i); - } - - long curTime = millis(); - if (curTime > timeSinceCapLastSent + capSendTime) - { - if (sendLevel >= 2) - { - - sendEvent(CapacitiveEvent(CapacitiveEvent::ValuesUpdate, values, CAPACITIVE_COUNT)); - } - - timeSinceCapLastSent = curTime; - } -#endif -} -void CapacitiveManager::setTouch(int index, bool value) -{ -#ifdef CAPACITIVE_COUNT - if (touches[index] == value) - return; - touches[index] = value; - sendEvent(CapacitiveEvent(CapacitiveEvent::TouchUpdate, index, value)); -#endif -} - -void CapacitiveManager::setEnabled(bool value) -{ -#ifdef CAPACITIVE_COUNT - if (isEnabled == value) - return; - isEnabled = value; -#endif -} - -bool CapacitiveManager::handleCommand(String command, var *data, int numData) -{ -#ifdef CAPACITIVE_COUNT - if (checkCommand(command, "enabled", numData, 1)) - { - setEnabled(data[0].intValue()); - return true; - } - if (checkCommand(command, "sendLevel", numData, 1)) - { - sendLevel = data[0].intValue(); - return true; - } - else if (checkCommand(command, "updateRate", numData, 1)) - { - capSendTime = 1000 / data[0].intValue(); - return true; - } -#endif - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/sensors/capacitive/CapacitiveManager.h b/Firmware/BentoFlowCreator/src/sensors/capacitive/CapacitiveManager.h deleted file mode 100644 index c6c54153..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/capacitive/CapacitiveManager.h +++ /dev/null @@ -1,57 +0,0 @@ -#include "../../common/Common.h" - -#ifdef CAPACITIVE_COUNT -#include "Adafruit_MPR121.h" -#endif -// You can have up to 4 on one i2c bus but one is enough for testing! - -class CapacitiveEvent -{ -public: - enum Type { TouchUpdate, ValuesUpdate, TYPES_MAX }; - static const String eventNames[TYPES_MAX]; - - CapacitiveEvent(Type t, float * data = nullptr, int numData = 0) : type(t), data(data), numData(numData) {} - CapacitiveEvent(Type t, int index, bool balue) : type(t), index(index), value(value) {} - Type type; - float * data; - int numData; - - int index; - bool value; -}; - - -class CapacitiveManager : public Component, public EventBroadcaster { -public: - CapacitiveManager(); - ~CapacitiveManager(); - -#ifdef CAPACITIVE_COUNT - Adafruit_MPR121 cap; - float values[CAPACITIVE_COUNT]; - bool touches[CAPACITIVE_COUNT]; -#endif - - bool isConnected; - bool isEnabled; - int sendLevel; //0 = throws / 1 = +orientation / 2 = + other stuff - - long capSendTime; - long timeSinceCapLastSent; - - - uint16_t lastTouchStates; - - void init(); - void update(); - - void setTouch(int index, bool value); - void setEnabled(bool value); - - bool handleCommand(String command, var * data, int numData) override; - - #ifdef USE_PREFERENCES - Preferences prefs; - #endif -}; diff --git a/Firmware/BentoFlowCreator/src/sensors/imu/IMUManager.cpp b/Firmware/BentoFlowCreator/src/sensors/imu/IMUManager.cpp deleted file mode 100644 index 130e9899..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/imu/IMUManager.cpp +++ /dev/null @@ -1,562 +0,0 @@ -#include "IMUManager.h" - -const String IMUEvent::eventNames[IMUEvent::TYPES_MAX]{"orientation", "accel", "gyro", "linearAccel", "gravity", "throwState", "calibration", "activity", "debug", "projectedAngleClub", "spin"}; -IMUManager *IMUManager::instance = NULL; - -IMUManager::IMUManager() : Component("imu"), -#ifdef HAS_IMU - bno(55), -#endif - isConnected(false), - isEnabled(false), - sendLevel(1), - orientationSendTime(20), // 50fps - timeSinceOrientationLastSent(0), - throwState(0) -#ifdef IMU_READ_ASYNC - , - hasNewData(false), shouldStopRead(false), imuLock(false) -#endif -{ - - instance = this; - -#ifdef HAS_IMU - bno.setMode(Adafruit_BNO055::OPERATION_MODE_CONFIG); - bno.setAxisRemap(Adafruit_BNO055::IMU_REMAP_CONFIG); - bno.setAxisSign(Adafruit_BNO055::IMU_REMAP_SIGN); - bno.setMode(Adafruit_BNO055::OPERATION_MODE_NDOF); - bno.setExtCrystalUse(true); -#endif - - accelThresholds[0] = .8f; - accelThresholds[1] = 2; - accelThresholds[2] = 4; - - diffThreshold = 8; - - flatThresholds[0] = .8f; - flatThresholds[1] = 2; - - semiFlatThreshold = 2; - loftieThreshold = 12; - singleThreshold = 25; - - activity = .0; - prevActivity = .0; - orientationXOffset = .0; - - angleOffset = .0f; - countNonDouble = 0; -} - -IMUManager::~IMUManager() -{ -} - -void IMUManager::init() -{ -#ifdef HAS_IMU - - NDBG("Init"); - if (isConnected) - return; - - Wire.begin(SDA_PIN, SCL_PIN); - - if (!bno.begin()) - { - NDBG("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!"); - isConnected = false; - return; - } - - bno.setMode(Adafruit_BNO055::OPERATION_MODE_CONFIG); - bno.setAxisRemap(IMU_REMAP_CONFIG); - bno.setAxisSign(IMU_REMAP_SIGN); - bno.setMode(Adafruit_BNO055::OPERATION_MODE_NDOF); - - //bno.setExtCrystalUse(true); - bno.enterNormalMode(); - - isConnected = true; - NDBG("Imu is connected."); - -#ifdef USE_PREFERENCES - prefs.begin(name.c_str()); - accelThresholds[0] = prefs.getFloat("throwMin", accelThresholds[0]); - accelThresholds[1] = prefs.getFloat("throwMax", accelThresholds[1]); - accelThresholds[1] = prefs.getFloat("throwFast", accelThresholds[2]); - diffThreshold = prefs.getFloat("diff", diffThreshold); - flatThresholds[0] = prefs.getFloat("flatMin", flatThresholds[0]); - flatThresholds[1] = prefs.getFloat("flatMax", flatThresholds[1]); - - semiFlatThreshold = prefs.getFloat("semiFlat", semiFlatThreshold); - loftieThreshold = prefs.getFloat("loftie", loftieThreshold); - singleThreshold = prefs.getFloat("single", singleThreshold); - - orientationXOffset = prefs.getFloat("xOffset", orientationXOffset); - prefs.end(); -#endif - -#ifdef IMU_READ_ASYNC - DBG("IMU Task Create"); - xTaskCreate(&IMUManager::readIMUStatic, "imu", NATIVE_STACK_SIZE, NULL, 1, NULL); -#endif - - DBG("IMU CONFIG: "); - DBG("flat threshold " + String(flatThresholds[0]) + " " + String(flatThresholds[1])); - DBG("accel threshold " + String(accelThresholds[0]) + " " + String(accelThresholds[1])); - DBG("diff threshold " + String(diffThreshold)); - DBG("semiFlat threshold " + String(semiFlatThreshold)); - DBG("loftie threshold " + String(loftieThreshold)); - DBG("single threshold " + String(singleThreshold)); - DBG("orientation x offset " + String(orientationXOffset)); - -#endif -} - -void IMUManager::update() -{ -#ifdef HAS_IMU - if (!isEnabled || !isConnected) - return; - -#ifdef IMU_READ_ASYNC - if (!hasNewData) - return; - hasNewData = false; - imuLock = true; -#else - readIMU(); -#endif - - long curTime = millis(); - if (curTime > timeSinceOrientationLastSent + orientationSendTime) - { - // TSTART() - if (sendLevel >= 1) - { - - sendEvent(IMUEvent(IMUEvent::OrientationUpdate, orientation, 3)); - if (sendLevel >= 2) - { - sendEvent(IMUEvent(IMUEvent::AccelUpdate, accel, 3)); - sendEvent(IMUEvent(IMUEvent::LinearAccelUpdate, linearAccel, 3)); - sendEvent(IMUEvent(IMUEvent::GyroUpdate, gyro, 3)); - sendEvent(IMUEvent(IMUEvent::ActivityUpdate)); - sendEvent(IMUEvent(IMUEvent::ProjectedAngleUpdate)); - sendEvent(IMUEvent(IMUEvent::SpinUpdate)); - // sendEvent(IMUEvent(IMUEvent::Gravity, gravity, 3)); - } - } - - timeSinceOrientationLastSent = curTime; - // TFINISH("Send") - } - -#ifdef IMU_READ_ASYNC - imuLock = false; -#endif - -#endif -} - -#ifdef IMU_READ_ASYNC -void IMUManager::readIMUStatic(void *) -{ - DBG("Thread IMU Start"); - while (!instance->shouldStopRead) - { - instance->readIMU(); - delay(5); - } - - DBG("Thread IMU Finish"); - - vTaskDelete(NULL); - - DBG("Task deleted"); -} -#endif - -void IMUManager::readIMU() -{ - if (!isEnabled) - return; -#ifdef HAS_IMU - -#ifdef IMU_READ_ASYNC - if (imuLock) - return; -#endif - - //DBG("Read IMU"); - - imu::Quaternion q = bno.getQuat(); - q.normalize(); - - // float temp = q.x(); q.x() = -q.y(); q.y() = temp; - // q.z() = -q.z(); - - imu::Vector<3> euler = q.toEuler(); - orientation[0] = fmod(((euler.x() * 180 / PI) + orientationXOffset + 180.0f*5), 360.0f) - 180.0f; - orientation[1] = euler.y() * 180 / PI; // Pitch - orientation[2] = euler.z() * 180 / PI; // Roll - - - imu::Vector<3> acc = bno.getVector(Adafruit_BNO055::VECTOR_ACCELEROMETER); - accel[0] = acc.x(); - accel[1] = acc.y(); - accel[2] = acc.z(); - - imu::Vector<3> laccel = bno.getVector(Adafruit_BNO055::VECTOR_LINEARACCEL); - linearAccel[0] = laccel.x(); - linearAccel[1] = laccel.y(); - linearAccel[2] = laccel.z(); - - imu::Vector<3> gyr = bno.getVector(Adafruit_BNO055::VECTOR_GYROSCOPE); - gyro[0] = gyr.x(); - gyro[1] = gyr.y(); - gyro[2] = gyr.z(); - - // imu::Vector<3> grav = bno.getVector(Adafruit_BNO055::VECTOR_GRAVITY); - // gravity[0] = grav.x(); - // gravity[1] = grav.y(); - // gravity[2] = grav.z(); - - computeThrow(); - computeActivity(); - computeProjectedAngle(); - computeSpin(); - -#ifdef IMU_READ_ASYNC - hasNewData = true; -#endif - -#endif -} - -void IMUManager::computeSpin() { - float currentSpin = 0.5; - - if (throwState == 0) { - spinCount = 0; - currentSpinLastUpdate = 0; - lastThrowState = 0; - spin = 0; - return; - } - - if (throwState > 0 && lastThrowState == 0) { - launchOrientationX = orientation[0]; - - if (launchOrientationX >= 0 && launchOrientationX < 180) { - launchProjectedAngle = projectedAngle; - } else { - launchProjectedAngle = 1-projectedAngle; - } - } - - if (launchOrientationX >= 0 && launchOrientationX < 180) { - currentSpin = projectedAngle; - } else { - currentSpin = 1 - projectedAngle; - } - - if (currentSpin > 0 && currentSpin < 0.5 && currentSpinLastUpdate > 0.5) { - spinCount += 1; - } - - lastThrowState = throwState; - currentSpinLastUpdate = currentSpin; - spin = currentSpin + spinCount - launchProjectedAngle; -} - -void IMUManager::computeProjectedAngle() { - float eulerRadians[3]; - float lookAt[3]; - float result; - - //Recalculate x orientation for the projected angle, based on xOnCalibration - float xOrientation = orientation[0]; - float newX = 0; - if (xOnCalibration < 0) { - if (xOrientation > xOnCalibration) { - if (xOrientation < 0) { - newX = (xOnCalibration * -1) - (xOrientation * -1); - } else { - if (xOrientation + (xOnCalibration * -1) > 180.0f) { - newX = (360.0f - xOrientation - (xOnCalibration * -1)) * -1; - } else { - newX = xOrientation + (xOnCalibration * -1); - } - } - } else { - newX = (xOnCalibration * -1) - (xOrientation * -1); - } - } else { - if (xOrientation > xOnCalibration) { - newX = xOrientation - xOnCalibration; - } else { - if ((xOrientation - xOnCalibration) < -180) { - newX = (180.0f - xOnCalibration) + (180.0f - (xOrientation * -1)); - } else { - newX = xOrientation - xOnCalibration; - } - } - } - - eulerRadians[0] = newX * PI / 180.0f; - eulerRadians[1] = orientation[1] * PI / 180.0f; - eulerRadians[2] = orientation[2] * PI / 180.0f; - - lookAt[0] = cos(eulerRadians[1]) * sin(eulerRadians[0]); - lookAt[1] = sin(eulerRadians[1]); - lookAt[2] = cos(eulerRadians[1]) * cos(eulerRadians[0]); - - result = atan(lookAt[1] / lookAt[2]) - PI / 2.0f; - - if (lookAt[2] > 0.0f) { - result = result + PI; - } - - result = (result / PI) * 0.5f + 0.5f; - result = fmod((result + angleOffset), 1.0f); - - if (result >= 0.5) { - result = result - 0.5; - } else { - result = result + 0.5; - } - - projectedAngle = result; - - // DBG("Projected Angle: " + String(projectedAngle)); -} - - -void IMUManager::computeThrow() -{ -#ifdef HAS_IMU - float maxAccelYZ = max(abs(accel[1]), abs(accel[2])); - float maxAccel = max(maxAccelYZ, abs(accel[0])); - float maxLinearAccel = max(max(abs(linearAccel[0]), abs(linearAccel[1])), abs(linearAccel[2])); - float accLinearDiff = abs(maxAccelYZ - maxLinearAccel); - - bool curIsFlat = throwState == 1; - float flatThresh = curIsFlat ? flatThresholds[1] : flatThresholds[0]; - bool isFlatting = maxAccel < flatThresh; - bool isFastSpin = false; - - int newState = 0; - if (isFlatting) - { - newState = 1; // flat - } - else - { - bool curIsThrowing = throwState > 1; - isFastSpin = accel[0] >= 38.0f; - float throwThresh = curIsThrowing ? accelThresholds[1] : accelThresholds[0]; - throwThresh = isFastSpin ? accelThresholds[2] : throwThresh; - - bool accelCheck = maxAccelYZ < throwThresh; - - bool isThrowing = false; - - if (curIsThrowing) - { - isThrowing = accelCheck; - } - else - { - bool diffCheck = accLinearDiff > diffThreshold; - isThrowing = accelCheck && diffCheck; - } - - float throwPower = abs(accel[0]); - - if (isThrowing) - { - if (throwPower < semiFlatThreshold) - newState = 4; - else if (throwPower < loftieThreshold) - newState = 5; - else if (throwPower < singleThreshold) - newState = 2; - else - newState = 3; // double - - if (curIsThrowing && throwState != newState) { - if (throwState == 3 && newState == 2) { - newState = 3; // double will stay a double - } else if (throwState == 2 && newState == 5) { - newState = 2; // single will stay a single - } - } - } - - if (newState != 3 && countNonDouble < 10) { - countNonDouble = countNonDouble + 1; - } else if (newState == 3) { - countNonDouble = 0; - } - - if (throwState == 3 && newState != 3 && countNonDouble < 3) { - newState = 3; - } - } - - // NDBG(String(throwState)); - - if (newState != throwState) - { - throwState = newState; - sendEvent(IMUEvent(IMUEvent::ThrowState)); - } - -#endif -} - - -void IMUManager::computeActivity() -{ - float maxLinearAccel = max(max(abs(linearAccel[0]), abs(linearAccel[1])), abs(linearAccel[2])); - maxLinearAccel = (((maxLinearAccel - 0) * (1 - 0)) / (40 - 0)) + 0; // remap to 0..1 range - maxLinearAccel = min(maxLinearAccel, (float)1.0); - - activity = prevActivity + (maxLinearAccel - prevActivity) * 0.1; - prevActivity = activity; -} - - -void IMUManager::sendCalibrationStatus() { - uint8_t system, gyro, accel, mag; - system = gyro = accel = mag = 0; - bno.getCalibration(&system, &gyro, &accel, &mag); - - calibration[0] = (float)system; - calibration[1] = (float)gyro; - calibration[2] = (float)accel; - calibration[3] = (float)mag; - - sendEvent(IMUEvent(IMUEvent::CalibrationStatus, calibration, 4)); -} - - -void IMUManager::setEnabled(bool value) -{ - if (isEnabled == value) - return; - - isEnabled = value; -} - -void IMUManager::setOrientationXOffset(float offset = 0.0f) -{ - orientationXOffset = offset; -} - -void IMUManager::setProjectAngleOffset(float yaw = 0.0f, float angle = 0.0f) -{ - angleOffset = angle; - xOnCalibration = yaw; -} - -void IMUManager::shutdown() -{ - setEnabled(false); - #ifdef IMU_READ_ASYNC - shouldStopRead = true; - #endif -} - -bool IMUManager::handleCommand(String command, var *data, int numData) -{ -#ifdef HAS_IMU - if (checkCommand(command, "enabled", numData, 1)) - { - setEnabled(data[0].intValue()); - return true; - } - if (checkCommand(command, "sendLevel", numData, 1)) - { - sendLevel = data[0].intValue(); - return true; - } - else if (checkCommand(command, "updateRate", numData, 1)) - { - orientationSendTime = 1000 / data[0].intValue(); - return true; - } - else if (checkCommand(command, "calibrationStatus", numData, 0)) - { - sendCalibrationStatus(); - return true; - } - else if (checkCommand(command, "accelThresholds", numData, 3)) - { - accelThresholds[0] = data[0].floatValue(); - accelThresholds[1] = data[1].floatValue(); - accelThresholds[2] = data[2].floatValue(); - prefs.begin(name.c_str()); - prefs.putFloat("throwMin", accelThresholds[0]); - prefs.putFloat("throwMax", accelThresholds[1]); - prefs.putFloat("throwFast", accelThresholds[2]); - prefs.end(); - return true; - } - else if (checkCommand(command, "diffThreshold", numData, 1)) - { - diffThreshold = data[0].floatValue(); - prefs.begin(name.c_str()); - prefs.putFloat("diff", diffThreshold); - prefs.end(); - return true; - } - else if (checkCommand(command, "flatThresholds", numData, 2)) - { - flatThresholds[0] = data[0].floatValue(); - flatThresholds[1] = data[1].floatValue(); - prefs.begin(name.c_str()); - prefs.putFloat("flatMin", flatThresholds[0]); - prefs.putFloat("flatMax", flatThresholds[1]); - prefs.end(); - return true; - } - else if (checkCommand(command, "semiFlatThreshold", numData, 1)) - { - semiFlatThreshold = data[0].floatValue(); - prefs.begin(name.c_str()); - prefs.putFloat("semiFlat", semiFlatThreshold); - prefs.end(); - return true; - } - else if (checkCommand(command, "loftieThreshold", numData, 1)) - { - loftieThreshold = data[0].floatValue(); - prefs.begin(name.c_str()); - prefs.putFloat("loftie", loftieThreshold); - prefs.end(); - return true; - } - else if (checkCommand(command, "singleThreshold", numData, 1)) - { - singleThreshold = data[0].floatValue(); - prefs.begin(name.c_str()); - prefs.putFloat("single", singleThreshold); - prefs.end(); - return true; - } - else if (checkCommand(command, "orientationXOffset", numData, 1)) - { - orientationXOffset = data[0].floatValue(); - prefs.begin(name.c_str()); - prefs.putFloat("xOffset", orientationXOffset); - prefs.end(); - return true; - } -#endif - return false; -} diff --git a/Firmware/BentoFlowCreator/src/sensors/imu/IMUManager.h b/Firmware/BentoFlowCreator/src/sensors/imu/IMUManager.h deleted file mode 100644 index 677d4eb6..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/imu/IMUManager.h +++ /dev/null @@ -1,111 +0,0 @@ -#include "../../common/Common.h" - -#include -#include "Adafruit_BNO055/Adafruit_BNO055.h" - -#define TRAIL_MAX 20 -#define IMU_READ_ASYNC -#define NATIVE_STACK_SIZE (32 * 1024) - -class IMUEvent -{ -public: - enum Type { OrientationUpdate, AccelUpdate, GyroUpdate, LinearAccelUpdate, Gravity, ThrowState, CalibrationStatus, ActivityUpdate, Debug, ProjectedAngleUpdate, SpinUpdate, TYPES_MAX }; - static const String eventNames[TYPES_MAX]; - - IMUEvent(Type t, float * data = nullptr, int numData = 0) : type(t), data(data), numData(numData) {} - Type type; - float * data; - int intData; - int numData; -}; - - -class IMUManager : public Component, public EventBroadcaster { -public: - IMUManager(); - ~IMUManager(); - - static IMUManager * instance; - -#ifdef HAS_IMU - Adafruit_BNO055 bno; -#endif - - long tstart; - long tend; - - bool isConnected; - bool isEnabled; - int sendLevel; //-1 = noSend / 0 = throws / 1 = +orientation / 2 = + other stuff - - long orientationSendTime; - long timeSinceOrientationLastSent; - - float calibration[4]; - - float orientation[3]; - float accel[3]; - float gyro[3]; - float linearAccel[3]; - float gravity[3]; - float orientationXOffset; - - int throwState; //0 = none, 1 = flat, 2 = single, 3 = double+, 4 = flat-front, 5 = loftie - float activity; - float prevActivity; - float debug[4]; - - //IMU Compute - float flatThresholds[2]; - float accelThresholds[3]; - float diffThreshold; - float semiFlatThreshold; - float loftieThreshold; - float singleThreshold; - - // Projected Angle - float angleOffset; - float projectedAngle; - float xOnCalibration; - int countNonDouble; - - // Spin Compute - float launchOrientationX; - float launchProjectedAngle; - float currentSpinLastUpdate; - int lastThrowState; - int spinCount; - float spin; - - -#ifdef IMU_READ_ASYNC - bool hasNewData; - bool imuLock; - bool shouldStopRead; - static void readIMUStatic(void *); -#endif - - void init(); - void update(); - - void readIMU(); - - void sendCalibrationStatus(); - void computeThrow(); - void computeActivity(); - void computeProjectedAngle(); - void computeSpin(); - - void setEnabled(bool value); - void setOrientationXOffset(float offset); - void setProjectAngleOffset(float yaw, float angle); - - void shutdown(); - - bool handleCommand(String command, var * data, int numData) override; - - #ifdef USE_PREFERENCES - Preferences prefs; - #endif -}; diff --git a/Firmware/BentoFlowCreator/src/sensors/touch/TouchManager.cpp b/Firmware/BentoFlowCreator/src/sensors/touch/TouchManager.cpp deleted file mode 100644 index 96dbb9fb..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/touch/TouchManager.cpp +++ /dev/null @@ -1,135 +0,0 @@ - -#include "TouchManager.h" - -const String TouchEvent::eventNames[TouchEvent::TYPES_MAX]{"pressed", "shortPress", "longPress", "veryLongPress", "multiPress"}; - -TouchManager::TouchManager() : - Component("touch"), - touchThreshold(90) -{ - #ifdef TOUCH_COUNT - for (int i = 0; i < TOUCH_COUNT; i++) - { - isPressed[i] = false; - debounceCount[i] = 0; - multiPressCount[i] = 0; - timeAtPress[i] = 0; - } - #endif -} - -void TouchManager::init() -{ - -#ifdef TOUCH_COUNT - for (int i = 0; i < TOUCH_COUNT; i++) - { - - //pinMode(buttonPins[i], BUTTON_INPUT_MODE); - //isPressed[i] = digitalRead(buttonPins[i]); - } -#endif //TOUCH_COUNT > 0 - -#ifdef TOUCH_WAKEUP_PIN -//Setup interrupt on Touch Pad 3 (GPIO15) - // touchAttachInterrupt(TOUCH_WAKEUP_PIN, touchCallback, touchThreshold); -#endif //TOUCH_WAKEUP_PIN - -} - -void TouchManager::update() -{ -#ifdef TOUCH_COUNT - for (int i = 0; i < TOUCH_COUNT; i++) - { - bool v = touchRead(touchPins[i]) < touchThreshold; - - if (v) - debounceCount[i] = min(debounceCount[i] + 1, touchPressDebounce); - else - debounceCount[i] = max(debounceCount[i] - 1, 0); - - bool newPressed = isPressed[i]; - if (isPressed[i] && debounceCount[i] == 0) - newPressed = false; - - if (!isPressed[i] && debounceCount[i] == touchPressDebounce) - newPressed = true; - - if (newPressed != isPressed[i]) //touch state changed - { - isPressed[i] = newPressed; - isLongPressed[i] = false; - isVeryLongPressed[i] = false; - - if (isPressed[i]) - { - timeAtPress[i] = millis(); - sendEvent(TouchEvent(TouchEvent::Pressed, i, 1)); - - multiPressCount[i]++; - sendEvent(TouchEvent(TouchEvent::MultiPress, i, multiPressCount[i])); - } - else - { - if (millis() < timeAtPress[i] + shortPressTime) - { - sendEvent(TouchEvent(TouchEvent::ShortPress, i)); - } - - sendEvent(TouchEvent(TouchEvent::Pressed, i, 0)); - } - } - else - { - if (isPressed[i]) - { - if (!isLongPressed[i] && millis() > timeAtPress[i] + longPressTime) - { - isLongPressed[i] = true; - sendEvent(TouchEvent(TouchEvent::LongPress, i)); - } - - if (!isVeryLongPressed[i] && millis() > timeAtPress[i] + veryLongPressTime) - { - isVeryLongPressed[i] = true; - sendEvent(TouchEvent(TouchEvent::VeryLongPress, i)); - } - } - - if (millis() > timeAtPress[i] + multiPressTime) - { - if(multiPressCount[i] > 0) - { - multiPressCount[i] = 0; - sendEvent(TouchEvent(TouchEvent::MultiPress, i, multiPressCount[i])); - } - } - } - } -#endif //TOUCH_COUNT -} - -void TouchManager::touchCallback() -{ - DBG("Touch callback"); -} - -void TouchManager::setTouchThreshold(int value) -{ - NDBG("Touch threshold is now "+String(value)); - touchThreshold = value; - // touch_pad_set_thresh(TOUCH_WAKEUP_PIN, value); -} - -bool TouchManager::handleCommand(String command, var *data, int numData) -{ -#ifdef TOUCH_COUNT - if (checkCommand(command, "threshold", numData, 0)) - { - setTouchThreshold(data[0].intValue()); - return true; - } -#endif - return false; -} \ No newline at end of file diff --git a/Firmware/BentoFlowCreator/src/sensors/touch/TouchManager.h b/Firmware/BentoFlowCreator/src/sensors/touch/TouchManager.h deleted file mode 100644 index f5ea260b..00000000 --- a/Firmware/BentoFlowCreator/src/sensors/touch/TouchManager.h +++ /dev/null @@ -1,65 +0,0 @@ -#pragma once -#include "../../common/Common.h" - -class TouchEvent -{ -public: - enum Type - { - Pressed, - ShortPress, - LongPress, - VeryLongPress, - MultiPress, - TYPES_MAX - }; - - static const String eventNames[TYPES_MAX]; - - TouchEvent(Type type, int id, int value = 1) : type(type), id(id), value(value) {} - - Type type; - int id; - int value; -}; - -class TouchManager : - public Component, - public EventBroadcaster -{ -public: - TouchManager(); - ~TouchManager(){} - - int touchThreshold; - -#ifdef TOUCH_COUNT - bool isPressed[TOUCH_COUNT]; - bool isLongPressed[TOUCH_COUNT]; - bool isVeryLongPressed[TOUCH_COUNT]; -#endif - - void init(); - void update(); - - void setTouchThreshold(int value); - - static void touchCallback(); - - bool handleCommand(String command, var *data, int numData) override; - -private : - const int longPressTime = 500; //more than 500ms is long press - const int veryLongPressTime = 1500; //more than 1500ms is very long press - const int shortPressTime = 500; //less than 500ms is short press - const int multiPressTime = 300; //each new press shorter than 500ms after the previous one will increase the multiclick - - const int touchPressDebounce = 5; //denoising, needs five reads to validate a change - -#ifdef TOUCH_COUNT - int debounceCount[TOUCH_COUNT]; - - long timeAtPress[TOUCH_COUNT]; - int multiPressCount[TOUCH_COUNT]; - #endif -}; \ No newline at end of file diff --git a/Firmware/Bentuino/.vscode/c_cpp_properties.json b/Firmware/Bentuino/.vscode/c_cpp_properties.json index ae1b1730..bf96572c 100644 --- a/Firmware/Bentuino/.vscode/c_cpp_properties.json +++ b/Firmware/Bentuino/.vscode/c_cpp_properties.json @@ -11,33 +11,33 @@ "D:/Projects/Dev/BenTo/Firmware/Bentuino/include", "D:/Projects/Dev/BenTo/Firmware/Bentuino/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/FastAccelStepper/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/WebSockets/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/FastAccelStepper/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/WebSockets/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ESP Async WebServer/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/AsyncTCP/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ArtnetWifi/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ESP32Servo/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/SimplexNoise", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Wasm3/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/arduino-timer/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit DotStar", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ESP Async WebServer/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/AsyncTCP/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ArtnetWifi/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ESP32Servo/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/SimplexNoise", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Wasm3/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/arduino-timer/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit DotStar", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/ESPmDNS/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/OSC", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/OSC", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SD/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPIFFS/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/FS/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ArduinoJson/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ArduinoJson/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Preferences/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit BNO055", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit BNO055/utility", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit Unified Sensor", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit BusIO", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit BNO055", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit BNO055/utility", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit Unified Sensor", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit BusIO", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit NeoPixel", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit NeoPixel", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/esp_additions/freertos", @@ -264,33 +264,33 @@ "D:/Projects/Dev/BenTo/Firmware/Bentuino/include", "D:/Projects/Dev/BenTo/Firmware/Bentuino/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SD_MMC/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/FastAccelStepper/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/WebSockets/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/FastAccelStepper/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/WebSockets/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WiFiClientSecure/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Ethernet/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ESP Async WebServer/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/AsyncTCP/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ArtnetWifi/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ESP32Servo/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/SimplexNoise", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Wasm3/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/arduino-timer/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit DotStar", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ESP Async WebServer/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/AsyncTCP/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ArtnetWifi/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ESP32Servo/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/SimplexNoise", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Wasm3/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/arduino-timer/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit DotStar", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/ESPmDNS/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/OSC", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/OSC", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SD/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPIFFS/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/FS/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/ArduinoJson/src", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/ArduinoJson/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Preferences/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit BNO055", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit BNO055/utility", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit Unified Sensor", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit BusIO", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit BNO055", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit BNO055/utility", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit Unified Sensor", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit BusIO", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src", - "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/olimex/Adafruit NeoPixel", + "D:/Projects/Dev/BenTo/Firmware/Bentuino/.pio/libdeps/phonetuino/Adafruit NeoPixel", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include", "C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/esp_additions/freertos", @@ -514,7 +514,7 @@ }, "defines": [ "PLATFORMIO=60115", - "ARDUINO_ESP32_POE", + "ARDUINO_FEATHER_ESP32", "ARDUINO_BENTUINO", "USE_SERIAL", "USE_SERVER", @@ -524,46 +524,15 @@ "CONFIG_ASYNC_TCP_USE_WDT=0", "USE_WIFI", "USE_OSC", - "BENTUINO_CREATORTAB", - "USE_ETHERNET=true", - "WIFI_DEFAULT_MODE=MODE_ETH", + "USE_IO", + "IO_MAX_COUNT=6", "USE_POWER", "POWER_KEEP_PIN=12", - "POWER_WAKEUP_BUTTON=34", + "POWER_WAKEUP_BUTTON=36", "POWER_WAKEUP_BUTTON_STATE=true", - "USE_LEDSTRIP", - "USE_STREAMING", - "LEDSTRIP_MAX_COUNT=1", - "LED_DEFAULT_EN_PIN=-1", - "LED_DEFAULT_DATA_PIN=4", - "LED_DEFAULT_CLK_PIN=-1", - "LED_DEFAULT_COUNT=32", - "LED_DEFAULT_TYPE=WS2812B", - "LED_DEFAULT_COLOR_ORDER=GRB", - "LED_DEFAULT_INVERT_DIRECTION=false", - "LED_DEFAULT_BRIGHTNESS=0.5f", - "LED_MAX_BRIGHTNESS=0.4f", - "LED_MAX_COUNT=1000", - "PLAYBACK_USE_ALPHA", - "PLAYBACK_MAX_SCRIPTS=32", - "USE_FX", "USE_BUTTON", "BUTTON_MAX_COUNT=4", - "BUTTON_DEFAULT_PIN=34", - "USE_IO", - "IO_MAX_COUNT=4", - "IO_DEFAULT_PIN=-1", - "IO_DEFAULT_MODE=IOComponent::PinMode::A_OUTPUT", - "USE_FILES", - "FILES_TYPE_MMC", - "FILES_DEFAULT_SDSPEED=27000000", - "FILES_DEFAULT_SD_EN=33", - "FILES_DEFAULT_SD_POWER_VALUE=LOW", - "FILES_DEFAULT_SD_MISO=19", - "FILES_DEFAULT_SD_MOSI=13", - "FILES_DEFAULT_SD_SCK=14", - "FILES_DEFAULT_SD_CS=15", - "USE_SCRIPT", + "BUTTON_DEFAULT_PIN=36", "HAVE_CONFIG_H", "MBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\"", "UNITY_INCLUDE_CONFIG_H", @@ -577,13 +546,13 @@ "F_CPU=240000000L", "ARDUINO=10812", "ARDUINO_VARIANT=\"esp32\"", - "ARDUINO_BOARD=\"OLIMEX ESP32-PoE\"", + "ARDUINO_BOARD=\"Adafruit ESP32 Feather\"", "ARDUINO_PARTITION_huge_app", "" ], "cStandard": "gnu99", "cppStandard": "gnu++11", - "compilerPath": "C:/Users/bkupe/.platformio/packages/toolchain-xtensa-esp32/bin/xtensa-esp32-elf-gcc.exe", + "compilerPath": "C:/Users/bkupe/.platformio/packages/toolchain-xtensa-esp32@8.4.0+2021r2-patch3/bin/xtensa-esp32-elf-gcc.exe", "compilerArgs": [ "-mlongcalls", "" diff --git a/Firmware/Bentuino/platformio.ini b/Firmware/Bentuino/platformio.ini index a391ac39..de5ad682 100644 --- a/Firmware/Bentuino/platformio.ini +++ b/Firmware/Bentuino/platformio.ini @@ -9,7 +9,7 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = creatorclub +default_envs = phonetuino [bentuino] platform = espressif32@~5.0.0 @@ -292,9 +292,11 @@ build_flags = [env:phonetuino] extends = bentuino +board = featheresp32 build_flags = ${bentuino.build_flags} -D USE_IO + -D IO_MAX_COUNT=6 -D USE_POWER -D POWER_KEEP_PIN=12 -D POWER_WAKEUP_BUTTON=36