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>2021-05-29 12:41:09 +0300
committerDavid Crocker <dcrocker@eschertech.com>2021-05-29 12:41:09 +0300
commitff782fe72421808074ce639398c3b93297f4822a (patch)
tree56b235914ad0cf8b80b4823769008d23dc352e39 /src/Heating
parentb249347bf4fc75cb8cedc6317ae5fe936169b057 (diff)
Report heater averagre PWM in object model instead of lastPwm
Diffstat (limited to 'src/Heating')
-rw-r--r--src/Heating/Heater.cpp4
-rw-r--r--src/Heating/Heater.h1
-rw-r--r--src/Heating/LocalHeater.h1
3 files changed, 3 insertions, 3 deletions
diff --git a/src/Heating/Heater.cpp b/src/Heating/Heater.cpp
index 3ef410da..57176698 100644
--- a/src/Heating/Heater.cpp
+++ b/src/Heating/Heater.cpp
@@ -38,12 +38,12 @@ constexpr ObjectModelTableEntry Heater::objectModelTable[] =
// Within each group, these entries must be in alphabetical order
// 0. Heater members
{ "active", OBJECT_MODEL_FUNC(self->GetActiveTemperature(), 1), ObjectModelEntryFlags::live },
+ { "avgPwm", OBJECT_MODEL_FUNC(self->GetAveragePWM(), 2), ObjectModelEntryFlags::live },
{ "current", OBJECT_MODEL_FUNC(self->GetTemperature(), 1), ObjectModelEntryFlags::live },
{ "max", OBJECT_MODEL_FUNC(self->GetHighestTemperatureLimit(), 1), ObjectModelEntryFlags::none },
{ "min", OBJECT_MODEL_FUNC(self->GetLowestTemperatureLimit(), 1), ObjectModelEntryFlags::none },
{ "model", OBJECT_MODEL_FUNC((const FopDt *)&self->GetModel()), ObjectModelEntryFlags::verbose },
{ "monitors", OBJECT_MODEL_FUNC_NOSELF(&monitorsArrayDescriptor), ObjectModelEntryFlags::none },
- { "pwm", OBJECT_MODEL_FUNC(self->lastPwm, 1), ObjectModelEntryFlags::live },
{ "sensor", OBJECT_MODEL_FUNC((int32_t)self->GetSensorNumber()), ObjectModelEntryFlags::none },
{ "standby", OBJECT_MODEL_FUNC(self->GetStandbyTemperature(), 1), ObjectModelEntryFlags::live },
{ "state", OBJECT_MODEL_FUNC(self->GetStatus().ToString()), ObjectModelEntryFlags::live },
@@ -104,7 +104,7 @@ Heater::HeaterParameters Heater::fanOffParams, Heater::fanOnParams;
}
Heater::Heater(unsigned int num) noexcept
- : lastPwm(0.0), tuned(false), heaterNumber(num), sensorNumber(-1), activeTemperature(0.0), standbyTemperature(0.0),
+ : tuned(false), heaterNumber(num), sensorNumber(-1), activeTemperature(0.0), standbyTemperature(0.0),
maxTempExcursion(DefaultMaxTempExcursion), maxHeatingFaultTime(DefaultMaxHeatingFaultTime),
active(false), modelSetByUser(false), monitorsSetByUser(false)
{
diff --git a/src/Heating/Heater.h b/src/Heating/Heater.h
index 25796a65..c5b088b7 100644
--- a/src/Heating/Heater.h
+++ b/src/Heating/Heater.h
@@ -139,7 +139,6 @@ protected:
void SetAndReportModel(bool usingFans) noexcept;
HeaterMonitor monitors[MaxMonitorsPerHeater]; // embedding them in the Heater uses less memory than dynamic allocation
- float lastPwm; // the last PWM value set for this heater
bool tuned; // true if tuning was successful
// Constants used during heater tuning
diff --git a/src/Heating/LocalHeater.h b/src/Heating/LocalHeater.h
index 8fe8dff9..2015eb6e 100644
--- a/src/Heating/LocalHeater.h
+++ b/src/Heating/LocalHeater.h
@@ -66,6 +66,7 @@ private:
float previousTemperatures[NumPreviousTemperatures]; // The temperatures of the previous NumDerivativeSamples measurements, used for calculating the derivative
size_t previousTemperatureIndex; // Which slot in previousTemperature we fill in next
float iAccumulator; // The integral LocalHeater component
+ float lastPwm; // The last PWM value set for this heater
float averagePWM; // The running average of the PWM, after scaling.
uint32_t timeSetHeating; // When we turned on the heater
uint32_t lastSampleTime; // Time when the temperature was last sampled by Spin()