Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MarlinKimbra
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
MarlinKimbra
Commits
a8e1e08b
Commit
a8e1e08b
authored
Jun 09, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update
parent
433d7898
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
185 additions
and
175 deletions
+185
-175
Configuration.h
MarlinKimbra/Configuration.h
+5
-6
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+22
-18
temperature.cpp
MarlinKimbra/temperature.cpp
+151
-147
temperature.h
MarlinKimbra/temperature.h
+7
-4
No files found.
MarlinKimbra/Configuration.h
View file @
a8e1e08b
...
...
@@ -215,10 +215,13 @@
//============================= PID Settings ================================
//===========================================================================
// PID Tuning Guide here: http://reprap.org/wiki/PID_Tuning
// Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP
#define BANG_MAX 255 // limits current to nozzle while in bang-bang mode; 255=full current
#define PID_MAX BANG_MAX // limits current to nozzle while PID is active (see PID_FUNCTIONAL_RANGE below); 255=full current
#define K1 0.95 // Smoothing factor within the PID
#define MAX_OVERSHOOT_PID_AUTOTUNE 20 // Max valor for overshoot autotune
// Comment the following line to disable PID and enable bang-bang.
#define PIDTEMP
#ifdef PIDTEMP
//#define PID_DEBUG // Sends debug data to the serial port.
//#define PID_OPENLOOP 1 // Puts PID in open loop. M104/M140 sets the output power from 0 to PID_MAX
...
...
@@ -227,16 +230,12 @@
// is more then PID_FUNCTIONAL_RANGE then the PID will be shut off and the heater will be set to min/max.
#define PID_FUNCTIONAL_RANGE 10 // degC
#define PID_INTEGRAL_DRIVE_MAX PID_MAX // Limit for the integral term
#define K1 0.95 // Smoothing factor within the PID
#define MAX_OVERSHOOT_PID_AUTOTUNE 20 // Max valor for overshoot autotune
// HotEnd{HE0,HE1,HE2,HE3}
#define DEFAULT_Kp {40, 40, 40, 40} // Kp for E0, E1, E2, E3
#define DEFAULT_Ki {07, 07, 07, 07} // Ki for E0, E1, E2, E3
#define DEFAULT_Kd {60, 60, 60, 60} // Kd for E0, E1, E2, E3
#endif // PIDTEMP
//===========================================================================
//===========================================================================
//============================= PID > Bed Temperature Control ===============
...
...
MarlinKimbra/Marlin_main.cpp
View file @
a8e1e08b
...
...
@@ -3204,10 +3204,10 @@ inline void gcode_G28() {
#ifdef ENABLE_AUTO_BED_LEVELING
void
out_of_range_error
(
const
char
*
edge
)
{
char
msg
[
40
]
;
sprintf_P
(
msg
,
PSTR
(
"?Probe %s position out of range.
\n
"
),
edge
);
ECHO_
V
(
msg
);
void
out_of_range_error
(
const
char
*
p_
edge
)
{
ECHO_M
(
"?Probe "
)
;
PS_PGM
(
p_
edge
);
ECHO_
EM
(
" position out of range."
);
}
/**
...
...
@@ -5123,18 +5123,20 @@ inline void gcode_M226() {
#endif // PREVENT_DANGEROUS_EXTRUDE
/**
#if defined(PIDTEMP) || defined(PIDTEMPBED)
/**
* M303: PID relay autotune
* S<temperature> sets the target temperature. (default target temperature = 150C)
* E<extruder> (-1 for the bed)
* C<cycles>
*/
inline
void
gcode_M303
()
{
inline
void
gcode_M303
()
{
int
e
=
code_seen
(
'E'
)
?
code_value_short
()
:
0
;
int
c
=
code_seen
(
'C'
)
?
code_value_short
()
:
5
;
float
temp
=
code_seen
(
'S'
)
?
code_value
()
:
(
e
<
0
?
70.0
:
150.0
);
PID_autotune
(
temp
,
e
,
c
);
}
}
#endif
#ifdef PIDTEMPBED
// M304: Set bed PID parameters P I and D
...
...
@@ -6425,8 +6427,10 @@ void process_next_command() {
gcode_M302
();
break
;
#endif // PREVENT_DANGEROUS_EXTRUDE
#if defined(PIDTEMP) || defined(PIDTEMPBED)
case
303
:
// M303 PID autotune
gcode_M303
();
break
;
#endif
#ifdef PIDTEMPBED
case
304
:
// M304
...
...
MarlinKimbra/temperature.cpp
View file @
a8e1e08b
...
...
@@ -184,7 +184,8 @@ static void updateTemperaturesFromRawValues();
//================================ Functions ================================
//===========================================================================
void
PID_autotune
(
float
temp
,
int
hotend
,
int
ncycles
)
{
#if defined(PIDTEMP) || defined(PIDTEMPBED)
void
PID_autotune
(
float
temp
,
int
hotend
,
int
ncycles
)
{
float
input
=
0.0
;
int
cycles
=
0
;
bool
heating
=
true
;
...
...
@@ -333,6 +334,7 @@ void PID_autotune(float temp, int hotend, int ncycles) {
}
if
(
cycles
>
ncycles
)
{
ECHO_LM
(
DB
,
MSG_PID_AUTOTUNE_FINISHED
);
#ifdef PIDTEMP
if
(
hotend
>=
0
)
{
PID_PARAM
(
Kp
,
hotend
)
=
Kp_temp
;
PID_PARAM
(
Ki
,
hotend
)
=
scalePID_i
(
Ki_temp
);
...
...
@@ -348,11 +350,13 @@ void PID_autotune(float temp, int hotend, int ncycles) {
ECHO_LMV
(
DB
,
"#define DEFAULT_bedKi "
,
unscalePID_i
(
Ki_temp
));
ECHO_LMV
(
DB
,
"#define DEFAULT_bedKd "
,
unscalePID_d
(
Kd_temp
));
}
#endif
return
;
}
lcd_update
();
}
}
}
#endif
void
updatePID
()
{
#ifdef PIDTEMP
...
...
@@ -1646,10 +1650,10 @@ ISR(TIMER0_COMPB_vect) {
#endif //BABYSTEPPING
}
#if
def PIDTEMP
#if
defined(PIDTEMP) || defined(PIDTEMPBED)
// Apply the scale factors to the PID values
float
scalePID_i
(
float
i
)
{
return
i
*
PID_dT
;
}
float
unscalePID_i
(
float
i
)
{
return
i
/
PID_dT
;
}
float
scalePID_d
(
float
d
)
{
return
d
/
PID_dT
;
}
float
unscalePID_d
(
float
d
)
{
return
d
*
PID_dT
;
}
#endif //
PIDTEMP
#endif //
defined(PIDTEMP) || defined(PIDTEMPBED)
MarlinKimbra/temperature.h
View file @
a8e1e08b
...
...
@@ -64,16 +64,19 @@ extern float current_temperature_bed;
#ifdef PIDTEMP
extern
float
Kp
[
HOTENDS
],
Ki
[
HOTENDS
],
Kd
[
HOTENDS
];
#define PID_PARAM(param, e) param[e] // use macro to point to array value
float
scalePID_i
(
float
i
);
float
scalePID_d
(
float
d
);
float
unscalePID_i
(
float
i
);
float
unscalePID_d
(
float
d
);
#endif
#ifdef PIDTEMPBED
extern
float
bedKp
,
bedKi
,
bedKd
;
#endif
#if defined(PIDTEMP) || defined(PIDTEMPBED)
float
scalePID_i
(
float
i
);
float
scalePID_d
(
float
d
);
float
unscalePID_i
(
float
i
);
float
unscalePID_d
(
float
d
);
#endif
#ifdef BABYSTEPPING
extern
volatile
int
babystepsTodo
[
3
];
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment