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

WiP - ES8388 #5

Merged
merged 17 commits into from
Apr 5, 2023
Merged

WiP - ES8388 #5

merged 17 commits into from
Apr 5, 2023

Conversation

netmindz
Copy link
Collaborator

Work in progress so far on support for the ES8388 as used in the LyraT v4.3

@netmindz
Copy link
Collaborator Author

Note: pin18 used on the LyraT clashes with the temp usermod, so that needs to be disabled or moved to different pin

platformio.ini Outdated
@@ -587,6 +587,8 @@ build_flags_min =

lib_deps_min =
https://github.com/kosme/arduinoFFT#develop @ 1.9.2 ; used for USERMOD_AUDIOREACTIVE
https://github.com/netmindz/es8388arduino.git @ 0.0.1 ; used for USERMOD_AUDIOREACTIVE ES8388 source
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib_deps_min is used in every MM platformio environment. As es8388 is only for specific environments, it should be moved to that,
I guess something like

[env:esp32_4MB_ES8388_max]
extends = esp32_4MB_max_base
build_flags = ${esp32_4MB_max_base.build_flags}
-D WLED_RELEASE_NAME= esp32_4MB_ES8388_max ; This will be included in the firmware.bin filename
lib_deps = ${esp32_4MB_max_base.lib_deps}
https://github.com/netmindz/es8388arduino.git @ 0.0.1 ; used for USERMOD_AUDIOREACTIVE ES8388 source

@softhack007 , what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really for specific hardware, you can get standalone boards with the chip as well as the LyraT.

There was a suggestion to just inline the bits of the library once we have something working so there is no dependency at all. Though this does nothing to the size of the final image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://moonmodules.github.io/WLED-Docs/moonmodules/platformio-entries/
for an explanation of the MM platformio entries model.

I am still not sure if it should be in lib_deps_min, hopefully @softhack007 can shine a light on this ;-)

Copy link
Collaborator

@softhack007 softhack007 Nov 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ewoudwijma: Depends on how we finally integrate this driver.

  1. A new instance of class AudioSource - similar to ES7243 - means that any external lib needs to be there for each compile env.
  2. If its still experimental, i would prefer to make the code optional, like #ifdef BOARD_LYRAT43 ... #endif. In this case, we would create a new MM compile env that has -D BOARD_LYRAT43 in build_flags, and the library could also be added only to this new MM compile env.

Actually i'd prefer option 2 for the moment. I still hope we can later extract a few basic I2C commands that are needed to properly initialize the ES8388 and put these into our code, so external no need to use an external library.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option 2 sounds perfect!

@ewoudwijma
Copy link
Collaborator

@netmindz , @softhack007 , what is current status of this? If the pr can be updated with option 2 approach we can merge...

@netmindz
Copy link
Collaborator Author

Sorry, not had any time to test. The code compiles and runs, but no audio detected, so clearly not configuring the hardware correctly.

If I am understanding correctly then option 2 is really an extension of option 1 and rather than board specific, the option would be for ES8388 as this chip is used in a few different boards

@troyhacks
Copy link
Collaborator

Has anything come from this? I have a few of these boards and I'd love to get them running.

@netmindz
Copy link
Collaborator Author

I've not had a chance to do any further work to see why the code runs without error but appears like it's capturing silence.

I can dig out the links for the other ES8388 projects I was referring to if you have any time/desire to help complete this work

@netmindz
Copy link
Collaborator Author

https://mm.kno.wled.ge/WLEDSR/Other-Links/#es8388

@netmindz
Copy link
Collaborator Author

netmindz commented Apr 4, 2023

Going to test @troyhacks 's rewrite in the next few days, but as it's now quite a neatly contained feature are we ok to skip the need for any optional build flags? While this chip is used on the LayraT it is a generic chip that can be used on standalone boards or other single board solutions.
Once testing complete, would be good to just have there by default in all builds. Ok with that @ewoudwijma and @softhack007 ?

@ewoudwijma ewoudwijma marked this pull request as ready for review April 5, 2023 09:02
@ewoudwijma ewoudwijma merged commit e4243c4 into MoonModules:mdev Apr 5, 2023
@ewoudwijma
Copy link
Collaborator

Okay with that and merged !

netmindz referenced this pull request in netmindz/WLED May 23, 2023
softhack007 added a commit that referenced this pull request Nov 15, 2023
this is a band-aid fix for random crashes when switching between presets with multiple segments - crossfade disabled.

!! adding type initializers fixed it for me on -S3, however I still see (less frequent) crashes on esp32, due to heap corruption.

It took me hours to get a meaningful stackdump:

assert failed: heap_caps_free heap_caps.c:360 (heap != NULL && "free() target pointer is outside heap areas")

Backtrace: 0x40084ee1:0x3ffb2570 0x4008e341:0x3ffb2590 0x40094709:0x3ffb25b0 0x4008534a:0x3ffb26e0 0x40094739:0x3ffb2700 0x400e9037:0x3ffb2720 0x400e917c:0x3ffb2740 0x400eaeeb:0x3ffb2760 0x40117ec5:0x3ffb27c0 0x401184ea:0x3ffb2800 0x4013509d:0x3ffb2820

  #0  0x40084ee1:0x3ffb2570 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:402
  #1  0x4008e341:0x3ffb2590 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:128
  #2  0x40094709:0x3ffb25b0 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
  #3  0x4008534a:0x3ffb26e0 in heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:360
      (inlined by) heap_caps_free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/heap/heap_caps.c:345
  #4  0x40094739:0x3ffb2700 in free at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/heap.c:39
  #5  0x400e9037:0x3ffb2720 in Segment::deallocateData() at wled00/FX_fcn.cpp:189
  #6  0x400e917c:0x3ffb2740 in Segment::resetIfRequired() at wled00/FX_fcn.cpp:206
      (inlined by) Segment::resetIfRequired() at wled00/FX_fcn.cpp:203
  #7  0x400eaeeb:0x3ffb2760 in WS2812FX::service() at wled00/FX_fcn.cpp:1216 (discriminator 2)
  #8  0x40117ec5:0x3ffb27c0 in WLED::loop() at wled00/wled.cpp:115 (discriminator 3)
  #9  0x401184ea:0x3ffb2800 in loop() at C:/src/wled00/wled00.ino:20
  #10 0x4013509d:0x3ffb2820 in loopTask(void*) at C:/Users/user/.platformio/packages/framework-arduinoespressif32/cores/esp32/main.cpp:50

ELF file SHA256: 18c20b536f4c6ef4
CroachX added a commit to CroachX/WLED that referenced this pull request Sep 26, 2024
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

Successfully merging this pull request may close these issues.

4 participants