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-11-19 11:23:53 +0300
committerDavid Crocker <dcrocker@eschertech.com>2020-11-19 11:23:53 +0300
commitbe5f583491490febf0384214d168286c250e6712 (patch)
tree2b3388afc170d9fbef1ff42b22a2b499b4a7bd80 /src/Heating
parent27396093ac1e46c17593f508881c8398a307a1ed (diff)
Fixed compile errors when HAS_VOLTAGE_MONITOR is not set
Also made processing of remote temperayure and heater reports more efficient
Diffstat (limited to 'src/Heating')
-rw-r--r--src/Heating/Heat.cpp71
-rw-r--r--src/Heating/LocalHeater.cpp7
2 files changed, 37 insertions, 41 deletions
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp
index bd8bd733..7815676d 100644
--- a/src/Heating/Heat.cpp
+++ b/src/Heating/Heat.cpp
@@ -1172,52 +1172,43 @@ bool Heat::WriteBedAndChamberTempSettings(FileStore *f) const noexcept
void Heat::ProcessRemoteSensorsReport(CanAddress src, const CanMessageSensorTemperatures& msg) noexcept
{
- uint64_t sensorsReported = msg.whichSensors;
- size_t index = 0;
- for (unsigned int sensor = 0; sensor < 64 && sensorsReported != 0; ++sensor)
- {
- if (((uint8_t)sensorsReported & 1u) != 0)
- {
- if (index < ARRAY_SIZE(msg.temperatureReports))
- {
- const auto ts = FindSensor(sensor);
- if (ts.IsNotNull())
- {
- ts->UpdateRemoteTemperature(src, msg.temperatureReports[index]);
- }
+ Bitmap<uint64_t> sensorsReported(msg.whichSensors);
+ sensorsReported.Iterate([this, src, msg](unsigned int sensor, unsigned int index)
+ {
+ if (index < ARRAY_SIZE(msg.temperatureReports))
+ {
+ const auto ts = FindSensor(sensor);
+ if (ts.IsNotNull())
+ {
+ ts->UpdateRemoteTemperature(src, msg.temperatureReports[index]);
+ }
# ifdef DUET3_ATE
- else
- {
- Duet3Ate::ProcessOrphanedSensorReport(src, sensor, msg.temperatureReports[index]);
- }
+ else
+ {
+ Duet3Ate::ProcessOrphanedSensorReport(src, sensor, msg.temperatureReports[index]);
+ }
# endif
- }
- ++index;
- }
- sensorsReported >>= 1;
- }
+ }
+
+ }
+ );
}
void Heat::ProcessRemoteHeatersReport(CanAddress src, const CanMessageHeatersStatus& msg) noexcept
{
- uint64_t heatersReported = msg.whichHeaters;
- size_t index = 0;
- for (unsigned int heaterNum = 0; heaterNum < 64 && heatersReported != 0; ++heaterNum)
- {
- if (((uint8_t)heatersReported & 1u) != 0)
- {
- if (index < ARRAY_SIZE(msg.reports))
- {
- const auto h = FindHeater(heaterNum);
- if (h.IsNotNull())
- {
- h->UpdateRemoteStatus(src, msg.reports[index]);
- }
- }
- ++index;
- }
- heatersReported >>= 1;
- }
+ Bitmap<uint64_t> heatersReported(msg.whichHeaters);
+ heatersReported.Iterate([this, src, msg](unsigned int heaterNum, unsigned int index)
+ {
+ if (index < ARRAY_SIZE(msg.reports))
+ {
+ const auto h = FindHeater(heaterNum);
+ if (h.IsNotNull())
+ {
+ h->UpdateRemoteStatus(src, msg.reports[index]);
+ }
+ }
+ }
+ );
}
#endif
diff --git a/src/Heating/LocalHeater.cpp b/src/Heating/LocalHeater.cpp
index 5cac4954..049d708d 100644
--- a/src/Heating/LocalHeater.cpp
+++ b/src/Heating/LocalHeater.cpp
@@ -841,14 +841,19 @@ void LocalHeater::CalculateModel(HeaterParameters& params) noexcept
"tOn %ld" PLUS_OR_MINUS "%ld, tOff %ld" PLUS_OR_MINUS "%ld,"
" dHigh %ld" PLUS_OR_MINUS "%ld, dLow %ld" PLUS_OR_MINUS "%ld,"
" R %.3f" PLUS_OR_MINUS "%.3f, C %.3f" PLUS_OR_MINUS "%.3f,"
- " V %.1f" PLUS_OR_MINUS "%.1f, cycles %u\n",
+#if HAS_VOLTAGE_MONITOR
+ " V %.1f" PLUS_OR_MINUS "%.1f,"
+#endif
+ " cycles %u\n",
lrintf(tOn.GetMean()), lrintf(tOn.GetDeviation()),
lrintf(tOff.GetMean()), lrintf(tOff.GetDeviation()),
lrintf(dHigh.GetMean()), lrintf(dHigh.GetDeviation()),
lrintf(dLow.GetMean()), lrintf(dLow.GetDeviation()),
(double)heatingRate.GetMean(), (double)heatingRate.GetDeviation(),
(double)coolingRate.GetMean(), (double)coolingRate.GetDeviation(),
+#if HAS_VOLTAGE_MONITOR
(double)tuningVoltage.GetMean(), (double)tuningVoltage.GetDeviation(),
+#endif
coolingRate.GetNumSamples()
);
}