diff --git a/BUILDS.md b/BUILDS.md index cbf0198f7..5939ba1d6 100644 --- a/BUILDS.md +++ b/BUILDS.md @@ -55,6 +55,7 @@ m = minimal, l = lite, t = tasmota, k = knx, s = sensors, i = ir, d = display | USE_KEELOQ | - | - | - / - | - | - | - | - | | USE_SONOFF_D1 | - | - | x / - | x | - | - | - | | USE_SHELLY_DIMMER | - | - | x / - | - | - | - | - | +| USE_AC_ZERO_CROSS_DIMMER | - | - | x / x | x | x | x | x | | | | | | | | | | | Feature or Sensor | m | l | t | k | s | i | d | Remarks | USE_LIGHT | - | x | x / x | x | x | x | x | diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 0bf113f9e..768e60a09 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -321,6 +321,7 @@ #define LIGHT_VIRTUAL_CT false // [SetOption106] Virtual CT - Creates a virtual White ColorTemp for RGBW lights #define LIGHT_VIRTUAL_CT_CW false // [SetOption107] Virtual CT Channel - signals whether the hardware white is cold CW (true) or warm WW (false) #define LIGHT_VIRTUAL_CT_POINTS 3 // Number of reference points for Virtual CT (min 2, default 3) +#define USE_AC_ZERO_CROSS_DIMMER // Requires USE_COUNTER and USE_LIGHT // -- Energy -------------------------------------- #define ENERGY_VOLTAGE_ALWAYS false // [SetOption21] Enable show voltage even if powered off diff --git a/tasmota/tasmota_configurations.h b/tasmota/tasmota_configurations.h index bdcb005cc..e00ed0c22 100644 --- a/tasmota/tasmota_configurations.h +++ b/tasmota/tasmota_configurations.h @@ -506,7 +506,6 @@ //#undef USE_WEBSERVER // Disable Webserver #undef USE_ENHANCED_GUI_WIFI_SCAN // Disable wifi scan output with BSSID (+0k5 code) //#undef USE_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code) -#define USE_EMULATION // Enable Hue emulation #define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common) #undef USE_EMULATION_WEMO // Disable Belkin WeMo emulation for Alexa (+6k code, +2k mem common) #undef USE_CUSTOM // Disable Custom features @@ -755,6 +754,7 @@ #undef USE_THERMOSTAT // Disable support for Thermostat #undef DEBUG_THEO // Disable debug code #undef USE_DEBUG_DRIVER // Disable debug code +#undef USE_AC_ZERO_CROSS_DIMMER // Disable support for AC_ZERO_CROSS_DIMMER #endif // FIRMWARE_LITE @@ -899,6 +899,7 @@ #undef USE_PROMETHEUS // Disable support for https://prometheus.io/ metrics exporting over HTTP /metrics endpoint #undef DEBUG_THEO // Disable debug code #undef USE_DEBUG_DRIVER // Disable debug code +#undef USE_AC_ZERO_CROSS_DIMMER // Disable support for AC_ZERO_CROSS_DIMMER #endif // FIRMWARE_MINIMAL #endif // ifndef FIRMWARE_MINICUSTOM @@ -981,6 +982,26 @@ #ifdef USE_EMULATION_WEMO #define USE_EMULATION #endif +#ifdef USE_EMULATION +#define USE_LIGHT +#endif + +#ifdef USE_AC_ZERO_CROSS_DIMMER +#define USE_COUNTER +#define USE_LIGHT +#endif + +#ifdef USE_PWM_DIMMER +#define USE_LIGHT +#endif + +#ifdef USE_TUYA_MCU +#define USE_LIGHT +#endif + +#ifdef USE_ARILUX_RF +#define USE_LIGHT +#endif // Convert legacy slave to client #ifdef USE_TASMOTA_SLAVE diff --git a/tasmota/xdrv_12_home_assistant.ino b/tasmota/xdrv_12_home_assistant.ino index 5fb759f15..ddfb29923 100644 --- a/tasmota/xdrv_12_home_assistant.ino +++ b/tasmota/xdrv_12_home_assistant.ino @@ -422,7 +422,9 @@ void HAssAnnounceRelayLight(void) char stemp3[TOPSZ]; char unique_id[30]; +#ifdef USE_LIGHT bool LightControl = light_controller.isCTRGBLinked(); // SetOption37 - Color remapping for led channels, also provides an option for allowing independent handling of RGB and white channels +#endif //USE_LIGHT bool PwmMulti = Settings->flag3.pwm_multi_channels; // SetOption68 - Multi-channel PWM instead of a single light bool is_topic_light = false; // Switch HAss domain between Lights and Relays bool ind_light = false; // Controls Separated Lights when SetOption37 is >= 128 @@ -448,14 +450,15 @@ void HAssAnnounceRelayLight(void) if (TUYA_DIMMER == TasmotaGlobal.module_type || SK03_TUYA == TasmotaGlobal.module_type) { TuyaMod = true; } #endif //ESP8266 +#ifdef USE_LIGHT // 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 - if (PwmMulti) { max_lights = Light.subtype; } if (!LightControl) { ind_light = true; if (!PwmMulti) { max_lights = 2;} } +#endif //USE_LIGHT #ifdef USE_SHUTTER if (Settings->flag3.shutter_mode) { @@ -500,11 +503,16 @@ void HAssAnnounceRelayLight(void) if (bitRead(shutter_mask, i-1)) { // suppress shutter relays +#ifdef USE_LIGHT } else if ((i < Light.device) && !RelayX) { err_flag = true; AddLog(LOG_LEVEL_ERROR, PSTR("%s"), kHAssError2); } else { if (Settings->flag.hass_discovery && (RelayX || (Light.device > 0) && (max_lights > 0)) && !err_flag ) +#else + } else { + if (Settings->flag.hass_discovery && RelayX ) +#endif //USE_LIGHT { // SetOption19 - Control Home Assistant automatic discovery (See SetOption59) char name[TOPSZ]; // friendlyname(33) + " " + index char value_template[33]; diff --git a/tasmota/xdrv_35_pwm_dimmer.ino b/tasmota/xdrv_35_pwm_dimmer.ino index 6bcc3a28b..83f030c71 100644 --- a/tasmota/xdrv_35_pwm_dimmer.ino +++ b/tasmota/xdrv_35_pwm_dimmer.ino @@ -18,6 +18,7 @@ */ #ifdef USE_PWM_DIMMER +#ifdef USE_LIGHT /*********************************************************************************************\ * Support for Martin Jerry/acenx/Tessan/NTONPOWER SD0x PWM dimmer switches. The brightness of @@ -886,4 +887,5 @@ bool Xdrv35(uint8_t function) return result; } +#endif // USE_LIGHT #endif // USE_PWM_DIMMER diff --git a/tasmota/xsns_01_counter.ino b/tasmota/xsns_01_counter.ino index ba0758290..7bac7f9d3 100644 --- a/tasmota/xsns_01_counter.ino +++ b/tasmota/xsns_01_counter.ino @@ -24,8 +24,6 @@ #define XSNS_01 1 -#define USE_AC_ZERO_CROSS_DIMMER 1 - #define D_PRFX_COUNTER "Counter" #define D_CMND_COUNTERTYPE "Type" #define D_CMND_COUNTERDEBOUNCE "Debounce" @@ -59,7 +57,7 @@ struct AC_ZERO_CROSS_DIMMER { uint32_t lastCycleCount = 0; uint32_t currentSteps = 100; } ac_zero_cross_dimmer; -#endif +#endif //USE_AC_ZERO_CROSS_DIMMER void IRAM_ATTR CounterIsrArg(void *arg) { uint32_t index = *static_cast(arg); @@ -101,7 +99,7 @@ void IRAM_ATTR CounterIsrArg(void *arg) { } ac_zero_cross_dimmer.lastCycleCount = ac_zero_cross_dimmer.currentCycleCount; } -#endif +#endif //USE_AC_ZERO_CROSS_DIMMER return; } } @@ -152,7 +150,7 @@ void CounterInit(void) if (PinUsed(GPIO_CNTR1, i)) { #ifdef USE_AC_ZERO_CROSS_DIMMER ac_zero_cross_dimmer.tobe_cycle_timeClockCycles = microsecondsToClockCycles(1000000 / Settings->pwm_frequency); -#endif +#endif //USE_AC_ZERO_CROSS_DIMMER Counter.any_counter = true; pinMode(Pin(GPIO_CNTR1, i), bitRead(Counter.no_pullup, i) ? INPUT : INPUT_PULLUP); if ((0 == Settings->pulse_counter_debounce_low) && (0 == Settings->pulse_counter_debounce_high) && !Settings->flag4.zerocross_dimmer) { @@ -269,7 +267,7 @@ void SyncACDimmer(void) } } } -#endif +#endif //USE_AC_ZERO_CROSS_DIMMER /*********************************************************************************************\ * Commands @@ -349,7 +347,7 @@ bool Xsns01(uint8_t function) case FUNC_LOOP: SyncACDimmer(); break; -#endif +#endif //USE_AC_ZERO_CROSS_DIMMER #ifdef USE_WEBSERVER case FUNC_WEB_SENSOR: CounterShow(0);