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
a6879c86
Commit
a6879c86
authored
Feb 16, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Temperature.cpp
parent
03bb009c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
328 additions
and
369 deletions
+328
-369
language_fi.h
MarlinKimbra/language_fi.h
+38
-38
temperature.cpp
MarlinKimbra/temperature.cpp
+290
-331
No files found.
MarlinKimbra/language_fi.h
View file @
a6879c86
...
...
@@ -18,40 +18,40 @@
#define MSG_BED_SETTING "Bed Setting"
#define MSG_SET_HOME_OFFSETS "Set home offsets"
#define MSG_SET_ORIGIN "Aseta origo"
#define MSG_PREHEAT_PLA "Esil
ammita
PLA"
#define MSG_PREHEAT_PLA_ALL "Esil
a
. PLA Kaikki"
#define MSG_PREHEAT_PLA_BEDONLY "Esil
a
. PLA Alusta"
#define MSG_PREHEAT_PLA_SETTINGS "Esil
a
mm. PLA konf"
#define MSG_PREHEAT_ABS "Esil
ammita
ABS"
#define MSG_PREHEAT_ABS_ALL
"Esila
. ABS Kaikki"
#define MSG_PREHEAT_ABS_BEDONLY "Esil
a
. ABS Alusta"
#define MSG_PREHEAT_ABS_SETTINGS "Esil
a
mm. ABS konf"
#define MSG_PREHEAT_GUM "
Preheat
GUM"
#define MSG_PREHEAT_GUM_ALL "
Preheat GUM All
"
#define MSG_PREHEAT_GUM_BEDONLY "
Preheat GUM Bed
"
#define MSG_PREHEAT_GUM_SETTINGS "
Preheat GUM c
onf"
#define MSG_COOLDOWN "J
aahdyta
"
#define MSG_SWITCH_PS_ON "Virta p
aa
lle"
#define MSG_PREHEAT_PLA "Esil
" STR_ae "mmit" STR_ae "
PLA"
#define MSG_PREHEAT_PLA_ALL "Esil
" STR_ae "
. PLA Kaikki"
#define MSG_PREHEAT_PLA_BEDONLY "Esil
" STR_ae "
. PLA Alusta"
#define MSG_PREHEAT_PLA_SETTINGS "Esil
" STR_ae "
mm. PLA konf"
#define MSG_PREHEAT_ABS "Esil
" STR_ae "mmit" STR_ae "
ABS"
#define MSG_PREHEAT_ABS_ALL
"Esil" STR_ae "
. ABS Kaikki"
#define MSG_PREHEAT_ABS_BEDONLY "Esil
" STR_ae "
. ABS Alusta"
#define MSG_PREHEAT_ABS_SETTINGS "Esil
" STR_ae "
mm. ABS konf"
#define MSG_PREHEAT_GUM "
Esil" STR_ae "mmit" STR_ae "
GUM"
#define MSG_PREHEAT_GUM_ALL "
Esil" STR_ae ". GUM Kaikki
"
#define MSG_PREHEAT_GUM_BEDONLY "
Esil" STR_ae ". GUM Alusta
"
#define MSG_PREHEAT_GUM_SETTINGS "
Esil" STR_ae "mm. GUM k
onf"
#define MSG_COOLDOWN "J
" STR_ae "" STR_ae "hdyt" STR_ae "
"
#define MSG_SWITCH_PS_ON "Virta p
" STR_ae "" STR_ae "
lle"
#define MSG_SWITCH_PS_OFF "Virta pois"
#define MSG_EXTRUDE "Pursota"
#define MSG_RETRACT "Ved
a
takaisin"
#define MSG_RETRACT "Ved
" STR_ae "
takaisin"
#define MSG_MOVE_AXIS "Liikuta akseleita"
#define MSG_MOVE_X "
Move
X"
#define MSG_MOVE_Y "
Move
Y"
#define MSG_MOVE_Z "
Move
Z"
#define MSG_MOVE_X "
Liikuta
X"
#define MSG_MOVE_Y "
Liikuta
Y"
#define MSG_MOVE_Z "
Liikuta
Z"
#define MSG_MOVE_E "Extruder"
#define MSG_MOVE_01MM "
Move
0.1mm"
#define MSG_MOVE_1MM "
Move
1mm"
#define MSG_MOVE_10MM "
Move
10mm"
#define MSG_MOVE_01MM "
Liikuta
0.1mm"
#define MSG_MOVE_1MM "
Liikuta
1mm"
#define MSG_MOVE_10MM "
Liikuta
10mm"
#define MSG_SPEED "Nopeus"
#define MSG_NOZZLE "Suutin"
#define MSG_BED "Alusta"
#define MSG_FAN_SPEED "Tuul. nopeus"
#define MSG_FLOW "Virtaus"
#define MSG_CONTROL "Kontrolli"
#define MSG_MIN
" "
STR_THERMOMETER " Min"
#define MSG_MAX
" "
STR_THERMOMETER " Max"
#define MSG_FACTOR
" " STR_THERMOMETER " Fact
"
#define MSG_MIN STR_THERMOMETER " Min"
#define MSG_MAX STR_THERMOMETER " Max"
#define MSG_FACTOR
STR_THERMOMETER " Kerr
"
#define MSG_AUTOTEMP "Autotemp"
#define MSG_ON "On "
#define MSG_OFF "Off"
...
...
@@ -78,22 +78,22 @@
#define MSG_E1STEPS "E1 steps/mm"
#define MSG_E2STEPS "E2 steps/mm"
#define MSG_E3STEPS "E3 steps/mm"
#define MSG_TEMPERATURE "L
ampo
tila"
#define MSG_TEMPERATURE "L
" STR_ae "mp" STR_oe "
tila"
#define MSG_MOTION "Liike"
#define MSG_VOLUMETRIC "Filament"
#define MSG_VOLUMETRIC_ENABLED "E in mm" STR_h3
#define MSG_FILAMENT_SIZE_EXTRUDER "Fil. Dia."
#define MSG_CONTRAST "LCD
contrast
"
#define MSG_CONTRAST "LCD
kontrasti
"
#define MSG_STORE_EPROM "Tallenna muistiin"
#define MSG_LOAD_EPROM "Lataa muistista"
#define MSG_RESTORE_FAILSAFE "Palauta oletus"
#define MSG_REFRESH "P
aivita
"
#define MSG_REFRESH "P
" STR_ae "ivit" STR_ae "
"
#define MSG_WATCH "Seuraa"
#define MSG_PREPARE "Valmistele"
#define MSG_TUNE "S
aada
"
#define MSG_PAUSE_PRINT "Keskeyt
a
tulostus"
#define MSG_TUNE "S
" STR_ae "" STR_ae "d" STR_ae "
"
#define MSG_PAUSE_PRINT "Keskeyt
" STR_ae "
tulostus"
#define MSG_RESUME_PRINT "Jatka tulostusta"
#define MSG_STOP_PRINT "Pys
ayta
tulostus"
#define MSG_STOP_PRINT "Pys
" STR_ae "yt" STR_ae "
tulostus"
#define MSG_CARD_MENU "Korttivalikko"
#define MSG_NO_CARD "Ei korttia"
#define MSG_DWELL "Nukkumassa..."
...
...
@@ -103,9 +103,9 @@
#define MSG_NO_MOVE "Ei liiketta."
#define MSG_KILLED "KILLED. "
#define MSG_STOPPED "STOPPED. "
#define MSG_CONTROL_RETRACT "Ved
a
mm"
#define MSG_CONTROL_RETRACT_SWAP "Va. Ved
a
mm"
#define MSG_CONTROL_RETRACTF "Ved
a
V"
#define MSG_CONTROL_RETRACT "Ved
" STR_ae "
mm"
#define MSG_CONTROL_RETRACT_SWAP "Va. Ved
" STR_ae "
mm"
#define MSG_CONTROL_RETRACTF "Ved
" STR_ae "
V"
#define MSG_CONTROL_RETRACT_ZLIFT "Z mm"
#define MSG_CONTROL_RETRACT_RECOVER "UnRet +mm"
#define MSG_CONTROL_RETRACT_RECOVER_SWAP "Va. UnRet +mm"
...
...
@@ -123,11 +123,11 @@
#define MSG_ENDSTOP_ABORT "Endstop abort"
#ifdef DELTA
#define MSG_DELTA_CALIBRATE "Delta
Calibration
"
#define MSG_DELTA_CALIBRATE_X "
Calibrate
X"
#define MSG_DELTA_CALIBRATE_Y "
Calibrate
Y"
#define MSG_DELTA_CALIBRATE_Z "
Calibrate
Z"
#define MSG_DELTA_CALIBRATE_CENTER "
Calibrate
Center"
#define MSG_DELTA_CALIBRATE "Delta
Kalibrointi
"
#define MSG_DELTA_CALIBRATE_X "
Kalibroi
X"
#define MSG_DELTA_CALIBRATE_Y "
Kalibroi
Y"
#define MSG_DELTA_CALIBRATE_Z "
Kalibroi
Z"
#define MSG_DELTA_CALIBRATE_CENTER "
Kalibroi
Center"
#endif // DELTA
#define MSG_LASER "Laser Preset"
...
...
MarlinKimbra/temperature.cpp
View file @
a6879c86
...
...
@@ -418,7 +418,8 @@ int getHeaterPower(int heater) {
#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_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
(defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1) || \
(defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1)
#if defined(FAN_PIN) && FAN_PIN > -1
#if EXTRUDER_0_AUTO_FAN_PIN == FAN_PIN
...
...
@@ -430,19 +431,22 @@ int getHeaterPower(int heater) {
#if EXTRUDER_2_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set EXTRUDER_2_AUTO_FAN_PIN equal to FAN_PIN"
#endif
#if EXTRUDER_3_AUTO_FAN_PIN == FAN_PIN
#error "You cannot set EXTRUDER_3_AUTO_FAN_PIN equal to FAN_PIN"
#endif
#endif
void
setExtruderAutoFanState
(
int
pin
,
bool
state
)
{
void
setExtruderAutoFanState
(
int
pin
,
bool
state
)
{
unsigned
char
newFanSpeed
=
(
state
!=
0
)
?
EXTRUDER_AUTO_FAN_SPEED
:
0
;
// this idiom allows both digital and PWM fan outputs (see M42 handling).
pinMode
(
pin
,
OUTPUT
);
digitalWrite
(
pin
,
newFanSpeed
);
analogWrite
(
pin
,
newFanSpeed
);
}
}
void
checkExtruderAutoFans
()
{
void
checkExtruderAutoFans
()
{
uint8_t
fanState
=
0
;
// which fan pins need to be turned on?
...
...
@@ -451,7 +455,7 @@ void checkExtruderAutoFans()
fanState
|=
1
;
#endif
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
#if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
if
(
current_temperature
[
1
]
>
EXTRUDER_AUTO_FAN_TEMPERATURE
)
{
...
...
@@ -485,14 +489,14 @@ void checkExtruderAutoFans()
fanState
|=
8
;
}
#endif
#endif // !SINLGENOZZE
#endif // !SINLGENOZZE
// update extruder auto fan states
#if defined(EXTRUDER_0_AUTO_FAN_PIN) && EXTRUDER_0_AUTO_FAN_PIN > -1
setExtruderAutoFanState
(
EXTRUDER_0_AUTO_FAN_PIN
,
(
fanState
&
1
)
!=
0
);
#endif
#ifndef SINGLENOZZLE
#ifndef SINGLENOZZLE
#if defined(EXTRUDER_1_AUTO_FAN_PIN) && EXTRUDER_1_AUTO_FAN_PIN > -1
if
(
EXTRUDER_1_AUTO_FAN_PIN
!=
EXTRUDER_0_AUTO_FAN_PIN
)
setExtruderAutoFanState
(
EXTRUDER_1_AUTO_FAN_PIN
,
(
fanState
&
2
)
!=
0
);
...
...
@@ -508,9 +512,8 @@ void checkExtruderAutoFans()
&&
EXTRUDER_3_AUTO_FAN_PIN
!=
EXTRUDER_0_AUTO_FAN_PIN
)
setExtruderAutoFanState
(
EXTRUDER_3_AUTO_FAN_PIN
,
(
fanState
&
8
)
!=
0
);
#endif
#endif // !SINLGENOZZE
}
#endif // !SINLGENOZZE
}
#endif // any extruder auto fan pins set
void
manage_heater
()
...
...
@@ -524,12 +527,10 @@ void manage_heater()
updateTemperaturesFromRawValues
();
#ifdef HEATER_0_USES_MAX6675
if
(
current_temperature
[
0
]
>
1023
||
current_temperature
[
0
]
>
HEATER_0_MAXTEMP
)
{
if
(
current_temperature
[
0
]
>
1023
||
current_temperature
[
0
]
>
HEATER_0_MAXTEMP
)
{
max_temp_error
(
0
);
}
if
(
current_temperature
[
0
]
==
0
||
current_temperature
[
0
]
<
HEATER_0_MINTEMP
)
{
if
(
current_temperature
[
0
]
==
0
||
current_temperature
[
0
]
<
HEATER_0_MINTEMP
)
{
min_temp_error
(
0
);
}
#endif //HEATER_0_USES_MAX6675
...
...
@@ -550,20 +551,16 @@ void manage_heater()
#ifndef PID_OPENLOOP
pid_error
[
e
]
=
target_temperature
[
e
]
-
pid_input
;
if
(
pid_error
[
e
]
>
PID_FUNCTIONAL_RANGE
)
{
if
(
pid_error
[
e
]
>
PID_FUNCTIONAL_RANGE
)
{
pid_output
=
BANG_MAX
;
pid_reset
[
e
]
=
true
;
}
else
if
(
pid_error
[
e
]
<
-
PID_FUNCTIONAL_RANGE
||
target_temperature
[
e
]
==
0
)
{
else
if
(
pid_error
[
e
]
<
-
PID_FUNCTIONAL_RANGE
||
target_temperature
[
e
]
==
0
)
{
pid_output
=
0
;
pid_reset
[
e
]
=
true
;
}
else
{
if
(
pid_reset
[
e
]
==
true
)
{
else
{
if
(
pid_reset
[
e
]
==
true
)
{
temp_iState
[
e
]
=
0.0
;
pid_reset
[
e
]
=
false
;
}
...
...
@@ -576,12 +573,11 @@ void manage_heater()
#define K2 (1.0-K1)
dTerm
[
e
]
=
(
Kd
[
e
]
*
(
pid_input
-
temp_dState
[
e
]))
*
K2
+
(
K1
*
dTerm
[
e
]);
pid_output
=
pTerm
[
e
]
+
iTerm
[
e
]
-
dTerm
[
e
];
if
(
pid_output
>
PID_MAX
)
{
if
(
pid_output
>
PID_MAX
)
{
if
(
pid_error
[
e
]
>
0
)
temp_iState
[
e
]
-=
pid_error
[
e
];
// conditional un-integration
pid_output
=
PID_MAX
;
}
else
if
(
pid_output
<
0
)
{
}
else
if
(
pid_output
<
0
)
{
if
(
pid_error
[
e
]
<
0
)
temp_iState
[
e
]
-=
pid_error
[
e
];
// conditional un-integration
pid_output
=
0
;
}
...
...
@@ -608,45 +604,37 @@ void manage_heater()
#endif //PID_DEBUG
#else //NO PIDTEMP
pid_output
=
0
;
if
(
current_temperature
[
e
]
<
target_temperature
[
e
])
{
if
(
current_temperature
[
e
]
<
target_temperature
[
e
])
{
pid_output
=
PID_MAX
;
}
#endif //PIDTEMP
// Check if temperature is within the correct range
if
((
current_temperature
[
e
]
>
minttemp
[
e
])
&&
(
current_temperature
[
e
]
<
maxttemp
[
e
]))
{
if
((
current_temperature
[
e
]
>
minttemp
[
e
])
&&
(
current_temperature
[
e
]
<
maxttemp
[
e
]))
{
soft_pwm
[
e
]
=
(
int
)
pid_output
>>
1
;
}
else
{
else
{
soft_pwm
[
e
]
=
0
;
}
#ifdef WATCH_TEMP_PERIOD
if
(
watchmillis
[
e
]
&&
millis
()
-
watchmillis
[
e
]
>
WATCH_TEMP_PERIOD
)
{
if
(
degHotend
(
e
)
<
watch_start_temp
[
e
]
+
WATCH_TEMP_INCREASE
)
{
if
(
watchmillis
[
e
]
&&
millis
()
-
watchmillis
[
e
]
>
WATCH_TEMP_PERIOD
)
{
if
(
degHotend
(
e
)
<
watch_start_temp
[
e
]
+
WATCH_TEMP_INCREASE
)
{
setTargetHotend
(
0
,
e
);
LCD_MESSAGEPGM
(
"Heating failed"
);
SERIAL_ECHO_START
;
SERIAL_ECHOLN
(
"Heating failed"
);
}
else
{
else
{
watchmillis
[
e
]
=
0
;
}
}
#endif //WATCH_TEMP_PERIOD
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
if
(
fabs
(
current_temperature
[
0
]
-
redundant_temperature
)
>
MAX_REDUNDANT_TEMP_SENSOR_DIFF
)
{
if
(
fabs
(
current_temperature
[
0
]
-
redundant_temperature
)
>
MAX_REDUNDANT_TEMP_SENSOR_DIFF
)
{
disable_heater
();
if
(
IsStopped
()
==
false
)
{
if
(
IsStopped
()
==
false
)
{
SERIAL_ERROR_START
;
SERIAL_ERRORLNPGM
(
"Extruder switched off. Temperature difference between temp sensors is too high !"
);
LCD_ALERTMESSAGEPGM
(
"Err: REDUNDANT TEMP ERROR"
);
...
...
@@ -656,13 +644,13 @@ void manage_heater()
#endif
}
#endif //TEMP_SENSOR_1_AS_REDUNDANT
}
//
End extruder for loop
}
//End extruder for loop
#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_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
if
(
millis
()
-
extruder_autofan_last_check
>
2500
)
// only need to check fan state very infrequently
{
(defined(EXTRUDER_2_AUTO_FAN_PIN) && EXTRUDER_2_AUTO_FAN_PIN > -1)
|| \
(defined(EXTRUDER_3_AUTO_FAN_PIN) && EXTRUDER_3_AUTO_FAN_PIN > -1)
if
(
millis
()
-
extruder_autofan_last_check
>
2500
)
{
// only need to check fan state very infrequently
checkExtruderAutoFans
();
extruder_autofan_last_check
=
millis
();
}
...
...
@@ -675,14 +663,12 @@ void manage_heater()
#endif
#if TEMP_SENSOR_BED != 0
#if defined(THERMAL_RUNAWAY_PROTECTION_BED_PERIOD) && THERMAL_RUNAWAY_PROTECTION_BED_PERIOD > 0
thermal_runaway_protection
(
&
thermal_runaway_bed_state_machine
,
&
thermal_runaway_bed_timer
,
current_temperature_bed
,
target_temperature_bed
,
9
,
THERMAL_RUNAWAY_PROTECTION_BED_PERIOD
,
THERMAL_RUNAWAY_PROTECTION_BED_HYSTERESIS
);
#endif
#ifdef PIDTEMPBED
pid_input
=
current_temperature_bed
;
#ifndef PID_OPENLOOP
pid_error_bed
=
target_temperature_bed
-
pid_input
;
pTerm_bed
=
bedKp
*
pid_error_bed
;
...
...
@@ -699,7 +685,8 @@ void manage_heater()
if
(
pid_output
>
MAX_BED_POWER
)
{
if
(
pid_error_bed
>
0
)
temp_iState_bed
-=
pid_error_bed
;
// conditional un-integration
pid_output
=
MAX_BED_POWER
;
}
else
if
(
pid_output
<
0
){
}
else
if
(
pid_output
<
0
)
{
if
(
pid_error_bed
<
0
)
temp_iState_bed
-=
pid_error_bed
;
// conditional un-integration
pid_output
=
0
;
}
...
...
@@ -723,8 +710,7 @@ void manage_heater()
SERIAL_ECHOLN
(
dTerm_bed
);
#endif //PID_BED_DEBUG
if
((
current_temperature_bed
>
BED_MINTEMP
)
&&
(
current_temperature_bed
<
BED_MAXTEMP
))
{
if
((
current_temperature_bed
>
BED_MINTEMP
)
&&
(
current_temperature_bed
<
BED_MAXTEMP
))
{
soft_pwm_bed
=
(
int
)
pid_output
>>
1
;
}
else
{
...
...
@@ -733,47 +719,38 @@ void manage_heater()
#elif !defined(BED_LIMIT_SWITCHING)
// Check if temperature is within the correct range
if
((
current_temperature_bed
>
BED_MINTEMP
)
&&
(
current_temperature_bed
<
BED_MAXTEMP
))
{
if
(
current_temperature_bed
>=
target_temperature_bed
)
{
if
((
current_temperature_bed
>
BED_MINTEMP
)
&&
(
current_temperature_bed
<
BED_MAXTEMP
))
{
if
(
current_temperature_bed
>=
target_temperature_bed
)
{
soft_pwm_bed
=
0
;
}
else
{
else
{
soft_pwm_bed
=
MAX_BED_POWER
>>
1
;
}
}
else
{
else
{
soft_pwm_bed
=
0
;
WRITE
(
HEATER_BED_PIN
,
LOW
);
}
#else //#ifdef BED_LIMIT_SWITCHING
// Check if temperature is within the correct band
if
((
current_temperature_bed
>
BED_MINTEMP
)
&&
(
current_temperature_bed
<
BED_MAXTEMP
))
{
if
(
current_temperature_bed
>
target_temperature_bed
+
BED_HYSTERESIS
)
{
if
((
current_temperature_bed
>
BED_MINTEMP
)
&&
(
current_temperature_bed
<
BED_MAXTEMP
))
{
if
(
current_temperature_bed
>
target_temperature_bed
+
BED_HYSTERESIS
)
{
soft_pwm_bed
=
0
;
}
else
if
(
current_temperature_bed
<=
target_temperature_bed
-
BED_HYSTERESIS
)
{
else
if
(
current_temperature_bed
<=
target_temperature_bed
-
BED_HYSTERESIS
)
{
soft_pwm_bed
=
MAX_BED_POWER
>>
1
;
}
}
else
{
else
{
soft_pwm_bed
=
0
;
WRITE
(
HEATER_BED_PIN
,
LOW
);
}
#endif
#endif
#endif
//BED_LIMIT_SWITCHING
#endif
//TEMP_SENSOR_BED != 0
//code for controlling the extruder rate based on the width sensor
#ifdef FILAMENT_SENSOR
if
(
filament_sensor
)
{
//code for controlling the extruder rate based on the width sensor
#ifdef FILAMENT_SENSOR
if
(
filament_sensor
)
{
meas_shift_index
=
delay_index1
-
meas_delay_cm
;
if
(
meas_shift_index
<
0
)
meas_shift_index
=
meas_shift_index
+
(
MAX_MEASUREMENT_DELAY
+
1
);
//loop around buffer if needed
...
...
@@ -790,18 +767,19 @@ void manage_heater()
if
(
volumetric_multiplier
[
FILAMENT_SENSOR_EXTRUDER_NUM
]
<
0.01
)
volumetric_multiplier
[
FILAMENT_SENSOR_EXTRUDER_NUM
]
=
0.01
;
}
#endif
#endif //FILAMENT_SENSOR
}
#define PGM_RD_W(x) (short)pgm_read_word(&x)
// Derived from RepRap FiveD extruder::getTemperature()
// For hot end temperature measurement.
static
float
analog2temp
(
int
raw
,
uint8_t
e
)
{
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
static
float
analog2temp
(
int
raw
,
uint8_t
e
)
{
#ifdef TEMP_SENSOR_1_AS_REDUNDANT
if
(
e
>
EXTRUDERS
)
#else
#else
if
(
e
>=
EXTRUDERS
)
#endif
#endif
{
SERIAL_ERROR_START
;
SERIAL_ERROR
((
int
)
e
);
...
...
@@ -811,21 +789,16 @@ static float analog2temp(int raw, uint8_t e) {
}
#ifdef HEATER_0_USES_MAX6675
if
(
e
==
0
)
{
return
0.25
*
raw
;
}
#endif
if
(
heater_ttbl_map
[
e
]
!=
NULL
)
{
if
(
heater_ttbl_map
[
e
]
!=
NULL
)
{
float
celsius
=
0
;
uint8_t
i
;
short
(
*
tt
)[][
2
]
=
(
short
(
*
)[][
2
])(
heater_ttbl_map
[
e
]);
for
(
i
=
1
;
i
<
heater_ttbllen_map
[
e
];
i
++
)
{
if
(
PGM_RD_W
((
*
tt
)[
i
][
0
])
>
raw
)
{
for
(
i
=
1
;
i
<
heater_ttbllen_map
[
e
];
i
++
)
{
if
(
PGM_RD_W
((
*
tt
)[
i
][
0
])
>
raw
)
{
celsius
=
PGM_RD_W
((
*
tt
)[
i
-
1
][
1
])
+
(
raw
-
PGM_RD_W
((
*
tt
)[
i
-
1
][
0
]))
*
(
float
)(
PGM_RD_W
((
*
tt
)[
i
][
1
])
-
PGM_RD_W
((
*
tt
)[
i
-
1
][
1
]))
/
...
...
@@ -844,15 +817,14 @@ static float analog2temp(int raw, uint8_t e) {
// Derived from RepRap FiveD extruder::getTemperature()
// For bed temperature measurement.
static
float
analog2tempBed
(
int
raw
)
{
static
float
analog2tempBed
(
int
raw
)
{
#ifdef BED_USES_THERMISTOR
float
celsius
=
0
;
byte
i
;
for
(
i
=
1
;
i
<
BEDTEMPTABLE_LEN
;
i
++
)
{
if
(
PGM_RD_W
(
BEDTEMPTABLE
[
i
][
0
])
>
raw
)
{
for
(
i
=
1
;
i
<
BEDTEMPTABLE_LEN
;
i
++
)
{
if
(
PGM_RD_W
(
BEDTEMPTABLE
[
i
][
0
])
>
raw
)
{
celsius
=
PGM_RD_W
(
BEDTEMPTABLE
[
i
-
1
][
1
])
+
(
raw
-
PGM_RD_W
(
BEDTEMPTABLE
[
i
-
1
][
0
]))
*
(
float
)(
PGM_RD_W
(
BEDTEMPTABLE
[
i
][
1
])
-
PGM_RD_W
(
BEDTEMPTABLE
[
i
-
1
][
1
]))
/
...
...
@@ -867,9 +839,9 @@ static float analog2tempBed(int raw) {
return
celsius
;
#elif defined BED_USES_AD595
return
((
raw
*
((
5.0
*
100.0
)
/
1024.0
)
/
OVERSAMPLENR
)
*
TEMP_SENSOR_AD595_GAIN
)
+
TEMP_SENSOR_AD595_OFFSET
;
#else
#else
//NO BED_USES_THERMISTOR
return
0
;
#endif
#endif
//BED_USES_THERMISTOR
}
/* Called to get the raw values into the the actual temperatures. The raw values are created in interrupt context,
...
...
@@ -882,11 +854,10 @@ static void updateTemperaturesFromRawValues()
#ifndef SINGLENOZZLE
for
(
uint8_t
e
=
0
;
e
<
EXTRUDERS
;
e
++
)
{
#else
uint8_t
e
=
0
;
{
#endif // !SINGLENOZZLE
{
current_temperature
[
e
]
=
analog2temp
(
current_temperature_raw
[
e
],
e
);
}
current_temperature_bed
=
analog2tempBed
(
current_temperature_bed_raw
);
...
...
@@ -904,67 +875,56 @@ static void updateTemperaturesFromRawValues()
CRITICAL_SECTION_END
;
}
// For converting raw Filament Width to milimeters
#ifdef FILAMENT_SENSOR
float
analog2widthFil
()
{
return
current_raw_filwidth
/
16383.0
*
5.0
;
//return current_raw_filwidth;
}
// For converting raw Filament Width to a ratio
int
widthFil_to_size_ratio
()
{
float
temp
;
float
analog2widthFil
()
{
return
current_raw_filwidth
/
16383.0
*
5.0
;
//return current_raw_filwidth;
}
temp
=
filament_width_meas
;
if
(
filament_width_meas
<
MEASURED_LOWER_LIMIT
)
// For converting raw Filament Width to a ratio
int
widthFil_to_size_ratio
()
{
float
temp
;
temp
=
filament_width_meas
;
if
(
filament_width_meas
<
MEASURED_LOWER_LIMIT
)
temp
=
filament_width_nominal
;
//assume sensor cut out
else
if
(
filament_width_meas
>
MEASURED_UPPER_LIMIT
)
else
if
(
filament_width_meas
>
MEASURED_UPPER_LIMIT
)
temp
=
MEASURED_UPPER_LIMIT
;
return
(
filament_width_nominal
/
temp
*
100
);
}
return
(
filament_width_nominal
/
temp
*
100
);
}
#endif
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
MCUCR
=
(
1
<<
JTD
);
MCUCR
=
(
1
<<
JTD
);
#endif
#endif
// Finish init of mult extruder arrays
#ifndef SINGLENOZZLE
for
(
uint8_t
e
=
0
;
e
<
EXTRUDERS
;
e
++
)
{
#else
uint8_t
e
=
0
;
{
#endif // !SINGLENOZZLE
{
// populate with the first value
maxttemp
[
e
]
=
maxttemp
[
0
];
#ifdef PIDTEMP
#ifdef PIDTEMP
temp_iState_min
[
e
]
=
0.0
;
temp_iState_max
[
e
]
=
PID_INTEGRAL_DRIVE_MAX
/
Ki
[
e
];
#endif //PIDTEMP
#ifdef PIDTEMPBED
#endif //PIDTEMP
#ifdef PIDTEMPBED
temp_iState_min_bed
=
0.0
;
temp_iState_max_bed
=
PID_INTEGRAL_DRIVE_MAX
/
bedKi
;
#endif //PIDTEMPBED
#endif //PIDTEMPBED
}
#if defined(HEATER_0_PIN) && (HEATER_0_PIN > -1)
SET_OUTPUT
(
HEATER_0_PIN
);
#endif
#ifndef SINGLENOZZLE
#if defined(HEATER_1_PIN) && (HEATER_1_PIN > -1)
SET_OUTPUT
(
HEATER_1_PIN
);
...
...
@@ -980,6 +940,7 @@ void tp_init()
#if defined(HEATER_BED_PIN) && (HEATER_BED_PIN > -1)
SET_OUTPUT
(
HEATER_BED_PIN
);
#endif
#if defined(FAN_PIN) && (FAN_PIN > -1)
SET_OUTPUT
(
FAN_PIN
);
#ifdef FAST_PWM_FAN
...
...
@@ -991,7 +952,6 @@ void tp_init()
#endif
#ifdef HEATER_0_USES_MAX6675
#ifndef SDSUPPORT
SET_OUTPUT
(
SCK_PIN
);
WRITE
(
SCK_PIN
,
0
);
...
...
@@ -1004,11 +964,10 @@ void tp_init()
#else
pinMode
(
SS_PIN
,
OUTPUT
);
digitalWrite
(
SS_PIN
,
HIGH
);
#endif
#endif
//SDSUPPORT
SET_OUTPUT
(
MAX6675_SS
);
WRITE
(
MAX6675_SS
,
1
);
#endif //HEATER_0_USES_MAX6675
// Set analog inputs
...
...
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