Skip to content
Open

V2 #13

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea
.vscode
.pio
.DS_Store
.DS_Store
*.pio.h
14 changes: 0 additions & 14 deletions .vscode/c_cpp_properties.json

This file was deleted.

28 changes: 6 additions & 22 deletions src/EffectsController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ void EffectsController::addEffect(EffectContainer *container) {
stackEffectContainers[++stackCounter] = container;
}

void EffectsController::attachBrightnessControl(byte port, byte poti) {
brightnessControl[--port] = poti;
}

void EffectsController::setBrightness(byte port, byte brightness) {
ws2812FXDevices[--port][0]->setBrightness(brightness);
ws2812FXbrightness[port] = brightness;
Expand Down Expand Up @@ -142,6 +138,12 @@ void EffectsController::handleEvent(Event *event) {

void EffectsController::handleEvent(ConfigEvent *event) {
if (event->boardId == boardId) {
if (flickerState)
_ledBuiltInDevice->on();
else
_ledBuiltInDevice->off();
flickerState = !flickerState;

switch (event->topic) {
case CONFIG_TOPIC_PLATFORM:
platform = event->value;
Expand Down Expand Up @@ -517,24 +519,6 @@ void EffectsController::update() {
}
}
}

if (brightnessControlBasePin > 0) {
if (millis() - brightnessUpdateInterval >
UPDATE_INTERVAL_WS2812FX_BRIGHTNESS) {
// Don't update the brightness too often.
brightnessUpdateInterval = millis();
for (byte i = 0; i < PPUC_MAX_BRIGHTNESS_CONTROLS; i++) {
brightnessControlReads[i] =
analogRead(brightnessControlBasePin + i) / 4;
}
for (byte i = 0; i < PPUC_MAX_WS2812FX_DEVICES; i++) {
if (brightnessControl[i] > 0) {
setBrightness(i + 1,
brightnessControlReads[brightnessControl[i - 1]]);
}
}
}
}
}

void EffectsController::start() {
Expand Down
7 changes: 2 additions & 5 deletions src/EffectsController.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class EffectsController : public EventListener {
if (controllerType == CONTROLLER_16_8_1) {
// Read bordID. Ideal value at 10bit resolution: (DIP+1)*1023*2/35
// -> 58.46 to 935.3
boardId = 16 - ((int)((analogRead(28) + 29.23) / 58.46));
boardId = (16 - ((int)((analogRead(28) + 29.23) / 58.46))) & 0b0111;

_ledBuiltInDevice = new LedBuiltInDevice();
_ledBuiltInDevice->on();
Expand Down Expand Up @@ -133,10 +133,7 @@ class EffectsController : public EventListener {
byte ws2812FXbrightness[PPUC_MAX_WS2812FX_DEVICES] = {0};
EffectContainer* stackEffectContainers[EFFECT_STACK_SIZE];
int stackCounter = -1;
byte brightnessControl[PPUC_MAX_WS2812FX_DEVICES] = {0};
byte brightnessControlReads[PPUC_MAX_BRIGHTNESS_CONTROLS] = {0};
byte brightnessControlBasePin = 0;

bool flickerState = false;
int mode = 0;

byte platform;
Expand Down
2 changes: 1 addition & 1 deletion src/EventDispatcher/CrossLinkDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CrossLinkDebugger::CrossLinkDebugger() {
Serial.print("PPUC board #");
// Read bordID. Ideal value at 10bit resolution: (DIP+1)*1023*2/35 -> 58.46
// to 935.3
Serial.println(16 - ((int)((analogRead(28) + 29.23) / 58.46)));
Serial.println((16 - ((int)((analogRead(28) + 29.23) / 58.46))) & 0b0111);
Serial.println("PPUC core #0 started");
Serial.println("PPUC CrossLinkDebugger");
Serial.println("----------------------");
Expand Down
7 changes: 4 additions & 3 deletions src/EventDispatcher/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define CONFIG_TOPIC_SWITCHES 115 // "s"
#define CONFIG_TOPIC_TRIGGER 116 // "t"
#define CONFIG_TOPIC_SWITCH_MATRIX 120 // "x"
#define CONFIG_TOPIC_SWITCH_CHAIN 121 // "y"

#define CONFIG_TOPIC_HOLD_POWER_ACTIVATION_TIME 65 // "A"
#define CONFIG_TOPIC_DURATION 65 // "A"
Expand All @@ -63,8 +64,10 @@
#define CONFIG_TOPIC_MIN_PULSE_TIME 77 // "M"
#define CONFIG_TOPIC_FROM 77 // "M"
#define CONFIG_TOPIC_MIN_INTENSITY 77 // "M"
#define CONFIG_TOPIC_DEBOUNCE_TIME 77 // "M"
#define CONFIG_TOPIC_NUMBER 78 // "N"
#define CONFIG_TOPIC_AMOUNT_LEDS 79 // "O"
#define CONFIG_TOPIC_NUM_ROWS 79 // "O"
#define CONFIG_TOPIC_PORT 80 // "P"
#define CONFIG_TOPIC_SPEED 83 // "S"
#define CONFIG_TOPIC_SOURCE 83 // "S"
Expand All @@ -74,6 +77,7 @@
#define CONFIG_TOPIC_LIGHT_UP 85 // "U"
#define CONFIG_TOPIC_ACTIVE_LOW 86 // "V"
#define CONFIG_TOPIC_POWER 87 // "W"
#define CONFIG_TOPIC_NEXT_BOARD 88 // "X"
#define CONFIG_TOPIC_TYPE 89 // "Y"
#define CONFIG_TOPIC_EFFECT 89 // "Y"
#define CONFIG_TOPIC_MODE 90 // "Z"
Expand All @@ -91,9 +95,6 @@
#define LED_TYPE_FLASHER 2 // Flasher
#define LED_TYPE_LAMP 3 // Lamp

#define MATRIX_TYPE_COLUMN 1 // Column
#define MATRIX_TYPE_ROW 2 // Row

#define PWM_EFFECT_SINE 1
#define PWM_EFFECT_RAMP_DOWN_STOP 2
#define PWM_EFFECT_IMPULSE 3
Expand Down
Loading
Loading