Made a formula for calc speed
This commit is contained in:
parent
49c0874445
commit
d14044e8df
@ -4,8 +4,8 @@
|
|||||||
*
|
*
|
||||||
* Created on 13. mars 2024, 13:38
|
* Created on 13. mars 2024, 13:38
|
||||||
*/
|
*/
|
||||||
#include "uart.h"
|
|
||||||
#include "voltage.h"
|
|
||||||
|
|
||||||
#ifndef FANSEEEED_H
|
#ifndef FANSEEEED_H
|
||||||
#define FANSEEEED_H
|
#define FANSEEEED_H
|
||||||
@ -13,8 +13,14 @@
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
#include "uart.h"
|
||||||
int speed(uint16_t adcVal);
|
#include <stdbool.h>
|
||||||
|
#include <float.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <math.h>
|
||||||
|
int fan_speed(float value);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@ -1 +1,21 @@
|
|||||||
|
|
||||||
|
#include "fan speeeed.h"
|
||||||
|
|
||||||
|
int fan_speed(float value){
|
||||||
|
float fan_speed;
|
||||||
|
float p = 0;
|
||||||
|
float timelate = 0;
|
||||||
|
float starttime = 0;
|
||||||
|
int oldPR = 0;
|
||||||
|
int curlPR;
|
||||||
|
int f;
|
||||||
|
if (curlPr > 300 && oldPr < 300){
|
||||||
|
starttime = millis();
|
||||||
|
p =(starttime - timelate);
|
||||||
|
timelate = startime;
|
||||||
|
}
|
||||||
|
oldPR = curlPR;
|
||||||
|
f = ((1/p)*1000);
|
||||||
|
fan_speed = (f*60)/2;
|
||||||
|
return fan_speed;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user