Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2b3b4f0

Browse files
Merge branch 'master' into release/v3.3.x
2 parents 69d8914 + ae634a9 commit 2b3b4f0

34 files changed

+4357
-9
lines changed

‎cores/esp32/ColorFormat.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ espHsvColor_t espRgbColorToHsvColor(espRgbColor_t rgb) {
119119
}
120120

121121
espRgbColor_t espXYColorToRgbColor(uint8_t Level, espXyColor_t xy) {
122-
return espXYToRgbColor(Level, xy.x, xy.y);
122+
return espXYToRgbColor(Level, xy.x, xy.y, true);
123123
}
124124

125-
espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y) {
125+
espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y, booladdXYZScaling) {
126126
// convert xyY color space to RGB
127127

128128
// https://www.easyrgb.com/en/math.php
@@ -156,9 +156,11 @@ espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t curren
156156
// X, Y and Z input refer to a D65/2° standard illuminant.
157157
// sR, sG and sB (standard RGB) output range = 0 ÷ 255
158158
// convert XYZ to RGB - CIE XYZ to sRGB
159-
X = X / 100.0f;
160-
Y = Y / 100.0f;
161-
Z = Z / 100.0f;
159+
if (addXYZScaling) {
160+
X = X / 100.0f;
161+
Y = Y / 100.0f;
162+
Z = Z / 100.0f;
163+
}
162164

163165
r = (X * 3.2406f) - (Y * 1.5372f) - (Z * 0.4986f);
164166
g = -(X * 0.9689f) + (Y * 1.8758f) + (Z * 0.0415f);

‎cores/esp32/ColorFormat.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#pragma once
2020

2121
#include <stdint.h>
22+
#include <stdbool.h>
2223
#ifdef __cplusplus
2324
extern "C" {
2425
#endif
@@ -49,7 +50,7 @@ typedef struct HsvColor_t espHsvColor_t;
4950
typedef struct XyColor_t espXyColor_t;
5051
typedef struct CtColor_t espCtColor_t;
5152

52-
espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y);
53+
espRgbColor_t espXYToRgbColor(uint8_t Level, uint16_t current_X, uint16_t current_Y, booladdXYZScaling);
5354
espRgbColor_t espXYColorToRgb(uint8_t Level, espXyColor_t xy);
5455
espXyColor_t espRgbColorToXYColor(espRgbColor_t rgb);
5556
espXyColor_t espRgbToXYColor(uint8_t r, uint8_t g, uint8_t b);

‎docs/en/libraries.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,15 @@ The Arduino ESP32 offers some unique APIs, described in this section:
9191
:glob:
9292

9393
api/*
94+
95+
Zigbee APIs
96+
-----------
97+
98+
.. toctree::
99+
:maxdepth: 1
100+
:glob:
101+
102+
zigbee/zigbee
103+
zigbee/zigbee_core
104+
zigbee/zigbee_ep
105+
zigbee/ep_*

‎docs/en/zigbee/ep_analog.rst

Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
############
2+
ZigbeeAnalog
3+
############
4+
5+
About
6+
-----
7+
8+
The ``ZigbeeAnalog`` class provides analog input and output endpoints for Zigbee networks. This endpoint implements the Zigbee Home Automation (HA) standard for analog signal processing and control.
9+
Analog Input (AI) is meant to be used for sensors that provide an analog signal, such as temperature, humidity, pressure to be sent to the coordinator.
10+
Analog Output (AO) is meant to be used for actuators that require an analog signal, such as dimmers, valves, etc. to be controlled by the coordinator.
11+
12+
13+
Common API
14+
----------
15+
16+
Constructor
17+
***********
18+
19+
ZigbeeAnalog
20+
^^^^^^^^^^^^
21+
22+
Creates a new Zigbee analog endpoint.
23+
24+
.. code-block:: arduino
25+
26+
ZigbeeAnalog(uint8_t endpoint);
27+
28+
* ``endpoint`` - Endpoint number (1-254)
29+
30+
Cluster Management
31+
******************
32+
33+
addAnalogInput
34+
^^^^^^^^^^^^^^
35+
36+
Adds analog input cluster to the endpoint.
37+
38+
.. code-block:: arduino
39+
40+
bool addAnalogInput();
41+
42+
This function will return ``true`` if successful, ``false`` otherwise.
43+
44+
addAnalogOutput
45+
^^^^^^^^^^^^^^^
46+
47+
Adds analog output cluster to the endpoint.
48+
49+
.. code-block:: arduino
50+
51+
bool addAnalogOutput();
52+
53+
This function will return ``true`` if successful, ``false`` otherwise.
54+
55+
Analog Input API
56+
----------------
57+
58+
Configuration Methods
59+
*********************
60+
61+
setAnalogInputApplication
62+
^^^^^^^^^^^^^^^^^^^^^^^^^
63+
64+
Sets the application type for the analog input.
65+
66+
.. code-block:: arduino
67+
68+
bool setAnalogInputApplication(uint32_t application_type);
69+
70+
* ``application_type`` - Application type constant (see esp_zigbee_zcl_analog_input.h for values)
71+
72+
This function will return ``true`` if successful, ``false`` otherwise.
73+
74+
setAnalogInputDescription
75+
^^^^^^^^^^^^^^^^^^^^^^^^^
76+
77+
Sets a custom description for the analog input.
78+
79+
.. code-block:: arduino
80+
81+
bool setAnalogInputDescription(const char *description);
82+
83+
* ``description`` - Description string
84+
85+
This function will return ``true`` if successful, ``false`` otherwise.
86+
87+
setAnalogInputResolution
88+
^^^^^^^^^^^^^^^^^^^^^^^^
89+
90+
Sets the resolution for the analog input.
91+
92+
.. code-block:: arduino
93+
94+
bool setAnalogInputResolution(float resolution);
95+
96+
* ``resolution`` - Resolution value
97+
98+
This function will return ``true`` if successful, ``false`` otherwise.
99+
100+
setAnalogInputMinMax
101+
^^^^^^^^^^^^^^^^^^^^
102+
103+
Sets the minimum and maximum values for the analog input.
104+
105+
.. code-block:: arduino
106+
107+
bool setAnalogInputMinMax(float min, float max);
108+
109+
* ``min`` - Minimum value
110+
* ``max`` - Maximum value
111+
112+
This function will return ``true`` if successful, ``false`` otherwise.
113+
114+
Value Control
115+
*************
116+
117+
setAnalogInput
118+
^^^^^^^^^^^^^^
119+
120+
Sets the analog input value.
121+
122+
.. code-block:: arduino
123+
124+
bool setAnalogInput(float analog);
125+
126+
* ``analog`` - Analog input value
127+
128+
This function will return ``true`` if successful, ``false`` otherwise.
129+
130+
Reporting Methods
131+
*****************
132+
133+
setAnalogInputReporting
134+
^^^^^^^^^^^^^^^^^^^^^^^
135+
136+
Sets the reporting configuration for analog input.
137+
138+
.. code-block:: arduino
139+
140+
bool setAnalogInputReporting(uint16_t min_interval, uint16_t max_interval, float delta);
141+
142+
* ``min_interval`` - Minimum reporting interval in seconds
143+
* ``max_interval`` - Maximum reporting interval in seconds
144+
* ``delta`` - Minimum change in value to trigger a report
145+
146+
This function will return ``true`` if successful, ``false`` otherwise.
147+
148+
reportAnalogInput
149+
^^^^^^^^^^^^^^^^^
150+
151+
Manually reports the current analog input value.
152+
153+
.. code-block:: arduino
154+
155+
bool reportAnalogInput();
156+
157+
This function will return ``true`` if successful, ``false`` otherwise.
158+
159+
Analog Output API
160+
-----------------
161+
162+
Configuration Methods
163+
*********************
164+
165+
setAnalogOutputApplication
166+
^^^^^^^^^^^^^^^^^^^^^^^^^^
167+
168+
Sets the application type for the analog output.
169+
170+
.. code-block:: arduino
171+
172+
bool setAnalogOutputApplication(uint32_t application_type);
173+
174+
* ``application_type`` - Application type constant (see esp_zigbee_zcl_analog_output.h for values)
175+
176+
This function will return ``true`` if successful, ``false`` otherwise.
177+
178+
setAnalogOutputDescription
179+
^^^^^^^^^^^^^^^^^^^^^^^^^^
180+
181+
Sets a custom description for the analog output.
182+
183+
.. code-block:: arduino
184+
185+
bool setAnalogOutputDescription(const char *description);
186+
187+
* ``description`` - Description string
188+
189+
This function will return ``true`` if successful, ``false`` otherwise.
190+
191+
setAnalogOutputResolution
192+
^^^^^^^^^^^^^^^^^^^^^^^^^
193+
194+
Sets the resolution for the analog output.
195+
196+
.. code-block:: arduino
197+
198+
bool setAnalogOutputResolution(float resolution);
199+
200+
* ``resolution`` - Resolution value
201+
202+
This function will return ``true`` if successful, ``false`` otherwise.
203+
204+
setAnalogOutputMinMax
205+
^^^^^^^^^^^^^^^^^^^^^
206+
207+
Sets the minimum and maximum values for the analog output.
208+
209+
.. code-block:: arduino
210+
211+
bool setAnalogOutputMinMax(float min, float max);
212+
213+
* ``min`` - Minimum value
214+
* ``max`` - Maximum value
215+
216+
This function will return ``true`` if successful, ``false`` otherwise.
217+
218+
Value Control
219+
*************
220+
221+
setAnalogOutput
222+
^^^^^^^^^^^^^^^
223+
224+
Sets the analog output value.
225+
226+
.. code-block:: arduino
227+
228+
bool setAnalogOutput(float analog);
229+
230+
* ``analog`` - Analog output value
231+
232+
This function will return ``true`` if successful, ``false`` otherwise.
233+
234+
getAnalogOutput
235+
^^^^^^^^^^^^^^^
236+
237+
Gets the current analog output value.
238+
239+
.. code-block:: arduino
240+
241+
float getAnalogOutput();
242+
243+
This function will return current analog output value.
244+
245+
Reporting Methods
246+
*****************
247+
248+
reportAnalogOutput
249+
^^^^^^^^^^^^^^^^^^
250+
251+
Manually reports the current analog output value.
252+
253+
.. code-block:: arduino
254+
255+
bool reportAnalogOutput();
256+
257+
This function will return ``true`` if successful, ``false`` otherwise.
258+
259+
Event Handling
260+
**************
261+
262+
onAnalogOutputChange
263+
^^^^^^^^^^^^^^^^^^^^
264+
265+
Sets a callback function to be called when the analog output value changes.
266+
267+
.. code-block:: arduino
268+
269+
void onAnalogOutputChange(void (*callback)(float analog));
270+
271+
* ``callback`` - Function to call when analog output changes
272+
273+
Example
274+
-------
275+
276+
Analog Input/Output
277+
*******************
278+
279+
.. literalinclude:: ../../../libraries/Zigbee/examples/Zigbee_Analog_Input_Output/Zigbee_Analog_Input_Output.ino
280+
:language: arduino

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /