Fixed scale tare

This commit is contained in:
Martin Bauer
2020-06-05 20:55:01 +02:00
parent 123c2a534b
commit daa2454e71
14 changed files with 622 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
#include <ESPAsyncWebServer.h>
#include <FS.h>
#include "FilesystemAbstraction.h"
#define FLASH_TEXT(name) const char *name
@@ -35,7 +36,7 @@ public:
WebdavFileListCallback(const String &path)
: path_(path), headerWritten_(false), finished_(false)
{
dir_ = SPIFFS.openDir(path);
dir_ = portablefs::openDir(path);
}
size_t operator()(uint8_t *buffer, size_t maxLen, size_t index)
@@ -104,11 +105,11 @@ public:
}
size_t bytesWritten = buffer - bufferStart;
assert(bytesWritten < maxLen, "Written too much!");
Serial.print("Bytes written ");
Serial.println(bytesWritten);
Serial.print("Max bytes ");
Serial.println(maxLen);
assert_msg(bytesWritten < maxLen, "Written too much!");
//Serial.print("Bytes written ");
//Serial.println(bytesWritten);
//Serial.print("Max bytes ");
//Serial.println(maxLen);
return bytesWritten;
}
@@ -122,7 +123,7 @@ private:
{
size_t size = 0;
auto fileBase = fileZero.substring(0, fileZero.indexOf('_'));
auto newDirInstance = SPIFFS.openDir(path_);
auto newDirInstance = portablefs::openDir(path_);
while (newDirInstance.next())
if (newDirInstance.isFile() && newDirInstance.fileName().startsWith(fileBase))
size += newDirInstance.fileSize();
@@ -136,7 +137,7 @@ private:
buffer += len;
}
Dir dir_;
portablefs::Dir dir_;
const String path_;
bool headerWritten_;
bool finished_;
@@ -147,7 +148,7 @@ bool deleteMeasurementFiles(const String &stName, const String &folder)
String baseName = folder + "/" + stName.substring(0, stName.indexOf("."));
int counter = 0;
{
auto d = SPIFFS.openDir(folder);
auto d = portablefs::openDir(folder);
while (d.next())
if (d.isFile() && d.fileName().startsWith(baseName))
++counter;