17
17
AsyncWebServer server (80 );
18
18
19
19
#ifdef AP_MODE
20
- const char * ssid = " PICO2" ;
21
- const char * password = " 12345678" ;
20
+ const char * ssid = " PICO2" ;
21
+ const char * password = " 12345678" ;
22
22
#else
23
- const char * ssid = " 使用しているルータのSSID" ;
24
- const char * password = " ルータのパスワード" ;
23
+ const char * ssid = " 使用しているルータのSSID" ;
24
+ const char * password = " ルータのパスワード" ;
25
25
#endif
26
26
27
-
28
-
29
- void webServerSetup (void ) {
30
-
27
+ void webServerSetup (void )
28
+ {
31
29
#ifdef AP_MODE
32
30
WiFi.softAP (ssid, password);
33
31
IPAddress myIP = WiFi.softAPIP ();
@@ -43,7 +41,7 @@ void webServerSetup(void) {
43
41
Serial.println (WiFi.localIP ());
44
42
#endif
45
43
46
- server.on (" /" , HTTP_GET, [](AsyncWebServerRequest* request) {
44
+ server.on (" /" , HTTP_GET, [](AsyncWebServerRequest * request) {
47
45
String html = " " ;
48
46
html += " <!DOCTYPE html>" ;
49
47
html += " <html lang=\" en\" >" ;
@@ -108,12 +106,14 @@ void webServerSetup(void) {
108
106
html += " ></th><th><input name=\" ref_right\" type=\" text\" size=\" 10\" value=" ;
109
107
html += String (g_sensor.sen_r .ref );
110
108
html += " ></th></tr>" ;
111
- html += " <tr><th>SIDE Threshold</th><td><input name=\" th_left\" type=\" text\" size=\" 10\" value=" ;
109
+ html +=
110
+ " <tr><th>SIDE Threshold</th><td><input name=\" th_left\" type=\" text\" size=\" 10\" value=" ;
112
111
html += String (g_sensor.sen_l .th_wall );
113
112
html += " ></td><td><input name=\" th_right\" type=\" text\" size=\" 10\" value=" ;
114
113
html += String (g_sensor.sen_r .th_wall );
115
114
html += " ></td></tr>" ;
116
- html += " <tr><th>FRONT Threshold</th><th><input name=\" th_fl\" type=\" text\" size=\" 10\" value=" ;
115
+ html +=
116
+ " <tr><th>FRONT Threshold</th><th><input name=\" th_fl\" type=\" text\" size=\" 10\" value=" ;
117
117
html += String (g_sensor.sen_fl .th_wall );
118
118
html += " ></th><th><input name=\" th_fr\" type=\" text\" size=\" 10\" value=" ;
119
119
html += String (g_sensor.sen_fr .th_wall );
@@ -130,10 +130,12 @@ void webServerSetup(void) {
130
130
131
131
html += " <p><h2>Tire Parameter</h2></p>" ;
132
132
html += " <table align=\" center\" >" ;
133
- html += " <tr><th>TIRE_DIAMETER</th><td><input name=\" tire_dia\" type=\" text\" size=\" 10\" value=" ;
133
+ html +=
134
+ " <tr><th>TIRE_DIAMETER</th><td><input name=\" tire_dia\" type=\" text\" size=\" 10\" value=" ;
134
135
html += String (g_run.tire_diameter , 3 );
135
136
html += " >mm</td></tr>" ;
136
- html += " <tr><th>TREAD_WIDTH</th><td><input name=\" tread_width\" type=\" text\" size=\" 10\" value=" ;
137
+ html +=
138
+ " <tr><th>TREAD_WIDTH</th><td><input name=\" tread_width\" type=\" text\" size=\" 10\" value=" ;
137
139
html += String (g_run.tread_width , 3 );
138
140
html += " >mm</td></tr>" ;
139
141
html += " </table>" ;
@@ -154,7 +156,8 @@ void webServerSetup(void) {
154
156
155
157
html += " <p><h2>Accel Parameter</h2></p>" ;
156
158
html += " <table align=\" center\" >" ;
157
- html += " <tr><th>Search accel</th><td><input name=\" search_acc\" type=\" text\" size=\" 10\" value=" ;
159
+ html +=
160
+ " <tr><th>Search accel</th><td><input name=\" search_acc\" type=\" text\" size=\" 10\" value=" ;
158
161
html += String (g_run.search_accel , 3 );
159
162
html += " >mm</td></tr>" ;
160
163
html += " <tr><th>Turn accel</th><td><input name=\" turn_acc\" type=\" text\" size=\" 10\" value=" ;
@@ -166,7 +169,8 @@ void webServerSetup(void) {
166
169
167
170
html += " <p><h2>Speed Parameter</h2></p>" ;
168
171
html += " <table align=\" center\" >" ;
169
- html += " <tr><th>Search speed</th><td><input name=\" search_spd\" type=\" text\" size=\" 10\" value=" ;
172
+ html +=
173
+ " <tr><th>Search speed</th><td><input name=\" search_spd\" type=\" text\" size=\" 10\" value=" ;
170
174
html += String (g_run.search_speed );
171
175
html += " >mm</td></tr>" ;
172
176
html += " <tr><th>max speed</th><td><input name=\" max_spd\" type=\" text\" size=\" 10\" value=" ;
@@ -176,7 +180,6 @@ void webServerSetup(void) {
176
180
html += " <br>" ;
177
181
html += " <br>" ;
178
182
179
-
180
183
html += " <input type=\" submit\" value=\" Save\" >" ;
181
184
html += " </form><br>" ;
182
185
html += " </body>" ;
@@ -247,28 +250,27 @@ void webServerSetup(void) {
247
250
request->send (200 , " text/html" , html);
248
251
});
249
252
250
- server.on (" /voltage" , HTTP_GET, [](AsyncWebServerRequest* request) {
253
+ server.on (" /voltage" , HTTP_GET, [](AsyncWebServerRequest * request) {
251
254
request->send (200 , " text/plain" , String (g_sensor.battery_value ) + " mV" );
252
255
});
253
256
254
- server.on (" /left_value" , HTTP_GET, [](AsyncWebServerRequest* request) {
257
+ server.on (" /left_value" , HTTP_GET, [](AsyncWebServerRequest * request) {
255
258
request->send (200 , " text/plain" , String (g_sensor.sen_l .value ));
256
259
});
257
260
258
- server.on (" /right_value" , HTTP_GET, [](AsyncWebServerRequest* request) {
261
+ server.on (" /right_value" , HTTP_GET, [](AsyncWebServerRequest * request) {
259
262
request->send (200 , " text/plain" , String (g_sensor.sen_r .value ));
260
263
});
261
264
262
- server.on (" /left_front_value" , HTTP_GET, [](AsyncWebServerRequest* request) {
265
+ server.on (" /left_front_value" , HTTP_GET, [](AsyncWebServerRequest * request) {
263
266
request->send (200 , " text/plain" , String (g_sensor.sen_fl .value ));
264
267
});
265
268
266
- server.on (" /right_front_value" , HTTP_GET, [](AsyncWebServerRequest* request) {
269
+ server.on (" /right_front_value" , HTTP_GET, [](AsyncWebServerRequest * request) {
267
270
request->send (200 , " text/plain" , String (g_sensor.sen_fr .value ));
268
271
});
269
272
270
-
271
- server.on (" /get" , HTTP_GET, [](AsyncWebServerRequest* request) {
273
+ server.on (" /get" , HTTP_GET, [](AsyncWebServerRequest * request) {
272
274
String inputMessage;
273
275
274
276
inputMessage = request->getParam (" tire_dia" )->value ();
@@ -309,10 +311,9 @@ void webServerSetup(void) {
309
311
inputMessage = request->getParam (" max_spd" )->value ();
310
312
g_run.max_speed = inputMessage.toInt ();
311
313
312
-
313
314
Serial.println (" saved" );
314
315
paramWrite ();
315
- g_run.pulse = g_run.tire_diameter * PI / (35.0 / 10.0 * 20.0 *8.0 );
316
+ g_run.pulse = g_run.tire_diameter * PI / (35.0 / 10.0 * 20.0 * 8.0 );
316
317
317
318
buzzerEnable (INC_FREQ);
318
319
delay (30 );
0 commit comments