Temp: change TEMP_EWMA to integer.
This allows to use EWMA_ALPHA in an #if clause, which is needed
for the next commit.
Review changes by Traumflug: made changes to comments more
complete, added rounding ("+ 500") and also adjusted Configtool
for the change.
This commit is contained in:
parent
29cb2e801a
commit
66f06d20a2
|
|
@ -208,17 +208,18 @@
|
||||||
#define TEMP_RESIDENCY_TIME 60
|
#define TEMP_RESIDENCY_TIME 60
|
||||||
|
|
||||||
/** \def TEMP_EWMA
|
/** \def TEMP_EWMA
|
||||||
|
|
||||||
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
||||||
1.0 for unfiltered data (and a 140 bytes smaller binary).
|
1000 for unfiltered data (and a 140 bytes smaller binary).
|
||||||
|
|
||||||
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
||||||
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
|
50 to 100 are typical. Smaller is smoother but slower adjusting, larger is
|
||||||
quicker but rougher. If you need to use this, set the PID parameter to zero
|
quicker but rougher. If you need to use this, set the PID parameter to zero
|
||||||
(M132 S0) to make the PID loop insensitive to noise.
|
(M132 S0) to make the PID loop insensitive to noise.
|
||||||
|
|
||||||
Valid range: 0.001 to 1.0
|
Valid range: 1 to 1000
|
||||||
*/
|
*/
|
||||||
#define TEMP_EWMA 1.0
|
#define TEMP_EWMA 1000
|
||||||
|
|
||||||
/** \def REPORT_TARGET_TEMPS
|
/** \def REPORT_TARGET_TEMPS
|
||||||
With this enabled, M105 commands will return the current temperatures along
|
With this enabled, M105 commands will return the current temperatures along
|
||||||
|
|
|
||||||
|
|
@ -208,17 +208,18 @@
|
||||||
#define TEMP_RESIDENCY_TIME 60
|
#define TEMP_RESIDENCY_TIME 60
|
||||||
|
|
||||||
/** \def TEMP_EWMA
|
/** \def TEMP_EWMA
|
||||||
|
|
||||||
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
||||||
1.0 for unfiltered data (and a 140 bytes smaller binary).
|
1000 for unfiltered data (and a 140 bytes smaller binary).
|
||||||
|
|
||||||
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
||||||
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
|
50 to 100 are typical. Smaller is smoother but slower adjusting, larger is
|
||||||
quicker but rougher. If you need to use this, set the PID parameter to zero
|
quicker but rougher. If you need to use this, set the PID parameter to zero
|
||||||
(M132 S0) to make the PID loop insensitive to noise.
|
(M132 S0) to make the PID loop insensitive to noise.
|
||||||
|
|
||||||
Valid range: 0.001 to 1.0
|
Valid range: 1 to 1000
|
||||||
*/
|
*/
|
||||||
#define TEMP_EWMA 1.0
|
#define TEMP_EWMA 1000
|
||||||
|
|
||||||
/** \def REPORT_TARGET_TEMPS
|
/** \def REPORT_TARGET_TEMPS
|
||||||
With this enabled, M105 commands will return the current temperatures along
|
With this enabled, M105 commands will return the current temperatures along
|
||||||
|
|
|
||||||
|
|
@ -208,17 +208,18 @@
|
||||||
#define TEMP_RESIDENCY_TIME 60
|
#define TEMP_RESIDENCY_TIME 60
|
||||||
|
|
||||||
/** \def TEMP_EWMA
|
/** \def TEMP_EWMA
|
||||||
|
|
||||||
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
||||||
1.0 for unfiltered data (and a 140 bytes smaller binary).
|
1000 for unfiltered data (and a 140 bytes smaller binary).
|
||||||
|
|
||||||
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
||||||
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
|
50 to 100 are typical. Smaller is smoother but slower adjusting, larger is
|
||||||
quicker but rougher. If you need to use this, set the PID parameter to zero
|
quicker but rougher. If you need to use this, set the PID parameter to zero
|
||||||
(M132 S0) to make the PID loop insensitive to noise.
|
(M132 S0) to make the PID loop insensitive to noise.
|
||||||
|
|
||||||
Valid range: 0.001 to 1.0
|
Valid range: 1 to 1000
|
||||||
*/
|
*/
|
||||||
#define TEMP_EWMA 1.0
|
#define TEMP_EWMA 1000
|
||||||
|
|
||||||
/** \def REPORT_TARGET_TEMPS
|
/** \def REPORT_TARGET_TEMPS
|
||||||
With this enabled, M105 commands will return the current temperatures along
|
With this enabled, M105 commands will return the current temperatures along
|
||||||
|
|
|
||||||
|
|
@ -208,17 +208,18 @@
|
||||||
#define TEMP_RESIDENCY_TIME 60
|
#define TEMP_RESIDENCY_TIME 60
|
||||||
|
|
||||||
/** \def TEMP_EWMA
|
/** \def TEMP_EWMA
|
||||||
|
|
||||||
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
||||||
1.0 for unfiltered data (and a 140 bytes smaller binary).
|
1000 for unfiltered data (and a 140 bytes smaller binary).
|
||||||
|
|
||||||
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
||||||
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
|
50 to 100 are typical. Smaller is smoother but slower adjusting, larger is
|
||||||
quicker but rougher. If you need to use this, set the PID parameter to zero
|
quicker but rougher. If you need to use this, set the PID parameter to zero
|
||||||
(M132 S0) to make the PID loop insensitive to noise.
|
(M132 S0) to make the PID loop insensitive to noise.
|
||||||
|
|
||||||
Valid range: 0.001 to 1.0
|
Valid range: 1 to 1000
|
||||||
*/
|
*/
|
||||||
#define TEMP_EWMA 1.0
|
#define TEMP_EWMA 1000
|
||||||
|
|
||||||
/** \def REPORT_TARGET_TEMPS
|
/** \def REPORT_TARGET_TEMPS
|
||||||
With this enabled, M105 commands will return the current temperatures along
|
With this enabled, M105 commands will return the current temperatures along
|
||||||
|
|
|
||||||
|
|
@ -145,39 +145,12 @@ class MiscellaneousPage(wx.Panel, Page):
|
||||||
sz.Add(tc, pos = (7, 5))
|
sz.Add(tc, pos = (7, 5))
|
||||||
|
|
||||||
k = 'TEMP_EWMA'
|
k = 'TEMP_EWMA'
|
||||||
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlEWMA)
|
tc = self.addTextCtrl(k, labelWidth, self.onTextCtrlInteger)
|
||||||
sz.Add(tc, pos = (8, 5))
|
sz.Add(tc, pos = (8, 5))
|
||||||
|
|
||||||
self.SetSizer(sz)
|
self.SetSizer(sz)
|
||||||
self.enableAll(False)
|
self.enableAll(False)
|
||||||
|
|
||||||
def onTextCtrlEWMA(self, evt):
|
|
||||||
self.assertModified(True)
|
|
||||||
tc = evt.GetEventObject()
|
|
||||||
name = tc.GetName()
|
|
||||||
w = tc.GetValue().strip()
|
|
||||||
if w == "":
|
|
||||||
valid = True
|
|
||||||
else:
|
|
||||||
m = reFloat.match(w)
|
|
||||||
if m:
|
|
||||||
v = float(w)
|
|
||||||
if v < 0.1 or v > 1.0:
|
|
||||||
valid = False
|
|
||||||
else:
|
|
||||||
valid = True
|
|
||||||
else:
|
|
||||||
valid = False
|
|
||||||
|
|
||||||
self.setFieldValidity(name, valid)
|
|
||||||
|
|
||||||
if valid:
|
|
||||||
tc.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
|
|
||||||
else:
|
|
||||||
tc.SetBackgroundColour("pink")
|
|
||||||
tc.Refresh()
|
|
||||||
evt.Skip()
|
|
||||||
|
|
||||||
def setHeaters(self, hlist):
|
def setHeaters(self, hlist):
|
||||||
k = 'DC_EXTRUDER'
|
k = 'DC_EXTRUDER'
|
||||||
v = self.choices[k].GetSelection()
|
v = self.choices[k].GetSelection()
|
||||||
|
|
|
||||||
|
|
@ -208,17 +208,18 @@
|
||||||
#define TEMP_RESIDENCY_TIME 60
|
#define TEMP_RESIDENCY_TIME 60
|
||||||
|
|
||||||
/** \def TEMP_EWMA
|
/** \def TEMP_EWMA
|
||||||
|
|
||||||
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
||||||
1.0 for unfiltered data (and a 140 bytes smaller binary).
|
1000 for unfiltered data (and a 140 bytes smaller binary).
|
||||||
|
|
||||||
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
||||||
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
|
50 to 100 are typical. Smaller is smoother but slower adjusting, larger is
|
||||||
quicker but rougher. If you need to use this, set the PID parameter to zero
|
quicker but rougher. If you need to use this, set the PID parameter to zero
|
||||||
(M132 S0) to make the PID loop insensitive to noise.
|
(M132 S0) to make the PID loop insensitive to noise.
|
||||||
|
|
||||||
Valid range: 0.001 to 1.0
|
Valid range: 1 to 1000
|
||||||
*/
|
*/
|
||||||
#define TEMP_EWMA 1.0
|
#define TEMP_EWMA 1000
|
||||||
|
|
||||||
/** \def REPORT_TARGET_TEMPS
|
/** \def REPORT_TARGET_TEMPS
|
||||||
With this enabled, M105 commands will return the current temperatures along
|
With this enabled, M105 commands will return the current temperatures along
|
||||||
|
|
|
||||||
8
temp.c
8
temp.c
|
|
@ -86,16 +86,16 @@ static struct {
|
||||||
|
|
||||||
Default alpha constant for the Exponentially Weighted Moving Average (EWMA)
|
Default alpha constant for the Exponentially Weighted Moving Average (EWMA)
|
||||||
for smoothing noisy sensors. Instrument Engineer's Handbook, 4th ed,
|
for smoothing noisy sensors. Instrument Engineer's Handbook, 4th ed,
|
||||||
Vol 2 p126 says values of 0.05 to 0.1 are typical.
|
Vol 2 p126 says values of 50 to 100 are typical.
|
||||||
|
|
||||||
Setting it to 1.0 turns EWMA off.
|
This is scaled by factor 1000. Setting it to 1000 turns EWMA off.
|
||||||
*/
|
*/
|
||||||
#ifndef TEMP_EWMA
|
#ifndef TEMP_EWMA
|
||||||
#define TEMP_EWMA 1.0
|
#define TEMP_EWMA 1000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EWMA_SCALE 1024L
|
#define EWMA_SCALE 1024L
|
||||||
#define EWMA_ALPHA ((uint32_t)(TEMP_EWMA * EWMA_SCALE))
|
#define EWMA_ALPHA ((TEMP_EWMA * EWMA_SCALE + 500) / 1000)
|
||||||
|
|
||||||
// If EWMA is used, continuously update analog reading for more data points.
|
// If EWMA is used, continuously update analog reading for more data points.
|
||||||
#define TEMP_READ_CONTINUOUS (EWMA_ALPHA < EWMA_SCALE)
|
#define TEMP_READ_CONTINUOUS (EWMA_ALPHA < EWMA_SCALE)
|
||||||
|
|
|
||||||
|
|
@ -405,18 +405,18 @@
|
||||||
*/
|
*/
|
||||||
#define TEMP_RESIDENCY_TIME 60
|
#define TEMP_RESIDENCY_TIME 60
|
||||||
|
|
||||||
/**
|
/** \def TEMP_EWMA
|
||||||
TEMP_EWMA: Smooth noisy temperature sensors. Good hardware shouldn't be
|
Smooth noisy temperature sensors. Good hardware shouldn't be noisy. Set to
|
||||||
noisy. Set to 1.0 for unfiltered data (and a 140 bytes smaller binary).
|
1000 for unfiltered data (and a 140 bytes smaller binary).
|
||||||
|
|
||||||
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
Instrument Engineer's Handbook, 4th ed, Vol 2 p126 says values of
|
||||||
0.05 to 0.1 are typical. Smaller is smoother but slower adjusting, larger is
|
50 to 100 are typical. Smaller is smoother but slower adjusting, larger is
|
||||||
quicker but rougher. If you need to use this, set the PID parameter to zero
|
quicker but rougher. If you need to use this, set the PID parameter to zero
|
||||||
(M132 S0) to make the PID loop insensitive to noise.
|
(M132 S0) to make the PID loop insensitive to noise.
|
||||||
|
|
||||||
Valid range: 0.001 to 1.0
|
Valid range: 1 to 1000
|
||||||
*/
|
*/
|
||||||
#define TEMP_EWMA 1.0
|
#define TEMP_EWMA 1000
|
||||||
|
|
||||||
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
|
/** \def TEMP_MAX6675 TEMP_THERMISTOR TEMP_AD595 TEMP_PT100 TEMP_INTERCOM
|
||||||
\def TEMP_MCP3008
|
\def TEMP_MCP3008
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue