Fix in websocket newData message sending
This commit is contained in:
@@ -75,14 +75,13 @@ private:
|
||||
void saveToFileSystem()
|
||||
{
|
||||
static const uint32_t arrayHeaderOffset = ChunkT::arrayHeaderOffset();
|
||||
Serial.printf(" -------- Array header offset ---- %u\n", arrayHeaderOffset);
|
||||
const uint32_t numMeasurements = chunk->numMeasurements();
|
||||
|
||||
// todo: check this! free doesn't mean that the file writing actually works ok
|
||||
// use error codes of write instead? anyway: test it!
|
||||
Serial.printf("%ld saveToFileSystem start()\n", millis());
|
||||
Serial.printf("%ld saveToFileSystem start\n", millis());
|
||||
deleteUntilBytesFree(CONFIG_SESSION_MAX_SIZE);
|
||||
Serial.printf("%ld after deleteUntilBytesFree()\n", millis());
|
||||
Serial.printf(" %ld after deleteUntilBytesFree()\n", millis());
|
||||
|
||||
String filename = String(CONFIG_DATA_PATH) + "/" + String(chunk->getStartTime());
|
||||
if (portablefs::exists(filename.c_str()))
|
||||
@@ -94,12 +93,12 @@ private:
|
||||
Measurement_T *startPtr = chunk->getDataPointer() + existingMeasurements;
|
||||
file.write((uint8_t *)(startPtr), measurementsToWrite * sizeof(Measurement_T));
|
||||
|
||||
Serial.printf("%ld Incr Save: before header patch\n", millis());
|
||||
Serial.printf(" %ld Incr Save: before header patch\n", millis());
|
||||
file.seek(arrayHeaderOffset);
|
||||
|
||||
StreamingMsgPackEncoder<portablefs::File> encoder(&file);
|
||||
encoder.template sendArrayHeader<Measurement_T>(numMeasurements);
|
||||
Serial.printf("%ld total measurements up to now %u\n", millis(), numMeasurements);
|
||||
Serial.printf(" %ld total measurements up to now %u\n", millis(), numMeasurements);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -108,7 +107,7 @@ private:
|
||||
StreamingMsgPackEncoder<portablefs::File> encoder(&file);
|
||||
chunk->serialize(encoder);
|
||||
}
|
||||
Serial.printf("%ld saveToFileSystem done-------------\n", millis());
|
||||
Serial.printf(" %ld saveToFileSystem done\n", millis());
|
||||
}
|
||||
|
||||
void deleteUntilBytesFree(size_t requiredSpace)
|
||||
|
||||
Reference in New Issue
Block a user