mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Add files
This commit is contained in:
parent
57c97b3f07
commit
fe456b62b3
4 changed files with 50 additions and 1 deletions
|
@ -17,7 +17,7 @@
|
||||||
//#define KIA_E_GMP_BATTERY
|
//#define KIA_E_GMP_BATTERY
|
||||||
//#define KIA_HYUNDAI_HYBRID_BATTERY
|
//#define KIA_HYUNDAI_HYBRID_BATTERY
|
||||||
//#define MG_5_BATTERY
|
//#define MG_5_BATTERY
|
||||||
//#define NISSAN_LEAF_BATTERY
|
#define NISSAN_LEAF_BATTERY
|
||||||
//#define PYLON_BATTERY
|
//#define PYLON_BATTERY
|
||||||
//#define RENAULT_KANGOO_BATTERY
|
//#define RENAULT_KANGOO_BATTERY
|
||||||
//#define RENAULT_ZOE_GEN1_BATTERY
|
//#define RENAULT_ZOE_GEN1_BATTERY
|
||||||
|
|
27
Software/src/devboard/webserver/advanced_battery_html.cpp
Normal file
27
Software/src/devboard/webserver/advanced_battery_html.cpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include "advanced_battery_html.h"
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include "../../datalayer/datalayer.h"
|
||||||
|
|
||||||
|
String advanced_battery_processor(const String& var) {
|
||||||
|
if (var == "X") {
|
||||||
|
String content = "";
|
||||||
|
//Page format
|
||||||
|
content += "<style>";
|
||||||
|
content += "body { background-color: black; color: white; }";
|
||||||
|
content += "</style>";
|
||||||
|
|
||||||
|
// Start a new block with a specific background color
|
||||||
|
content += "<div style='background-color: #303E47; padding: 10px; margin-bottom: 10px;border-radius: 50px'>";
|
||||||
|
|
||||||
|
content += "<h4 style='color: white;'>SSID: <span id='SSID'></span> <button onclick='editSSID()'>Edit</button></h4>";
|
||||||
|
|
||||||
|
content += "</div>";
|
||||||
|
|
||||||
|
content += "<button onclick='goToMainPage()'>Back to main page</button>";
|
||||||
|
content += "<script>";
|
||||||
|
content += "function goToMainPage() { window.location.href = '/'; }";
|
||||||
|
content += "</script>";
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
return String();
|
||||||
|
}
|
17
Software/src/devboard/webserver/advanced_battery_html.h
Normal file
17
Software/src/devboard/webserver/advanced_battery_html.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef ADVANCEDBATTERY_H
|
||||||
|
#define ADVANCEDBATTERY_H
|
||||||
|
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Replaces placeholder with content section in web page
|
||||||
|
*
|
||||||
|
* @param[in] var
|
||||||
|
*
|
||||||
|
* @return String
|
||||||
|
*/
|
||||||
|
String advanced_battery_processor(const String& var);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -15,6 +15,7 @@ unsigned long ota_progress_millis = 0;
|
||||||
#include "events_html.h"
|
#include "events_html.h"
|
||||||
#include "index_html.cpp"
|
#include "index_html.cpp"
|
||||||
#include "settings_html.h"
|
#include "settings_html.h"
|
||||||
|
#include "advanced_battery_html.h"
|
||||||
|
|
||||||
enum WifiState {
|
enum WifiState {
|
||||||
INIT, //before connecting first time
|
INIT, //before connecting first time
|
||||||
|
@ -59,6 +60,10 @@ void init_webserver() {
|
||||||
server.on("/settings", HTTP_GET,
|
server.on("/settings", HTTP_GET,
|
||||||
[](AsyncWebServerRequest* request) { request->send_P(200, "text/html", index_html, settings_processor); });
|
[](AsyncWebServerRequest* request) { request->send_P(200, "text/html", index_html, settings_processor); });
|
||||||
|
|
||||||
|
// Route for going to advanced battery info web page
|
||||||
|
server.on("/advanced", HTTP_GET,
|
||||||
|
[](AsyncWebServerRequest* request) { request->send_P(200, "text/html", index_html, advanced_battery_processor); });
|
||||||
|
|
||||||
// Route for going to cellmonitor web page
|
// Route for going to cellmonitor web page
|
||||||
server.on("/cellmonitor", HTTP_GET, [](AsyncWebServerRequest* request) {
|
server.on("/cellmonitor", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||||
request->send_P(200, "text/html", index_html, cellmonitor_processor);
|
request->send_P(200, "text/html", index_html, cellmonitor_processor);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue