forked from ornea/slowcooker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
http_pid_config.ino
119 lines (90 loc) · 3.43 KB
/
http_pid_config.ino
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
void handle_pid_config()
{
Serial.println(F("/pid_config Accessed"));
START_HTML;
START_PAGE(AppConfig.EpHostname, "PID Configuration Page");
START_FORM("pid_config_update");
START_TABLE("AP: PID Configuration.");
ADD_ROW_STRING ("kpPID: ");
ADD_INPUT_CELL (AppConfig.PID[kp], kpPID);
END_ROW;
ADD_ROW_STRING ("kiPID: ");
ADD_INPUT_CELL (AppConfig.PID[ki], kiPID);
END_ROW;
ADD_ROW_STRING ("kdPID: ");
ADD_INPUT_CELL (AppConfig.PID[kd], kdPID);
END_ROW;
ADD_ROW_STRING ("maxPID: ");
ADD_INPUT_CELL (AppConfig.PID[mvmax], maxPID);
END_ROW;
ADD_ROW_STRING ("minPID: ");
ADD_INPUT_CELL (AppConfig.PID[mvmin], minPID);
END_ROW;
ADD_ROW_STRING ("SP1: ");
ADD_INPUT_CELL (AppConfig.PID[sp1], sp1PID);
END_ROW;
ADD_ROW_STRING ("SP2: ");
ADD_INPUT_CELL (AppConfig.PID[sp2], sp2PID);
END_ROW;
ADD_ROW_STRING ("SP1TD: ");
ADD_INPUT_CELL (AppConfig.PID[sp1td], sp1tdPID);
END_ROW;
ADD_ROW_STRING ("SP2TD: ");
ADD_INPUT_CELL (AppConfig.PID[sp2td], sp2tdPID);
END_ROW;
ADD_ROW_STRING ("CAL: ");
ADD_INPUT_CELL (AppConfig.PID[cal], CAL);
END_ROW;
ADD_ROW_STRING ("PWMfreq: ");
ADD_INPUT_CELL (AppConfig.PWMfreq, PWMfreq);
END_ROW;
END_TABLE;
END_FORM;
END_PAGE_CUSTOM;
END_PAGE;
//server.sendHeader("Access-Control-Allow-Origin", "*");
}
void handle_pid_config_update()
{
Serial.println(F("/pid_config_update Accessed"));
Serial.println(F("Writing to EEPROM with new kpPID: "));
Serial.println(server.arg ("kpPID" ));
AppConfig.PID[kp] = server.arg ("kpPID" ).toFloat();
Serial.println(F("Writing to EEPROM with new kiPID: "));
Serial.println(server.arg ("kiPID" ));
AppConfig.PID[ki] = server.arg ("kiPID" ).toFloat();
Serial.println(F("Writing to EEPROM with new kdPID: "));
Serial.println(server.arg ("kdPID" ));
AppConfig.PID[kd] = server.arg ("kdPID" ).toFloat();
Serial.println(F("Writing to EEPROM with new maxPID: "));
Serial.println(server.arg ("maxPID" ));
AppConfig.PID[mvmax] = server.arg ("maxPID" ).toInt();
Serial.println(F("Writing to EEPROM with new minPID: "));
Serial.println(server.arg ("minPID" ));
AppConfig.PID[mvmin] = server.arg ("minPID" ).toInt();
Serial.println(F("Writing to EEPROM with new sp1PID: "));
Serial.println(server.arg ("sp1PID" ));
AppConfig.PID[sp1] = server.arg ("sp1PID" ).toInt();
Serial.println(F("Writing to EEPROM with new sp2PID: "));
Serial.println(server.arg ("sp2PID" ));
AppConfig.PID[sp2] = server.arg ("sp2PID" ).toInt();
Serial.println(F("Writing to EEPROM with new sp1tdPID: "));
Serial.println(server.arg ("sp1tdPID" ));
AppConfig.PID[sp1td] = server.arg ("sp1tdPID" ).toInt();
Serial.println(F("Writing to EEPROM with new sp2tdPID: "));
Serial.println(server.arg ("sp2tdPID" ));
AppConfig.PID[sp2td] = server.arg ("sp2tdPID" ).toInt();
Serial.println(F("Writing to EEPROM with new CAL: "));
Serial.println(server.arg ("CAL" ));
AppConfig.PID[cal] = server.arg ("CAL" ).toInt();
Serial.println(F("Writing to EEPROM with new PWMfreq: "));
Serial.println(server.arg ("PWMfreq" ));
AppConfig.PWMfreq = server.arg ("PWMfreq" ).toInt();
START_HTML;
START_PAGE(AppConfig.EpHostname, "Updating PID Configuration");
server.sendContent(F("PID saved to eeprom..."));
END_PAGE_CUSTOM;
END_PAGE;
Serial.println(F("PID saved to eeprom... "));
SaveAppConfig();
}