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>2017-12-09 00:01:56 +0300
committerDavid Crocker <dcrocker@eschertech.com>2017-12-09 00:02:49 +0300
commit6b67f92a5712b470d0369db86314f9111cc6842c (patch)
tree0892515dcfbe2a5e440e835ee9faeff240c08730 /src/Heating
parentd0335c60392e372d0f079ea569d126ba2b773eee (diff)
Version 1.20RC1
New features: M109 and M104 commands now set both the active and the standby temperatures of the tool. M109 now only selects a tool if no tool was selected Filament errors are now logged M587 now checks that the password is either empty or is at least 8 characters long M122 now includes the minimum and maximum StallGuard registers for each driver seen since the last M122 command M307 now accepts an F parameter to allow the PWM frequency to be set. Caution: do not use excessively high PWM frequencies, especially with the bed heater, because you may overheat the mosfets. The calculation of PID parameters from the heater model has been changed to provide faster heating and less risk of undershoot The M81 command now accepts an optional S1 parameter, which defers the power down until al thermostatic fans have stopped SD card detection is now working properly (Duet WiFi/Ethernet only) A file that is open on the SD card can no longer be deleted Bug fixes: M109 commands could cause unwanted head movement when no tool change was required If a filament error occurred more than one, the print would be paused each time but a message box would only be displayed the first time If a new request arrived but no responder was available, there was no timeout waiting for a responder (thanks chrishamm) Z probe types 5 and 8 didn't work on Duet 085 M500 didn't save axis lengths found by G1 S3
Diffstat (limited to 'src/Heating')
-rw-r--r--src/Heating/FOPDT.cpp8
-rw-r--r--src/Heating/FOPDT.h4
-rw-r--r--src/Heating/Heat.cpp4
-rw-r--r--src/Heating/Heat.h6
-rw-r--r--src/Heating/Pid.cpp10
-rw-r--r--src/Heating/Pid.h2
-rw-r--r--src/Heating/Sensors/DhtSensor.cpp2
7 files changed, 19 insertions, 17 deletions
diff --git a/src/Heating/FOPDT.cpp b/src/Heating/FOPDT.cpp
index 31b67514..3c990502 100644
--- a/src/Heating/FOPDT.cpp
+++ b/src/Heating/FOPDT.cpp
@@ -14,13 +14,13 @@ extern StringRef scratchString;
// Heater 6 on the Duet 0.8.5 is disabled by default at startup so that we can use fan 2.
// Set up sensible defaults here in case the user enables the heater without specifying values for all the parameters.
FopDt::FopDt()
- : gain(DefaultHotEndHeaterGain), timeConstant(DefaultHotEndHeaterTimeConstant), deadTime(DefaultHotEndHeaterDeadTime), maxPwm(1.0), standardVoltage(0.0),
+ : gain(DefaultHotEndHeaterGain), timeConstant(DefaultHotEndHeaterTimeConstant), deadTime(DefaultHotEndHeaterDeadTime), maxPwm(1.0), standardVoltage(0.0), pwmFreq(0),
enabled(false), usePid(true), inverted(false), pidParametersOverridden(false)
{
}
// Check the model parameters are sensible, if they are then save them and return true.
-bool FopDt::SetParameters(float pg, float ptc, float pdt, float pMaxPwm, float temperatureLimit, float pVoltage, bool pUsePid, bool pInverted)
+bool FopDt::SetParameters(float pg, float ptc, float pdt, float pMaxPwm, float temperatureLimit, float pVoltage, bool pUsePid, bool pInverted, PwmFrequency pPwmFreq)
{
if (pg == -1.0 && ptc == -1.0 && pdt == -1.0)
{
@@ -41,6 +41,7 @@ bool FopDt::SetParameters(float pg, float ptc, float pdt, float pMaxPwm, float t
usePid = pUsePid;
inverted = pInverted;
enabled = true;
+ pwmFreq = pPwmFreq;
CalcPidConstants();
return true;
}
@@ -117,12 +118,11 @@ void FopDt::CalcPidConstants()
{
const float timeFrac = deadTime/timeConstant;
loadChangeParams.kP = 0.7/(gain * timeFrac);
-// loadChangeParams.recipTi = 1.0/(deadTime * 2.0); // Ti = 2 * deadTime (this is what we used in version 1.15c)
loadChangeParams.recipTi = (1.0/1.14)/(powf(timeConstant, 0.25) * powf(deadTime, 0.75)); // Ti = 1.14 * timeConstant^0.25 * deadTime^0.75 (Ho et al)
loadChangeParams.tD = deadTime * 0.7;
setpointChangeParams.kP = 0.7/(gain * timeFrac);
- setpointChangeParams.recipTi = 1.0/timeConstant; // Ti = time constant
+ setpointChangeParams.recipTi = 1.0/(powf(timeConstant, 0.5) * powf(deadTime, 0.5)); // Ti = timeConstant^0.5 * deadTime^0.5
setpointChangeParams.tD = deadTime * 0.7;
pidParametersOverridden = false;
diff --git a/src/Heating/FOPDT.h b/src/Heating/FOPDT.h
index e0e8fcc0..adb6e136 100644
--- a/src/Heating/FOPDT.h
+++ b/src/Heating/FOPDT.h
@@ -35,7 +35,7 @@ class FopDt
public:
FopDt();
- bool SetParameters(float pg, float ptc, float pdt, float pMaxPwm, float temperatureLimit, float pVoltage, bool pUsePid, bool pInverted);
+ bool SetParameters(float pg, float ptc, float pdt, float pMaxPwm, float temperatureLimit, float pVoltage, bool pUsePid, bool pInverted, uint16_t pPwmFreq);
float GetGain() const { return gain; }
float GetTimeConstant() const { return timeConstant; }
@@ -45,6 +45,7 @@ public:
bool UsePid() const { return usePid; }
bool IsInverted() const { return inverted; }
bool IsEnabled() const { return enabled; }
+ uint16_t GetPwmFrequency() const { return pwmFreq; }
bool ArePidParametersOverridden() const { return pidParametersOverridden; }
M301PidParameters GetM301PidParameters(bool forLoadChange) const;
void SetM301PidParameters(const M301PidParameters& params);
@@ -64,6 +65,7 @@ private:
float deadTime;
float maxPwm;
float standardVoltage; // power voltage reading at which tuning was done, or 0 if unknown
+ PwmFrequency pwmFreq;
bool enabled;
bool usePid;
bool inverted;
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp
index 3ae3c085..b1a514c5 100644
--- a/src/Heating/Heat.cpp
+++ b/src/Heating/Heat.cpp
@@ -55,11 +55,11 @@ void Heat::ResetHeaterModels()
{
if (IsBedHeater(heater) || IsChamberHeater(heater))
{
- pids[heater]->SetModel(DefaultBedHeaterGain, DefaultBedHeaterTimeConstant, DefaultBedHeaterDeadTime, 1.0, 0.0, false, false);
+ pids[heater]->SetModel(DefaultBedHeaterGain, DefaultBedHeaterTimeConstant, DefaultBedHeaterDeadTime, 1.0, 0.0, false, false, 0);
}
else
{
- pids[heater]->SetModel(DefaultHotEndHeaterGain, DefaultHotEndHeaterTimeConstant, DefaultHotEndHeaterDeadTime, 1.0, 0.0, true, false);
+ pids[heater]->SetModel(DefaultHotEndHeaterGain, DefaultHotEndHeaterTimeConstant, DefaultHotEndHeaterDeadTime, 1.0, 0.0, true, false, 0);
}
}
}
diff --git a/src/Heating/Heat.h b/src/Heating/Heat.h
index 05141107..95485ff3 100644
--- a/src/Heating/Heat.h
+++ b/src/Heating/Heat.h
@@ -97,7 +97,7 @@ public:
const FopDt& GetHeaterModel(size_t heater) const // Get the process model for the specified heater
pre(heater < Heaters);
- bool SetHeaterModel(size_t heater, float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted) // Set the heater process model
+ bool SetHeaterModel(size_t heater, float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted, PwmFrequency pwmFreq) // Set the heater process model
pre(heater < Heaters);
bool IsHeaterSignalInverted(size_t heater) // Set PWM signal inversion
@@ -203,9 +203,9 @@ inline const FopDt& Heat::GetHeaterModel(size_t heater) const
}
// Set the heater process model
-inline bool Heat::SetHeaterModel(size_t heater, float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted)
+inline bool Heat::SetHeaterModel(size_t heater, float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted, PwmFrequency pwmFreq)
{
- return pids[heater]->SetModel(gain, tc, td, maxPwm, voltage, usePid, inverted);
+ return pids[heater]->SetModel(gain, tc, td, maxPwm, voltage, usePid, inverted, pwmFreq);
}
inline bool Heat::IsHeaterSignalInverted(size_t heater)
diff --git a/src/Heating/Pid.cpp b/src/Heating/Pid.cpp
index ba53e4dc..41ec78d0 100644
--- a/src/Heating/Pid.cpp
+++ b/src/Heating/Pid.cpp
@@ -45,14 +45,14 @@ PID::PID(Platform& p, int8_t h) : platform(p), heater(h), mode(HeaterMode::off),
inline void PID::SetHeater(float power) const
{
- platform.SetHeater(heater, invertPwmSignal ? (1.0 - power) : power);
+ platform.SetHeater(heater, invertPwmSignal ? (1.0 - power) : power, model.GetPwmFrequency());
}
void PID::Init(float pGain, float pTc, float pTd, bool usePid, bool inverted)
{
maxTempExcursion = DefaultMaxTempExcursion;
maxHeatingFaultTime = DefaultMaxHeatingFaultTime;
- model.SetParameters(pGain, pTc, pTd, 1.0, GetHighestTemperatureLimit(), 0.0, usePid, inverted);
+ model.SetParameters(pGain, pTc, pTd, 1.0, GetHighestTemperatureLimit(), 0.0, usePid, inverted, 0);
Reset();
if (model.IsEnabled())
@@ -85,10 +85,10 @@ void PID::Reset()
}
// Set the process model
-bool PID::SetModel(float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted)
+bool PID::SetModel(float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted, PwmFrequency pwmFreq)
{
const float temperatureLimit = GetHighestTemperatureLimit();
- const bool rslt = model.SetParameters(gain, tc, td, maxPwm, temperatureLimit, voltage, usePid, inverted);
+ const bool rslt = model.SetParameters(gain, tc, td, maxPwm, temperatureLimit, voltage, usePid, inverted, pwmFreq);
if (rslt)
{
#if defined(DUET_06_085)
@@ -935,7 +935,7 @@ void PID::CalculateModel()
#else
0.0,
#endif
- true, false);
+ true, false, model.GetPwmFrequency());
if (tuned)
{
platform.MessageF(LoggedGenericMessage,
diff --git a/src/Heating/Pid.h b/src/Heating/Pid.h
index 84845c41..b59fb422 100644
--- a/src/Heating/Pid.h
+++ b/src/Heating/Pid.h
@@ -70,7 +70,7 @@ public:
const FopDt& GetModel() const // Get the process model
{ return model; }
- bool SetModel(float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted); // Set the process model
+ bool SetModel(float gain, float tc, float td, float maxPwm, float voltage, bool usePid, bool inverted, PwmFrequency pwmFreq); // Set the process model
bool IsHeaterSignalInverted() const // Is the PWM output signal inverted?
{ return invertPwmSignal; }
diff --git a/src/Heating/Sensors/DhtSensor.cpp b/src/Heating/Sensors/DhtSensor.cpp
index 868f22d8..60be36e4 100644
--- a/src/Heating/Sensors/DhtSensor.cpp
+++ b/src/Heating/Sensors/DhtSensor.cpp
@@ -124,7 +124,7 @@ uint32_t lastPulseTime;
volatile uint8_t numPulses;
uint32_t pulses[41]; // 1 start bit + 40 data bits
-void DhtDataTransition(void *param)
+void DhtDataTransition(CallbackParameter)
{
const uint32_t now = micros();
if (digitalRead(DhtDataPin) == HIGH)