ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
WS35Controller.cpp
Go to the documentation of this file.
1#include "WS35Controller.h"
2
3DMAMEM int dmaDisplayMemory[346 * 6];
4
5WS35Controller::WS35Controller(CameraManager* cameras, uint8_t maxBrightness) : Controller(cameras, maxBrightness, 0), leds(OctoWS2811(ledsPerStrip, dmaDisplayMemory, drawingMemory, config)){
6}
7
9 leds.begin();
10 leds.show();
11}
12
15
16 int offset;
17
18 IPixelGroup* camRghtPixels = cameras->GetCameras()[0]->GetPixelGroup();
19 IPixelGroup* camLeftPixels = cameras->GetCameras()[1]->GetPixelGroup();
20
21 for (int i = 0; i < 571; i++){
22 *camLeftPixels->GetColor(i) = camLeftPixels->GetColor(i)->Scale(brightness);
23 *camRghtPixels->GetColor(i) = camRghtPixels->GetColor(i)->Scale(brightness);
24 }
25
26 for (int i = 0; i < 571; i++) {
27 if (i < 346){
28 offset = i + 225;
29
30 leds.setPixel(i + 346 * 4, camLeftPixels->GetColor(offset)->R, camLeftPixels->GetColor(offset)->G, camLeftPixels->GetColor(offset)->B);//Pin 7
31 leds.setPixel(i + 346 * 5, camRghtPixels->GetColor(i)->R, camRghtPixels->GetColor(i)->G, camRghtPixels->GetColor(i)->B);//Pin 8
32 }
33 else{
34 offset = i - 346;
35
36 leds.setPixel(i + 346 * 6 - 346, camLeftPixels->GetColor(offset)->R, camLeftPixels->GetColor(offset)->G, camLeftPixels->GetColor(offset)->B);//Pin 8
37 leds.setPixel(i + 346 * 7 - 346, camRghtPixels->GetColor(i)->R, camRghtPixels->GetColor(i)->G, camRghtPixels->GetColor(i)->B);//Pin 8
38 }
39 }
40
41 leds.show();
42}
43
44void WS35Controller::SetPixels(uint8_t strip, uint16_t led, RGBColor rgb){
45 leds.setPixel(346 * strip + led, rgb.R, rgb.G, rgb.B);//Pin 8
46}
47
48void WS35Controller::SetBrightness(uint8_t maxBrightness){
49 this->maxBrightness = maxBrightness * 25 + 5;
50
51 if(isOn){//past soft start
52 this->brightness = maxBrightness * 25 + 5;
53 }
54}
55
56void WS35Controller::SetAccentBrightness(uint8_t maxAccentBrightness){
57 this->maxAccentBrightness = maxAccentBrightness * 25 + 5;
58
59 if(isOn){//past soft start
60 this->accentBrightness = maxAccentBrightness * 25 + 5;
61 }
62}
const int config
OctoWS2811 leds(ledsPerStrip, displayMemory, drawingMemory, config)
int drawingMemory[346 *6]
const int ledsPerStrip
DMAMEM int dmaDisplayMemory[346 *6]
Declares the WS35Controller class for managing WS2812-based displays on the Delta,...
virtual IPixelGroup * GetPixelGroup()=0
Retrieves the associated pixel group.
Manages multiple CameraBase objects.
CameraBase ** GetCameras()
Retrieves the array of CameraBase objects.
Base class for managing brightness and display operations of lighting controllers.
Definition Controller.h:25
uint8_t maxAccentBrightness
Maximum allowed accent brightness level.
Definition Controller.h:35
uint8_t accentBrightness
Current accent brightness level.
Definition Controller.h:33
uint8_t brightness
Current brightness level.
Definition Controller.h:32
uint8_t maxBrightness
Maximum allowed brightness level.
Definition Controller.h:34
CameraManager * cameras
Pointer to the CameraManager for managing camera data.
Definition Controller.h:31
void UpdateBrightness()
Updates the brightness based on internal logic.
Definition Controller.cpp:9
bool isOn
Indicates if the controller is active.
Definition Controller.h:36
Interface for managing and interacting with a collection of pixels.
Definition IPixelGroup.h:25
virtual RGBColor * GetColor(uint16_t count)=0
Retrieves the color of a specific pixel.
Represents an RGB color and provides methods for manipulation.
Definition RGBColor.h:23
RGBColor Scale(const uint8_t &maxBrightness)
Scales the brightness of the color to a maximum value.
Definition RGBColor.cpp:29
uint8_t B
Blue component of the color (0-255).
Definition RGBColor.h:27
uint8_t G
Green component of the color (0-255).
Definition RGBColor.h:26
uint8_t R
Red component of the color (0-255).
Definition RGBColor.h:25
void Initialize() override
Initializes the WS35Controller and sets up the displays.
OctoWS2811 leds
Instance of OctoWS2811 for controlling the LEDs.
WS35Controller(CameraManager *cameras, uint8_t maxBrightness)
Constructs a WS35Controller with specified parameters.
void SetPixels(uint8_t strip, uint16_t led, RGBColor rgb)
Sets the color of a specific LED on a specific strip.
void Display() override
Updates and displays the content on the WS2812 displays.
void SetAccentBrightness(uint8_t maxAccentBrightness) override
Sets the maximum accent brightness (not used for this controller).
void SetBrightness(uint8_t maxBrightness) override
Sets the maximum brightness for the displays.