Skip to content

Commit b5367f7

Browse files
authored
Merge pull request #13004 from ascillato/Fix_compilation_for_USE_LIGHT
Fix compilation issue when disabling `USE_LIGHT` feature
2 parents d7e523b + 9cdeab1 commit b5367f7

6 files changed

+40
-9
lines changed

BUILDS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ m = minimal, l = lite, t = tasmota, k = knx, s = sensors, i = ir, d = display
5555
| USE_KEELOQ | - | - | - / - | - | - | - | - |
5656
| USE_SONOFF_D1 | - | - | x / - | x | - | - | - |
5757
| USE_SHELLY_DIMMER | - | - | x / - | - | - | - | - |
58+
| USE_AC_ZERO_CROSS_DIMMER | - | - | x / x | x | x | x | x |
5859
| | | | | | | | |
5960
| Feature or Sensor | m | l | t | k | s | i | d | Remarks
6061
| USE_LIGHT | - | x | x / x | x | x | x | x |

tasmota/my_user_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@
321321
#define LIGHT_VIRTUAL_CT false // [SetOption106] Virtual CT - Creates a virtual White ColorTemp for RGBW lights
322322
#define LIGHT_VIRTUAL_CT_CW false // [SetOption107] Virtual CT Channel - signals whether the hardware white is cold CW (true) or warm WW (false)
323323
#define LIGHT_VIRTUAL_CT_POINTS 3 // Number of reference points for Virtual CT (min 2, default 3)
324+
#define USE_AC_ZERO_CROSS_DIMMER // Requires USE_COUNTER and USE_LIGHT
324325

325326
// -- Energy --------------------------------------
326327
#define ENERGY_VOLTAGE_ALWAYS false // [SetOption21] Enable show voltage even if powered off

tasmota/tasmota_configurations.h

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@
506506
//#undef USE_WEBSERVER // Disable Webserver
507507
#undef USE_ENHANCED_GUI_WIFI_SCAN // Disable wifi scan output with BSSID (+0k5 code)
508508
//#undef USE_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code)
509-
#define USE_EMULATION // Enable Hue emulation
510509
#define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
511510
#undef USE_EMULATION_WEMO // Disable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
512511
#undef USE_CUSTOM // Disable Custom features
@@ -755,6 +754,7 @@
755754
#undef USE_THERMOSTAT // Disable support for Thermostat
756755
#undef DEBUG_THEO // Disable debug code
757756
#undef USE_DEBUG_DRIVER // Disable debug code
757+
#undef USE_AC_ZERO_CROSS_DIMMER // Disable support for AC_ZERO_CROSS_DIMMER
758758
#endif // FIRMWARE_LITE
759759

760760

@@ -899,6 +899,7 @@
899899
#undef USE_PROMETHEUS // Disable support for https://prometheus.io/ metrics exporting over HTTP /metrics endpoint
900900
#undef DEBUG_THEO // Disable debug code
901901
#undef USE_DEBUG_DRIVER // Disable debug code
902+
#undef USE_AC_ZERO_CROSS_DIMMER // Disable support for AC_ZERO_CROSS_DIMMER
902903

903904
#endif // FIRMWARE_MINIMAL
904905
#endif // ifndef FIRMWARE_MINICUSTOM
@@ -981,6 +982,26 @@
981982
#ifdef USE_EMULATION_WEMO
982983
#define USE_EMULATION
983984
#endif
985+
#ifdef USE_EMULATION
986+
#define USE_LIGHT
987+
#endif
988+
989+
#ifdef USE_AC_ZERO_CROSS_DIMMER
990+
#define USE_COUNTER
991+
#define USE_LIGHT
992+
#endif
993+
994+
#ifdef USE_PWM_DIMMER
995+
#define USE_LIGHT
996+
#endif
997+
998+
#ifdef USE_TUYA_MCU
999+
#define USE_LIGHT
1000+
#endif
1001+
1002+
#ifdef USE_ARILUX_RF
1003+
#define USE_LIGHT
1004+
#endif
9841005

9851006
// Convert legacy slave to client
9861007
#ifdef USE_TASMOTA_SLAVE

tasmota/xdrv_12_home_assistant.ino

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,9 @@ void HAssAnnounceRelayLight(void)
422422
char stemp3[TOPSZ];
423423
char unique_id[30];
424424

425+
#ifdef USE_LIGHT
425426
bool LightControl = light_controller.isCTRGBLinked(); // SetOption37 - Color remapping for led channels, also provides an option for allowing independent handling of RGB and white channels
427+
#endif //USE_LIGHT
426428
bool PwmMulti = Settings->flag3.pwm_multi_channels; // SetOption68 - Multi-channel PWM instead of a single light
427429
bool is_topic_light = false; // Switch HAss domain between Lights and Relays
428430
bool ind_light = false; // Controls Separated Lights when SetOption37 is >= 128
@@ -448,14 +450,15 @@ void HAssAnnounceRelayLight(void)
448450
if (TUYA_DIMMER == TasmotaGlobal.module_type || SK03_TUYA == TasmotaGlobal.module_type) { TuyaMod = true; }
449451
#endif //ESP8266
450452

453+
#ifdef USE_LIGHT
451454
// If there is a special Light to be enabled and managed with SetOption68 or SetOption37 >= 128, Discovery calculates the maximum number of entities to be generated in advance
452-
453455
if (PwmMulti) { max_lights = Light.subtype; }
454456

455457
if (!LightControl) {
456458
ind_light = true;
457459
if (!PwmMulti) { max_lights = 2;}
458460
}
461+
#endif //USE_LIGHT
459462

460463
#ifdef USE_SHUTTER
461464
if (Settings->flag3.shutter_mode) {
@@ -500,11 +503,16 @@ void HAssAnnounceRelayLight(void)
500503

501504
if (bitRead(shutter_mask, i-1)) {
502505
// suppress shutter relays
506+
#ifdef USE_LIGHT
503507
} else if ((i < Light.device) && !RelayX) {
504508
err_flag = true;
505509
AddLog(LOG_LEVEL_ERROR, PSTR("%s"), kHAssError2);
506510
} else {
507511
if (Settings->flag.hass_discovery && (RelayX || (Light.device > 0) && (max_lights > 0)) && !err_flag )
512+
#else
513+
} else {
514+
if (Settings->flag.hass_discovery && RelayX )
515+
#endif //USE_LIGHT
508516
{ // SetOption19 - Control Home Assistant automatic discovery (See SetOption59)
509517
char name[TOPSZ]; // friendlyname(33) + " " + index
510518
char value_template[33];

tasmota/xdrv_35_pwm_dimmer.ino

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
#ifdef USE_PWM_DIMMER
21+
#ifdef USE_LIGHT
2122

2223
/*********************************************************************************************\
2324
* Support for Martin Jerry/acenx/Tessan/NTONPOWER SD0x PWM dimmer switches. The brightness of
@@ -886,4 +887,5 @@ bool Xdrv35(uint8_t function)
886887
return result;
887888
}
888889

890+
#endif // USE_LIGHT
889891
#endif // USE_PWM_DIMMER

tasmota/xsns_01_counter.ino

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424

2525
#define XSNS_01 1
2626

27-
#define USE_AC_ZERO_CROSS_DIMMER 1
28-
2927
#define D_PRFX_COUNTER "Counter"
3028
#define D_CMND_COUNTERTYPE "Type"
3129
#define D_CMND_COUNTERDEBOUNCE "Debounce"
@@ -59,7 +57,7 @@ struct AC_ZERO_CROSS_DIMMER {
5957
uint32_t lastCycleCount = 0;
6058
uint32_t currentSteps = 100;
6159
} ac_zero_cross_dimmer;
62-
#endif
60+
#endif //USE_AC_ZERO_CROSS_DIMMER
6361

6462
void IRAM_ATTR CounterIsrArg(void *arg) {
6563
uint32_t index = *static_cast<uint8_t*>(arg);
@@ -101,7 +99,7 @@ void IRAM_ATTR CounterIsrArg(void *arg) {
10199
}
102100
ac_zero_cross_dimmer.lastCycleCount = ac_zero_cross_dimmer.currentCycleCount;
103101
}
104-
#endif
102+
#endif //USE_AC_ZERO_CROSS_DIMMER
105103
return;
106104
}
107105
}
@@ -152,7 +150,7 @@ void CounterInit(void)
152150
if (PinUsed(GPIO_CNTR1, i)) {
153151
#ifdef USE_AC_ZERO_CROSS_DIMMER
154152
ac_zero_cross_dimmer.tobe_cycle_timeClockCycles = microsecondsToClockCycles(1000000 / Settings->pwm_frequency);
155-
#endif
153+
#endif //USE_AC_ZERO_CROSS_DIMMER
156154
Counter.any_counter = true;
157155
pinMode(Pin(GPIO_CNTR1, i), bitRead(Counter.no_pullup, i) ? INPUT : INPUT_PULLUP);
158156
if ((0 == Settings->pulse_counter_debounce_low) && (0 == Settings->pulse_counter_debounce_high) && !Settings->flag4.zerocross_dimmer) {
@@ -269,7 +267,7 @@ void SyncACDimmer(void)
269267
}
270268
}
271269
}
272-
#endif
270+
#endif //USE_AC_ZERO_CROSS_DIMMER
273271

274272
/*********************************************************************************************\
275273
* Commands
@@ -349,7 +347,7 @@ bool Xsns01(uint8_t function)
349347
case FUNC_LOOP:
350348
SyncACDimmer();
351349
break;
352-
#endif
350+
#endif //USE_AC_ZERO_CROSS_DIMMER
353351
#ifdef USE_WEBSERVER
354352
case FUNC_WEB_SENSOR:
355353
CounterShow(0);

0 commit comments

Comments
 (0)