diff options
author | David Crocker <dcrocker@eschertech.com> | 2021-07-19 02:57:01 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2021-07-19 03:02:51 +0300 |
commit | 1b58c63543e92cb36f28174402e8de38aa2b02aa (patch) | |
tree | 2de7a7f09723cb8896091ee98f660efb9034757a /src/Accelerometers/Accelerometers.cpp | |
parent | 03bd591dac92c4fea398eaea128c0aa56e2e56ca (diff) |
Added support for LIS3DSH
Diffstat (limited to 'src/Accelerometers/Accelerometers.cpp')
-rw-r--r-- | src/Accelerometers/Accelerometers.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/src/Accelerometers/Accelerometers.cpp b/src/Accelerometers/Accelerometers.cpp index 7cbff6a0..2e4639a2 100644 --- a/src/Accelerometers/Accelerometers.cpp +++ b/src/Accelerometers/Accelerometers.cpp @@ -80,7 +80,7 @@ static IoPort irqPort; for (;;) { TaskBase::Take(); - FileStore * const f = accelerometerFile; // capture volatile variable + FileStore * f = accelerometerFile; // capture volatile variable if (f != nullptr) { // Collect and write the samples @@ -102,14 +102,10 @@ static IoPort irqPort; { // samplesRead == 0 indicates an error, e.g. no interrupt samplesWanted = 0; - if (f != nullptr) - { - f->Write("Failed to collect data from accelerometer\n"); - f->Truncate(); // truncate the file in case we didn't write all the preallocated space - f->Close(); - accelerometerFile = nullptr; - } - break; + f->Write("Failed to collect data from accelerometer\n"); + f->Truncate(); // truncate the file in case we didn't write all the preallocated space + f->Close(); + f = nullptr; } else { @@ -187,7 +183,6 @@ static IoPort irqPort; { f->Truncate(); // truncate the file in case we didn't write all the preallocated space f->Close(); - accelerometerFile = nullptr; } accelerometer->StopCollecting(); @@ -338,11 +333,11 @@ GCodeResult Accelerometers::ConfigureAccelerometer(GCodeBuffer& gb, const String } # if SUPPORT_CAN_EXPANSION - reply.printf("Accelerometer %u:%u with orientation %u samples at %uHz with %u-bit resolution, SPI frequency %" PRIu32, - CanInterface::GetCanAddress(), 0, orientation, samplingRate, resolution, accelerometer->GetFrequency()); + reply.printf("Accelerometer %u:%u type %s with orientation %u samples at %uHz with %u-bit resolution, SPI frequency %" PRIu32, + CanInterface::GetCanAddress(), 0, accelerometer->GetTypeName(), orientation, samplingRate, resolution, accelerometer->GetFrequency()); # else - reply.printf("Accelerometer %u with orientation %u samples at %uHz with %u-bit resolution, SPI frequency %" PRIu32, - 0, orientation, samplingRate, resolution, accelerometer->GetFrequency()); + reply.printf("Accelerometer %u type %s with orientation %u samples at %uHz with %u-bit resolution, SPI frequency %" PRIu32, + 0, accelerometer->GetTypeName(), orientation, samplingRate, resolution, accelerometer->GetFrequency()); # endif return GCodeResult::ok; } |