Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT Monitoring Module
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
DIOT Monitoring Module
Commits
494ccbf9
Commit
494ccbf9
authored
Sep 18, 2023
by
Alén Arias Vázquez
😎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added sw filter to not update values hier that 4000.0 rpms
parent
2fdc7e88
Pipeline
#4865
passed with stage
in 1 minute and 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
main.c
main_fw/src/main.c
+26
-3
No files found.
main_fw/src/main.c
View file @
494ccbf9
...
...
@@ -52,8 +52,11 @@ static uint16_t iter __xMR;
static
uint16_t
fan_ramp_up_count
__xMR
=
0
;
#endif
/* MAX Speed Datasheet: 3600.0 */
#define FAN_MAX_RPMS 4000.0
static
volatile
uint16_t
tacho_cnt
[
3
]
__xMR
;
static
volatile
uint16_t
tacho_rpm
[
3
]
__xMR
;
static
volatile
uint16_t
tacho_rpm_prev
[
3
]
__xMR
;
// when fan_cmdrpm is 0, setfrpms and temp_curve_points_y represent
// duty cycle (0 to 1000)
...
...
@@ -233,7 +236,12 @@ void __xMR update_rpm()
if
(
fan_installed
[
0
])
{
tacho_rpm
[
0
]
=
60
*
tacho_cnt
[
0
]
/
(
1
+
fan_ppr
[
0
]);
tacho_cnt
[
0
]
=
0
;
frpms_lin
[
0
]
=
float_to_linear
(
tacho_rpm
[
0
]);
if
(
tacho_rpm
[
0
]
<=
FAN_MAX_RPMS
)
{
frpms_lin
[
0
]
=
float_to_linear
(
tacho_rpm
[
0
]);
tacho_rpm_prev
[
0
]
=
tacho_rpm
[
0
];
}
else
{
frpms_lin
[
0
]
=
float_to_linear
(
tacho_rpm_prev
[
0
]);
}
}
else
{
tacho_rpm
[
0
]
=
0
;
tacho_cnt
[
0
]
=
0
;
...
...
@@ -243,7 +251,12 @@ void __xMR update_rpm()
if
(
fan_installed
[
1
])
{
tacho_rpm
[
1
]
=
60
*
tacho_cnt
[
1
]
/
(
1
+
fan_ppr
[
1
]);
tacho_cnt
[
1
]
=
0
;
frpms_lin
[
1
]
=
float_to_linear
(
tacho_rpm
[
1
]);
if
(
tacho_rpm
[
1
]
<=
FAN_MAX_RPMS
)
{
frpms_lin
[
1
]
=
float_to_linear
(
tacho_rpm
[
1
]);
tacho_rpm_prev
[
1
]
=
tacho_rpm
[
1
];
}
else
{
frpms_lin
[
1
]
=
float_to_linear
(
tacho_rpm_prev
[
1
]);
}
}
else
{
tacho_rpm
[
1
]
=
0
;
tacho_cnt
[
1
]
=
0
;
...
...
@@ -253,7 +266,12 @@ void __xMR update_rpm()
if
(
fan_installed
[
2
])
{
tacho_rpm
[
2
]
=
60
*
tacho_cnt
[
2
]
/
(
1
+
fan_ppr
[
2
]);
tacho_cnt
[
2
]
=
0
;
frpms_lin
[
2
]
=
float_to_linear
(
tacho_rpm
[
2
]);
if
(
tacho_rpm
[
2
]
<=
FAN_MAX_RPMS
)
{
frpms_lin
[
2
]
=
float_to_linear
(
tacho_rpm
[
2
]);
tacho_rpm_prev
[
2
]
=
tacho_rpm
[
2
];
}
else
{
frpms_lin
[
2
]
=
float_to_linear
(
tacho_rpm_prev
[
2
]);
}
}
else
{
tacho_rpm
[
2
]
=
0
;
tacho_cnt
[
2
]
=
0
;
...
...
@@ -578,6 +596,11 @@ endless_loop(void)
int
main
(
void
)
{
/* initialize previous value to 0 */
tacho_rpm_prev
[
0
]
=
0
.
0
;
tacho_rpm_prev
[
1
]
=
0
.
0
;
tacho_rpm_prev
[
2
]
=
0
.
0
;
/* Initializes MCU, drivers and middleware */
atmel_start_init
();
gpio_set_pin_pull_mode
(
ADDR0
,
GPIO_PULL_UP
);
...
...
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