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

Separate components better and remove audio_board dependencies #110

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

luar123
Copy link

@luar123 luar123 commented Jan 4, 2025

This PR removes dependencies from components and within main.c to allow easier re-use.

  • remove the audio_board dependency from player.c by supplying the i2s_pin_config through player_init
  • For setting DAC mute and volume, player and http_get tasks are both updating audioDAC_data (guarded by a semaphore). And on each update it is send to the main task which will handle the actual DAC control.
  • With this, app_main does not need any global variable anymore and all the tasks and supporting functions could be moved to a component.
  • add dependencies.lock to .gitignore as this file is auto-generated.

Draft state, because I need to run more tests.

@luar123 luar123 changed the title Seperate components better and remove audio_board dependencies Separate components better and remove audio_board dependencies Jan 4, 2025
@@ -379,9 +349,12 @@ int deinit_player(void) {
/**
* call before http task creation!
*/
int init_player(void) {
int init_player(i2s_std_gpio_config_t pin_config0_, i2s_port_t i2sNum_) {
Copy link
Owner

Choose a reason for hiding this comment

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

What's the reason for the _ ? Couldn't you just drop this and use rhe parameter as a variable directly?

Copy link
Author

Choose a reason for hiding this comment

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

I need to assign these paramters (coming from app_main) to the global variables pin_config0 and i2sNum. Of course I can use a different name instead of the trailing underscore.

main/main.c Outdated Show resolved Hide resolved
main/main.c Outdated Show resolved Hide resolved
@luar123
Copy link
Author

luar123 commented Jan 5, 2025

Thanks for the feedback. Sorry, I mixed different code style conventions.
There is also a bug with the queue, need to use overwrite instead of send, will fix that soon.

Should I also move everything from app_main to lightsnapcast component or a new component? Or better leave that for later?

@CarlosDerSeher
Copy link
Owner

CarlosDerSeher commented Jan 5, 2025

I've always wanted to seperate decoder part to a own module too. But this I will do when I find a solution to the 20ms bug (#54). I am on this, so it would be easier for me not to change too much currently because this will make it hard to merge later.

@luar123 luar123 marked this pull request as ready for review January 5, 2025 17:28
@luar123
Copy link
Author

luar123 commented Jan 5, 2025

Yes, sure.
With this last commit this PR is ready. All included sdkconfigs compile and I tested it on my setup with pcm5102a.

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.

2 participants