This commit is contained in:
Dooho Yi 2021-11-12 18:56:17 +09:00
parent 49d88e3b92
commit 7523628865

View file

@ -2,10 +2,10 @@
//============<configurations>============ //============<configurations>============
// //
// 'SHOW_SCREEN' : whether if playing info. displayed or not. // 'ENABLE_SCREEN' : whether if playing info. displayed or not.
// //
//============</configurations>============ //============</configurations>============
//#define SHOW_SCREEN //#define ENABLE_SCREEN
//============<audioooo-param>============ //============<audioooo-param>============
#define GAIN_MAX 1.0 // if 1.0 is too loud, give max. limit here. #define GAIN_MAX 1.0 // if 1.0 is too loud, give max. limit here.
@ -55,6 +55,7 @@ Audio audio;
String screen_filename = "/___.mp3"; String screen_filename = "/___.mp3";
// //
#if defined(ENABLE_SCREEN)
extern Task screen_cmd_notify_task; extern Task screen_cmd_notify_task;
bool cmd_notify = false; bool cmd_notify = false;
void screen_cmd_notify() { void screen_cmd_notify() {
@ -74,8 +75,6 @@ void screen() {
display.setTextColor(SSD1306_WHITE); display.setTextColor(SSD1306_WHITE);
display.setTextSize(1); display.setTextSize(1);
#if defined(SHOW_SCREEN)
//line1 - mode line (playing / stopped) + notify mark //line1 - mode line (playing / stopped) + notify mark
display.setCursor(0, line); display.setCursor(0, line);
if (audio.isRunning()) display.println("= playing ==="); if (audio.isRunning()) display.println("= playing ===");
@ -91,13 +90,12 @@ void screen() {
display.println(screen_filename.c_str()); display.println(screen_filename.c_str());
line += line_step; line += line_step;
#endif
// //
display.display(); display.display();
// //
} }
Task screen_task(SCREEN_PERIOD, TASK_FOREVER, &screen, &runner, true); Task screen_task(SCREEN_PERIOD, TASK_FOREVER, &screen, &runner, true);
#endif
//audio files (wav & mp3) //audio files (wav & mp3)
String file_list[100]; //<-- later change this to be a vector (variable length) String file_list[100]; //<-- later change this to be a vector (variable length)
@ -206,6 +204,10 @@ void setup() {
file_index = 0; file_index = 0;
audio.connecttoSD(file_list[file_index].c_str()); audio.connecttoSD(file_list[file_index].c_str());
screen_filename = file_list[file_index]; screen_filename = file_list[file_index];
//clear screen (make it black out, for sure.)
display.clearDisplay();
display.display();
} }
void loop() { void loop() {