@@ -16,14 +16,17 @@ void BoxPlayer::loop() {
16
16
void BoxPlayer::play () {
17
17
Log.info (" Player play" );
18
18
Box.boxDAC .play ();
19
+ Box.boxPower .feedSleepTimer ();
19
20
}
20
21
void BoxPlayer::pause () {
21
22
Log.info (" Player pause" );
22
23
Box.boxDAC .pause ();
24
+ Box.boxPower .feedSleepTimer ();
23
25
}
24
26
void BoxPlayer::stop () {
25
27
Log.info (" Player stop" );
26
28
Box.boxDAC .stop ();
29
+ Box.boxPower .feedSleepTimer ();
27
30
}
28
31
void BoxPlayer::rewind () {
29
32
// TODO
@@ -64,13 +67,18 @@ void BoxPlayer::songEnded() {
64
67
}
65
68
dir.closeDir ();
66
69
if (songIndex > 0 )
67
- Box. boxDAC . playFile (songPath);
70
+ _play (songPath);
68
71
} else {
69
72
Log.error (" Player could not open dir %s..." , _dirPath);
70
73
}
71
74
}
72
75
}
73
76
77
+ bool BoxPlayer::_play (const char * path) {
78
+ Box.boxPower .feedSleepTimer ();
79
+ return Box.boxDAC .playFile (path);
80
+ }
81
+
74
82
bool BoxPlayer::playDir (const char * path, PLAYER_FLAGS flags) {
75
83
Log.info (" Playing dir %s" , _dirPath);
76
84
@@ -94,7 +102,7 @@ bool BoxPlayer::playDir(const char* path, PLAYER_FLAGS flags) {
94
102
}
95
103
dir.closeDir ();
96
104
if (_dirSongCount > 0 ) {
97
- return Box. boxDAC . playFile (songPath);
105
+ return _play (songPath);
98
106
} else {
99
107
Log.error (" Player could not find songs to play..." );
100
108
}
@@ -106,7 +114,8 @@ bool BoxPlayer::playDir(const char* path, PLAYER_FLAGS flags) {
106
114
bool BoxPlayer::playFile (const char * file, PLAYER_FLAGS flags) {
107
115
_mode = PLAYER_MODE::FILE;
108
116
_flags = flags;
109
- return Box.boxDAC .playFile (file);
117
+ Log.info (" Playing file %s" , file);
118
+ return _play (file);
110
119
}
111
120
112
121
bool BoxPlayer::isPlaying () {
0 commit comments