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);
|
pinMode(LED, OUTPUT);
|
||||||
digitalWrite(LED, LOW);
|
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);
|
pinMode(BUTTON, INPUT_PULLUP);
|
||||||
|
|
||||||
// Setup SPIFFS
|
// Setup SPIFFS
|
||||||
if (!SPIFFS.begin())
|
if (!SPIFFS.begin())
|
||||||
{
|
{
|
||||||
Serial.println("SPIFFS error. Exiting.");
|
Serial.println("SPIFFS error. Exiting.");
|
||||||
|
display.println("Impossible d'acceder aux fichiers...");
|
||||||
|
display.display();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +124,8 @@ void setup()
|
||||||
{
|
{
|
||||||
selectedFile = fileName;
|
selectedFile = fileName;
|
||||||
Serial.println("Selected " + fileName);
|
Serial.println("Selected " + fileName);
|
||||||
|
display.println("Selectionne : " + fileName);
|
||||||
|
display.display();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
file.close();
|
file.close();
|
||||||
|
@ -135,6 +152,8 @@ void setup()
|
||||||
#endif
|
#endif
|
||||||
String wifiMessage = wifiMode + " IP: " + wifiIP;
|
String wifiMessage = wifiMode + " IP: " + wifiIP;
|
||||||
Serial.println(wifiMessage);
|
Serial.println(wifiMessage);
|
||||||
|
display.println(wifiMessage);
|
||||||
|
display.display();
|
||||||
|
|
||||||
// Server
|
// Server
|
||||||
server.on("/play", HTTP_GET, onPlay);
|
server.on("/play", HTTP_GET, onPlay);
|
||||||
|
@ -146,25 +165,13 @@ void setup()
|
||||||
server.begin();
|
server.begin();
|
||||||
|
|
||||||
Serial.println("Server ready!");
|
Serial.println("Server ready!");
|
||||||
|
display.println("Serveur pret !");
|
||||||
|
display.display();
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
|
||||||
audio.setVolume(21); // Max 21
|
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
|
// Setup is done, light up the LED
|
||||||
digitalWrite(LED, HIGH);
|
digitalWrite(LED, HIGH);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue