Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SDFileSystem NeoStrip PinDetect
Revision 8:fa37292cf52c, committed 2020-04-30
- Comitter:
- makkoli98
- Date:
- Thu Apr 30 02:46:26 2020 +0000
- Parent:
- 6:2f0706de9553
- Parent:
- 7:c2ef4232feb4
- Child:
- 9:0e16d1e33c4b
- Commit message:
- merged mic2led with play/pause fixes
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 30 02:33:57 2020 +0000
+++ b/main.cpp Thu Apr 30 02:46:26 2020 +0000
@@ -263,14 +263,16 @@
if (bhit == '1') {
switch (bnum) {
case '1': // Button 1 for play/pause
- if (waver.get_play_state() == 1) {
- waver.set_play_state(0);
- thread2.terminate();
- mute = 0;
- } else if (waver.get_play_state() == 0) {
- waver.set_play_state(1);
- thread2.start(sound_thread);
- mute = 1;
+ if (src) {
+ if (waver.get_play_state() == 1) {
+ waver.set_play_state(0);
+ thread2.terminate();
+ mute = 0;
+ } else if (waver.get_play_state() == 0) {
+ waver.set_play_state(1);
+ thread2.start(sound_thread);
+ mute = 1;
+ }
}
break;
case '2': // Button 2 for mute/unmute
@@ -297,7 +299,7 @@
}
break;
case '7': // Left arrow for previous
- if (sd_mtx.trylock()) {
+ if (sd_mtx.trylock() && src) {
sd_mtx.lock();
waver.set_play_state(0);
if (cur_song > 0) {
@@ -313,7 +315,7 @@
}
break;
case '8': // Right arrow for skip
- if (sd_mtx.trylock()) {
+ if (sd_mtx.trylock() && src) {
sd_mtx.lock();
waver.set_play_state(0);
if (cur_song < filenames.size() - 1) {