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

Improve Sound #80

Open
wants to merge 88 commits into
base: main
Choose a base branch
from

Conversation

Apehaenger
Copy link
Contributor

@Apehaenger Apehaenger commented Nov 8, 2023

Think this is how it can be done.

This PR mainly:

  • Switch to Makuna's DFMiniMp3 lib for a better support of DFPlayer clones
  • Adds a couple of advert and background sounds
  • Support volume control and language switch (English and German) via CoverUI (but will not save it at the moment)

SD-Card Structure Problem (old/new sound implementation):

I assumed that >90% of the installations in the wild, will have the original DFRobot DFPlayer with the old SD-Card-Structure installed.
Because DFRobot's DFPlayer has the quirk to auto-play the first sound in SD-Cards root, after a reset(), I detect an old SD-Card-Structure in that way, that if there's an auto-played sound with a specific length (shorter than the one of the new SD-Card-Structure) then it's identified as "old SD-Card-Structure". For sure, this works only for those who have an DFRobot DFPlayer.

This (shall) result in the following behavior (tested with a couple of DFPlayer and SD-Cards):

DFPlayer SD-Card-Structure Plays
DFRobot old "Hi", krk, "Hi, I'm Steve ...". No further sound output
DFRobot new "Ping" (3-5 times), "Hi I'm Steve ...". No further sound output

Overcurrent problem on 3.3V (Pico) line

All current OM installation (with sound) already play "Hi", krk, "Hi, I'm Steve ..." and we haven't heard of died Pico (VREG) till now.
So this sound PR also stop (by default) after "Hi, I'm Steve ...", except it got compiled with DFPIS5V (already added to CI firmware build)
For sure this doubles our firmware binaries :-/ But does it matter?

Warning
Of course, everybody is free to install a DFPIS5V firmware without changing his DFPlayer to 5V, but we should expect that he has read README-Sound, DFPIS5V.md before, and knows about the risk

firmware.zip

Copy link
Contributor Author

@Apehaenger Apehaenger left a comment

Choose a reason for hiding this comment

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

In relation to commit 2287720

Only now I do recognized that beside the HighLevel-Mode also the HighLevel-SubMode is available in ..._high_level_state.current_mode.

I like to use it for some more sound stuff identification, but didn't like to do the Mode-Masking and SubMode-Shifting again and again.

So I built this simple class for easier handling of the HighLevel-Modes and SubModes.

What I'm undecided is:

  1. My decision for a Class or if I should better build it as/with template functions?
  2. The location in datatypes.h. Should it better go into a HigheLevelState.hpp file?

How're your thoughts?

@Apehaenger
Copy link
Contributor Author

Finished all new sound capabilities (by the use of the HL-State-SubModes), changes and ideas.
Just succeed test on second mower. Work as expected.

@Apehaenger Apehaenger mentioned this pull request Oct 7, 2024
12 tasks
@Apehaenger Apehaenger marked this pull request as draft October 10, 2024 10:22
@Apehaenger Apehaenger marked this pull request as ready for review November 23, 2024 22:18
@Apehaenger
Copy link
Contributor Author

Apehaenger commented Nov 24, 2024

Think I'm done 🤔

Background-Sounds are optional now and default to "off"!

Completely changed DFPlayer, auto-play- quirk and SD-Card-Structure (origin/new) detection.

Also changed some code stuff which was ugly before.

Made about 367 tests on my Desktop with original as well as DFPlayer-Clones, with old and new SD-Card structure (because of my changed detection code).
Today William tested in real here: https://discord.com/channels/958476543846412329/961804411112394842/1310055009743929405 and I also did a quick real outdoor mow test today.

This PR ClemensElflein/open_mower_ros#166 is also required for getting background-sound option in mower_config

Website/Docs changes are here: ClemensElflein/openmower.de#40

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