|
|
|
@ -18,7 +18,7 @@
|
|
|
|
|
|
|
|
|
|
#include <limits> |
|
|
|
|
|
|
|
|
|
#define DUMMY_DATA 0 |
|
|
|
|
#define DUMMY_DATA 1 |
|
|
|
|
|
|
|
|
|
AsyncWebServer server(80); |
|
|
|
|
|
|
|
|
@ -262,6 +262,11 @@ void setup()
|
|
|
|
|
// Special case to send index.html without caching
|
|
|
|
|
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(SPIFFS, "/www/index.html", "text/html"); }); |
|
|
|
|
server.serveStatic("/index.html", SPIFFS, "/www/index.html"); |
|
|
|
|
server.on("/manifest.webmanifest", HTTP_GET, [](AsyncWebServerRequest *request){ |
|
|
|
|
AsyncWebServerResponse* response = request->beginResponse(SPIFFS, "/www/manifest.webmanifest", "application/manifest+json; charset=utf-8"); |
|
|
|
|
//response->addHeader("Content-Disposition", "inline");
|
|
|
|
|
request->send(response); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
// Log files (not cached)
|
|
|
|
|
server.serveStatic("/api/log", SPIFFS, "/log/"); |
|
|
|
@ -493,8 +498,11 @@ void loop()
|
|
|
|
|
if(altitudeChange > 0) |
|
|
|
|
tripAscendingElevation += altitudeChange; |
|
|
|
|
|
|
|
|
|
uint32_t newEnergy = entry.batteryVoltage * entry.batteryOutputCurrent * ((float)dt / 1000.0f); |
|
|
|
|
tripMotorEnergy += newEnergy; |
|
|
|
|
static float remainingEnergy = 0.0f; |
|
|
|
|
float newEnergy = entry.batteryVoltage * entry.batteryOutputCurrent * ((float)dt / 1000.0f) + remainingEnergy; |
|
|
|
|
uint32_t newEnergyIntegralJoules = (uint32_t)newEnergy; |
|
|
|
|
remainingEnergy = newEnergy - (float)newEnergyIntegralJoules; |
|
|
|
|
tripMotorEnergy += newEnergyIntegralJoules; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
delay(isOnTrip ? 10 : 1000); |
|
|
|
|