Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Duet3D/RepRapFirmware.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Crocker <dcrocker@eschertech.com>2020-01-29 00:12:54 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-01-29 00:12:54 +0300
commita00811bf7eefe6a12600b7cc9dc1fdcc20d800b0 (patch)
tree73a6cfa5a843078173e797d5019b888d06f66c9b /src/Endstops/ZProbe.cpp
parentc37c45253c509258847c405faa527039b5d189f9 (diff)
Fix for negative readings from modulated Z probes
Diffstat (limited to 'src/Endstops/ZProbe.cpp')
-rw-r--r--src/Endstops/ZProbe.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Endstops/ZProbe.cpp b/src/Endstops/ZProbe.cpp
index 055e076f..457b647c 100644
--- a/src/Endstops/ZProbe.cpp
+++ b/src/Endstops/ZProbe.cpp
@@ -38,7 +38,7 @@ constexpr ObjectModelArrayDescriptor ZProbe::valueArrayDescriptor =
{ int v1 = 0;
return ExpressionValue
( (context.GetLastIndex() == 0)
- ? (int32_t)((const ZProbe*)self)->GetRawReading()
+ ? (int32_t)((const ZProbe*)self)->GetReading()
: (((const ZProbe*)self)->GetSecondaryValues(v1), v1)
);
}
@@ -136,7 +136,7 @@ int ZProbe::GetReading() const noexcept
case ZProbeType::dumbModulated: // Dumb modulated IR sensor.
// We assume that zProbeOnFilter and zProbeOffFilter average the same number of readings.
// Because of noise, it is possible to get a negative reading, so allow for this.
- zProbeVal = (int) (((int32_t)p.GetZProbeOnFilter().GetSum() - (int32_t)p.GetZProbeOffFilter().GetSum())/ZProbeAverageReadings);
+ zProbeVal = (int) (((int32_t)p.GetZProbeOnFilter().GetSum() - (int32_t)p.GetZProbeOffFilter().GetSum())/(int)ZProbeAverageReadings);
break;
case ZProbeType::unfilteredDigital: // Switch connected to Z probe input, no filtering