Skip to content

Commit

Permalink
fix macro checks
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Feb 21, 2024
1 parent fc93bed commit 28fedcf
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 18 deletions.
17 changes: 15 additions & 2 deletions Firmware/BentoFlow/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs = esp8266
default_envs = bentoflow

[base]
board = whackbutton
board = creatorwheel
framework = arduino
lib_deps =
https://github.com/adafruit/Adafruit_BNO055.git#1.4.3
Expand Down Expand Up @@ -46,6 +46,19 @@ lib_deps =
m5stack/M5StickCPlus@^0.0.8
kosme/arduinoFFT @ ^1.5.6
rstephan/ArtnetWifi @ ^1.4.0
https://github.com/adafruit/Adafruit_BNO055.git#1.4.3
Wire
SPI
Preferences
SPIFFS
ESPmDNS
https://github.com/contrem/arduino-timer
wasm3/Wasm3 @ ^0.5.0
https://github.com/jshaw/SimplexNoise
WebServer
fastled/FastLED @ ^3.5.0
benkuper/OSC @ ^1.0.0
bblanchon/ArduinoJson @ ^6.21.2

[env:bentoflow]
extends = base, esp32
Expand Down
2 changes: 1 addition & 1 deletion Firmware/BentoFlow/src/MainManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class MainManager : public Component
void rgbLedsEvent(const RGBLedsEvent &e);
#endif

#if HAS_FILES
#ifdef HAS_FILES
void fileEvent(const FileEvent &e);
#endif

Expand Down
6 changes: 6 additions & 0 deletions Firmware/BentoFlow/src/common/config/config_creatorwheel.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
const int buttonPins[BUTTON_COUNT]{36};

//battery sence
#define HAS_BATTERY
#define BATTERY_PIN 35 // takes the measurment from the battery sence.
#define BATTERY_CHARGE_PIN 39

Expand All @@ -65,6 +66,11 @@ const int buttonPins[BUTTON_COUNT]{36};

// SD config
#define HAS_FILES
#define HAS_BATTERY



#define HAS_SCRIPTS

#define SDSPEED 27000000

Expand Down
2 changes: 1 addition & 1 deletion Firmware/BentoFlow/src/leds/LedManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ void LedManager::init()
rgbManager.addListener(std::bind(&LedManager::rgbLedsEvent, this, std::placeholders::_1));
sysLedMode.init();

#if HAS_IR
#ifdef HAS_IR
irManager.init();
#endif

Expand Down
4 changes: 2 additions & 2 deletions Firmware/BentoFlow/src/leds/LedManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ class LedManager : public Component {
//out
RGBLedsManager rgbManager;

#if HAS_LED_FX
#ifdef HAS_LED_FX
FXManager fxManager;
#endif

#if HAS_IR
#ifdef HAS_IR
IRLedsManager irManager;
#endif

Expand Down
2 changes: 1 addition & 1 deletion Firmware/BentoFlow/src/leds/fx/FXManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "FXManager.h"
#include "../../MainManager.h"

#if HAS_LED_FX
#ifdef HAS_LED_FX

#ifdef LED_COUNT

Expand Down
2 changes: 1 addition & 1 deletion Firmware/BentoFlow/src/leds/fx/FXManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "common/Common.h"

#if HAS_LED_FX
#ifdef HAS_LED_FX

#ifdef LED_COUNT
#include <FastLED.h>
Expand Down
2 changes: 1 addition & 1 deletion Firmware/BentoFlow/src/leds/player/PlayerMode.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

#include "PlayerMode.h"
#if HAS_SCRIPTS
#ifdef HAS_SCRIPTS
#include "../../scripts/ScriptManager.h"
#endif

Expand Down
49 changes: 40 additions & 9 deletions Firmware/BentoFlow/src/scripts/wasmFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,82 +168,106 @@ m3ApiRawFunction(m3_pointHSV)
m3ApiRawFunction(m3_setIR)
{
m3ApiGetArg(float, v);
#ifdef HAS_IR
MainManager::instance->leds.irManager.setBrightness(v);

#endif
m3ApiSuccess();
}


m3ApiRawFunction(m3_updateLeds)
{
MainManager::instance->leds.rgbManager.update();
m3ApiSuccess();
}


m3ApiRawFunction(m3_getFXSpeed)
{
m3ApiReturnType(float);
#ifdef HAS_LED_FX
float v = MainManager::instance->leds.fxManager.offsetSpeed;
#else
float v = 0;
#endif
m3ApiReturn((float)v);
}

m3ApiRawFunction(m3_getFXIsoSpeed)
{
m3ApiReturnType(float);
#ifdef HAS_LED_FX
float v = MainManager::instance->leds.fxManager.isolationSpeed;
#else
float v = 0;
#endif
m3ApiReturn((float)v);
}

m3ApiRawFunction(m3_getFXStaticOffset)
{
m3ApiReturnType(float);
#ifdef HAS_LED_FX
float v = MainManager::instance->leds.fxManager.staticOffset;
#else
float v = 0;
#endif
m3ApiReturn((float)v);
}

m3ApiRawFunction(m3_getFXFlipped)
{
m3ApiReturnType(uint32_t);
#ifdef HAS_LED_FX
bool v = MainManager::instance->leds.fxManager.boardIsFlipped;
#else
float v = 0;
#endif
m3ApiReturn((uint32_t)v);
}

m3ApiRawFunction(m3_setFXSpeed)
{
m3ApiGetArg(float, sp);
#ifdef HAS_LED_FX
MainManager::instance->leds.fxManager.offsetSpeed = sp;
#endif
m3ApiSuccess();
}

m3ApiRawFunction(m3_setFXIsoSpeed)
{
m3ApiGetArg(float, sp);
#ifdef HAS_LED_FX
MainManager::instance->leds.fxManager.isolationSpeed = sp;
#endif
m3ApiSuccess();
}

m3ApiRawFunction(m3_setFXIsoAxis)
{
m3ApiGetArg(uint32_t, ax);
#ifdef HAS_LED_FX
MainManager::instance->leds.fxManager.isolationAxis = ax;
#endif
m3ApiSuccess();
}

m3ApiRawFunction(m3_setFXStaticOffset)
{
m3ApiGetArg(float, sp);
#ifdef HAS_LED_FX
MainManager::instance->leds.fxManager.staticOffset = sp;
#endif
m3ApiSuccess();
}

m3ApiRawFunction(m3_resetFX)
{
#ifdef HAS_LED_FX
MainManager::instance->leds.fxManager.reset();
#endif
m3ApiSuccess();
}


#endif

m3ApiRawFunction(m3_setBatterySendEnabled)
Expand All @@ -255,22 +279,26 @@ m3ApiRawFunction(m3_setBatterySendEnabled)

m3ApiRawFunction(m3_playVariant)
{
#ifdef HAS_VARIANT
m3ApiGetArg(uint32_t, v);
String name = MainManager::instance->leds.playerMode.fileName;
float time = MainManager::instance->leds.playerMode.curTimeMs;
uint32_t start = millis();
char l = name.charAt(name.length()-1);
char l = name.charAt(name.length() - 1);

if (l >= '0' && l <= '9') {
name.remove(name.length()-1);
}
if (l >= '0' && l <= '9')
{
name.remove(name.length() - 1);
}

name = name + String(v);

MainManager::instance->leds.playerMode.load(name, false);

time = (time + (millis() - start)) / 1000;
MainManager::instance->leds.playerMode.play(time);
#endif

m3ApiSuccess();
}

Expand Down Expand Up @@ -364,24 +392,27 @@ m3ApiRawFunction(m3_getSpin)
m3ApiRawFunction(m3_setMicEnabled)
{
m3ApiGetArg(uint32_t, en);
#ifdef HAS_MIC
MicManager::instance->setEnabled((bool)en);
#endif
m3ApiSuccess();
}

m3ApiRawFunction(m3_getMicLevel)
{
m3ApiReturnType(float);

#ifdef HAS_MIC
#ifdef BUTTON_COUNT
float v = MicManager::instance->enveloppe;
#endif
#else
float v = 0;
#endif

m3ApiReturn((float)v);
}


m3ApiRawFunction(m3_randomInt)
{
m3ApiReturnType(uint32_t);
Expand Down

0 comments on commit 28fedcf

Please sign in to comment.