-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfig.cpp
More file actions
130 lines (119 loc) · 2.83 KB
/
config.cpp
File metadata and controls
130 lines (119 loc) · 2.83 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#include "config.h"
const uint8_t buttonPin = 0;
const uint8_t ledPin = 12 ;//Blink when in low speed mode
const uint8_t buzzerPin = 8; // beep beep beep. Must be analog or PWM compatible. -1 to disable beeping.
double waterTempAdjust(double val){
return val - 1.1;
}
// List of temperature sensors
const SensorDef sensorDefs[] = {
{
// Sensor name used when sending its temperature to serial
name: "Water",
// Sensor pin. Must be analog
pin: A2,
// Max temperature, that will make the buzzer beep as warning. Set to NAN to disable
maxTemp: 50.0,
adjust: &waterTempAdjust,
},
{
name: "Air intake",
pin: A3,
maxTemp: NAN,
adjust: nullptr,
},
};
const uint8_t sensorsLength = sizeof(sensorDefs) / sizeof(SensorDef);
// This is an example curve for speed control
static SpeedCurve defaultCurve = {
// temp °C => speed %
{ 25.0, 25 },
{ 35.0, 40 },
{ 40.0, 70 },
{ 55.0, 100 },
};
static uint8_t defaultCurveLength = sizeof(defaultCurve) / sizeof(SpeedCurvePoint);
// List of fans
const FanDef fanDefs[] = {
{
// Fan name used when sending its speed to serial
name: "Top rad",
// Fan pin. Must be PWM compatible
pin: 10,
// Tachometer fan pin. This pin MUST support interruptions
tachoPin: 3,
// Associated sensor index in `sensorDefs` list. Will be used to calculate fan speed with speedCurve.
sensorIndex: 0,
// Curve used to calculate fan speed in Auto mode
speedCurve: defaultCurve,
// Number of points on speedCurve
speedCurveLength: defaultCurveLength,
// true to start the fan at 100% for half a second
kickStart: false,
},
{
name: "Side rad",
pin: 11,
tachoPin: 2,
sensorIndex: 0,
speedCurve: SpeedCurve{
{ 25.0, 35 },
{ 35.0, 45 },
{ 40.0, 75 },
{ 55.0, 100 },
},
speedCurveLength: 4,
kickStart: false,
},
{
name: "Bot fan",
pin: 9,
tachoPin: -1,
sensorIndex: 0,
speedCurve: SpeedCurve{
{ 25.0, 22 },
{ 35.0, 35 },
{ 40.0, 50 },
{ 55.0, 100 },
},
speedCurveLength: 4,
kickStart: true,
},
{
name: "Rear fan",
pin: 6,
tachoPin: -1,
sensorIndex: 0,
speedCurve: SpeedCurve{
{ 25.0, 35 },
{ 35.0, 50 },
{ 40.0, 70 },
{ 55.0, 100 },
},
speedCurveLength: 4,
kickStart: false,
},
};
const uint8_t fansLength = sizeof(fanDefs) / sizeof(FanDef);
static const PROGMEM uint8_t deltaIcon[] = {
0b00000000,
0b01100000,
0b01011000,
0b01000110,
0b01011000,
0b01100000,
0b00000000,
};
const CustomDef customDefs[] = {
{
name: "Delta",
icon: deltaIcon,
value: [](char* buffer, const Sensor* sensors, const Fan* fans){
auto val = sensors[0].smoothedTemp() - sensors[1].smoothedTemp();
dtostrf(val, 5, 1, buffer);
},
},
};
const uint8_t customLength = sizeof(customDefs) / sizeof(CustomDef);
// Is SSD1306 128x64 display connected?
const bool hasDisplay = true;