Linear-Analog Error in Expansion Board
-
Hi!
I connected a sensor to the Expansion 3HC (FW 3.3RC3) but after sending the configuration the board was reseting:M308 S3 P"1.temp2" Y"linear-analog" F1 B0 C300 A"Linear"
As it works if I set the type to "pt1000", it looks like a bug related with "linear-analog" but I am worried it may be something missing in the configuration as I have to change the 'LinearAnalogSensor.cpp' to make it work.
With this configuration, the value of 'thermistorInputChannel' was crazy, so I changed the Configure and Poll methods:GCodeResult LinearAnalogSensor::Configure(const CanMessageGenericParser& parser, const StringRef& reply) { bool seen = false; if (!ConfigurePort(parser, reply, PinAccess::readAnalog, seen)) { return GCodeResult::error; } if (parser.GetFloatParam('B', lowTemp)) { seen = true; } if (parser.GetFloatParam('C', highTemp)) { seen = true; } if (parser.GetBoolParam('F', filtered)) { seen = true; } if (seen) { CalcDerivedParameters(); adcFilterChannel = Platform::GetAveragingFilterIndex(port); if (adcFilterChannel >= 0) { Platform::GetAdcFilter(adcFilterChannel)->Init((1u << AnalogIn::AdcBits) - 1); } } else { CopyBasicDetails(reply); reply.catf(", %sfiltered, range %.1f to %.1f", (filtered) ? "" : "un", (double)lowTemp, (double)highTemp); } return GCodeResult::ok; } void LinearAnalogSensor::Poll() { const volatile ThermistorAveragingFilter *tempFilter = Platform::GetAdcFilter(adcFilterChannel); int32_t tempReading; if (filtered) { if (!tempFilter->IsValid()) { SetResult(TemperatureError::notReady); } tempReading = tempFilter->GetSum()/(tempFilter->NumAveraged() >> AdcOversampleBits); } else { tempReading = tempFilter->GetLastReading() << AdcOversampleBits; } SetResult((tempReading * linearIncreasePerCount) + lowTemp, TemperatureError::success); }
Is there something I am missing in the M308?
Thanks! -
@matias thanks for reporting this. I can confirm that it is a firmware issue, and I will try to resolve it in the forthcoming firmware 3.4.0beta7.
-
@dc42 Thanks!!
-
@matias I confirm this is fixed in beta 7.