rrivirr / rriv

GNU General Public License v3.0
1 stars 9 forks source link

Use a special output device in testMeasurementCycle #107

Open ZavenArra opened 1 year ago

ZavenArra commented 1 year ago

in test measurement cycle we currently use a boolean to tell the file system write cache to also output to serial. It would fit our pattern better to instead have a special OutputDevice that is handed to the cache that writes to both outputs. OutputDevices should define how output is written, and not at the WriteCache level.

void Datalogger::testMeasurementCycle()
{
  initializeMeasurementCycle();
  fileSystemWriteCache->setOutputToSerial(true); // another way to do this would be to set a special write cache
  while(processReadingsCycle()){
    fileSystemWriteCache->flushCache();
    outputLastMeasurement();
  }      
  fileSystemWriteCache->flushCache();            // instead of using a boolean in this particular write cache
  fileSystemWriteCache->setOutputToSerial(false);// and then set it back to the original writecache here
}