blob: 77c919f810e128a9881772f82d69eeee74cfcc5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* Fan.h
*
* Created on: 29 Jun 2016
* Author: David
*/
#ifndef SRC_FAN_H_
#define SRC_FAN_H_
#include "RepRapFirmware.h"
class Fan
{
private:
float val;
float minVal;
float triggerTemperature;
float lastPwm;
uint32_t blipTime; // in milliseconds
uint32_t blipStartTime;
uint16_t freq;
uint16_t heatersMonitored;
Pin pin;
bool inverted;
bool hardwareInverted;
bool blipping;
void Refresh();
void SetHardwarePwm(float pwmVal);
public:
bool IsEnabled() const { return pin != NoPin; }
float GetValue() const { return val; }
float GetMinValue() const { return minVal; }
float GetBlipTime() const { return (float)blipTime * MillisToSeconds; }
float GetPwmFrequency() const { return freq; }
bool GetInverted() const { return inverted; }
uint16_t GetHeatersMonitored() const { return heatersMonitored; }
float GetTriggerTemperature() const { return triggerTemperature; }
void Init(Pin p_pin, bool hwInverted);
void SetValue(float speed);
void SetMinValue(float speed);
void SetBlipTime(float t);
void SetInverted(bool inv);
void SetPwmFrequency(float p_freq);
void SetTriggerTemperature(float t) { triggerTemperature = t; }
void SetHeatersMonitored(uint16_t h);
void Check();
void Disable();
};
#endif /* SRC_FAN_H_ */
|