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
1e7265b6
Commit
1e7265b6
authored
May 06, 2016
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix ADVANCED LPC
parent
fd9eeea6
Changes
12
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
295 additions
and
88 deletions
+295
-88
Configuration_Feature.h
MK/Configuration_Feature.h
+40
-8
MK_Main.cpp
MK/module/MK_Main.cpp
+25
-9
MK_Main.h
MK/module/MK_Main.h
+8
-0
conditionals.h
MK/module/conditionals.h
+1
-1
language.h
MK/module/language/language.h
+1
-1
language_it.h
MK/module/language/language_it.h
+6
-6
planner.cpp
MK/module/motion/planner.cpp
+14
-1
planner.h
MK/module/motion/planner.h
+9
-2
stepper.cpp
MK/module/motion/stepper.cpp
+139
-52
stepper_indirection.h
MK/module/motion/stepper_indirection.h
+0
-1
sanitycheck.h
MK/module/sanitycheck.h
+6
-0
temperature.cpp
MK/module/temperature/temperature.cpp
+46
-7
No files found.
MK/Configuration_Feature.h
View file @
1e7265b6
...
...
@@ -268,17 +268,37 @@
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
// Whenever an M104 or M109 increases the target temperature the firmware will wait for the
// WATCH TEMP PERIOD to expire, and if the temperature hasn't increased by WATCH TEMP INCREASE
// degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
//but only if the current temperature is far enough below the target for a reliable test.
#define WATCH_TEMP_PERIOD 16 // Seconds
#define WATCH_TEMP_INCREASE 4 // Degrees Celsius
/**
* Whenever an M104 or M109 increases the target temperature the firmware will wait for the
* WATCH TEMP PERIOD to expire, and if the temperature hasn't increased by WATCH TEMP INCREASE
* degrees, the machine is halted, requiring a hard reset. This test restarts with any M104/M109,
* but only if the current temperature is far enough below the target for a reliable test.
*
* If you get false positives for "Heating failed" increase WATCH TEMP PERIOD and/or decrease WATCH TEMP INCREASE
* WATCH TEMP INCREASE should not be below 2.
*/
#define WATCH_TEMP_PERIOD 20 // Seconds
#define WATCH_TEMP_INCREASE 2 // Degrees Celsius
/**
* Thermal Protection parameters for the bed are just as above for hotends.
*/
//#define THERMAL_PROTECTION_BED
#define THERMAL_PROTECTION_BED_PERIOD 20 // Seconds
#define THERMAL_PROTECTION_BED_HYSTERESIS 2 // Degrees Celsius
/**
* Whenever an M140 or M190 increases the target temperature the firmware will wait for the
* WATCH BED TEMP PERIOD to expire, and if the temperature hasn't increased by WATCH BED TEMP INCREASE
* degrees, the machine is halted, requiring a hard reset. This test restarts with any M140/M190,
* but only if the current temperature is far enough below the target for a reliable test.
*
* If you get too many "Heating failed" errors, increase WATCH BED TEMP PERIOD and/or decrease
* WATCH BED TEMP INCREASE. (WATCH BED TEMP INCREASE should not be below 2.)
*/
#define WATCH_BED_TEMP_PERIOD 60 // Seconds
#define WATCH_BED_TEMP_INCREASE 2 // Degrees Celsius
/********************************************************************************/
...
...
@@ -563,9 +583,21 @@
*****************************************************************************************/
//#define ADVANCE
#define EXTRUDER_ADVANCE_K .0
#define EXTRUDER_ADVANCE_K
0
.0
#define D_FILAMENT 1.75
#define STEPS_PER_CUBIC_MM_E 0.85
/*****************************************************************************************/
/*****************************************************************************************
****************** Extruder Advance Linear Pressure Control *****************************
*****************************************************************************************
* *
* Assumption: advance = k * (delta velocity) *
* K=0 means advance disabled. A good value for a gregs wade extruder will be around K=75*
* *
*****************************************************************************************/
//#define ADVANCE_LPC
#define ADVANCE_LPC_K 75
/*****************************************************************************************/
...
...
MK/module/MK_Main.cpp
View file @
1e7265b6
...
...
@@ -5356,7 +5356,7 @@ inline void gcode_M92() {
#endif
/**
* M104: Set hot
end temperature
* M104: Set hotend temperature
*/
inline
void
gcode_M104
()
{
if
(
setTargetedExtruder
(
104
))
return
;
...
...
@@ -6368,7 +6368,7 @@ inline void gcode_M226() {
* M363: SCARA calibration: Move to cal-position PsiB (90 deg calibration - steps per degree)
*/
inline
bool
gcode_M363
()
{
ECHO_LM
(
DB
,
"Cal: Psi 90 "
);
ECHO_LM
(
DB
,
"Cal: Psi 90 "
);
return
SCARA_move_to_cal
(
50
,
90
);
}
...
...
@@ -7230,6 +7230,17 @@ inline void gcode_M503() {
}
#endif
#if ENABLED(ADVANCE_LPC)
/**
* M905: Set advance factor
*/
inline
void
gcode_M905
()
{
st_synchronize
();
if
(
code_seen
(
'K'
))
extruder_advance_k
=
code_value
();
ECHO_LMV
(
DB
,
"Advance factor = "
,
extruder_advance_k
);
}
#endif
#if MB(ALLIGATOR)
/**
* M906: Set motor currents
...
...
@@ -7866,14 +7877,14 @@ void process_next_command() {
case
112
:
// M112 Emergency Stop
gcode_M112
();
break
;
case
114
:
// M114 Report current position
gcode_M114
();
break
;
#if ENABLED(HOST_KEEPALIVE_FEATURE)
case
113
:
// M113: Set Host Keepalive interval
gcode_M113
();
break
;
#endif
case
114
:
// M114 Report current position
gcode_M114
();
break
;
case
115
:
// M115 Report capabilities
gcode_M115
();
break
;
...
...
@@ -8090,7 +8101,7 @@ void process_next_command() {
#endif
#if ENABLED(FILAMENTCHANGEENABLE)
case
600
:
//Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
case
600
:
//
Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
gcode_M600
();
break
;
#endif
...
...
@@ -8104,6 +8115,11 @@ void process_next_command() {
gcode_M666
();
break
;
#endif
#if ENABLED(ADVANCE_LPC)
case
905
:
// M905 Set advance factor.
gcode_M905
();
break
;
#endif
#if MB(ALLIGATOR)
case
906
:
// M906 Set motor currents XYZ T0-4 E
gcode_M906
();
break
;
...
...
MK/module/MK_Main.h
View file @
1e7265b6
...
...
@@ -36,6 +36,10 @@ void idle(
void
manage_inactivity
(
bool
ignore_stepper_queue
=
false
);
#if ENABLED(DUAL_X_CARRIAGE)
extern
bool
extruder_duplication_enabled
;
#endif
void
FlushSerialRequestResend
();
void
ok_to_send
();
...
...
@@ -134,6 +138,10 @@ extern bool axis_known_position[3];
extern
bool
axis_homed
[
3
];
extern
float
zprobe_zoffset
;
#if ENABLED(ADVANCE_LPC)
extern
int
extruder_advance_k
;
#endif
#if HEATER_USES_AD595
extern
float
ad595_offset
[
HOTENDS
];
extern
float
ad595_gain
[
HOTENDS
];
...
...
MK/module/conditionals.h
View file @
1e7265b6
...
...
@@ -505,7 +505,7 @@
*/
#if ENABLED(ADVANCE)
#define EXTRUSION_AREA (0.25 * (D_FILAMENT) * (D_FILAMENT) * M_PI)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS + active_extruder] /
EXTRUSION_AREA
)
#define STEPS_PER_CUBIC_MM_E (axis_steps_per_unit[E_AXIS + active_extruder] /
(EXTRUSION_AREA)
)
#endif
/**
...
...
MK/module/language/language.h
View file @
1e7265b6
...
...
@@ -221,7 +221,7 @@
#define SERIAL_HEATER_BED "bed"
#define SERIAL_STOPPED_HEATER ", system stopped! Heater_ID: "
//#define SERIAL_REDUNDANCY
"Heater switched off. Temperature difference between temp sensors is too high !"
#define SERIAL_REDUNDANCY
"Heater switched off. Temperature difference between temp sensors is too high !"
#define SERIAL_T_HEATING_FAILED "Heating failed"
#define SERIAL_T_THERMAL_RUNAWAY "Thermal Runaway"
#define SERIAL_T_MAXTEMP "MAXTEMP triggered"
...
...
MK/module/language/language_it.h
View file @
1e7265b6
...
...
@@ -151,13 +151,13 @@
#define MSG_BABYSTEP_Z MSG_BABYSTEP " " MSG_Z
#define MSG_ENDSTOP_ABORT "Finecorsa abort."
#define MSG_HEATING_FAILED_LCD "Riscaldamento fallito"
#define MSG_ERR_REDUNDANT_TEMP "
REDUNDANT TEMP ERROR
"
#define MSG_THERMAL_RUNAWAY "T
HERMAL RUNAWAY
"
#define MSG_ERR_REDUNDANT_TEMP "
Err: TEMP RIDONDANTI
"
#define MSG_THERMAL_RUNAWAY "T
EMP FUORI CONTROLLO
"
#define MSG_AD595 "AD595 Offset & Gain"
#define MSG_ERR_MAXTEMP "
MAXTEMP ERROR
"
#define MSG_ERR_MINTEMP "
MINTEMP ERROR
"
#define MSG_ERR_MAXTEMP_BED "
MAXTEMP BED ERROR
"
#define MSG_ERR_MINTEMP_BED "
MINTEMP BED ERROR
"
#define MSG_ERR_MAXTEMP "
Err: TEMP MASSIMA
"
#define MSG_ERR_MINTEMP "
Err: TEMP MINIMA
"
#define MSG_ERR_MAXTEMP_BED "
Err: TEMP MASSIMA PIATTO
"
#define MSG_ERR_MINTEMP_BED "
Err: TEMP MINIMA PIATTO
"
#define MSG_END_DAY "giorni"
#define MSG_END_HOUR "ore"
#define MSG_END_MINUTE "minuti"
...
...
MK/module/motion/planner.cpp
View file @
1e7265b6
...
...
@@ -1126,7 +1126,20 @@ float junction_deviation = 0.1;
ECHO_SMV(OK, "advance :", block->advance/256);
ECHO_EMV("advance rate :", block->advance_rate/256);
*/
#endif // ADVANCE
#elif ENABLED(ADVANCE_LPC) // ADVANCE_LPC
// bse == allsteps: A problem occurs when there's a very tiny move before a retract.
// In this case, the retract and the move will be executed together.
// This leads to an enormous number of advance steps due to a huge e_acceleration.
// The math is correct, but you don't want a retract move done with advance!
// So this situation is filtered out here.
if
(
!
bse
||
(
!
bsx
&&
!
bsy
&&
!
bsz
)
||
extruder_advance_k
==
0
||
bse
==
allsteps
)
{
block
->
use_advance_lead
=
false
;
}
else
{
block
->
use_advance_lead
=
true
;
block
->
e_speed_multiplier8
=
(
block
->
steps
[
E_AXIS
]
<<
8
)
/
block
->
step_event_count
;
}
#endif
calculate_trapezoid_for_block
(
block
,
block
->
entry_speed
/
block
->
nominal_speed
,
safe_speed
/
block
->
nominal_speed
);
...
...
MK/module/motion/planner.h
View file @
1e7265b6
...
...
@@ -49,25 +49,32 @@
// This struct is used when buffering the setup for each linear movement "nominal" values are as specified in
// the source g-code and may never actually be reached if acceleration management is active.
typedef
struct
{
unsigned
char
active_driver
;
// Selects the active driver
// Fields used by the bresenham algorithm for tracing the line
unsigned
long
steps
[
NUM_AXIS
];
// Step count along each axis
unsigned
long
step_event_count
;
// The number of step events required to complete this block
#if ENABLED(COLOR_MIXING_EXTRUDER)
unsigned
long
mix_event_count
[
DRIVER_EXTRUDERS
];
// Step count for each stepper in a mixing extruder
#endif
unsigned
long
step_event_count
;
// The number of step events required to complete this block
long
accelerate_until
;
// The index of the step event on which to stop acceleration
long
decelerate_after
;
// The index of the step event on which to start decelerating
long
acceleration_rate
;
// The acceleration rate used for acceleration calculation
unsigned
char
direction_bits
;
// The direction bit set for this block (refers to *_DIRECTION_BIT in config.h)
unsigned
char
active_driver
;
// Selects the active driver
// Advance extrusion
#if ENABLED(ADVANCE)
long
advance_rate
;
volatile
long
initial_advance
;
volatile
long
final_advance
;
float
advance
;
#elif ENABLED(ADVANCE_LPC)
bool
use_advance_lead
;
int
e_speed_multiplier8
;
#endif
// Fields used by the motion planner to manage acceleration
...
...
MK/module/motion/stepper.cpp
View file @
1e7265b6
This diff is collapsed.
Click to expand it.
MK/module/motion/stepper_indirection.h
View file @
1e7265b6
...
...
@@ -232,7 +232,6 @@
#define NORM_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE(!INVERT_E1_DIR); break; case 0: E0_DIR_WRITE(!INVERT_E0_DIR); break; }}
#define REV_E_DIR() { switch(current_block->active_driver) { case 1: E1_DIR_WRITE( INVERT_E1_DIR); break; case 0: E0_DIR_WRITE( INVERT_E0_DIR); break; }}
#else
extern
bool
extruder_duplication_enabled
;
#define E_STEP_WRITE(v) { if(extruder_duplication_enabled) { E0_STEP_WRITE(v); E1_STEP_WRITE(v); } else if(current_block->active_driver == 1) { E1_STEP_WRITE(v); } else { E0_STEP_WRITE(v); }}
#define NORM_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE(!INVERT_E0_DIR); E1_DIR_WRITE(!INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE(!INVERT_E1_DIR); } else { E0_DIR_WRITE(!INVERT_E0_DIR); }}
#define REV_E_DIR() { if(extruder_duplication_enabled) { E0_DIR_WRITE( INVERT_E0_DIR); E1_DIR_WRITE( INVERT_E1_DIR); } else if(current_block->active_driver == 1) { E1_DIR_WRITE( INVERT_E1_DIR); } else { E0_DIR_WRITE( INVERT_E0_DIR); }}
...
...
MK/module/sanitycheck.h
View file @
1e7265b6
...
...
@@ -391,6 +391,12 @@
#endif
#endif
/**
* Advance Extrusion
*/
#if ENABLED(ADVANCE) && ENABLED(ADVANCE_LPC)
#error You can enable ADVANCE or ADVANCE_LPC, but not both.
#endif
#if ENABLED(ADVANCE)
#if DISABLED(EXTRUDER_ADVANCE_K)
#error DEPENDENCY ERROR: Missing setting EXTRUDER_ADVANCE_K
...
...
MK/module/temperature/temperature.cpp
View file @
1e7265b6
...
...
@@ -200,6 +200,11 @@ static void updateTemperaturesFromRawValues();
millis_t
watch_heater_next_ms
[
HOTENDS
]
=
{
0
};
#endif
#if ENABLED(THERMAL_PROTECTION_BED)
int
watch_target_bed_temp
=
0
;
millis_t
watch_bed_next_ms
=
0
;
#endif
#if DISABLED(SOFT_PWM_SCALE)
#define SOFT_PWM_SCALE 0
#endif
...
...
@@ -286,12 +291,12 @@ void autotempShutdown() {
#if HAS(AUTO_FAN)
if
(
ms
>
next_auto_fan_check_ms
)
{
checkExtruderAutoFans
();
next_auto_fan_check_ms
=
ms
+
2500
;
next_auto_fan_check_ms
=
ms
+
2500
UL
;
}
#endif
if
(
heating
&&
input
>
temp
)
{
if
(
ms
>
t2
+
5000
)
{
if
(
ms
>
t2
+
5000
UL
)
{
heating
=
false
;
if
(
hotend
<
0
)
soft_pwm_bed
=
(
bias
-
d
)
>>
1
;
...
...
@@ -304,7 +309,7 @@ void autotempShutdown() {
}
if
(
!
heating
&&
input
<
temp
)
{
if
(
ms
>
t1
+
5000
)
{
if
(
ms
>
t1
+
5000
UL
)
{
heating
=
true
;
t2
=
ms
;
t_low
=
t2
-
t1
;
...
...
@@ -699,7 +704,7 @@ void manage_heater() {
if
(
ct
<
max
(
HEATER_0_MINTEMP
,
0.01
))
min_temp_error
(
0
);
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || DISABLED(PIDTEMPBED) || HAS(AUTO_FAN)
#if ENABLED(THERMAL_PROTECTION_HOTENDS) ||
ENABLED(THERMAL_PROTECTION_BED) ||
DISABLED(PIDTEMPBED) || HAS(AUTO_FAN)
millis_t
ms
=
millis
();
#endif
...
...
@@ -733,9 +738,27 @@ void manage_heater() {
#endif // THERMAL_PROTECTION_HOTENDS
// Check if the temperature is failing to increase
#if ENABLED(THERMAL_PROTECTION_BED)
// Is it time to check the bed?
if
(
watch_bed_next_ms
&&
ELAPSED
(
ms
,
watch_bed_next_ms
))
{
// Has it failed to increase enough?
if
(
degBed
()
<
watch_target_bed_temp
)
{
// Stop!
_temp_error
(
-
1
,
PSTR
(
SERIAL_T_HEATING_FAILED
),
PSTR
(
MSG_HEATING_FAILED_LCD
));
}
else
{
// Start again if the target is still far off
start_watching_bed
();
}
}
#endif // THERMAL_PROTECTION_HOTENDS
#if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
if
(
fabs
(
current_temperature
[
0
]
-
redundant_temperature
)
>
MAX_REDUNDANT_TEMP_SENSOR_DIFF
)
{
_temp_error
(
0
,
PSTR
(
MSG_EXTRUDER_SWITCHED_OFF
),
PSTR
(
MSG_ERR_REDUNDANT_TEMP
));
_temp_error
(
0
,
PSTR
(
SERIAL_REDUNDANCY
),
PSTR
(
MSG_ERR_REDUNDANT_TEMP
));
}
#endif
...
...
@@ -791,7 +814,7 @@ void manage_heater() {
soft_pwm_bed
=
0
;
WRITE_HEATER_BED
(
LOW
);
}
#else // BED_LIMIT_SWITCHING
#else //
!PIDTEMPBED && !
BED_LIMIT_SWITCHING
// Check if temperature is within the correct range
if
(
current_temperature_bed
>
BED_MINTEMP
&&
current_temperature_bed
<
BED_MAXTEMP
)
{
soft_pwm_bed
=
current_temperature_bed
<
target_temperature_bed
?
MAX_BED_POWER
>>
1
:
0
;
...
...
@@ -1226,6 +1249,22 @@ void tp_init() {
}
#endif
#if ENABLED(THERMAL_PROTECTION_BED)
/**
* Start Heating Sanity Check for bed that are below
* their target temperature by a configurable margin.
* This is called when the temperature is set. (M140, M190)
*/
void
start_watching_bed
()
{
if
(
degBed
()
<
degTargetBed
()
-
(
WATCH_BED_TEMP_INCREASE
+
TEMP_BED_HYSTERESIS
+
1
))
{
watch_target_bed_temp
=
degBed
()
+
WATCH_BED_TEMP_INCREASE
;
watch_bed_next_ms
=
millis
()
+
(
WATCH_BED_TEMP_PERIOD
)
*
1000UL
;
}
else
watch_bed_next_ms
=
0
;
}
#endif
#if ENABLED(THERMAL_PROTECTION_HOTENDS) || ENABLED(THERMAL_PROTECTION_BED)
void
thermal_runaway_protection
(
TRState
*
state
,
millis_t
*
timer
,
float
temperature
,
float
target_temperature
,
int
heater_id
,
int
period_seconds
,
int
hysteresis_degc
)
{
...
...
@@ -1268,7 +1307,7 @@ void tp_init() {
if
(
temperature
>=
tr_target_temperature
[
heater_index
]
-
hysteresis_degc
)
*
timer
=
millis
();
// If the timer goes too long without a reset, trigger shutdown
else
if
(
millis
()
>
*
timer
+
period_seconds
*
1000UL
)
else
if
(
ELAPSED
(
millis
(),
*
timer
+
period_seconds
*
1000UL
)
)
*
state
=
TRRunaway
;
break
;
case
TRRunaway
:
...
...
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