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
185949fe
Commit
185949fe
authored
Mar 23, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #17 from simone97/patch-13
Added support for see the Power Consumption
parents
98906772
daf25b4e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
23 deletions
+98
-23
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+98
-23
No files found.
MarlinKimbra/Marlin_main.cpp
View file @
185949fe
...
...
@@ -333,6 +333,27 @@ uint8_t debugLevel = 0;
int
EtoPPressure
=
0
;
#endif //BARICUDA
#ifdef FILAMENTCHANGEENABLE
bool
filament_changing
=
false
;
#endif
#ifdef IDLE_OOZING_PREVENT || EXTRUDER_RUNOUT_PREVENT
unsigned
long
axis_last_activity
=
0
;
bool
axis_is_moving
=
false
;
#endif
#ifdef IDLE_OOZING_PREVENT
bool
IDLE_OOZING_retracted
[
EXTRUDERS
]
=
{
false
#if EXTRUDERS > 1
,
false
#if EXTRUDERS > 2
,
false
#if EXTRUDERS > 3
,
false
#endif
#endif
#endif
};
#endif
#ifdef FWRETRACT
bool
autoretract_enabled
=
false
;
bool
retracted
[
EXTRUDERS
]
=
{
false
...
...
@@ -379,7 +400,7 @@ uint8_t debugLevel = 0;
static
float
delta
[
3
]
=
{
0
,
0
,
0
};
#endif //SCARA
#if
def FILAMENT_SENSOR
#if
(defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
//Variables for Filament Sensor input
float
filament_width_nominal
=
DEFAULT_NOMINAL_FILAMENT_DIA
;
//Set nominal filament width, can be changed with M404
bool
filament_sensor
=
false
;
//M405 turns on filament_sensor control, M406 turns it off
...
...
@@ -391,6 +412,11 @@ uint8_t debugLevel = 0;
int
meas_delay_cm
=
MEASUREMENT_DELAY_CM
;
//distance delay setting
#endif
#if (defined(POWER_CONSUMPTION) && defined(POWER_CONSUMPTION_PIN) && POWER_CONSUMPTION_PIN >= 0)
unsigned
int
power_consumption_meas
=
0
;
unsigned
long
power_consumption_hour
=
0.0
;
#endif
#ifdef LASERBEAM
int
laser_ttl_modulation
=
0
;
#endif
...
...
@@ -1932,6 +1958,40 @@ bool extruder_duplication_enabled = false; // used in mode 2
void
refresh_cmd_timeout
(
void
)
{
previous_millis_cmd
=
millis
();
}
#ifdef IDLE_OOZING_PREVENT
void
IDLE_OOZING_retract
(
bool
retracting
)
{
if
(
retracting
&&
!
IDLE_OOZING_retracted
[
active_extruder
])
{
//SERIAL_ECHOLN("RETRACT FOR OOZING PREVENT");
destination
[
X_AXIS
]
=
current_position
[
X_AXIS
];
destination
[
Y_AXIS
]
=
current_position
[
Y_AXIS
];
destination
[
Z_AXIS
]
=
current_position
[
Z_AXIS
];
destination
[
E_AXIS
]
=
current_position
[
E_AXIS
];
current_position
[
E_AXIS
]
+=
IDLE_OOZING_LENGTH
/
volumetric_multiplier
[
active_extruder
];
plan_set_e_position
(
current_position
[
E_AXIS
]);
float
oldFeedrate
=
feedrate
;
feedrate
=
IDLE_OOZING_FEEDRATE
*
60
;
IDLE_OOZING_retracted
[
active_extruder
]
=
true
;
prepare_move
();
feedrate
=
oldFeedrate
;
}
else
if
(
!
retracting
&&
IDLE_OOZING_retracted
[
active_extruder
]){
//SERIAL_ECHOLN("EXTRUDE FOR OOZING PREVENT");
destination
[
X_AXIS
]
=
current_position
[
X_AXIS
];
destination
[
Y_AXIS
]
=
current_position
[
Y_AXIS
];
destination
[
Z_AXIS
]
=
current_position
[
Z_AXIS
];
destination
[
E_AXIS
]
=
current_position
[
E_AXIS
];
current_position
[
E_AXIS
]
-=
(
IDLE_OOZING_LENGTH
+
IDLE_OOZING_RECOVER_LENGTH
)
/
volumetric_multiplier
[
active_extruder
];
plan_set_e_position
(
current_position
[
E_AXIS
]);
float
oldFeedrate
=
feedrate
;
feedrate
=
IDLE_OOZING_RECOVER_FEEDRATE
*
60
;
IDLE_OOZING_retracted
[
active_extruder
]
=
false
;
prepare_move
();
feedrate
=
oldFeedrate
;
}
}
#endif
#ifdef FWRETRACT
void
retract
(
bool
retracting
,
bool
swapretract
=
false
)
{
...
...
@@ -2155,6 +2215,9 @@ inline void wait_bed() {
// G0-G1: Coordinated movement of X Y Z E axes
inline
void
gcode_G0_G1
()
{
if
(
!
Stopped
)
{
#ifdef IDLE_OOZING_PREVENT
IDLE_OOZING_retract
(
false
);
#endif
get_coordinates
();
// For X Y Z E F
#ifdef FWRETRACT
if
(
autoretract_enabled
)
{
...
...
@@ -3837,6 +3900,7 @@ inline void gcode_M204() {
#ifdef FILAMENTCHANGEENABLE
//M600: Pause for filament change X[pos] Y[pos] Z[relative lift] E[initial retract] L[later retract distance for removal]
inline
void
gcode_M600
()
{
filament_changing
=
true
;
float
target
[
NUM_AXIS
];
for
(
int
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
target
[
i
]
=
lastpos
[
i
]
=
current_position
[
i
];
...
...
@@ -3996,6 +4060,7 @@ inline void gcode_M204() {
for
(
int8_t
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
current_position
[
i
]
=
lastpos
[
i
];
plan_set_position
(
current_position
[
X_AXIS
],
current_position
[
Y_AXIS
],
current_position
[
Z_AXIS
],
current_position
[
E_AXIS
]);
#endif
filament_changing
=
false
;
}
#endif //FILAMENTCHANGEENABLE
...
...
@@ -5570,17 +5635,15 @@ void process_commands()
break
;
#endif // NABLE_AUTO_BED_LEVELING
#if
def FILAMENT_SENSOR
#if
(defined(FILAMENT_SENSOR) && defined(FILWIDTH_PIN) && FILWIDTH_PIN >= 0)
case
404
:
//M404 Enter the nominal filament width (3mm, 1.75mm ) N<3.0> or display nominal filament width
{
#if (FILWIDTH_PIN > -1)
if
(
code_seen
(
'D'
))
filament_width_nominal
=
code_value
();
else
{
SERIAL_PROTOCOLPGM
(
"Filament dia (nominal mm):"
);
SERIAL_PROTOCOLLN
(
filament_width_nominal
);
}
#endif
}
break
;
case
405
:
//M405 Turn on filament sensor for control
...
...
@@ -6121,6 +6184,9 @@ void clamp_to_software_endstops(float target[3])
void
prepare_move
()
{
#ifdef IDLE_OOZING_PREVENT || EXTRUDER_RUNOUT_PREVENT
axis_is_moving
=
true
;
#endif
clamp_to_software_endstops
(
destination
);
refresh_cmd_timeout
();
...
...
@@ -6140,6 +6206,7 @@ void prepare_move()
return
;
}
float
seconds
=
6000
*
cartesian_mm
/
feedrate
/
feedmultiply
;
int
steps
=
max
(
1
,
int
(
scara_segments_per_second
*
seconds
));
//SERIAL_ECHOPGM("mm="); SERIAL_ECHO(cartesian_mm);
//SERIAL_ECHOPGM(" seconds="); SERIAL_ECHO(seconds);
...
...
@@ -6249,6 +6316,11 @@ void prepare_move()
}
#endif // !(DELTA || SCARA)
#ifdef IDLE_OOZING_PREVENT || EXTRUDER_RUNOUT_PREVENT
axis_last_activity
=
millis
();
axis_is_moving
=
false
;
#endif
for
(
int8_t
i
=
0
;
i
<
NUM_AXIS
;
i
++
)
{
current_position
[
i
]
=
destination
[
i
];
}
...
...
@@ -6513,9 +6585,13 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
#if defined(CONTROLLERFAN_PIN) && CONTROLLERFAN_PIN > -1
controllerFan
();
//Check if fan should be turned on to cool stepper drivers down
#endif
#ifdef IDLE_OOZING_PREVENT
if
(
!
debugDryrun
()
&&
!
axis_is_moving
&&
!
filament_changing
&&
(
millis
()
-
axis_last_activity
)
>
IDLE_OOZING_SECONDS
*
1000
&&
degHotend
(
active_extruder
)
>
IDLE_OOZING_MINTEMP
)
{
IDLE_OOZING_retract
(
true
);
}
#endif
#ifdef EXTRUDER_RUNOUT_PREVENT
if
(
(
millis
()
-
previous_millis_cmd
)
>
EXTRUDER_RUNOUT_SECONDS
*
1000
)
if
(
degHotend
(
active_extruder
)
>
EXTRUDER_RUNOUT_MINTEMP
)
if
(
!
debugDryrun
()
&&
!
axis_is_moving
&&
!
filament_changing
&&
(
millis
()
-
axis_last_activity
)
>
EXTRUDER_RUNOUT_SECONDS
*
1000
&&
degHotend
(
active_extruder
)
>
EXTRUDER_RUNOUT_MINTEMP
)
{
bool
oldstatus
=
READ
(
E0_ENABLE_PIN
);
enable_e0
();
...
...
@@ -6527,7 +6603,6 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) //default argument s
current_position
[
E_AXIS
]
=
oldepos
;
destination
[
E_AXIS
]
=
oldedes
;
plan_set_e_position
(
oldepos
);
previous_millis_cmd
=
millis
();
st_synchronize
();
WRITE
(
E0_ENABLE_PIN
,
oldstatus
);
}
...
...
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