Lamp-Da 0.1
A compact lantern project
Loading...
Searching...
No Matches
constants.h
Go to the documentation of this file.
1
5#ifndef USER_CONSTANTS_H
6#define USER_CONSTANTS_H
7
8#include <cstdint>
9#include <cmath>
10
11namespace lampda {
12
13//
14// common to all lamp type
15//
16
17// does button usermode defaults to "lockdown" mode?
18static constexpr bool usermodeDefaultsToLockdown = false;
19
20static constexpr float c_PI = 3.1415926535897f;
21static constexpr float c_TWO_PI = 6.2831853071795f;
22static constexpr float c_HALF_PI = 1.5707963267948f;
23
24static constexpr float c_degreesToRadians = c_PI / 180.0f;
25// Update when the soft changes version
26static constexpr uint8_t USER_SOFTWARE_VERSION_MAJOR = 1;
27static constexpr uint8_t USER_SOFTWARE_VERSION_MINOR = 8;
28
29//
30// simple lamp type
31//
32
33#ifdef LMBD_LAMP_TYPE__SIMPLE
34
35// compute the expected average loop runtime (in ms)
36// defined as milliseconds / FPS
37static constexpr uint32_t MAIN_LOOP_UPDATE_PERIOD_MS = static_cast<uint32_t>(1000 / 80.0f);
38
39// parameters of the led strip used
40static constexpr float consWattByMeter = 12; // power consumption (in Watt/meters)
41static constexpr uint16_t stripInputMinVoltage_mV = 9400; // min allowed voltage
42static constexpr uint16_t stripInputMaxVoltage_mV = 12000; // max allowed voltage
43static constexpr float ledStripLength_mm = 91.0f * 25.0f; // 91 sections of 25 mm
44
45// define position of led 0 to the circuit center
46static constexpr float circuitToLedZeroRotationX_degrees = 0.0f;
47static constexpr float circuitToLedZeroRotationY_degrees = 0.0f;
48static constexpr float circuitToLedZeroRotationZ_degrees = 88.0f;
49
50#endif // LMBD_LAMP_TYPE__SIMPLE
51
52//
53// cct lamp type
54//
55
56#ifdef LMBD_LAMP_TYPE__CCT
57
58// compute the expected average loop runtime (in ms)
59// defined as milliseconds / FPS
60static constexpr uint32_t MAIN_LOOP_UPDATE_PERIOD_MS = static_cast<uint32_t>(1000 / 80.0f);
61
62// parameters of the led strip used
63static constexpr float consWattByMeter = 10; // power consumption (in Watt/meters)
64static constexpr uint16_t stripInputMinVoltage_mV = 9000; // min allowed led voltage
65static constexpr uint16_t stripInputMaxVoltage_mV = 12000; // min allowed led voltage
66static constexpr float ledStripLength_mm = 67.0f * 27.0f; // 67 sections of 27 mm
67
68// define position of led 0 to the circuit center
69static constexpr float circuitToLedZeroRotationX_degrees = 0.0f;
70static constexpr float circuitToLedZeroRotationY_degrees = 0.0f;
71static constexpr float circuitToLedZeroRotationZ_degrees = 88.0f;
72
73#endif // LMBD_LAMP_TYPE__CCT
74
75//
76// indexable lamp type
77//
78
79#ifdef LMBD_LAMP_TYPE__INDEXABLE
80static constexpr float lampBodyRadius_mm = 25; // external radius of the lamp body
81
82// parameters of the led strip used
83#ifdef LMBD_LAMP_TYPE__INDEXABLE_IS_HD
84// hd 240L/m strip
85static constexpr uint16_t LED_COUNT = 870; // How many indexable leds are attached to the controler
86static constexpr float consWattByMeter = 5; // power consumption (in Watt/meters)
87static constexpr uint16_t stripInputMinVoltage_mV = 12000; // min allowed voltage
88static constexpr uint16_t stripInputMaxVoltage_mV = 12000; // max allowed voltage
89static constexpr float ledByMeter = 244; // the REAL indexable led by meters (for a 240Led/m)
90static constexpr float ledStripWidth_mm = 5.2f; // width of the led strip
91static constexpr float ledStripHeigh_mm = 0.7f; // heigh of the led strip (calibrated for this strip)
92static constexpr uint8_t minimumAllowedBrightness_8 = 3; // minium allowed brightnes level,0-255
93
94// compute the expected average loop runtime (in ms)
95// defined as milliseconds / FPS
96static constexpr uint32_t MAIN_LOOP_UPDATE_PERIOD_MS = static_cast<uint32_t>(1000 / 40.0f);
97#else
98// standard 160L/m strip
99static constexpr uint16_t LED_COUNT = 580; // How many indexable leds are attached to the controler
100static constexpr float consWattByMeter = 5; // power consumption (in Watt/meters)
101static constexpr uint16_t stripInputMinVoltage_mV = 12000; // min allowed voltage
102static constexpr uint16_t stripInputMaxVoltage_mV = 12000; // max allowed voltage
103static constexpr float ledByMeter = 162.6f; // the REAL indexable led by meters (for a 160Led/m)
104static constexpr float ledStripWidth_mm = 5.2f; // width of the led strip
105static constexpr float ledStripHeigh_mm = 0.7f; // heigh of the led strip (calibrated for this strip)
106static constexpr uint8_t minimumAllowedBrightness_8 = 3; // minium allowed brightnes level,0-255
107
108// compute the expected average loop runtime (in ms)
109// defined as milliseconds / FPS
110static constexpr uint32_t MAIN_LOOP_UPDATE_PERIOD_MS = static_cast<uint32_t>(1000 / 80.0f);
111#endif
112
113// physical parameters computations
114static constexpr float ledSize_mm = 1000.0f / ledByMeter; // size of the individual led
115static constexpr float lampBodyCircumpherence_mm = c_TWO_PI * lampBodyRadius_mm; // external circumpherence
116static constexpr float ledStripLength_mm = LED_COUNT * ledSize_mm;
117
118// led per tube circumpherence
119static constexpr float ledPerTurn = lampBodyCircumpherence_mm / ledSize_mm;
120// estimate of the lamp height
121static constexpr float lampHeight = ledStripWidth_mm * LED_COUNT / ledPerTurn;
122
123static constexpr float stripXCoordinates = lampBodyCircumpherence_mm / ledSize_mm;
124static constexpr float stripYCoordinates = ledStripLength_mm / lampBodyCircumpherence_mm;
125static constexpr float lampBodyHeight_mm = stripYCoordinates * ledStripWidth_mm;
126
127constexpr uint16_t stripMatrixWidth = ceil(stripXCoordinates);
128constexpr uint16_t stripMatrixHeight = ceil(stripYCoordinates);
129
130// define position of led 0 to the circuit center
131static constexpr float circuitToLedZeroRotationX_degrees = 0.0f;
132static constexpr float circuitToLedZeroRotationY_degrees = 0.0f;
133static constexpr float circuitToLedZeroRotationZ_degrees = 88.0f;
134
135#endif // LMBD_LAMP_TYPE__INDEXABLE
136
137//
138// add your own lamp type below :)
139//
140
141} // namespace lampda
142
143#endif
Program scope.
Definition: control_fixed_modes.hpp:12
static constexpr float c_PI
PI constant.
Definition: constants.h:20
static constexpr float c_degreesToRadians
convert degrees to radians
Definition: constants.h:24
static constexpr float c_TWO_PI
2*PI constant
Definition: constants.h:21
static constexpr float c_HALF_PI
PI/2 constant.
Definition: constants.h:22