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
ee5b01a0
Commit
ee5b01a0
authored
Feb 27, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear text in temperature.cpp
parent
d49d0cfe
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
446 additions
and
339 deletions
+446
-339
language.h
MarlinKimbra/language.h
+36
-0
language_an.h
MarlinKimbra/language_an.h
+21
-14
language_ca.h
MarlinKimbra/language_ca.h
+21
-14
language_de.h
MarlinKimbra/language_de.h
+7
-0
language_en.h
MarlinKimbra/language_en.h
+7
-0
language_es.h
MarlinKimbra/language_es.h
+7
-0
language_eu.h
MarlinKimbra/language_eu.h
+7
-0
language_fi.h
MarlinKimbra/language_fi.h
+7
-0
language_fr.h
MarlinKimbra/language_fr.h
+7
-0
language_it.h
MarlinKimbra/language_it.h
+7
-0
language_nl.h
MarlinKimbra/language_nl.h
+7
-0
language_pl.h
MarlinKimbra/language_pl.h
+7
-0
language_pt-br.h
MarlinKimbra/language_pt-br.h
+7
-0
language_pt.h
MarlinKimbra/language_pt.h
+7
-0
language_ru.h
MarlinKimbra/language_ru.h
+7
-0
temperature.cpp
MarlinKimbra/temperature.cpp
+284
-311
No files found.
MarlinKimbra/language.h
View file @
ee5b01a0
...
@@ -149,6 +149,42 @@
...
@@ -149,6 +149,42 @@
#define MSG_ERR_EEPROM_WRITE "Error writing to EEPROM!"
#define MSG_ERR_EEPROM_WRITE "Error writing to EEPROM!"
#define MSG_PID_AUTOTUNE "PID Autotune"
#define MSG_PID_AUTOTUNE_START MSG_PID_AUTOTUNE " start"
#define MSG_PID_AUTOTUNE_FAILED MSG_PID_AUTOTUNE " failed!"
#define MSG_PID_BAD_EXTRUDER_NUM MSG_PID_AUTOTUNE_FAILED " Bad extruder number"
#define MSG_PID_TEMP_TOO_HIGH MSG_PID_AUTOTUNE_FAILED " Temperature too high"
#define MSG_PID_TIMEOUT MSG_PID_AUTOTUNE_FAILED " timeout"
#define MSG_BIAS " bias: "
#define MSG_D " d: "
#define MSG_MIN " min: "
#define MSG_MAX " max: "
#define MSG_KU " Ku: "
#define MSG_TU " Tu: "
#define MSG_CLASSIC_PID " Classic PID "
#define MSG_KP " Kp: "
#define MSG_KI " Ki: "
#define MSG_KD " Kd: "
#define MSG_OK_B "ok B:"
#define MSG_OK_T "ok T:"
#define MSG_AT " @:"
#define MSG_PID_AUTOTUNE_FINISHED MSG_PID_AUTOTUNE " finished! Put the last Kp, Ki and Kd constants from above into Configuration.h"
#define MSG_PID_DEBUG " PID_DEBUG "
#define MSG_PID_DEBUG_INPUT ": Input "
#define MSG_PID_DEBUG_OUTPUT " Output "
#define MSG_PID_DEBUG_PTERM " pTerm "
#define MSG_PID_DEBUG_ITERM " iTerm "
#define MSG_PID_DEBUG_DTERM " dTerm "
#define MSG_HEATING_FAILED "Heating failed"
#define MSG_EXTRUDER_SWITCHED_OFF "Extruder switched off. Temperature difference between temp sensors is too high !"
#define MSG_INVALID_EXTRUDER_NUM " - Invalid extruder number !"
#define MSG_THERMAL_RUNAWAY_STOP "Thermal Runaway, system stopped! Heater_ID: "
#define MSG_SWITCHED_OFF_MAX " switched off. MAXTEMP triggered !!"
#define MSG_MINTEMP_EXTRUDER_OFF ": Extruder switched off. MINTEMP triggered !"
#define MSG_MAXTEMP_EXTRUDER_OFF ": Extruder" MSG_SWITCHED_OFF_MAX
#define MSG_MAXTEMP_BED_OFF "Heated bed" MSG_SWITCHED_OFF_MAX
// Add your own character. Reference: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf page 17-18
// Add your own character. Reference: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf page 17-18
#ifdef DOGLCD
#ifdef DOGLCD
#define STR_Ae "\304" // 'Ä' U8glib
#define STR_Ae "\304" // 'Ä' U8glib
...
...
MarlinKimbra/language_an.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_ca.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_de.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_en.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_es.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_eu.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop deuseztat"
#define MSG_ENDSTOP_ABORT "Endstop deuseztat"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_fi.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Kalibrointi"
#define MSG_DELTA_CALIBRATE "Delta Kalibrointi"
#define MSG_DELTA_CALIBRATE_X "Kalibroi X"
#define MSG_DELTA_CALIBRATE_X "Kalibroi X"
...
...
MarlinKimbra/language_fr.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Butee abandon"
#define MSG_ENDSTOP_ABORT "Butee abandon"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_it.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Finecorsa abort"
#define MSG_ENDSTOP_ABORT "Finecorsa abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Calibraz. Delta"
#define MSG_DELTA_CALIBRATE "Calibraz. Delta"
#define MSG_DELTA_CALIBRATE_X "Calibra X"
#define MSG_DELTA_CALIBRATE_X "Calibra X"
...
...
MarlinKimbra/language_nl.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystap Z"
#define MSG_BABYSTEP_Z "Babystap Z"
#define MSG_ENDSTOP_ABORT "Endstop afbr."
#define MSG_ENDSTOP_ABORT "Endstop afbr."
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_pl.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Blad wyl. kranc."
#define MSG_ENDSTOP_ABORT "Blad wyl. kranc."
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_pt-br.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_pt.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/language_ru.h
View file @
ee5b01a0
...
@@ -122,6 +122,13 @@
...
@@ -122,6 +122,13 @@
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_BABYSTEP_Z "Babystep Z"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_ENDSTOP_ABORT "Endstop abort"
#define MSG_HEATING_FAILED_LCD "Heating failed"
#define MSG_ERR_REDUNDANT_TEMP "Err: REDUNDANT TEMP ERROR"
#define MSG_THERMAL_RUNAWAY "THERMAL RUNAWAY"
#define MSG_ERR_MAXTEMP "Err: MAXTEMP"
#define MSG_ERR_MINTEMP "Err: MINTEMP"
#define MSG_ERR_MAXTEMP_BED "Err: MAXTEMP BED"
#ifdef DELTA
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE "Delta Calibration"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
#define MSG_DELTA_CALIBRATE_X "Calibrate X"
...
...
MarlinKimbra/temperature.cpp
View file @
ee5b01a0
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
#include "temperature.h"
#include "temperature.h"
#include "watchdog.h"
#include "watchdog.h"
#include "thermistortables.h"
#include "thermistortables.h"
#include "language.h"
#include "Sd2PinMap.h"
#include "Sd2PinMap.h"
...
@@ -55,7 +56,7 @@
...
@@ -55,7 +56,7 @@
#else
#else
int
current_temperature_raw
[
1
]
=
{
0
};
int
current_temperature_raw
[
1
]
=
{
0
};
float
current_temperature
[
1
]
=
{
0.0
};
float
current_temperature
[
1
]
=
{
0.0
};
int
target_temperature
[
1
]
=
{
0
};
int
target_temperature
[
1
]
=
{
0
};
#endif //SINGLENOZZLE
#endif //SINGLENOZZLE
int
target_temperature_bed
=
0
;
int
target_temperature_bed
=
0
;
int
current_temperature_bed_raw
=
0
;
int
current_temperature_bed_raw
=
0
;
...
@@ -85,7 +86,7 @@ float current_temperature_bed = 0.0;
...
@@ -85,7 +86,7 @@ float current_temperature_bed = 0.0;
unsigned
char
soft_pwm_bed
;
unsigned
char
soft_pwm_bed
;
#ifdef BABYSTEPPING
#ifdef BABYSTEPPING
volatile
int
babystepsTodo
[
3
]
=
{
0
,
0
,
0
};
volatile
int
babystepsTodo
[
3
]
=
{
0
};
#endif
#endif
#ifdef FILAMENT_SENSOR
#ifdef FILAMENT_SENSOR
...
@@ -156,18 +157,18 @@ static volatile bool temp_meas_ready = false;
...
@@ -156,18 +157,18 @@ static volatile bool temp_meas_ready = false;
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
#if EXTRUDERS > 4
#if EXTRUDERS > 4
#
error Unsupported number of extruders
#error Unsupported number of extruders
#elif EXTRUDERS > 3
#elif EXTRUDERS > 3
#
define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3, v4 }
#elif EXTRUDERS > 2
#elif EXTRUDERS > 2
#
define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2, v3 }
#elif EXTRUDERS > 1
#elif EXTRUDERS > 1
#
define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1, v2 }
#else
#else
#
define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
#endif
#endif
#else
#else
#
define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
#define ARRAY_BY_EXTRUDERS(v1, v2, v3, v4) { v1 }
#endif
#endif
// Init min and max temp with extreme values to prevent false errors during startup
// Init min and max temp with extreme values to prevent false errors during startup
...
@@ -227,15 +228,14 @@ static void updateTemperaturesFromRawValues();
...
@@ -227,15 +228,14 @@ static void updateTemperaturesFromRawValues();
//============================= functions ============================
//============================= functions ============================
//===========================================================================
//===========================================================================
void
PID_autotune
(
float
temp
,
int
extruder
,
int
ncycles
)
void
PID_autotune
(
float
temp
,
int
extruder
,
int
ncycles
)
{
{
float
input
=
0.0
;
float
input
=
0.0
;
int
cycles
=
0
;
int
cycles
=
0
;
bool
heating
=
true
;
bool
heating
=
true
;
unsigned
long
temp_millis
=
millis
();
unsigned
long
temp_millis
=
millis
();
unsigned
long
t1
=
temp_millis
;
unsigned
long
t1
=
temp_millis
;
unsigned
long
t2
=
temp_millis
;
unsigned
long
t2
=
temp_millis
;
long
t_high
=
0
;
long
t_high
=
0
;
long
t_low
=
0
;
long
t_low
=
0
;
...
@@ -257,15 +257,15 @@ void PID_autotune(float temp, int extruder, int ncycles)
...
@@ -257,15 +257,15 @@ void PID_autotune(float temp, int extruder, int ncycles)
if
(
extruder
>=
EXTRUDERS
)
if
(
extruder
>=
EXTRUDERS
)
#endif
#endif
{
{
SERIAL_ECHOLN
(
"PID Autotune failed. Bad extruder number."
);
SERIAL_ECHOLN
(
MSG_PID_BAD_EXTRUDER_NUM
);
return
;
return
;
}
}
SERIAL_ECHOLN
(
"PID Autotune start"
);
SERIAL_ECHOLN
(
MSG_PID_AUTOTUNE_START
);
disable_heater
();
// switch off all heaters.
disable_heater
();
// switch off all heaters.
if
(
extruder
<
0
)
if
(
extruder
<
0
)
{
{
soft_pwm_bed
=
(
MAX_BED_POWER
)
/
2
;
soft_pwm_bed
=
(
MAX_BED_POWER
)
/
2
;
bias
=
d
=
(
MAX_BED_POWER
)
/
2
;
bias
=
d
=
(
MAX_BED_POWER
)
/
2
;
...
@@ -283,8 +283,8 @@ void PID_autotune(float temp, int extruder, int ncycles)
...
@@ -283,8 +283,8 @@ void PID_autotune(float temp, int extruder, int ncycles)
input
=
(
extruder
<
0
)
?
current_temperature_bed
:
current_temperature
[
extruder
];
input
=
(
extruder
<
0
)
?
current_temperature_bed
:
current_temperature
[
extruder
];
max
=
max
(
max
,
input
);
max
=
max
(
max
,
input
);
min
=
min
(
min
,
input
);
min
=
min
(
min
,
input
);
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
#if (defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1) || \
...
@@ -319,37 +319,37 @@ void PID_autotune(float temp, int extruder, int ncycles)
...
@@ -319,37 +319,37 @@ void PID_autotune(float temp, int extruder, int ncycles)
if
(
bias
>
(
extruder
<
0
?
(
MAX_BED_POWER
)
:
(
PID_MAX
))
/
2
)
d
=
(
extruder
<
0
?
(
MAX_BED_POWER
)
:
(
PID_MAX
))
-
1
-
bias
;
if
(
bias
>
(
extruder
<
0
?
(
MAX_BED_POWER
)
:
(
PID_MAX
))
/
2
)
d
=
(
extruder
<
0
?
(
MAX_BED_POWER
)
:
(
PID_MAX
))
-
1
-
bias
;
else
d
=
bias
;
else
d
=
bias
;
SERIAL_PROTOCOLPGM
(
" bias: "
);
SERIAL_PROTOCOL
(
bias
);
SERIAL_PROTOCOLPGM
(
MSG_BIAS
);
SERIAL_PROTOCOL
(
bias
);
SERIAL_PROTOCOLPGM
(
" d: "
);
SERIAL_PROTOCOL
(
d
);
SERIAL_PROTOCOLPGM
(
MSG_D
);
SERIAL_PROTOCOL
(
d
);
SERIAL_PROTOCOLPGM
(
" min: "
);
SERIAL_PROTOCOL
(
min
);
SERIAL_PROTOCOLPGM
(
MSG_MIN
);
SERIAL_PROTOCOL
(
min
);
SERIAL_PROTOCOLPGM
(
" max: "
);
SERIAL_PROTOCOLLN
(
max
);
SERIAL_PROTOCOLPGM
(
MSG_MAX
);
SERIAL_PROTOCOLLN
(
max
);
if
(
cycles
>
2
)
{
if
(
cycles
>
2
)
{
Ku
=
(
4.0
*
d
)
/
(
3.14159
*
(
max
-
min
)
/
2.0
);
Ku
=
(
4.0
*
d
)
/
(
3.14159
*
(
max
-
min
)
/
2.0
);
Tu
=
((
float
)(
t_low
+
t_high
)
/
1000.0
);
Tu
=
((
float
)(
t_low
+
t_high
)
/
1000.0
);
SERIAL_PROTOCOLPGM
(
" Ku: "
);
SERIAL_PROTOCOL
(
Ku
);
SERIAL_PROTOCOLPGM
(
MSG_KU
);
SERIAL_PROTOCOL
(
Ku
);
SERIAL_PROTOCOLPGM
(
" Tu: "
);
SERIAL_PROTOCOLLN
(
Tu
);
SERIAL_PROTOCOLPGM
(
MSG_TU
);
SERIAL_PROTOCOLLN
(
Tu
);
Kp
=
0.6
*
Ku
;
Kp
=
0.6
*
Ku
;
Ki
=
2
*
Kp
/
Tu
;
Ki
=
2
*
Kp
/
Tu
;
Kd
=
Kp
*
Tu
/
8
;
Kd
=
Kp
*
Tu
/
8
;
SERIAL_PROTOCOLLNPGM
(
" Classic PID "
);
SERIAL_PROTOCOLLNPGM
(
MSG_CLASSIC_PID
);
SERIAL_PROTOCOLPGM
(
" Kp: "
);
SERIAL_PROTOCOLLN
(
Kp
);
SERIAL_PROTOCOLPGM
(
MSG_KP
);
SERIAL_PROTOCOLLN
(
Kp
);
SERIAL_PROTOCOLPGM
(
" Ki: "
);
SERIAL_PROTOCOLLN
(
Ki
);
SERIAL_PROTOCOLPGM
(
MSG_KI
);
SERIAL_PROTOCOLLN
(
Ki
);
SERIAL_PROTOCOLPGM
(
" Kd: "
);
SERIAL_PROTOCOLLN
(
Kd
);
SERIAL_PROTOCOLPGM
(
MSG_KD
);
SERIAL_PROTOCOLLN
(
Kd
);
/*
/*
Kp = 0.33*Ku;
Kp = 0.33*Ku;
Ki = Kp/Tu;
Ki = Kp/Tu;
Kd = Kp*Tu/3;
Kd = Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" Some overshoot ");
SERIAL_PROTOCOLLNPGM(" Some overshoot ");
SERIAL_PROTOCOLPGM(
" Kp: "
); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(
MSG_KP
); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(
" Ki: "
); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(
MSG_KI
); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(
" Kd: "
); SERIAL_PROTOCOLLN(Kd);
SERIAL_PROTOCOLPGM(
MSG_KD
); SERIAL_PROTOCOLLN(Kd);
Kp = 0.2*Ku;
Kp = 0.2*Ku;
Ki = 2*Kp/Tu;
Ki = 2*Kp/Tu;
Kd = Kp*Tu/3;
Kd = Kp*Tu/3;
SERIAL_PROTOCOLLNPGM(" No overshoot ");
SERIAL_PROTOCOLLNPGM(" No overshoot ");
SERIAL_PROTOCOLPGM(
" Kp: "
); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(
MSG_KP
); SERIAL_PROTOCOLLN(Kp);
SERIAL_PROTOCOLPGM(
" Ki: "
); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(
MSG_KI
); SERIAL_PROTOCOLLN(Ki);
SERIAL_PROTOCOLPGM(
" Kd: "
); SERIAL_PROTOCOLLN(Kd);
SERIAL_PROTOCOLPGM(
MSG_KD
); SERIAL_PROTOCOLLN(Kd);
*/
*/
}
}
}
}
...
@@ -363,40 +363,40 @@ void PID_autotune(float temp, int extruder, int ncycles)
...
@@ -363,40 +363,40 @@ void PID_autotune(float temp, int extruder, int ncycles)
}
}
}
}
if
(
input
>
(
temp
+
20
))
{
if
(
input
>
(
temp
+
20
))
{
SERIAL_PROTOCOLLNPGM
(
"PID Autotune failed! Temperature too high"
);
SERIAL_PROTOCOLLNPGM
(
MSG_PID_TEMP_TOO_HIGH
);
return
;
return
;
}
}
if
(
millis
()
-
temp_millis
>
2000
)
{
if
(
millis
()
-
temp_millis
>
2000
)
{
int
p
;
int
p
;
if
(
extruder
<
0
){
if
(
extruder
<
0
)
{
p
=
soft_pwm_bed
;
p
=
soft_pwm_bed
;
SERIAL_PROTOCOLPGM
(
"ok B:"
);
SERIAL_PROTOCOLPGM
(
MSG_OK_B
);
}
else
{
}
else
{
p
=
soft_pwm
[
extruder
];
p
=
soft_pwm
[
extruder
];
SERIAL_PROTOCOLPGM
(
"ok T:"
);
SERIAL_PROTOCOLPGM
(
MSG_OK_T
);
}
}
SERIAL_PROTOCOL
(
input
);
SERIAL_PROTOCOL
(
input
);
SERIAL_PROTOCOLPGM
(
" @:"
);
SERIAL_PROTOCOLPGM
(
MSG_AT
);
SERIAL_PROTOCOLLN
(
p
);
SERIAL_PROTOCOLLN
(
p
);
temp_millis
=
millis
();
temp_millis
=
millis
();
}
}
if
(((
millis
()
-
t1
)
+
(
millis
()
-
t2
))
>
(
10L
*
60L
*
1000L
*
2L
))
{
if
(((
millis
()
-
t1
)
+
(
millis
()
-
t2
))
>
(
10L
*
60L
*
1000L
*
2L
))
{
SERIAL_PROTOCOLLNPGM
(
"PID Autotune failed! timeout"
);
SERIAL_PROTOCOLLNPGM
(
MSG_PID_TIMEOUT
);
return
;
return
;
}
}
if
(
cycles
>
ncycles
)
{
if
(
cycles
>
ncycles
)
{
SERIAL_PROTOCOLLNPGM
(
"PID Autotune finished! Put the last Kp, Ki and Kd constants from above into Configuration.h"
);
SERIAL_PROTOCOLLNPGM
(
MSG_PID_AUTOTUNE_FINISHED
);
return
;
return
;
}
}
lcd_update
();
lcd_update
();
}
}
}
}
void
updatePID
()
void
updatePID
()
{
{
#ifdef PIDTEMP
#ifdef PIDTEMP
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
for
(
int
e
=
0
;
e
<
EXTRUDERS
;
e
++
)
{
for
(
int
e
=
0
;
e
<
EXTRUDERS
;
e
++
)
{
temp_iState_max
[
e
]
=
PID_INTEGRAL_DRIVE_MAX
/
Ki
[
e
];
temp_iState_max
[
e
]
=
PID_INTEGRAL_DRIVE_MAX
/
Ki
[
e
];
...
@@ -404,10 +404,10 @@ void updatePID()
...
@@ -404,10 +404,10 @@ void updatePID()
#else
#else
temp_iState_max
[
0
]
=
PID_INTEGRAL_DRIVE_MAX
/
Ki
[
0
];
temp_iState_max
[
0
]
=
PID_INTEGRAL_DRIVE_MAX
/
Ki
[
0
];
#endif
#endif
#endif
#endif
#ifdef PIDTEMPBED
#ifdef PIDTEMPBED
temp_iState_max_bed
=
PID_INTEGRAL_DRIVE_MAX
/
bedKi
;
temp_iState_max_bed
=
PID_INTEGRAL_DRIVE_MAX
/
bedKi
;
#endif
#endif
}
}
int
getHeaterPower
(
int
heater
)
{
int
getHeaterPower
(
int
heater
)
{
...
@@ -436,8 +436,7 @@ int getHeaterPower(int heater) {
...
@@ -436,8 +436,7 @@ int getHeaterPower(int heater) {
#endif
#endif
#endif
#endif
void
setExtruderAutoFanState
(
int
pin
,
bool
state
)
void
setExtruderAutoFanState
(
int
pin
,
bool
state
)
{
{
unsigned
char
newFanSpeed
=
(
state
!=
0
)
?
EXTRUDER_AUTO_FAN_SPEED
:
0
;
unsigned
char
newFanSpeed
=
(
state
!=
0
)
?
EXTRUDER_AUTO_FAN_SPEED
:
0
;
// this idiom allows both digital and PWM fan outputs (see M42 handling).
// this idiom allows both digital and PWM fan outputs (see M42 handling).
pinMode
(
pin
,
OUTPUT
);
pinMode
(
pin
,
OUTPUT
);
...
@@ -445,8 +444,7 @@ int getHeaterPower(int heater) {
...
@@ -445,8 +444,7 @@ int getHeaterPower(int heater) {
analogWrite
(
pin
,
newFanSpeed
);
analogWrite
(
pin
,
newFanSpeed
);
}
}
void
checkExtruderAutoFans
()
void
checkExtruderAutoFans
()
{
{
uint8_t
fanState
=
0
;
uint8_t
fanState
=
0
;
// which fan pins need to be turned on?
// which fan pins need to be turned on?
...
@@ -457,8 +455,7 @@ int getHeaterPower(int heater) {
...
@@ -457,8 +455,7 @@ int getHeaterPower(int heater) {
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
#if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
#if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
if
(
current_temperature
[
1
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
if
(
current_temperature
[
1
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
{
{
if
(
EXTRUDER_1_AUTO_FAN_PIN
==
EXTRUDER_0_AUTO_FAN_PIN
)
if
(
EXTRUDER_1_AUTO_FAN_PIN
==
EXTRUDER_0_AUTO_FAN_PIN
)
fanState
|=
1
;
fanState
|=
1
;
else
else
...
@@ -466,8 +463,7 @@ int getHeaterPower(int heater) {
...
@@ -466,8 +463,7 @@ int getHeaterPower(int heater) {
}
}
#endif
#endif
#if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1
#if defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1
if
(
current_temperature
[
2
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
if
(
current_temperature
[
2
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
{
{
if
(
EXTRUDER_2_AUTO_FAN_PIN
==
EXTRUDER_0_AUTO_FAN_PIN
)
if
(
EXTRUDER_2_AUTO_FAN_PIN
==
EXTRUDER_0_AUTO_FAN_PIN
)
fanState
|=
1
;
fanState
|=
1
;
else
if
(
EXTRUDER_2_AUTO_FAN_PIN
==
EXTRUDER_1_AUTO_FAN_PIN
)
else
if
(
EXTRUDER_2_AUTO_FAN_PIN
==
EXTRUDER_1_AUTO_FAN_PIN
)
...
@@ -477,8 +473,7 @@ int getHeaterPower(int heater) {
...
@@ -477,8 +473,7 @@ int getHeaterPower(int heater) {
}
}
#endif
#endif
#if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1
#if defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1
if
(
current_temperature
[
3
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
if
(
current_temperature
[
3
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
{
{
if
(
EXTRUDER_3_AUTO_FAN_PIN
==
EXTRUDER_0_AUTO_FAN_PIN
)
if
(
EXTRUDER_3_AUTO_FAN_PIN
==
EXTRUDER_0_AUTO_FAN_PIN
)
fanState
|=
1
;
fanState
|=
1
;
else
if
(
EXTRUDER_3_AUTO_FAN_PIN
==
EXTRUDER_1_AUTO_FAN_PIN
)
else
if
(
EXTRUDER_3_AUTO_FAN_PIN
==
EXTRUDER_1_AUTO_FAN_PIN
)
...
@@ -516,8 +511,7 @@ int getHeaterPower(int heater) {
...
@@ -516,8 +511,7 @@ int getHeaterPower(int heater) {
}
}
#endif // any extruder auto fan pins set
#endif // any extruder auto fan pins set
void
manage_heater
()
void
manage_heater
()
{
{
static
float
pid_input
;
static
float
pid_input
;
static
float
pid_output
;
static
float
pid_output
;
...
@@ -589,41 +583,34 @@ void manage_heater()
...
@@ -589,41 +583,34 @@ void manage_heater()
#ifdef PID_DEBUG
#ifdef PID_DEBUG
SERIAL_ECHO_START
;
SERIAL_ECHO_START
;
SERIAL_ECHO
(
" PID_DEBUG "
);
SERIAL_ECHO
(
MSG_PID_DEBUG
);
SERIAL_ECHO
(
e
);
SERIAL_ECHO
(
e
);
SERIAL_ECHO
(
": Input "
);
SERIAL_ECHO
(
MSG_PID_DEBUG_INPUT
);
SERIAL_ECHO
(
pid_input
);
SERIAL_ECHO
(
pid_input
);
SERIAL_ECHO
(
" Output "
);
SERIAL_ECHO
(
MSG_PID_DEBUG_OUTPUT
);
SERIAL_ECHO
(
pid_output
);
SERIAL_ECHO
(
pid_output
);
SERIAL_ECHO
(
" pTerm "
);
SERIAL_ECHO
(
MSG_PID_DEBUG_PTERM
);
SERIAL_ECHO
(
pTerm
[
e
]);
SERIAL_ECHO
(
pTerm
[
e
]);
SERIAL_ECHO
(
" iTerm "
);
SERIAL_ECHO
(
MSG_PID_DEBUG_ITERM
);
SERIAL_ECHO
(
iTerm
[
e
]);
SERIAL_ECHO
(
iTerm
[
e
]);
SERIAL_ECHO
(
" dTerm "
);
SERIAL_ECHO
(
MSG_PID_DEBUG_DTERM
);
SERIAL_ECHOLN
(
dTerm
[
e
]);
SERIAL_ECHOLN
(
dTerm
[
e
]);
#endif //PID_DEBUG
#endif //PID_DEBUG
#else //NO PIDTEMP
#else //NO PIDTEMP
pid_output
=
0
;
pid_output
=
0
;
if
(
current_temperature
[
e
]
<
target_temperature
[
e
])
{
if
(
current_temperature
[
e
]
<
target_temperature
[
e
])
pid_output
=
PID_MAX
;
pid_output
=
PID_MAX
;
}
#endif //PIDTEMP
#endif //PIDTEMP
// Check if temperature is within the correct range
// Check if temperature is within the correct range
if
((
current_temperature
[
e
]
>
minttemp
[
e
])
&&
(
current_temperature
[
e
]
<
maxttemp
[
e
]))
{
soft_pwm
[
e
]
=
current_temperature
[
e
]
>
minttemp
[
e
]
&&
current_temperature
[
e
]
<
maxttemp
[
e
]
?
(
int
)
pid_output
>>
1
:
0
;
soft_pwm
[
e
]
=
(
int
)
pid_output
>>
1
;
}
else
{
soft_pwm
[
e
]
=
0
;
}
#ifdef WATCH_TEMP_PERIOD
#ifdef WATCH_TEMP_PERIOD
if
(
watchmillis
[
e
]
&&
millis
()
-
watchmillis
[
e
]
>
WATCH_TEMP_PERIOD
)
{
if
(
watchmillis
[
e
]
&&
millis
()
-
watchmillis
[
e
]
>
WATCH_TEMP_PERIOD
)
{
if
(
degHotend
(
e
)
<
watch_start_temp
[
e
]
+
WATCH_TEMP_INCREASE
)
{
if
(
degHotend
(
e
)
<
watch_start_temp
[
e
]
+
WATCH_TEMP_INCREASE
)
{
setTargetHotend
(
0
,
e
);
setTargetHotend
(
0
,
e
);
LCD_MESSAGEPGM
(
"Heating failed"
);
LCD_MESSAGEPGM
(
MSG_HEATING_FAILED_LCD
);
SERIAL_ECHO_START
;
SERIAL_ECHO_START
;
SERIAL_ECHOLN
(
"Heating failed"
);
SERIAL_ECHOLN
PGM
(
MSG_HEATING_FAILED
);
}
}
else
{
else
{
watchmillis
[
e
]
=
0
;
watchmillis
[
e
]
=
0
;
...
@@ -636,8 +623,8 @@ void manage_heater()
...
@@ -636,8 +623,8 @@ void manage_heater()
disable_heater
();
disable_heater
();
if
(
IsStopped
()
==
false
)
{
if
(
IsStopped
()
==
false
)
{
SERIAL_ERROR_START
;
SERIAL_ERROR_START
;
SERIAL_ERRORLNPGM
(
"Extruder switched off. Temperature difference between temp sensors is too high !"
);
SERIAL_ERRORLNPGM
(
MSG_EXTRUDER_SWITCHED_OFF
);
LCD_ALERTMESSAGEPGM
(
"Err: REDUNDANT TEMP ERROR"
);
LCD_ALERTMESSAGEPGM
(
MSG_ERR_REDUNDANT_TEMP
);
}
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop
();
Stop
();
...
@@ -773,8 +760,7 @@ void manage_heater()
...
@@ -773,8 +760,7 @@ void manage_heater()
#define PGM_RD_W(x) (short)pgm_read_word(&x)
#define PGM_RD_W(x) (short)pgm_read_word(&x)
// Derived from RepRap FiveD extruder::getTemperature()
// Derived from RepRap FiveD extruder::getTemperature()
// For hot end temperature measurement.
// For hot end temperature measurement.
static
float
analog2temp
(
int
raw
,
uint8_t
e
)
static
float
analog2temp
(
int
raw
,
uint8_t
e
)
{
{
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
if
(
e
>
EXTRUDERS
)
if
(
e
>
EXTRUDERS
)
#else
#else
...
@@ -783,7 +769,7 @@ static float analog2temp(int raw, uint8_t e)
...
@@ -783,7 +769,7 @@ static float analog2temp(int raw, uint8_t e)
{
{
SERIAL_ERROR_START
;
SERIAL_ERROR_START
;
SERIAL_ERROR
((
int
)
e
);
SERIAL_ERROR
((
int
)
e
);
SERIAL_ERRORLNPGM
(
" - Invalid extruder number !"
);
SERIAL_ERRORLNPGM
(
MSG_INVALID_EXTRUDER_NUM
);
kill
();
kill
();
return
0.0
;
return
0.0
;
}
}
...
@@ -817,8 +803,7 @@ static float analog2temp(int raw, uint8_t e)
...
@@ -817,8 +803,7 @@ static float analog2temp(int raw, uint8_t e)
// Derived from RepRap FiveD extruder::getTemperature()
// Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement.
// For bed temperature measurement.
static
float
analog2tempBed
(
int
raw
)
static
float
analog2tempBed
(
int
raw
)
{
{
#ifdef BED_USES_THERMISTOR
#ifdef BED_USES_THERMISTOR
float
celsius
=
0
;
float
celsius
=
0
;
byte
i
;
byte
i
;
...
@@ -846,8 +831,7 @@ static float analog2tempBed(int raw)
...
@@ -846,8 +831,7 @@ static float analog2tempBed(int raw)
/* Called to get the raw values into the the actual temperatures. The raw values are created in interrupt context,
/* Called to get the raw values into the the actual temperatures. The raw values are created in interrupt context,
and this function is called from normal context as it is too slow to run in interrupts and will block the stepper routine otherwise */
and this function is called from normal context as it is too slow to run in interrupts and will block the stepper routine otherwise */
static
void
updateTemperaturesFromRawValues
()
static
void
updateTemperaturesFromRawValues
()
{
{
#ifdef HEATER_0_USES_MAX6675
#ifdef HEATER_0_USES_MAX6675
current_temperature_raw
[
0
]
=
read_max6675
();
current_temperature_raw
[
0
]
=
read_max6675
();
#endif
#endif
...
@@ -894,8 +878,7 @@ static void updateTemperaturesFromRawValues()
...
@@ -894,8 +878,7 @@ static void updateTemperaturesFromRawValues()
}
}
#endif
#endif
void
tp_init
()
void
tp_init
()
{
{
#if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
#if MB(RUMBA) && ((TEMP_SENSOR_0==-1)||(TEMP_SENSOR_1==-1)||(TEMP_SENSOR_2==-1)||(TEMP_SENSOR_BED==-1))
//disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
//disable RUMBA JTAG in case the thermocouple extension is plugged on top of JTAG connector
MCUCR
=
(
1
<<
JTD
);
MCUCR
=
(
1
<<
JTD
);
...
@@ -1141,28 +1124,25 @@ void tp_init()
...
@@ -1141,28 +1124,25 @@ void tp_init()
#endif //BED_MAXTEMP
#endif //BED_MAXTEMP
}
}
void
setWatch
()
void
setWatch
()
{
{
#ifdef WATCH_TEMP_PERIOD
#ifdef WATCH_TEMP_PERIOD
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
for
(
in
t
e
=
0
;
e
<
EXTRUDERS
;
e
++
)
for
(
uint8_
t
e
=
0
;
e
<
EXTRUDERS
;
e
++
)
#else
#else
in
t
e
=
0
;
uint8_
t
e
=
0
;
#endif // !SINGLENOZZLE
#endif // !SINGLENOZZLE
{
{
if
(
degHotend
(
e
)
<
degTargetHotend
(
e
)
-
(
WATCH_TEMP_INCREASE
*
2
))
if
(
degHotend
(
e
)
<
degTargetHotend
(
e
)
-
(
WATCH_TEMP_INCREASE
*
2
))
{
{
watch_start_temp
[
e
]
=
degHotend
(
e
);
watch_start_temp
[
e
]
=
degHotend
(
e
);
watchmillis
[
e
]
=
millis
();
watchmillis
[
e
]
=
millis
();
}
}
}
}
#endif //WATCH_TEMP_PERIOD
#endif //WATCH_TEMP_PERIOD
}
}
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
#if defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
void
thermal_runaway_protection
(
int
*
state
,
unsigned
long
*
timer
,
float
temperature
,
float
target_temperature
,
int
heater_id
,
int
period_seconds
,
int
hysteresis_degc
)
void
thermal_runaway_protection
(
int
*
state
,
unsigned
long
*
timer
,
float
temperature
,
float
target_temperature
,
int
heater_id
,
int
period_seconds
,
int
hysteresis_degc
)
{
{
/*
/*
SERIAL_ECHO_START;
SERIAL_ECHO_START;
SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:");
SERIAL_ECHO("Thermal Thermal Runaway Running. Heater ID:");
SERIAL_ECHO(heater_id);
SERIAL_ECHO(heater_id);
...
@@ -1175,7 +1155,7 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
...
@@ -1175,7 +1155,7 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
SERIAL_ECHO(" ; Target Temp:");
SERIAL_ECHO(" ; Target Temp:");
SERIAL_ECHO(target_temperature);
SERIAL_ECHO(target_temperature);
SERIAL_ECHOLN("");
SERIAL_ECHOLN("");
*/
*/
if
((
target_temperature
==
0
)
||
thermal_runaway
)
if
((
target_temperature
==
0
)
||
thermal_runaway
)
{
{
*
state
=
0
;
*
state
=
0
;
...
@@ -1218,55 +1198,54 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
...
@@ -1218,55 +1198,54 @@ void thermal_runaway_protection(int *state, unsigned long *timer, float temperat
}
}
break
;
break
;
}
}
}
}
#endif
#endif
//defined (THERMAL_RUNAWAY_PROTECTION_PERIOD) && THERMAL_RUNAWAY_PROTECTION_PERIOD > 0
void
disable_heater
()
void
disable_heater
()
{
{
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
for
(
in
t
i
=
0
;
i
<
EXTRUDERS
;
i
++
)
for
(
uint8_
t
i
=
0
;
i
<
EXTRUDERS
;
i
++
)
#else
#else
in
t
i
=
0
;
uint8_
t
i
=
0
;
#endif // !SINGLENOZZLE
#endif // !SINGLENOZZLE
setTargetHotend
(
0
,
i
);
setTargetHotend
(
0
,
i
);
setTargetBed
(
0
);
setTargetBed
(
0
);
#if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
#if defined(TEMP_0_PIN) && TEMP_0_PIN > -1
target_temperature
[
0
]
=
0
;
target_temperature
[
0
]
=
0
;
soft_pwm
[
0
]
=
0
;
soft_pwm
[
0
]
=
0
;
#if defined(HEATER_0_PIN) && HEATER_0_PIN > -1
#if defined(HEATER_0_PIN) && HEATER_0_PIN > -1
WRITE
(
HEATER_0_PIN
,
LOW
);
WRITE
(
HEATER_0_PIN
,
LOW
);
#endif
#endif
#endif
#endif
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
#if defined(TEMP_1_PIN) && TEMP_1_PIN > -1 && EXTRUDERS > 1
#if defined(TEMP_1_PIN) && TEMP_1_PIN > -1 && EXTRUDERS > 1
target_temperature
[
1
]
=
0
;
target_temperature
[
1
]
=
0
;
soft_pwm
[
1
]
=
0
;
soft_pwm
[
1
]
=
0
;
#if defined(HEATER_1_PIN) && HEATER_1_PIN > -1
#if defined(HEATER_1_PIN) && HEATER_1_PIN > -1
WRITE
(
HEATER_1_PIN
,
LOW
);
WRITE
(
HEATER_1_PIN
,
LOW
);
#endif
#endif
#endif
#endif
#if defined(TEMP_2_PIN) && TEMP_2_PIN > -1 && EXTRUDERS > 2
#if defined(TEMP_2_PIN) && TEMP_2_PIN > -1 && EXTRUDERS > 2
target_temperature
[
2
]
=
0
;
target_temperature
[
2
]
=
0
;
soft_pwm
[
2
]
=
0
;
soft_pwm
[
2
]
=
0
;
#if defined(HEATER_2_PIN) && HEATER_2_PIN > -1
#if defined(HEATER_2_PIN) && HEATER_2_PIN > -1
WRITE
(
HEATER_2_PIN
,
LOW
);
WRITE
(
HEATER_2_PIN
,
LOW
);
#endif
#endif
#endif
#endif
#if defined(TEMP_3_PIN) && TEMP_3_PIN > -1 && EXTRUDERS > 3
#if defined(TEMP_3_PIN) && TEMP_3_PIN > -1 && EXTRUDERS > 3
target_temperature
[
3
]
=
0
;
target_temperature
[
3
]
=
0
;
soft_pwm
[
3
]
=
0
;
soft_pwm
[
3
]
=
0
;
#if defined(HEATER_3_PIN) && HEATER_3_PIN > -1
#if defined(HEATER_3_PIN) && HEATER_3_PIN > -1
WRITE
(
HEATER_3_PIN
,
LOW
);
WRITE
(
HEATER_3_PIN
,
LOW
);
#endif
#endif
#endif
#endif
#endif // !SINGLENOZZLE
#endif // !SINGLENOZZLE
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
#if defined(TEMP_BED_PIN) && TEMP_BED_PIN > -1
target_temperature_bed
=
0
;
target_temperature_bed
=
0
;
soft_pwm_bed
=
0
;
soft_pwm_bed
=
0
;
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
#if defined(HEATER_BED_PIN) && HEATER_BED_PIN > -1
WRITE
(
HEATER_BED_PIN
,
LOW
);
WRITE
(
HEATER_BED_PIN
,
LOW
);
#endif
#endif
...
@@ -1291,8 +1270,8 @@ void min_temp_error(uint8_t e) {
...
@@ -1291,8 +1270,8 @@ void min_temp_error(uint8_t e) {
if
(
IsStopped
()
==
false
)
{
if
(
IsStopped
()
==
false
)
{
SERIAL_ERROR_START
;
SERIAL_ERROR_START
;
SERIAL_ERRORLN
((
int
)
e
);
SERIAL_ERRORLN
((
int
)
e
);
SERIAL_ERRORLNPGM
(
": Extruder switched off. MINTEMP triggered !"
);
SERIAL_ERRORLNPGM
(
MSG_MINTEMP_EXTRUDER_OFF
);
LCD_ALERTMESSAGEPGM
(
"Err: MINTEMP"
);
LCD_ALERTMESSAGEPGM
(
MSG_ERR_MINTEMP
);
}
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop
();
Stop
();
...
@@ -1300,13 +1279,13 @@ void min_temp_error(uint8_t e) {
...
@@ -1300,13 +1279,13 @@ void min_temp_error(uint8_t e) {
}
}
void
bed_max_temp_error
(
void
)
{
void
bed_max_temp_error
(
void
)
{
#if HEATER_BED_PIN > -1
#if HEATER_BED_PIN > -1
WRITE
(
HEATER_BED_PIN
,
0
);
WRITE
(
HEATER_BED_PIN
,
0
);
#endif
#endif
if
(
IsStopped
()
==
false
)
{
if
(
IsStopped
()
==
false
)
{
SERIAL_ERROR_START
;
SERIAL_ERROR_START
;
SERIAL_ERRORLNPGM
(
"Temperature heated bed switched off. MAXTEMP triggered !!"
);
SERIAL_ERRORLNPGM
(
MSG_MAXTEMP_BED_OFF
);
LCD_ALERTMESSAGEPGM
(
"Err: MAXTEMP BED"
);
LCD_ALERTMESSAGEPGM
(
MSG_ERR_MAXTEMP_BED
);
}
}
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
#ifndef BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE
Stop
();
Stop
();
...
@@ -1314,12 +1293,11 @@ void bed_max_temp_error(void) {
...
@@ -1314,12 +1293,11 @@ void bed_max_temp_error(void) {
}
}
#ifdef HEATER_0_USES_MAX6675
#ifdef HEATER_0_USES_MAX6675
#define MAX6675_HEAT_INTERVAL 250
#define MAX6675_HEAT_INTERVAL 250
long
max6675_previous_millis
=
MAX6675_HEAT_INTERVAL
;
long
max6675_previous_millis
=
MAX6675_HEAT_INTERVAL
;
int
max6675_temp
=
2000
;
int
max6675_temp
=
2000
;
static
int
read_max6675
()
static
int
read_max6675
()
{
{
if
(
millis
()
-
max6675_previous_millis
<
MAX6675_HEAT_INTERVAL
)
if
(
millis
()
-
max6675_previous_millis
<
MAX6675_HEAT_INTERVAL
)
return
max6675_temp
;
return
max6675_temp
;
...
@@ -1355,26 +1333,21 @@ static int read_max6675()
...
@@ -1355,26 +1333,21 @@ static int read_max6675()
// disable TT_MAX6675
// disable TT_MAX6675
WRITE
(
MAX6675_SS
,
1
);
WRITE
(
MAX6675_SS
,
1
);
if
(
max6675_temp
&
4
)
if
(
max6675_temp
&
4
)
{
{
// thermocouple open
// thermocouple open
max6675_temp
=
4000
;
max6675_temp
=
4000
;
}
}
else
else
{
{
max6675_temp
=
max6675_temp
>>
3
;
max6675_temp
=
max6675_temp
>>
3
;
}
}
return
max6675_temp
;
return
max6675_temp
;
}
}
#endif //HEATER_0_USES_MAX6675
#endif //HEATER_0_USES_MAX6675
// Timer 0 is shared with millies
// Timer 0 is shared with millies
ISR
(
TIMER0_COMPB_vect
)
ISR
(
TIMER0_COMPB_vect
)
{
{
//these variables are only accessible from the ISR, but static, so they don't lose their value
//these variables are only accesible from the ISR, but static, so they don't lose their value
static
unsigned
char
temp_count
=
0
;
static
unsigned
char
temp_count
=
0
;
static
unsigned
long
raw_temp_0_value
=
0
;
static
unsigned
long
raw_temp_0_value
=
0
;
static
unsigned
long
raw_temp_1_value
=
0
;
static
unsigned
long
raw_temp_1_value
=
0
;
...
@@ -1384,45 +1357,45 @@ ISR(TIMER0_COMPB_vect)
...
@@ -1384,45 +1357,45 @@ ISR(TIMER0_COMPB_vect)
static
unsigned
char
temp_state
=
12
;
static
unsigned
char
temp_state
=
12
;
static
unsigned
char
pwm_count
=
(
1
<<
SOFT_PWM_SCALE
);
static
unsigned
char
pwm_count
=
(
1
<<
SOFT_PWM_SCALE
);
static
unsigned
char
soft_pwm_0
;
static
unsigned
char
soft_pwm_0
;
#ifdef SLOW_PWM_HEATERS
#ifdef SLOW_PWM_HEATERS
static
unsigned
char
slow_pwm_count
=
0
;
static
unsigned
char
slow_pwm_count
=
0
;
static
unsigned
char
state_heater_0
=
0
;
static
unsigned
char
state_heater_0
=
0
;
static
unsigned
char
state_timer_heater_0
=
0
;
static
unsigned
char
state_timer_heater_0
=
0
;
#endif
#endif
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
#if (EXTRUDERS > 1) || defined(HEATERS_PARALLEL)
#if (EXTRUDERS > 1) || defined(HEATERS_PARALLEL)
static
unsigned
char
soft_pwm_1
;
static
unsigned
char
soft_pwm_1
;
#ifdef SLOW_PWM_HEATERS
#ifdef SLOW_PWM_HEATERS
static
unsigned
char
state_heater_1
=
0
;
static
unsigned
char
state_heater_1
=
0
;
static
unsigned
char
state_timer_heater_1
=
0
;
static
unsigned
char
state_timer_heater_1
=
0
;
#endif
#endif //SLOW_PWM_HEATERS
#endif
#endif //(EXTRUDERS > 1) || defined(HEATERS_PARALLEL)
#if EXTRUDERS > 2
#if EXTRUDERS > 2
static
unsigned
char
soft_pwm_2
;
static
unsigned
char
soft_pwm_2
;
#ifdef SLOW_PWM_HEATERS
#ifdef SLOW_PWM_HEATERS
static
unsigned
char
state_heater_2
=
0
;
static
unsigned
char
state_heater_2
=
0
;
static
unsigned
char
state_timer_heater_2
=
0
;
static
unsigned
char
state_timer_heater_2
=
0
;
#endif
#endif //SLOW_PWM_HEATERS
#endif
#endif //EXTRUDERS > 2
#if EXTRUDERS > 3
#if EXTRUDERS > 3
static
unsigned
char
soft_pwm_3
;
static
unsigned
char
soft_pwm_3
;
#ifdef SLOW_PWM_HEATERS
#ifdef SLOW_PWM_HEATERS
static
unsigned
char
state_heater_3
=
0
;
static
unsigned
char
state_heater_3
=
0
;
static
unsigned
char
state_timer_heater_3
=
0
;
static
unsigned
char
state_timer_heater_3
=
0
;
#endif
#endif //LOW_PWM_HEATERS
#endif
#endif //EXTRUDERS > 3
#endif // !SINGLENOZZLE
#endif // !SINGLENOZZLE
#if HEATER_BED_PIN > -1
#if HEATER_BED_PIN > -1
static
unsigned
char
soft_pwm_b
;
static
unsigned
char
soft_pwm_b
;
#ifdef SLOW_PWM_HEATERS
#ifdef SLOW_PWM_HEATERS
static
unsigned
char
state_heater_b
=
0
;
static
unsigned
char
state_heater_b
=
0
;
static
unsigned
char
state_timer_heater_b
=
0
;
static
unsigned
char
state_timer_heater_b
=
0
;
#endif
#endif //SLOW_PWM_HEATERS
#endif
#endif //HEATER_BED_PIN > -1
#if defined(FILWIDTH_PIN) &&(FILWIDTH_PIN > -1)
#if defined(FILWIDTH_PIN) &&(FILWIDTH_PIN > -1)
static
unsigned
long
raw_filwidth_value
=
0
;
//added for filament width sensor
static
unsigned
long
raw_filwidth_value
=
0
;
//added for filament width sensor
#endif
#endif
#ifndef SLOW_PWM_HEATERS
#ifndef SLOW_PWM_HEATERS
/*
/*
...
...
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