mirror of
https://github.com/Crocmagnon/buzzer.git
synced 2024-11-25 01:18:06 +01:00
Display whole status on screen + select file after uploading
This commit is contained in:
parent
4bee1156b1
commit
a0aacd4b22
4 changed files with 25 additions and 13 deletions
|
@ -34,7 +34,7 @@ void setup()
|
||||||
diagnosticPrintln("Configuration OK!");
|
diagnosticPrintln("Configuration OK!");
|
||||||
|
|
||||||
displayWifiCreds();
|
displayWifiCreds();
|
||||||
displaySelectedFile();
|
displayStatus();
|
||||||
|
|
||||||
// Setup is done, light up the LED
|
// Setup is done, light up the LED
|
||||||
Serial.println("All setup & ready to go!");
|
Serial.println("All setup & ready to go!");
|
||||||
|
|
|
@ -75,13 +75,25 @@ void displayWifiCreds()
|
||||||
display.display();
|
display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void displaySelectedFile()
|
void displayStatus()
|
||||||
{
|
{
|
||||||
|
clearMessageArea();
|
||||||
|
|
||||||
|
String volume = String(preferences.getUChar(CURRENT_VOLUME));
|
||||||
|
display.println("Volume: " + volume);
|
||||||
|
|
||||||
String prefix = "Son: ";
|
String prefix = "Son: ";
|
||||||
displayText(prefix + preferences.getString(SELECTED_FILE, "").substring(0, LINE_LENGTH - prefix.length()));
|
display.println(prefix + preferences.getString(SELECTED_FILE, "").substring(0, LINE_LENGTH - prefix.length()));
|
||||||
|
|
||||||
|
display.println("\nRetourne moi !");
|
||||||
|
|
||||||
|
display.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayVolume() {
|
void selectFile(String fileName)
|
||||||
String volume = String(preferences.getUChar(CURRENT_VOLUME));
|
{
|
||||||
displayText("Volume: " + volume);
|
preferences.putString(SELECTED_FILE, fileName);
|
||||||
|
displayStatus();
|
||||||
|
Serial.print("Select new file: ");
|
||||||
|
Serial.println(fileName);
|
||||||
}
|
}
|
|
@ -11,8 +11,10 @@ void clearMessageArea();
|
||||||
void displayText(String text);
|
void displayText(String text);
|
||||||
void play();
|
void play();
|
||||||
|
|
||||||
|
void selectFile(String fileName);
|
||||||
|
|
||||||
void displayWifiCreds();
|
void displayWifiCreds();
|
||||||
void displaySelectedFile();
|
void displayStatus();
|
||||||
|
|
||||||
void diagnosticPrint(String text);
|
void diagnosticPrint(String text);
|
||||||
void diagnosticPrintln(String text);
|
void diagnosticPrintln(String text);
|
||||||
|
|
|
@ -87,15 +87,12 @@ void onListFiles(AsyncWebServerRequest *request)
|
||||||
|
|
||||||
void onSelectFile(AsyncWebServerRequest *request)
|
void onSelectFile(AsyncWebServerRequest *request)
|
||||||
{
|
{
|
||||||
Serial.print("Select file: ");
|
Serial.println("Select file");
|
||||||
if (request->hasParam("fileName", true))
|
if (request->hasParam("fileName", true))
|
||||||
{
|
{
|
||||||
String selectedFile = request->getParam("fileName", true)->value();
|
String selectedFile = request->getParam("fileName", true)->value();
|
||||||
preferences.putString(SELECTED_FILE, selectedFile);
|
selectFile(selectedFile);
|
||||||
Serial.print(selectedFile);
|
|
||||||
displaySelectedFile();
|
|
||||||
}
|
}
|
||||||
Serial.println();
|
|
||||||
onStatus(request);
|
onStatus(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +149,7 @@ void onUploadFile(AsyncWebServerRequest *request, String filename, size_t index,
|
||||||
Serial.printf("Upload end: %s, %u B\n", filename.c_str(), index + len);
|
Serial.printf("Upload end: %s, %u B\n", filename.c_str(), index + len);
|
||||||
request->_tempFile.close();
|
request->_tempFile.close();
|
||||||
request->redirect("/");
|
request->redirect("/");
|
||||||
|
selectFile(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue