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
c8f7db18
Commit
c8f7db18
authored
May 13, 2016
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial code for flowmeter
parent
1540c3f7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
0 deletions
+39
-0
flowmeter.cpp
MK/module/flowmeter/flowmeter.cpp
+39
-0
flowmeter.h
MK/module/flowmeter/flowmeter.h
+0
-0
No files found.
MK/module/flowmeter/flowmeter.cpp
0 → 100644
View file @
c8f7db18
volatile
byte
flowrate_pulsecount
;
float
flowrate
;
unsigned
int
flowml
;
static
millis_t
flowmeter_timer
=
0
;
void
flow_init
()
{
flowrate
=
0
;
pulsecount
=
0
;
flowml
=
0
;
pinMode
(
FLOWMETER_PIN
,
INPUT
);
attachInterrupt
(
FLOWMETER_INTERRUPT
,
flowrate_pulsecounter
,
FALLING
);
}
void
flowrate_manage
()
{
millis_t
=
now
;
now
=
millis
()
if
(
ELAPSED
(
now
,
flowmeter_timer
)
{
detachInterrupt
(
FLOWMETER_INTERRUPT
);
flowrate
=
((
1000.0
/
(
now
-
flowmeter_timer
))
*
flowrate_pulsecount
)
/
FLOWMETER_CALIBRATION
;
flowmeter_timer
=
now
+
1000UL
;
flowml
=
(
flowrate
/
60
)
*
1000
;
pulseCount
=
0
;
attachInterrupt
(
FLOWMETER_INTERRUPT
,
flowrate_pulsecounter
,,
FALLING
);
}
}
void
flowrate_pulsecounter
()
{
// Increment the pulse counter
flowrate_pulsecount
++
;
}
MK/module/flowmeter/flowmeter.h
0 → 100644
View file @
c8f7db18
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