Fixes in firmware
This commit is contained in:
@@ -12,7 +12,9 @@ public:
|
||||
|
||||
void init(uint32_t epochStartTime) {
|
||||
currentChunk = &chunks[0];
|
||||
otherChunk = &chunks[1];
|
||||
currentChunk->init(epochStartTime, 0);
|
||||
otherChunk->init(0, 0);
|
||||
}
|
||||
|
||||
bool addPoint(Measurement_T measurement) {
|
||||
@@ -22,7 +24,7 @@ public:
|
||||
rotate();
|
||||
const bool secondInsertSuccess = currentChunk->addPoint(measurement);
|
||||
assert(secondInsertSuccess, "Session: insertion after rotation failed");
|
||||
//TODO check that there is place for file - remove old files
|
||||
// TODO check that there is place for file - remove old files
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -80,7 +82,7 @@ private:
|
||||
const auto fileName = chunkFileName(chunkNr, chunk->getStartTime());
|
||||
Serial.print("Writing session to file ");
|
||||
Serial.println(fileName);
|
||||
Writer writer( fileName );
|
||||
Writer writer(fileName);
|
||||
chunk->serialize(writer.encoder());
|
||||
};
|
||||
|
||||
@@ -91,7 +93,7 @@ private:
|
||||
|
||||
if( startIdx >= currentChunk->getStartIndex() ) {
|
||||
encoder.sendArrayPartialContents( currentChunk->getDataPointer(), currentChunk->numMeasurements() );
|
||||
return currentChunk->getStartIndex() + currentChunk->numMeasurements();
|
||||
return currentChunk->getStartIndex() + currentChunk->numMeasurements();
|
||||
} else if( startIdx >= otherChunk->getStartIndex() && otherChunkFilled() ) {
|
||||
encoder.sendArrayPartialContents( otherChunk->getDataPointer(), otherChunk->numMeasurements() );
|
||||
assert( otherChunk->numMeasurements(), CHUNK_SIZE );
|
||||
|
||||
@@ -10,15 +10,12 @@ public:
|
||||
encoder_(&f_),
|
||||
fileName_(fileName)
|
||||
{
|
||||
Serial.println("Opened file for writing successful?");
|
||||
bool success = f_;
|
||||
Serial.println(success);
|
||||
}
|
||||
~SpiffsStorageWriter() {
|
||||
f_.close();
|
||||
Serial.print("Closing file: ");
|
||||
Serial.println(fileName_);
|
||||
Serial.print("File exists: ");
|
||||
Serial.println(SPIFFS.exists(fileName_));
|
||||
}
|
||||
StreamingMsgPackEncoder<File> &encoder() { return encoder_; }
|
||||
@@ -34,7 +31,7 @@ class SpiffsStorageReader
|
||||
{
|
||||
public:
|
||||
SpiffsStorageReader(const String &fileName) :
|
||||
f_(SPIFFS.open(fileName, "w"))
|
||||
f_(SPIFFS.open(fileName, "r"))
|
||||
{}
|
||||
~SpiffsStorageReader() {
|
||||
f_.close();
|
||||
|
||||
Reference in New Issue
Block a user