Skip to content

Commit

Permalink
Reduced precision of closed loop data
Browse files Browse the repository at this point in the history
  • Loading branch information
dc42 committed Oct 9, 2021
1 parent 662240b commit 413bdc6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ClosedLoop/ClosedLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ GCodeResult ClosedLoop::StartDataCollection(DriverId driverId, GCodeBuffer& gb,

// Estimate how large the file will be
const unsigned int numVariables = Bitmap<uint32_t>(filterRequested).CountSetBits() + 1; // 1 extra for time stamp
const uint32_t preallocSize = numSamplesRequested * ((numVariables * 9) + 4);
const uint32_t preallocSize = numSamplesRequested * ((numVariables * 8) + 4); // assume format "xxx.xxx," for most samples

// Create the file
String<StringLength50> tempFilename;
Expand Down Expand Up @@ -190,7 +190,7 @@ void ClosedLoop::ProcessReceivedData(CanAddress src, const CanMessageClosedLoopD
currentLine.printf("%u", msg.firstSampleNumber + sampleIndex);
for (size_t i = 0; i < variableCount; i++)
{
currentLine.catf(",%.5f", (double)msg.data[sampleIndex*variableCount + i]);
currentLine.catf(",%.2f", (double)msg.data[sampleIndex*variableCount + i]);
}
currentLine.cat("\n");

Expand Down

0 comments on commit 413bdc6

Please sign in to comment.