Skip to content

Commit 4598729

Browse files
authored
fix(t-deck): Increase stack size and clean up audio loading code (#547)
* fix(t-deck): Increase stack size and clean up audio loading code * fix how suppression was configured
1 parent 8bb13e3 commit 4598729

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

components/t-deck/example/main/t_deck_example.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ extern "C" void app_main(void) {
174174
},
175175
.task_config = {
176176
.name = "lv_task",
177+
.stack_size_bytes = 6 * 1024,
177178
}});
178179
lv_task.start();
179180

@@ -227,23 +228,14 @@ static size_t load_audio() {
227228
return audio_bytes.size();
228229
}
229230

230-
// these are configured in the CMakeLists.txt file
231-
extern const char wav_start[] asm("_binary_click_wav_start"); // cppcheck-suppress syntaxError
232-
extern const char wav_end[] asm("_binary_click_wav_end"); // cppcheck-suppress syntaxError
231+
// load the audio data. these are configured in the CMakeLists.txt file
233232

234-
// -1 due to the size being 1 byte too large, I think because end is the byte
235-
// immediately after the last byte in the memory but I'm not sure - cmm 2022-08-20
236-
//
237-
// Suppression as these are linker symbols and cppcheck doesn't know how to ensure
238-
// they are the same object
239-
// cppcheck-suppress comparePointers
240-
size_t wav_size = (wav_end - wav_start) - 1;
241-
FILE *fp = fmemopen((void *)wav_start, wav_size, "rb");
242-
// read the file into the audio_bytes vector
243-
audio_bytes.resize(wav_size);
244-
fread(audio_bytes.data(), 1, wav_size, fp);
245-
fclose(fp);
246-
return wav_size;
233+
// cppcheck-suppress syntaxError
234+
extern const uint8_t click_wav_start[] asm("_binary_click_wav_start");
235+
// cppcheck-suppress syntaxError
236+
extern const uint8_t click_wav_end[] asm("_binary_click_wav_end");
237+
audio_bytes = std::vector<uint8_t>(click_wav_start, click_wav_end);
238+
return audio_bytes.size();
247239
}
248240

249241
static void play_click(espp::TDeck &tdeck) {

0 commit comments

Comments
 (0)