Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with DALI support fails since v14.x #22214

Closed
5 of 14 tasks
FeKn opened this issue Sep 29, 2024 · 10 comments
Closed
5 of 14 tasks

Build with DALI support fails since v14.x #22214

FeKn opened this issue Sep 29, 2024 · 10 comments
Assignees

Comments

@FeKn
Copy link

FeKn commented Sep 29, 2024

PROBLEM DESCRIPTION

A clear and concise description of what the problem is.
Building Tasmota32 v14.x (v14.0, v14.1, v14.2 or master) with DALI support enabled in 'user_config_override.h' fails to compile with the following error:

[...]
Compiling .pio/build/tasmota32/libfcf/WebServer/Parsing.cpp.o
Archiving .pio/build/tasmota32/lib18b/libAdafruit_seesaw_soilsensor_1.3.1.a
Indexing .pio/build/tasmota32/lib18b/libAdafruit_seesaw_soilsensor_1.3.1.a
Compiling .pio/build/tasmota32/libfcf/WebServer/WebServer.cpp.o
Compiling .pio/build/tasmota32/libfcf/WebServer/detail/mimetable.cpp.o
Compiling .pio/build/tasmota32/libd08/Update/HttpsOTAUpdate.cpp.o
Compiling .pio/build/tasmota32/libd08/Update/Updater.cpp.o
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino:81:38: warning: ignoring attribute 'section (".iram1.87")' because it conflicts with previous 'section (".iram1.5")' [-Wattributes]
   81 | void IRAM_ATTR DALI_Tick_Handler(void)
      |                                      ^
/home/User/Tasmota/tasmota/tasmota.ino:3938:16: note: previous declaration here
Compiling .pio/build/tasmota32/lib647/WiFi/AP.cpp.o
Archiving .pio/build/tasmota32/lib3e5/libFS.a
Compiling .pio/build/tasmota32/lib647/WiFi/STA.cpp.o
Indexing .pio/build/tasmota32/lib3e5/libFS.a
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino: In function 'void enableDaliRxInterrupt()':
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino:100:5: error: 'timerAlarmDisable' was not declared in this scope
  100 |     timerAlarmDisable(Dali->timer);
      |     ^~~~~~~~~~~~~~~~~
Compiling .pio/build/tasmota32/lib647/WiFi/WiFi.cpp.o
Compiling .pio/build/tasmota32/lib647/WiFi/WiFiAP.cpp.o
Compiling .pio/build/tasmota32/lib647/WiFi/WiFiGeneric.cpp.o
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino: In function 'void disableRxInterrupt()':
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino:110:5: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
  110 |     timerAlarmEnable(Dali->timer);
      |     ^~~~~~~~~~~~~~~~
      |     timerAlarm
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino: In function 'void DaliPreInit()':
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino:386:30: error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
  386 |      Dali->timer = timerBegin(DALI_TIMER, 13, true);
      |                    ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/User/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal.h:84,
                 from /home/User/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:36,
                 from /tmp/tmpvdkr5_5b:1:
/home/User/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-timer.h:35:13: note: declared here
   35 | hw_timer_t *timerBegin(uint32_t frequency);
      |             ^~~~~~~~~~
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino:387:25: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)())'
  387 |     timerAttachInterrupt(Dali->timer, &DALI_Tick_Handler, true);
      |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/User/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-timer.h:50:6: note: declared here
   50 | void timerAttachInterrupt(hw_timer_t *timer, void (*userFunc)(void));
      |      ^~~~~~~~~~~~~~~~~~~~
Compiling .pio/build/tasmota32/lib647/WiFi/WiFiMulti.cpp.o
/home/User/Tasmota/tasmota/tasmota_xdrv_driver/xdrv_89_esp32_dali.ino:388:5: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
  388 |     timerAlarmWrite(Dali->timer, 641, true);
      |     ^~~~~~~~~~~~~~~
      |     timerWrite
Archiving .pio/build/tasmota32/lib08c/libNetwork.a
Indexing .pio/build/tasmota32/lib08c/libNetwork.a
Compiling .pio/build/tasmota32/lib647/WiFi/WiFiSTA.cpp.o
Archiving .pio/build/tasmota32/lib062/libHTTPClient.a
Indexing .pio/build/tasmota32/lib062/libHTTPClient.a
Compiling .pio/build/tasmota32/lib647/WiFi/WiFiScan.cpp.o
Archiving .pio/build/tasmota32/libd08/libUpdate.a
Indexing .pio/build/tasmota32/libd08/libUpdate.a
Compiling .pio/build/tasmota32/lib3f4/HTTPUpdate/HTTPUpdate.cpp.o
Archiving .pio/build/tasmota32/libfcf/libWebServer.a
Compiling .pio/build/tasmota32/liba50/ESPmDNS/ESPmDNS.cpp.o
Indexing .pio/build/tasmota32/libfcf/libWebServer.a
Compiling .pio/build/tasmota32/lib84e/ESP32-to-ESP8266-compat/esp8266toEsp32.cpp.o
*** [.pio/build/tasmota32/src/tasmota.ino.cpp.o] Error 1
Compiling .pio/build/tasmota32/libc28/SD/SD.cpp.o
======================================= [FAILED] Took 30.59 seconds =======================================

Environment    Status    Duration
-------------  --------  ------------
tasmota32      FAILED    00:00:30.595
================================== 1 failed, 0 succeeded in 00:00:30.595 ==================================

 *  The terminal process "platformio 'run', '--environment', 'tasmota32'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in discussions
  • Searched the problem in the docs
  • Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): _____
  • Tasmota binary firmware version number used: v14.x (v14.0, v14.1, v14.2 or master)
    • Pre-compiled
    • Self-compiled
  • Flashing tools used: _____
  • Provide the output of command: Backlog Template; Module; GPIO 255:
  Configuration output here:

  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here:

  • Provide the output of this command: Status 0:
  STATUS 0 output here:

  • Set weblog to 4 and then, when you experience your issue, provide the output of the Console log:
  Console output here:

TO REPRODUCE

Steps to reproduce the behavior:
Build Tasmota32 v14.x (v14.0, v14.1, v14.2 or master) with DALI support enabled in 'user_config_override.h' (see below) via e.g. "platformio run --environment tasmota32" with VSCode or Gitpod.

Additions in 'user_config_override.h':

#ifndef USE_DALI
#define USE_DALI
#endif

    #ifdef DALI_IN_INVERT
    #undef DALI_IN_INVERT
    #endif
    #define DALI_IN_INVERT  0

    #ifdef DALI_OUT_INVERT
    #undef DALI_OUT_INVERT
    #endif
    #define DALI_OUT_INVERT  0

    #ifdef DALI_TIMER
    #undef DALI_TIMER
    #endif
    #define DALI_TIMER 0  

EXPECTED BEHAVIOUR

Successful build of Tasmota32 with DALI support (as in Tasmota32 v13.4 and earlier).

SCREENSHOTS

If applicable, add screenshots to help explain your problem.

ADDITIONAL CONTEXT

Add any other context about the problem here.
Build with the same 'user_config_override.h' is successful up to Tasmota32 v13.4, the error occurs since v14.0.

(Please, remember to close the issue when the problem has been addressed)

@sfromis
Copy link
Contributor

sfromis commented Sep 29, 2024

Looks like the code was not migrated from ESP32 Arduino Core 2.x to the different sets of API calls available with 3.0.
https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html#timer

@arendst
Copy link
Owner

arendst commented Sep 29, 2024

I'll see if I can fix this...

@arendst arendst self-assigned this Sep 29, 2024
@arendst
Copy link
Owner

arendst commented Sep 29, 2024

Try latest dev.

Not sure if it works as I don't know the initial timer frequency. I assume 160MHz but it may as well be a lot lower. Watch your console for possible error message DLI: Bad timer init.

//    Dali->timer = timerBegin(DALI_TIMER, 13, true);
    Dali->timer = timerBegin(12307692);  // 160MHz????? / 13
    if (nullptr == Dali->timer) {
        AddLog(LOG_LEVEL_INFO, PSTR("DLI: Bad timer init"));
        free(Dali);
        Dali = nullptr;
        return;
    }
//    timerAttachInterrupt(Dali->timer, &DALI_Tick_Handler, true);
    timerAttachInterrupt(Dali->timer, &DALI_Tick_Handler);
//    timerAlarmWrite(Dali->timer, 641, true);
    timerAlarm(Dali->timer, 641, true, 0);

@FeKn
Copy link
Author

FeKn commented Sep 29, 2024

Thanks for the quick response and the fix.

I have tried the change in commit 5d4230d:
Compiling with the 'user_config_override.h' mentioned above now works without any problems.
Unfortunately, controlling the lighting via DALI no longer works (exactly the same configuration with v13.4 works).
No error messages in console. The only DLI message is:

DLI: Init - RX-pin: 3, TX-pin: 1

@arendst
Copy link
Owner

arendst commented Sep 30, 2024

Pls try again with latest dev.

BTW as I don't own any DALI hardware whay would you suggest to have as a minimum for testing with Tasmota?

@FeKn
Copy link
Author

FeKn commented Oct 1, 2024

Thanks for the second fix!
Tested with 6fa38e4: Works like a charm! 👍 :-)

In my configuration I use a “DALI click” (https://www.mikroe.com/dali-click) with an ESP32. This is connected in parallel with a Busch-Jaeger DALI dimmer (https://www.busch-jaeger.de/en/online-catalogue/detail/2CKA006599A2986) on the DALI bus, which also acts as power supply.

The lights can be controlled with both DALI devices (= Tasmota and Busch-Jaeger) without any problems, but Tasmota does not recognize any changes made via the Busch-Jaeger dimmer, i.e. the information on the DALI bus is unfortunately not read at the moment...

@arendst
Copy link
Owner

arendst commented Oct 2, 2024

Thx for the feedback.

I'll dive into dali and see if I can Tasmota make recognize dali changes.

@arendst arendst closed this as completed Oct 2, 2024
@FeKn
Copy link
Author

FeKn commented Oct 2, 2024

I'll dive into dali and see if I can Tasmota make recognize dali changes.

Sounds great! 👍
Just get in touch with me if there's something to test :-)

@arendst
Copy link
Owner

arendst commented Oct 6, 2024

Latest dev branch contains a total rewrite of the Dali driver. It now supports ESP8266 too. It also decodes Dali 1 messages it receives like:

21:36:45.790-021 MQT: tele/wemos14/RESULT = {"DALI":{"Power":"ON","Dimmer":173,"Address":254,"Command":173}}

where Power and Dimmer show the broadcast address values.

Give it a shot.

arendst added a commit that referenced this issue Oct 14, 2024
- Add command ``DaliSend <address>|<address+256>,<command>`` to send command (address+256 is repeat) on DALI bus
- Add command ``DaliQuery <address>|<address+256>,<command>`` to send command (address+256 is repeat) on DALI bus and wait up to DALI_TIMEOUT ms for response
@arendst
Copy link
Owner

arendst commented Oct 14, 2024

@FeKn I updated DALI driver to be able to receive backward frames and show this to the user.

  • Using a commands like DaliQuery 0xff,0x90 or DaliQuery 255,144
  • Command DaliSend sends DALI commands tot he bus
  • Command DaliWeb 1 makes DALI broadcast address act like a Tasmota dimmable light on the GUI.

Pls report back if anything doesn't work as I envisionend.

Pls test if the driver still supports your environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants