Skip to content

Commit

Permalink
Merge branch 'ene9ba-feature/ll-add-sound-and-neopixel' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
ClemensElflein committed Jul 19, 2022
2 parents d536876 + 9120985 commit 20bc568
Show file tree
Hide file tree
Showing 23 changed files with 343 additions and 44 deletions.
Binary file removed Firmware/LowLevel/bin/firmware.uf2
Binary file not shown.
72 changes: 72 additions & 0 deletions Firmware/LowLevel/include/soundsystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Created by Elmar Elflein on 18/07/22.
// Copyright (c) 2022 Elmar Elflein. All rights reserved.
//
// This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
//
// Feel free to use the design in your private/educational projects, but don't try to sell the design or products based on it without getting my consent first.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
//
#ifndef _SOUND_SYSTEM_H_
#define _SOUND_SYSTEM_H_

//#include <Arduino.h>
#include <stdint.h>
#include <list>

#include <pins.h>
#include <DFPlayerMini_Fast.h>
#include <soundsystem.h>


#define BUFFERSIZE 100

#define NR_SOUNDFILES 15 // Number of Soundfiles on SD-card



class MP3Sound
{




public:

uint32_t anzSoundfiles; // number of files stored on the SD-card
bool playing;

MP3Sound();

bool begin(int anzsoundsOnSD); // init serial stream and soundmodule, anzsoundOnSD : maximum number of available soundfiles on the SD-card

void playSound(int soundNr); // play soundfile number. This method writes soundfile nr in a list, the method processSounds() (has to run in loop) will play
// the sounds according to the list

void playSoundAdHoc(int soundNr); // play soundfile number immediately whithout waiting until the end of sound

void setvolume(int vol); // scales loudness from 0 to 100 %

int sounds2play(); // returns the number if sounds to play in the list

int processSounds(); // play all sounds from the list. This method has to be calles cyclic, e.g. every second.


private:
std::list <int> active_sounds;
bool sound_available;




};


#endif // _SOUND_SYSTEM_H_ HEADER_FILE
19 changes: 15 additions & 4 deletions Firmware/LowLevel/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ lib_deps =
debug_tool = custom
debug_init_break =
debug_load_mode = always
debug_port = tcp:ubuntu:3333
debug_port = tcp:ubuntu.local:3333

; 133MHz
board_build.f_cpu = 133000000L
Expand All @@ -46,15 +46,15 @@ platform_packages =
lib_ldf_mode = off
debug_build_flags = -O0 -g -ggdb

build_src_filter = +<*> -<.git/> -<.svn/> -<imu/*>
build_src_filter = +<*> -<.git/> -<.svn/> -<imu/*> -<soundsystem.cpp>


[env:MPU9250]
lib_ignore = JY901
lib_deps = ${env.lib_deps}
bolderflight/Bolder Flight Systems MPU9250@^1.0.2
powerbroker2/DFPlayerMini_Fast@^1.2.4
build_src_filter = ${env.build_src_filter} +<imu/MPU9250/>
build_src_filter = ${env.build_src_filter} +<imu/MPU9250/> +<soundsystem.cpp>
build_flags =
${env.build_flags} -DENABLE_SOUND_MODULE

Expand All @@ -63,4 +63,15 @@ build_src_filter = ${env.build_src_filter} +<imu/WT901/>
lib_deps = ${env.lib_deps}
JY901
build_flags =
${env.build_flags} -DWT901_INSTEAD_OF_SOUND
${env.build_flags} -DWT901_INSTEAD_OF_SOUND


; This is our main protoype, it has some different wiring
[env:ELFLEIN_PROTOTYPE]
lib_ignore = JY901
lib_deps = ${env.lib_deps}
bolderflight/Bolder Flight Systems MPU9250@^1.0.2
powerbroker2/DFPlayerMini_Fast@^1.2.4
build_src_filter = ${env.build_src_filter} +<imu/MPU9250/> +<soundsystem.cpp>
build_flags =
${env.build_flags} -DENABLE_SOUND_MODULE -DELFLEIN_PROTOTYPE
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions Firmware/LowLevel/soundfiles/GoogleTTS_Strings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- file leading nr -- ------ string to convert ------------

0001 Hi, I am Steve, your open mower green care is my profession
0002 open mower start up successful
0003 Initializing robot operating system
0004 Starting map area recording
0005 waiting for rtk gps signal
0006 calculating map dimensions
0007 initiate mowing sequence
0008 emergency stop button triggered
0009 emergency wheel lift sensor triggered
0010 rain detected, heading back to base
0011 open mower has completed mowing the lawn, heading back to charging station
0012 stay back, autononous robot mower in use
0013 ups, I did it again
0014 Hallo, ich bin Tobi, dein intelligenter Rasemäher, Rasenpflege ist mein Beruf
0015 Hello, I am Tobi, your smart mower, green care ist my profession

Loading

0 comments on commit 20bc568

Please sign in to comment.