Skip to content

Commit

Permalink
Bentuino rework
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Oct 5, 2023
1 parent 0255a95 commit 0d8db94
Show file tree
Hide file tree
Showing 52 changed files with 736 additions and 583 deletions.
96 changes: 55 additions & 41 deletions Firmware/Bentuino/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@
{
"name": "PlatformIO",
"includePath": [
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/include",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/lib/SD/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/FastAccelStepper/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArtnetWifi/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ESP32Servo/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/include",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/lib/SD/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/FastAccelStepper/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArtnetWifi/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ESP32Servo/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/SimplexNoise",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Wasm3/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/arduino-timer/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit DotStar",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/SimplexNoise",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Wasm3/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/arduino-timer/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit DotStar",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/ESPmDNS/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/OSC",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/OSC",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPIFFS/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/FS/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArduinoJson/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArduinoJson/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Preferences/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055/utility",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit Unified Sensor",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BusIO",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055/utility",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit Unified Sensor",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BusIO",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit NeoPixel",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit NeoPixel",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_trace",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_update",
Expand Down Expand Up @@ -121,31 +121,31 @@
"browse": {
"limitSymbolsToIncludedHeaders": true,
"path": [
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/include",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/lib/SD/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/FastAccelStepper/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArtnetWifi/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ESP32Servo/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/include",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/lib/SD/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/FastAccelStepper/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArtnetWifi/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ESP32Servo/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/SimplexNoise",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Wasm3/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/arduino-timer/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit DotStar",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/SimplexNoise",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Wasm3/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/arduino-timer/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit DotStar",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/ESPmDNS/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/OSC",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/OSC",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPIFFS/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/FS/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArduinoJson/src",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/ArduinoJson/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Preferences/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055/utility",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit Unified Sensor",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BusIO",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BNO055/utility",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit Unified Sensor",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit BusIO",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/SPI/src",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/libraries/Wire/src",
"d:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit NeoPixel",
"D:/Documents/Perso/Projects/BenTo/Firmware/Bentuino/.pio/libdeps/bentuino/Adafruit NeoPixel",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/config",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_trace",
"C:/Users/bkupe/.platformio/packages/framework-arduinoespressif32/tools/sdk/include/app_update",
Expand Down Expand Up @@ -233,11 +233,25 @@
]
},
"defines": [
"PLATFORMIO=50205",
"ARDUINO_FLOWTOYS_CREATOR_TAB",
"PLATFORMIO=60111",
"ARDUINO_ESP32_DEV",
"ARDUINO_BENTUINO",
"POWER_KEEP_PIN=12",
"WAKEUP_BUTTON=36",
"WAKEUP_BUTTON_STATE=HIGH",
"POWER_WAKEUP_BUTTON=32",
"POWER_WAKEUP_BUTTON_STATE=HIGH",
"LED_DEFAULT_EN_PIN=27",
"LED_DEFAULT_DATA_PIN=32",
"LED_DEFAULT_CLK_PIN=33",
"LED_DEFAULT_COUNT=32",
"LED_DEFAULT_TYPE=SK9822",
"LED_DEFAULT_COLOR_ORDER=BGR",
"LED_DEFAULT_INVERT_DIRECTION=1",
"LED_DEFAULT_BRIGHTNESS=0.5f",
"LED_MAX_BRIGHTNESS=0.5f",
"LED_MAX_COUNT=1000",
"BUTTON_DEFAULT_PIN=34",
"IMU_DEFAULT_SDA=23",
"IMU_DEFAULT_SCL=22",
"ESP32",
"ESP_PLATFORM",
"F_CPU=240000000L",
Expand All @@ -246,11 +260,11 @@
"ARDUINO=10805",
"ARDUINO_ARCH_ESP32",
"ARDUINO_VARIANT=\"esp32\"",
"ARDUINO_BOARD=\"Flowtoys Creator Tab\"",
"ARDUINO_BOARD=\"Espressif ESP32 Dev Module\"",
""
],
"cStandard": "c99",
"cppStandard": "c++11",
"cStandard": "gnu99",
"cppStandard": "gnu++11",
"compilerPath": "C:/Users/bkupe/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gcc.exe",
"compilerArgs": [
"-mlongcalls",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"ldscript": "esp32_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_FLOWTOYS_CREATOR_CLUB -DPOWER_KEEP_PIN=12 -DWAKEUP_BUTTON=32 -DWAKEUP_BUTTON_STATE=HIGH",
"extra_flags": "",
"f_cpu": "240000000L",
"f_flash": "40000000L",
"flash_mode": "dio",
"mcu": "esp32",
"variant": "esp32",
"partitions":"default.csv"
"partitions":"no_ota.csv"
},
"connectivity": [
"wifi",
Expand All @@ -25,13 +25,13 @@
"arduino",
"espidf"
],
"name": "Flowtoys Creator Club",
"name": "Flowtoys Creator",
"upload": {
"flash_size": "4MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
"speed": 921600
},
"url": "https://github.com/benkuper/Bento",
"vendor": "Flowtoys"
Expand Down
2 changes: 1 addition & 1 deletion Firmware/Bentuino/boards/flowtoyscreatortab.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"require_upload_port": true,
"speed": 460800
"speed": 921600
},
"url": "https://github.com/benkuper/Bento",
"vendor": "Flowtoys"
Expand Down
32 changes: 30 additions & 2 deletions Firmware/Bentuino/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
; https://docs.platformio.org/page/projectconf.html

[env:bentuino]
board = esp32dev
platform = espressif32
board = flowtoyscreatortab
framework = arduino
lib_deps =
adafruit/Adafruit NeoPixel@^1.10.0
Expand All @@ -33,8 +33,36 @@ lib_deps =
madhephaestus/ESP32Servo @ ^0.11.0
rstephan/ArtnetWifi @ ^1.4.0
gin66/FastAccelStepper @ ^0.27.4
src_filter = +<main.cpp> +<UnityIncludes.cpp>

build_src_filter = +<main.cpp> +<UnityIncludes.cpp>
upload_speed = 921600
monitor_speed = 115200
lib_compat_mode = strict
lib_ldf_mode = deep
board_build.f_cpu = 240000000L
board_build.f_flash = 40000000L
board_build.flash_mode = dio
board_build.mcu = esp32
board_build.variant = esp32
board_build.partitions = no_ota.csv

build_flags =
-D ARDUINO_BENTUINO
-D POWER_KEEP_PIN=12
-D POWER_WAKEUP_BUTTON=32
-D POWER_WAKEUP_BUTTON_STATE=HIGH
-D LED_DEFAULT_EN_PIN=27
-D LED_DEFAULT_DATA_PIN=32
-D LED_DEFAULT_CLK_PIN=33
-D LED_DEFAULT_COUNT=32
-D LED_DEFAULT_TYPE=SK9822
-D LED_DEFAULT_COLOR_ORDER=BGR
-D LED_DEFAULT_INVERT_DIRECTION=1
-D LED_DEFAULT_BRIGHTNESS=0.5f
-D LED_MAX_BRIGHTNESS=0.5f
-D LED_MAX_COUNT=1000
-D BUTTON_DEFAULT_PIN=34
-D IMU_DEFAULT_SDA=23
-D IMU_DEFAULT_SCL=22


36 changes: 17 additions & 19 deletions Firmware/Bentuino/src/Common/BoardDefines.h
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
#pragma once

#ifndef MAIN_INCLUDE // Avoid showing twice

#ifndef MAIN_INCLUDE //Avoid showing twice
#pragma message ("Compiling For " ARDUINO_BOARD)
#endif
#pragma message("Compiling For " ARDUINO_BOARD)

#ifdef POWER_KEEP_PIN
#pragma message("Using Power PIN " XSTR(POWER_KEEP_PIN))
#define BOARD_INIT_POWER \
pinMode(POWER_KEEP_PIN, OUTPUT); \
digitalWrite(POWER_KEEP_PIN, HIGH); // keep pin12 high to keep board awake

#ifndef MAIN_INCLUDE //Avoid showing twice
#pragma message ("Using Power PIN " XSTR(POWER_KEEP_PIN))
#endif
#define BOARD_SHUTDOWN_POWER \
digitalWrite(POWER_KEEP_PIN, LOW);
#else

//keep pin12 high to keep board awake
#define BoardInit \
pinMode(POWER_KEEP_PIN, OUTPUT);\
digitalWrite(POWER_KEEP_PIN, HIGH);
#define BOARD_INIT_POWER
#define BOARD_INIT_SHUTDOWN

#define BoardShutdown \
digitalWrite(POWER_KEEP_PIN, LOW);
#endif
#endif //POWER_KEEP_PIN

#endif // MAIN_INCLUDE


#ifndef BoardInit
#define BoardInit
#endif
#define BoardInit \
BOARD_INIT_POWER

#ifndef BoardShutdown
#define BoardShutdown
#endif
#define BoardShutdown \
BOARD_SHUTDOWN_POWER
37 changes: 23 additions & 14 deletions Firmware/Bentuino/src/Common/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

// Component Helpers
#define AddComponent(name, comp, Type, enabled) comp = addComponent<Type##Component>(name, enabled, o["components"][name]);
#define AddOwnedComponent(comp) addComponent(comp, o["components"][(comp)->name]);
#define AddDefaultComponentListener(comp) comp->addListener(std::bind(&Component::onChildComponentEvent, this, std::placeholders::_1));

// > Component Class definition
Expand All @@ -34,17 +35,17 @@
{ \
public:

#define DeclareSubComponent(ParentClass, ClassPrefix, Type, Derives) \
DeclareComponentClass(ParentClass, ClassPrefix, Derives) \
ClassPrefix##Component(const String &name, bool enabled = true) : ParentClass(name, enabled) {} \
~ClassPrefix##Component() {} \
#define DeclareSubComponent(ParentClass, ClassPrefix, Type, Derives) \
DeclareComponentClass(ParentClass, ClassPrefix, Derives) \
ClassPrefix##Component(const String &name = Type, bool enabled = true) : ParentClass(name, enabled) {} \
~ClassPrefix##Component() {} \
virtual String getTypeString() const override { return Type; }

#define DeclareComponentSingleton(ClassPrefix, Type, Derives) \
DeclareComponentClass(Component, ClassPrefix, Derives) \
DeclareSingleton(ClassPrefix##Component) \
ClassPrefix##Component(const String &name, bool enabled = true) : Component(name, enabled) { InitSingleton() } \
~ClassPrefix##Component() { DeleteSingleton() } \
#define DeclareComponentSingleton(ClassPrefix, Type, Derives) \
DeclareComponentClass(Component, ClassPrefix, Derives) \
DeclareSingleton(ClassPrefix##Component) \
ClassPrefix##Component(const String &name = Type, bool enabled = true) : Component(name, enabled) { InitSingleton() } \
~ClassPrefix##Component() { DeleteSingleton() } \
virtual String getTypeString() const override { return Type; }

#define DeclareComponent(ClassPrefix, Type, Derives) DeclareSubComponent(Component, ClassPrefix, Type, Derives)
Expand Down Expand Up @@ -84,15 +85,23 @@
#define AddDefaultParameterListener(Class, param) param->addListener(std::bind(&Class::onParameterEvent, this, std::placeholders::_1));
#define SendParameterFeedback(param) CommunicationComponent::instance->sendParameterFeedback(this, param);

#define AddParameter(name, val) addParameter(name, val)
#define AddRangeParameter(name, val, minVal, maxVal, isConfig) addParameter(name, val, minVal, maxVal, false)
#define DeclareParameter(param, val, isConfig) Parameter param {#param, val, var(), var(),isConfig}
#define DeclareRangeParameter(param, val, min, max, isConfig) Parameter param {#param, val, min, max,isConfig}
#define DeclareConfigParameter(param, val) DeclareParameter(param, val, true)
#define DeclareRangeConfigParameter(param, val) DeclareRangeParameter(param, val, min, max, true)

#define AddParameter(param) addParameter(&param)
#define AddAndSetParameter(param) { addParameter(&param); param.set(Settings::getVal(o, #param , param.val)); }

// #define AddParameter(name, val) addParameter(name, val)
// #define AddRangeParameter(name, val, minVal, maxVal, isConfig) addParameter(name, val, minVal, maxVal, false)
// Only config parameters check the settings
#define AddConfigParameter(name, val) addParameter(name, Settings::getVal(o, name, val), var(), var(), true)
#define AddRangeConfigParameter(name, val, minVal, maxVal) addParameter(name, Settings::getVal(o, name, val), minVal, maxVal, true)
// #define AddConfigParameter(name, val) addParameter(name, Settings::getVal(o, name, val), var(), var(), true)
// #define AddRangeConfigParameter(name, val, minVal, maxVal) addParameter(name, Settings::getVal(o, name, val), minVal, maxVal, true)

// Script

#define LinkScriptFunctionsStart \
#define LinkScriptFunctionsStart \
virtual void linkScriptFunctionsInternal(IM3Module module, const char *tName) override \
{
#define LinkScriptFunctionsEnd }
Expand Down
Loading

0 comments on commit 0d8db94

Please sign in to comment.