ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Controller.h
Go to the documentation of this file.
1/**
2 * @file Controller.h
3 * @brief Declares the Controller base class for managing lighting controllers.
4 *
5 * This file defines the Controller class, which serves as a base class for
6 * managing brightness and display operations for various lighting controllers.
7 *
8 * @date 22/12/2024
9 * @author Coela Can't
10 */
11
12#pragma once
13
14#include <Arduino.h> // Include for Arduino compatibility.
15#include "../Utils/Math/Mathematics.h" // Include for mathematical utilities.
16#include "../Camera/CameraManager/CameraManager.h" // Include for camera management.
17
18/**
19 * @class Controller
20 * @brief Base class for managing brightness and display operations of lighting controllers.
21 *
22 * The Controller class provides an abstract interface and shared functionality
23 * for managing lighting systems, including brightness adjustment and display updates.
24 */
26private:
27 const uint32_t softStart = 5000000; ///< Duration for soft start in microseconds.
28 uint32_t previousTime; ///< Tracks the last update time.
29
30protected:
31 CameraManager* cameras; ///< Pointer to the CameraManager for managing camera data.
32 uint8_t brightness; ///< Current brightness level.
33 uint8_t accentBrightness; ///< Current accent brightness level.
34 uint8_t maxBrightness; ///< Maximum allowed brightness level.
35 uint8_t maxAccentBrightness; ///< Maximum allowed accent brightness level.
36 bool isOn = false; ///< Indicates if the controller is active.
37 bool startTime = false; ///< Indicates if the start time has been recorded.
38
39 /**
40 * @brief Constructs a Controller with specified parameters.
41 *
42 * @param cameras Pointer to the CameraManager.
43 * @param maxBrightness Maximum brightness for the controller.
44 * @param maxAccentBrightness Maximum accent brightness for the controller.
45 */
47
48 /**
49 * @brief Updates the brightness based on internal logic.
50 */
51 void UpdateBrightness();
52
53public:
54 /**
55 * @brief Initializes the controller.
56 */
57 virtual void Initialize() = 0;
58
59 /**
60 * @brief Updates and displays content on the lighting system.
61 */
62 virtual void Display() = 0;
63
64 /**
65 * @brief Retrieves the current brightness level.
66 *
67 * @return The current brightness as an 8-bit value.
68 */
69 uint8_t GetBrightness();
70
71 /**
72 * @brief Retrieves the current accent brightness level.
73 *
74 * @return The current accent brightness as an 8-bit value.
75 */
76 uint8_t GetAccentBrightness();
77
78 /**
79 * @brief Sets the maximum brightness for the controller.
80 *
81 * @param maxBrightness The maximum brightness value (0-255).
82 */
83 virtual void SetBrightness(uint8_t maxBrightness) = 0;
84
85 /**
86 * @brief Sets the maximum accent brightness for the controller.
87 *
88 * @param maxAccentBrightness The maximum accent brightness value (0-255). This is the secondary display if available.
89 */
90 virtual void SetAccentBrightness(uint8_t maxAccentBrightness) = 0;
91};
Manages multiple 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
bool startTime
Indicates if the start time has been recorded.
Definition Controller.h:37
uint32_t previousTime
Tracks the last update time.
Definition Controller.h:28
const uint32_t softStart
Duration for soft start in microseconds.
Definition Controller.h:27
uint8_t accentBrightness
Current accent brightness level.
Definition Controller.h:33
virtual void SetBrightness(uint8_t maxBrightness)=0
Sets the maximum brightness for the controller.
virtual void Display()=0
Updates and displays content on the lighting system.
uint8_t brightness
Current brightness level.
Definition Controller.h:32
uint8_t maxBrightness
Maximum allowed brightness level.
Definition Controller.h:34
virtual void Initialize()=0
Initializes the controller.
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
virtual void SetAccentBrightness(uint8_t maxAccentBrightness)=0
Sets the maximum accent brightness for the controller.
bool isOn
Indicates if the controller is active.
Definition Controller.h:36
uint8_t GetBrightness()
Retrieves the current brightness level.
uint8_t GetAccentBrightness()
Retrieves the current accent brightness level.