mirror of
https://github.com/Crocmagnon/buzzer.git
synced 2024-11-21 23:48:07 +01:00
Display loading messages on screen
This commit is contained in:
parent
14f4b14948
commit
0a6a042daf
2 changed files with 36 additions and 16 deletions
13
.vscode/settings.json
vendored
Normal file
13
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"array": "cpp",
|
||||
"deque": "cpp",
|
||||
"string": "cpp",
|
||||
"unordered_map": "cpp",
|
||||
"unordered_set": "cpp",
|
||||
"vector": "cpp",
|
||||
"string_view": "cpp",
|
||||
"initializer_list": "cpp",
|
||||
"regex": "cpp"
|
||||
}
|
||||
}
|
35
src/main.cpp
35
src/main.cpp
|
@ -91,12 +91,27 @@ void setup()
|
|||
pinMode(LED, OUTPUT);
|
||||
digitalWrite(LED, LOW);
|
||||
|
||||
// Screen
|
||||
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS))
|
||||
{
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
return;
|
||||
}
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(0, 0);
|
||||
display.println("Chargement...");
|
||||
display.display();
|
||||
|
||||
pinMode(BUTTON, INPUT_PULLUP);
|
||||
|
||||
// Setup SPIFFS
|
||||
if (!SPIFFS.begin())
|
||||
{
|
||||
Serial.println("SPIFFS error. Exiting.");
|
||||
display.println("Impossible d'acceder aux fichiers...");
|
||||
display.display();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -109,6 +124,8 @@ void setup()
|
|||
{
|
||||
selectedFile = fileName;
|
||||
Serial.println("Selected " + fileName);
|
||||
display.println("Selectionne : " + fileName);
|
||||
display.display();
|
||||
break;
|
||||
}
|
||||
file.close();
|
||||
|
@ -135,6 +152,8 @@ void setup()
|
|||
#endif
|
||||
String wifiMessage = wifiMode + " IP: " + wifiIP;
|
||||
Serial.println(wifiMessage);
|
||||
display.println(wifiMessage);
|
||||
display.display();
|
||||
|
||||
// Server
|
||||
server.on("/play", HTTP_GET, onPlay);
|
||||
|
@ -146,25 +165,13 @@ void setup()
|
|||
server.begin();
|
||||
|
||||
Serial.println("Server ready!");
|
||||
display.println("Serveur pret !");
|
||||
display.display();
|
||||
|
||||
// Audio
|
||||
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
||||
audio.setVolume(21); // Max 21
|
||||
|
||||
// Screen
|
||||
|
||||
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
|
||||
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
return;
|
||||
}
|
||||
display.clearDisplay();
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.setCursor(0, 0);
|
||||
display.println(wifiMessage);
|
||||
display.display();
|
||||
|
||||
// Setup is done, light up the LED
|
||||
digitalWrite(LED, HIGH);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue