Skip to content

Commit 36599a6

Browse files
committed
Switch color 3550938
1 parent ee9a32b commit 36599a6

File tree

9 files changed

+327
-334
lines changed

9 files changed

+327
-334
lines changed

hardware/arduino/zunoG2/cores/ZWSupport/ZWCCBasic.c

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
#include "ZWCCWindowCovering.h"
77
#include "ZWCCDoorLock.h"
88

9+
#if defined(WITH_CC_SWITCH_COLOR) && defined(WITH_CC_SWITCH_MULTILEVEL)
10+
__WEAK void __zunoSetterSwitchColorBrightness(uint8_t channel, uint8_t newValue) {
11+
(void)channel;
12+
(void)newValue;
13+
}
14+
15+
__WEAK uint8_t __zunoGetterSwitchColorBrightness(uint8_t channel) {
16+
return (0x0);
17+
(void)channel;
18+
}
19+
#endif
20+
921
void __zuno_BasicUniversalSetter1P(byte zuno_ch, uint8_t value) {
1022
uint8_t type = ZUNO_CFG_CHANNEL(zuno_ch).type;
1123

@@ -15,11 +27,11 @@ void __zuno_BasicUniversalSetter1P(byte zuno_ch, uint8_t value) {
1527
__zunoWindowCoveringBasicSet(zuno_ch, value);
1628
break;
1729
#endif
18-
// #ifdef WITH_CC_SWITCH_COLOR
19-
// case ZUNO_SWITCH_COLOR_CHANNEL_NUMBER:
20-
// zunoSwitchColorSaveSet(zuno_ch, &value);
21-
// break;
22-
// #endif
30+
#if defined(WITH_CC_SWITCH_COLOR) && defined(WITH_CC_SWITCH_MULTILEVEL)
31+
case ZUNO_SWITCH_COLOR_CHANNEL_NUMBER:
32+
__zunoSetterSwitchColorSwitchMultilevel(zuno_ch, value);
33+
break;
34+
#endif
2335
default:
2436
zuno_universalSetter1P(zuno_ch, value);
2537
break ;
@@ -36,11 +48,11 @@ uint8_t __zuno_BasicUniversalGetter1P(byte zuno_ch) {
3648
value = __zunoWindowCoveringBasicGet(zuno_ch);
3749
break;
3850
#endif
39-
// #ifdef WITH_CC_SWITCH_COLOR
40-
// case ZUNO_SWITCH_COLOR_CHANNEL_NUMBER:
41-
// value = zunoSwitchColorSaveGet(zuno_ch);
42-
// break;
43-
// #endif
51+
#if defined(WITH_CC_SWITCH_COLOR) && defined(WITH_CC_SWITCH_MULTILEVEL)
52+
case ZUNO_SWITCH_COLOR_CHANNEL_NUMBER:
53+
value = __zunoGetterSwitchColorSwitchMultilevel(zuno_ch);
54+
break;
55+
#endif
4456
default:
4557
value = zuno_universalGetter1P(zuno_ch);
4658
break ;
@@ -50,6 +62,9 @@ uint8_t __zuno_BasicUniversalGetter1P(byte zuno_ch) {
5062

5163
void __zuno_BasicUniversalTimerStop(uint8_t channel) {
5264
switch (ZUNO_CFG_CHANNEL(channel).type) {
65+
#if defined(WITH_CC_SWITCH_COLOR) && defined(WITH_CC_SWITCH_MULTILEVEL)
66+
case ZUNO_SWITCH_COLOR_CHANNEL_NUMBER:
67+
#endif
5368
#if defined(WITH_CC_SWITCH_MULTILEVEL)
5469
case ZUNO_SWITCH_MULTILEVEL_CHANNEL_NUMBER:
5570
__zuno_CCSwitchMultilevelTimerStop(channel);
@@ -102,6 +117,9 @@ void __zuno_BasicUniversalGetCurrentValueDurationTargetValue(uint8_t channel, ui
102117

103118
type = ZUNO_CFG_CHANNEL(channel).type;
104119
switch (type) {
120+
#if defined(WITH_CC_SWITCH_COLOR) && defined(WITH_CC_SWITCH_MULTILEVEL)
121+
case ZUNO_SWITCH_COLOR_CHANNEL_NUMBER:
122+
#endif
105123
#if defined(WITH_CC_SWITCH_MULTILEVEL)
106124
case ZUNO_SWITCH_MULTILEVEL_CHANNEL_NUMBER:
107125
__zuno_CCSwitchMultilevelGetValues(channel, current_value, duration_table_8, target_value);
@@ -185,13 +203,13 @@ static int _basic_set(byte channel, const ZwBasicSetFrame_t *paket, const ZUNOCo
185203
value = value ? 0xFF : 0x00;// Map the value right way
186204
break;
187205
#endif
188-
#ifdef WITH_CC_WINDOW_COVERING
206+
#if defined(WITH_CC_WINDOW_COVERING) && defined(WITH_CC_SWITCH_MULTILEVEL)
189207
case ZUNO_WINDOW_COVERING_CHANNEL_NUMBER:
190208
#endif
191-
#ifdef WITH_CC_SWITCH_COLOR
209+
#if defined(WITH_CC_SWITCH_COLOR) && defined(WITH_CC_SWITCH_MULTILEVEL)
192210
case ZUNO_SWITCH_COLOR_CHANNEL_NUMBER:
193211
#endif
194-
#ifdef WITH_CC_SWITCH_MULTILEVEL
212+
#if defined(WITH_CC_SWITCH_MULTILEVEL)
195213
case ZUNO_SWITCH_MULTILEVEL_CHANNEL_NUMBER:
196214
if (value > 0x63 && value < 0xFF)
197215
return (ZUNO_COMMAND_BLOCKED_FAILL);

0 commit comments

Comments
 (0)