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
eaac0a2f
Commit
eaac0a2f
authored
May 13, 2016
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Finally, all seems to work as expected. Eureka!
parent
50c07eba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
17 deletions
+42
-17
MK_Main.cpp
MK/module/MK_Main.cpp
+23
-7
flowmeter.cpp
MK/module/flowmeter/flowmeter.cpp
+14
-9
flowmeter.h
MK/module/flowmeter/flowmeter.h
+1
-1
temperature.cpp
MK/module/temperature/temperature.cpp
+4
-0
No files found.
MK/module/MK_Main.cpp
View file @
eaac0a2f
...
@@ -42,6 +42,10 @@
...
@@ -42,6 +42,10 @@
CardReader
card
;
CardReader
card
;
#endif
#endif
#if ENABLED(FLOWMETER_SENSOR) && ENABLED(MINFLOW_PROTECTION)
bool
flow_firstread
=
false
;
#endif
bool
Running
=
true
;
bool
Running
=
true
;
bool
Printing
=
false
;
bool
Printing
=
false
;
...
@@ -749,6 +753,9 @@ void setup() {
...
@@ -749,6 +753,9 @@ void setup() {
#endif
#endif
#if ENABLED(FLOWMETER_SENSOR)
#if ENABLED(FLOWMETER_SENSOR)
#if ENABLED(MINFLOW_PROTECTION)
flow_firstread
=
false
;
#endif
flow_init
();
flow_init
();
#endif
#endif
...
@@ -2969,8 +2976,14 @@ inline void do_blocking_move_to_z(float z) { do_blocking_move_to(current_positio
...
@@ -2969,8 +2976,14 @@ inline void do_blocking_move_to_z(float z) { do_blocking_move_to(current_positio
#if ENABLED(FLOWMETER_SENSOR)
#if ENABLED(FLOWMETER_SENSOR)
void
print_flowratestates
()
{
void
print_flowratestates
()
{
ECHO_MV
(
" FLOW: "
,
get_flowrate
(),
1
);
float
readval
;
ECHO_M
(
" ml/min "
);
readval
=
get_flowrate
();
#if ENABLED(MINFLOW_PROTECTION)
if
(
readval
>
MINFLOW_PROTECTION
)
flow_firstread
=
true
;
#endif
ECHO_MV
(
" FLOW: "
,
readval
);
ECHO_M
(
" l/min "
);
}
}
#endif
#endif
...
@@ -9252,14 +9265,11 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
...
@@ -9252,14 +9265,11 @@ void manage_inactivity(bool ignore_stepper_queue/*=false*/) {
if
(
max_inactive_time
&&
ELAPSED
(
ms
,
previous_cmd_ms
+
max_inactive_time
))
kill
(
PSTR
(
MSG_KILLED
));
if
(
max_inactive_time
&&
ELAPSED
(
ms
,
previous_cmd_ms
+
max_inactive_time
))
kill
(
PSTR
(
MSG_KILLED
));
#if ENABLED(FLOWMETER_SENSOR) && ENABLED(MINFLOW_PROTECTION)
#if ENABLED(FLOWMETER_SENSOR) && ENABLED(MINFLOW_PROTECTION)
if
(
get_flowrate
()
<
(
MINFLOW_PROTECTION
*
1000
))
{
if
(
flow_firstread
&&
Printing
&&
(
get_flowrate
()
<
(
float
)
MINFLOW_PROTECTION
))
{
if
(
Printing
)
flow_firstread
=
false
;
kill
(
PSTR
(
MSG_KILLED
));
kill
(
PSTR
(
MSG_KILLED
));
//else
// stop();
}
}
#endif
#endif
if
(
stepper_inactive_time
&&
ELAPSED
(
ms
,
previous_cmd_ms
+
stepper_inactive_time
)
if
(
stepper_inactive_time
&&
ELAPSED
(
ms
,
previous_cmd_ms
+
stepper_inactive_time
)
&&
!
ignore_stepper_queue
&&
!
blocks_queued
())
{
&&
!
ignore_stepper_queue
&&
!
blocks_queued
())
{
#if DISABLE_X == true
#if DISABLE_X == true
...
@@ -9480,6 +9490,9 @@ void kill(const char* lcd_msg) {
...
@@ -9480,6 +9490,9 @@ void kill(const char* lcd_msg) {
#if ENABLED(KILL_METHOD) && KILL_METHOD == 1
#if ENABLED(KILL_METHOD) && KILL_METHOD == 1
HAL
::
resetHardware
();
HAL
::
resetHardware
();
#endif
#endif
#if ENABLED(FLOWMETER_SENSOR) && ENABLED(MINFLOW_PROTECTION)
flow_firstread
=
false
;
#endif
#if ENABLED(ULTRA_LCD)
#if ENABLED(ULTRA_LCD)
lcd_setalertstatuspgm
(
lcd_msg
);
lcd_setalertstatuspgm
(
lcd_msg
);
...
@@ -9593,6 +9606,9 @@ void kill(const char* lcd_msg) {
...
@@ -9593,6 +9606,9 @@ void kill(const char* lcd_msg) {
#endif // FAST_PWM_FAN
#endif // FAST_PWM_FAN
void
stop
()
{
void
stop
()
{
#if ENABLED(FLOWMETER_SENSOR) && ENABLED(MINFLOW_PROTECTION)
flow_firstread
=
false
;
#endif
disable_all_heaters
();
disable_all_heaters
();
disable_all_coolers
();
disable_all_coolers
();
#ifdef LASER
#ifdef LASER
...
...
MK/module/flowmeter/flowmeter.cpp
View file @
eaac0a2f
...
@@ -23,18 +23,16 @@
...
@@ -23,18 +23,16 @@
#if ENABLED(FLOWMETER_SENSOR)
#if ENABLED(FLOWMETER_SENSOR)
volatile
byte
flowrate_pulsecount
;
volatile
int
flowrate_pulsecount
;
float
flowrate
;
float
flowrate
;
unsigned
int
flowml
;
static
millis_t
flowmeter_timer
=
0
;
static
millis_t
flowmeter_timer
=
0
;
static
millis_t
lastflow
=
0
;
void
flowrate_pulsecounter
();
void
flowrate_pulsecounter
();
void
flow_init
()
{
void
flow_init
()
{
flowrate
=
0
;
flowrate
=
0
;
flowrate_pulsecount
=
0
;
flowrate_pulsecount
=
0
;
flowml
=
0
;
pinMode
(
FLOWMETER_PIN
,
INPUT
);
pinMode
(
FLOWMETER_PIN
,
INPUT
);
attachInterrupt
(
digitalPinToInterrupt
(
FLOWMETER_PIN
),
flowrate_pulsecounter
,
FALLING
);
attachInterrupt
(
digitalPinToInterrupt
(
FLOWMETER_PIN
),
flowrate_pulsecounter
,
FALLING
);
...
@@ -45,18 +43,25 @@ void flowrate_manage() {
...
@@ -45,18 +43,25 @@ void flowrate_manage() {
now
=
millis
();
now
=
millis
();
if
(
ELAPSED
(
now
,
flowmeter_timer
))
{
if
(
ELAPSED
(
now
,
flowmeter_timer
))
{
detachInterrupt
(
digitalPinToInterrupt
(
FLOWMETER_PIN
));
detachInterrupt
(
digitalPinToInterrupt
(
FLOWMETER_PIN
));
flowrate
=
((
1000.0
/
(
now
-
flowmeter_timer
))
*
flowrate_pulsecount
)
/
FLOWMETER_CALIBRATION
;
flowrate
=
(
float
)(((
1000.0
/
(
float
)((
float
)
now
-
(
float
)
lastflow
))
*
(
float
)
flowrate_pulsecount
)
/
(
float
)
FLOWMETER_CALIBRATION
);
#if ENABLED(FLOWMETER_DEBUG)
ECHO_M
(
" FLOWMETER DEBUG "
);
ECHO_MV
(
" flowrate:"
,
flowrate
);
ECHO_MV
(
" flowrate_pulsecount:"
,
flowrate_pulsecount
);
ECHO_MV
(
" CALIBRATION:"
,
FLOWMETER_CALIBRATION
);
ECHO_E
;
#endif
flowmeter_timer
=
now
+
1000UL
;
flowmeter_timer
=
now
+
1000UL
;
flowml
=
(
flowrate
/
60.0
)
*
1000
;
lastflow
=
now
;
flowrate_pulsecount
=
0
;
flowrate_pulsecount
=
0
;
attachInterrupt
(
digitalPinToInterrupt
(
FLOWMETER_PIN
),
flowrate_pulsecounter
,
FALLING
);
attachInterrupt
(
digitalPinToInterrupt
(
FLOWMETER_PIN
),
flowrate_pulsecounter
,
FALLING
);
}
}
}
}
in
t
get_flowrate
()
{
floa
t
get_flowrate
()
{
return
flow
ml
;
return
flow
rate
;
}
}
void
flowrate_pulsecounter
()
void
flowrate_pulsecounter
()
...
...
MK/module/flowmeter/flowmeter.h
View file @
eaac0a2f
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#if ENABLED(FLOWMETER_SENSOR)
#if ENABLED(FLOWMETER_SENSOR)
void
flowrate_manage
();
void
flowrate_manage
();
void
flow_init
();
void
flow_init
();
in
t
get_flowrate
();
floa
t
get_flowrate
();
#endif
#endif
...
...
MK/module/temperature/temperature.cpp
View file @
eaac0a2f
...
@@ -818,6 +818,10 @@ float get_pid_output(int h) {
...
@@ -818,6 +818,10 @@ float get_pid_output(int h) {
#if ENABLED(PIDTEMPCOOLER)
#if ENABLED(PIDTEMPCOOLER)
float
get_pid_output_cooler
()
{
float
get_pid_output_cooler
()
{
float
pid_output
;
float
pid_output
;
if
(
target_temperature_cooler
==
0
)
return
0
#if ENABLED(PID_OPENLOOP)
#if ENABLED(PID_OPENLOOP)
pid_output
=
constrain
(
target_temperature_cooler
,
0
,
MAX_COOLER_POWER
);
pid_output
=
constrain
(
target_temperature_cooler
,
0
,
MAX_COOLER_POWER
);
#else
#else
...
...
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