fixed problem in initialization
This commit is contained in:
parent
772c3c410b
commit
a5fc54e87d
@ -8,7 +8,7 @@
|
||||
|
||||
class WebApiDatabaseClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
bool write(float energy);
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ void WebApiClass::init(Scheduler& scheduler)
|
||||
_webApiWebapp.init(_server);
|
||||
_webApiWsConsole.init(_server);
|
||||
_webApiWsLive.init(_server);
|
||||
_webApiWsDatabase.init(_server);
|
||||
|
||||
_server.begin();
|
||||
|
||||
|
||||
@ -1,19 +1,20 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "WebApi_database.h"
|
||||
#include "WebApi.h"
|
||||
#include "Datastore.h"
|
||||
#include "MessageOutput.h"
|
||||
#include "WebApi.h"
|
||||
#include "defaults.h"
|
||||
#include <Arduino.h>
|
||||
#include <AsyncJson.h>
|
||||
#include <LittleFS.h>
|
||||
|
||||
void WebApiDatabaseClass::init(AsyncWebServer* server)
|
||||
void WebApiDatabaseClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/database", HTTP_GET, std::bind(&WebApiDatabaseClass::onDatabase, this, _1));
|
||||
_server->on("/api/databaseHour", HTTP_GET, std::bind(&WebApiDatabaseClass::onDatabaseHour, this, _1));
|
||||
_server->on("/api/databaseDay", HTTP_GET, std::bind(&WebApiDatabaseClass::onDatabaseDay, this, _1));
|
||||
@ -70,7 +71,7 @@ bool WebApiDatabaseClass::write(float energy)
|
||||
|
||||
File f = LittleFS.open(DATABASE_FILENAME, "a", true);
|
||||
if (!f) {
|
||||
MessageOutput.println("Failed to append to database.");
|
||||
MessageOutput.println("Failed to append the database.");
|
||||
return (false);
|
||||
}
|
||||
f.write((const uint8_t*)&d, sizeof(pvData));
|
||||
@ -128,9 +129,9 @@ size_t WebApiDatabaseClass::readchunk(uint8_t* buffer, size_t maxLen, size_t ind
|
||||
size_t WebApiDatabaseClass::readchunk_log(uint8_t* buffer, size_t maxLen, size_t index)
|
||||
{
|
||||
size_t x = readchunk(buffer, maxLen, index);
|
||||
MessageOutput.println("----------");
|
||||
MessageOutput.println(maxLen);
|
||||
MessageOutput.println(x);
|
||||
//MessageOutput.println("----------");
|
||||
//MessageOutput.println(maxLen);
|
||||
//MessageOutput.println(x);
|
||||
return (x);
|
||||
}
|
||||
|
||||
|
||||
@ -19,10 +19,9 @@
|
||||
"sortablejs": "^1.15.1",
|
||||
"spark-md5": "^3.0.2",
|
||||
"vue": "^3.3.13",
|
||||
"vue-i18n": "^9.8.0",
|
||||
"vue-google-charts": "^1.1.0",
|
||||
"vue-i18n": "^9.8.0",
|
||||
"vue-router": "^4.2.5"
|
||||
|
||||
},
|
||||
"devDependencies": {
|
||||
"@intlify/unplugin-vue-i18n": "^1.6.0",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user