diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 8a4de54f0..3e2d83a5b 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -1037,6 +1037,7 @@ #define USE_DALI // Add support for DALI #define DALI_IN_INVERT 0 // DALI RX inverted ? #define DALI_OUT_INVERT 0 // DALI TX inverted ? + #define DALI_TIMER 0 // ESP32 hardware timer number 0-3 !!! timer 3 used in xdrv_10_scripter.ino !!! //#define USE_SONOFF_SPM // Add support for ESP32 based Sonoff Smart Stackable Power Meter (+11k code) //#define USE_DISPLAY_TM1621_SONOFF // Add support for TM1621 dsiplay driver used by Sonoff POWR3xxD and THR3xxD diff --git a/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino b/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino index 39ac47a3f..87523b6e0 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino @@ -31,6 +31,10 @@ #define XDRV_89 89 +#ifndef DALI_TIMER + #define DALI_TIMER 0 // Default timer +#endif + #define BROADCAST_DP 0b11111110 // 0xFE #define DALI_TOPIC "DALI" @@ -53,19 +57,6 @@ enum DALI_Commands { // commands for Console CMND_DALI_DIM, }; -/* Private variables ---------------------------------------------------------*/ -// Data variables -// uint16_t send_dali_data; // data to send to DALI bus -// uint16_t received_dali_data; // data received from DALI bus -// Processing variables -// uint8_t flag; // DALI status flag -// uint8_t bit_count; // nr of rec/send bits -// uint16_t tick_count; // nr of ticks of the timer - -// bool bit_value; // value of actual bit -// bool actual_val; // bit value in this tick of timer -// bool former_val; // bit value in previous tick of timer - struct DALI { // Data variables uint16_t send_dali_data; // data to send to DALI bus @@ -390,7 +381,7 @@ void DaliPreInit() { digitalWrite(Pin(GPIO_DALI_TX), HIGH); pinMode(Pin(GPIO_DALI_RX), INPUT); - DALI_timer = timerBegin(0, 13, true); + DALI_timer = timerBegin(DALI_TIMER, 13, true); timerAttachInterrupt(DALI_timer, &DALI_Tick_Handler, true); timerAlarmWrite(DALI_timer, 641, true);