mirror of
https://github.com/supleed2/ELEC50003-P1-CW.git
synced 2024-12-22 21:45:49 +00:00
Add command.js to webserver serve code
This commit is contained in:
parent
cc113aa086
commit
4fd4e56f62
|
@ -130,9 +130,9 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center;" colspan="2"><button style="color: red;">Emergency <br> Stop</button></td>
|
<td style="text-align: center;" colspan="2"><button style="color: red;">Emergency<br>Stop</button></td>
|
||||||
<td style="text-align: center;" colspan="2"><button>Telemetry Reset</button></td>
|
<td style="text-align: center;" colspan="2"><button>Telemetry<br>Reset</button></td>
|
||||||
<td style="text-align: center;" colspan="2"><button>Full <br> Charge</button></td>
|
<td style="text-align: center;" colspan="2"><button>Full<br>Charge</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td colspan="6"><hr></td></tr>
|
<tr><td colspan="6"><hr></td></tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -111,15 +111,17 @@ void setup()
|
||||||
{
|
{
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
while (!MDNS.begin("rover")) // Set up mDNS cast at "rover.local/"
|
while (!MDNS.begin("rover2")) // Set up mDNS cast at "rover.local/"
|
||||||
{
|
{
|
||||||
Serial.println("Error setting up mDNS, retrying in 5s");
|
Serial.println("Error setting up mDNS, retrying in 5s");
|
||||||
delay(5000);
|
delay(5000);
|
||||||
}
|
}
|
||||||
Serial.println("mDNS set up, access Control Panel at 'rover.local/'");
|
Serial.println("mDNS set up, access Control Panel at 'rover2.local/'");
|
||||||
|
|
||||||
webserver.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
|
webserver.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
|
||||||
{ request->send(SPIFFS, "/index.html", "text/html"); }); // Serve "index.html" at root page
|
{ request->send(SPIFFS, "/index.html", "text/html"); }); // Serve "index.html" at root page
|
||||||
|
webserver.on("/command.js", HTTP_GET, [](AsyncWebServerRequest *request)
|
||||||
|
{ request->send(SPIFFS, "/command.js", "text/js"); }); // Serve "command.js" for root page to accessj
|
||||||
webserver.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request)
|
webserver.on("/favicon.ico", HTTP_GET, [](AsyncWebServerRequest *request)
|
||||||
{ request->send(SPIFFS, "/favicon.ico", "image/png"); }); // Serve tab icon
|
{ request->send(SPIFFS, "/favicon.ico", "image/png"); }); // Serve tab icon
|
||||||
webserver.onNotFound(notFound); // Set up basic 404NotFound page
|
webserver.onNotFound(notFound); // Set up basic 404NotFound page
|
||||||
|
|
Loading…
Reference in a new issue