[sky9x] Revert to last version where massstorage was ok for all SDs!
[stock] Flash saving [stock] Voice mod port from er9x
This commit is contained in:
+11
-16
@@ -67,13 +67,17 @@ const char * audioFilenames[] = {
|
||||
|
||||
uint32_t sdAvailableAudioFiles = 0;
|
||||
|
||||
// TODO enable the assert when it's C++
|
||||
extern "C" {
|
||||
void retrieveAvailableAudioFiles()
|
||||
{
|
||||
FILINFO info;
|
||||
char filename[32] = SYSTEM_SOUNDS_PATH "/";
|
||||
|
||||
#if !defined WIN32 && defined __GNUC__
|
||||
assert(sizeof(audioFilenames)==AU_FRSKY_FIRST*sizeof(char *));
|
||||
assert(sizeof(sdAvailableAudioFiles)*8 > AU_FRSKY_FIRST);
|
||||
#endif
|
||||
|
||||
uint32_t availableAudioFiles = 0;
|
||||
|
||||
@@ -86,6 +90,7 @@ void retrieveAvailableAudioFiles()
|
||||
|
||||
sdAvailableAudioFiles = availableAudioFiles;
|
||||
}
|
||||
}
|
||||
|
||||
inline bool isAudioFileAvailable(uint8_t i, char * filename)
|
||||
{
|
||||
@@ -156,21 +161,10 @@ uint32_t pcmFreq = 8000;
|
||||
#ifndef SIMU
|
||||
void audioTask(void* pdata)
|
||||
{
|
||||
#if defined(SDCARD)
|
||||
if (CardIsConnected() && sdState==SD_STATE_CONNECTED) {
|
||||
// We lower the priority to allow the splash to be displayed...
|
||||
CoSetPriority(audioTaskId, MENUS_PRIO+1);
|
||||
if (f_mount(0, &g_FATFS_Obj) == FR_OK) {
|
||||
retrieveAvailableAudioFiles();
|
||||
sdState = SD_STATE_MOUNTED;
|
||||
}
|
||||
else {
|
||||
sdState = SD_STATE_ERROR;
|
||||
}
|
||||
CoSetPriority(audioTaskId, AUDIO_PRIO);
|
||||
AUDIO_TADA();
|
||||
}
|
||||
#endif
|
||||
#if defined(SDCARD)
|
||||
sdInit();
|
||||
AUDIO_TADA();
|
||||
#endif
|
||||
|
||||
while (1) {
|
||||
|
||||
@@ -434,6 +428,7 @@ void AudioQueue::play(uint8_t tFreq, uint8_t tLen, uint8_t tPause, uint8_t tFlag
|
||||
{
|
||||
CoEnterMutexSection(audioMutex);
|
||||
|
||||
|
||||
if (tFlags & PLAY_SOUND_VARIO) {
|
||||
background.freq = tFreq * 2;
|
||||
background.duration = tLen;
|
||||
@@ -477,7 +472,7 @@ void AudioQueue::playFile(const char *filename, uint8_t flags, uint8_t id)
|
||||
#if defined(SIMU)
|
||||
printf("playFile(\"%s\")\n", filename); fflush(stdout);
|
||||
#else
|
||||
if (!CardIsMounted())
|
||||
if (Card_initialized && !sd_card_mounted())
|
||||
return;
|
||||
|
||||
CoEnterMutexSection(audioMutex);
|
||||
|
||||
Reference in New Issue
Block a user