Compare commits
3 Commits
2a6da04095
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 42ea4d08fe | |||
| 48f0ab881d | |||
|
|
08370809e1 |
@@ -61,8 +61,11 @@
|
|||||||
<text x="141.847" y="197.573" font-size="14" text-anchor="middle" dominant-baseline="middle" fill="#FFF" transform="rotate(90 141.847 197.573)">180</text>
|
<text x="141.847" y="197.573" font-size="14" text-anchor="middle" dominant-baseline="middle" fill="#FFF" transform="rotate(90 141.847 197.573)">180</text>
|
||||||
<text x="111.000" y="187.550" font-size="14" text-anchor="middle" dominant-baseline="middle" fill="#FFF" transform="rotate(90 111.000 187.550)">200</text>
|
<text x="111.000" y="187.550" font-size="14" text-anchor="middle" dominant-baseline="middle" fill="#FFF" transform="rotate(90 111.000 187.550)">200</text>
|
||||||
</g>
|
</g>
|
||||||
<line id="needle" x1="150" y1="120" x2="150" y2="70" stroke="#e74c3c" stroke-width="6" stroke-linecap="round" />
|
<rect x="100" y="172" width="94" height="24" rx="4" ry="4" fill="#FFF" />
|
||||||
<text id="TotalKm" x="190" y="190" font-size="20" text-anchor="end" fill="#AAA">0.0</text>
|
<text id="TotalKm" x="190" y="190" font-size="20" text-anchor="end" fill="#AAA">0.0</text>
|
||||||
|
<text x="130" y="90" font-size="20" fill="#DDD">Km/h</text>
|
||||||
|
<line id="needle" x1="150" y1="120" x2="150" y2="70" stroke="#e74c3c" stroke-width="6" stroke-linecap="round" />
|
||||||
|
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div style="text-align:center; margin-top:20px;">
|
<div style="text-align:center; margin-top:20px;">
|
||||||
|
|||||||
@@ -4,12 +4,12 @@
|
|||||||
#include "WebServer.h"
|
#include "WebServer.h"
|
||||||
|
|
||||||
|
|
||||||
void handlePage(char *page) {
|
void handlePage(char *page, char *contentType) {
|
||||||
if (LittleFS.exists(page)) {
|
if (LittleFS.exists(page)) {
|
||||||
File file = LittleFS.open(page, "r");
|
File file = LittleFS.open(page, "r");
|
||||||
if (file) {
|
if (file) {
|
||||||
String html = file.readString();
|
String html = file.readString();
|
||||||
server.send(200, "text/html", html);
|
server.send(200, contentType, html);
|
||||||
file.close();
|
file.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#include <ESP8266WebServer.h>
|
||||||
|
|
||||||
extern ESP8266WebServer server;
|
extern ESP8266WebServer server;
|
||||||
|
|
||||||
void handlePage(char *page);
|
void handlePage(char *page, char *contentType);
|
||||||
12
src/main.cpp
12
src/main.cpp
@@ -6,6 +6,7 @@
|
|||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <LittleFS.h>
|
#include <LittleFS.h>
|
||||||
|
#include "WebServer.h"
|
||||||
|
|
||||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||||
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
||||||
@@ -45,11 +46,12 @@ void setup() {
|
|||||||
} else {
|
} else {
|
||||||
Serial.println("[DEBUG] LittleFS mounted");
|
Serial.println("[DEBUG] LittleFS mounted");
|
||||||
}
|
}
|
||||||
server.on("/", []() { handlePage("/index.html"); });
|
server.on("/", []() { handlePage("/index.html", "text/html"); });
|
||||||
server.on("/xpressnet.html", []() { handlePage("/xpressnet.html"); });
|
server.on("/xpressnet.html", []() { handlePage("/xpressnet.html", "text/html"); });
|
||||||
server.on("/mouse.html", []() { handlePage("/mouse.html"); });
|
server.on("/mouse.html", []() { handlePage("/mouse.html", "text/html"); });
|
||||||
server.on("/js/script.js", []() { handlePage("/js/script.js"); });
|
server.on("/js/mouse.js", []() { handlePage("/js/mouse.js", "application/javascript"); });
|
||||||
server.on("/css/style.css", []() { handlePage("/css/style.css"); });
|
server.on("/css/style.css", []() { handlePage("/css/style.css", "text/css"); });
|
||||||
|
server.on("/img/Speed.png", []() { handlePage("/img/Speed.png", "image/png"); });
|
||||||
server.begin();
|
server.begin();
|
||||||
Serial.println("[DEBUG] Web server started");
|
Serial.println("[DEBUG] Web server started");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user