Skip to content

Commit 2dbd825

Browse files
committedApr 18, 2025
change format
1 parent b15fc8e commit 2dbd825

File tree

6 files changed

+45
-47
lines changed

6 files changed

+45
-47
lines changed
 

‎pico_v2_STEP8_micromouse/Flash.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void paramRead(void)
273273
flashInit();
274274
break;
275275
}
276-
g_run.pulse = g_run.tire_diameter * PI / (35.0 / 10.0 * 20.0 *8.0);
276+
g_run.pulse = g_run.tire_diameter * PI / (35.0 / 10.0 * 20.0 * 8.0);
277277
cmds[0] = {"\0"};
278278
cmds[1] = {"\0"};
279279
}

‎pico_v2_STEP8_micromouse/run.ino

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ void RUN::interrupt(void)
6363
if (speed_target_l < MIN_SPEED) speed_target_l = MIN_SPEED;
6464

6565
speedSet(speed_target_l, speed_target_r);
66-
6766
}
6867

6968
void RUN::dirSet(t_CW_CCW dir_left, t_CW_CCW dir_right) { motorDirectionSet(dir_left, dir_right); }

‎pico_v2_STEP8_micromouse/search.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
#ifndef SRC_SEARCH_H_
1515
#define SRC_SEARCH_H_
1616

17-
18-
class SEARCH {
17+
class SEARCH
18+
{
1919
public:
20-
void lefthand(void);
21-
void adachi(char gx, char gy);
22-
private:
20+
void lefthand(void);
21+
void adachi(char gx, char gy);
2322

23+
private:
2424
};
2525
extern SEARCH g_search;
2626
#endif /* SRC_SEARCH_H_ */

‎pico_v2_STEP8_micromouse/sensor.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ typedef struct
2929
bool is_control;
3030
} t_sensor;
3131

32-
33-
class SENSOR{
32+
class SENSOR
33+
{
3434
public:
35-
volatile t_sensor sen_r, sen_l, sen_fr, sen_fl;
36-
volatile short battery_value;
37-
void interrupt(void);
35+
volatile t_sensor sen_r, sen_l, sen_fr, sen_fl;
36+
volatile short battery_value;
37+
void interrupt(void);
3838
};
3939

4040
extern SENSOR g_sensor;

‎pico_v2_STEP8_micromouse/sensor.ino

+8-10
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,13 @@
1616

1717
SENSOR g_sensor;
1818

19-
void sensorInterrupt(void) {
20-
g_sensor.interrupt();
21-
}
19+
void sensorInterrupt(void) { g_sensor.interrupt(); }
2220

23-
void SENSOR::interrupt(void)
21+
void SENSOR::interrupt(void)
2422
{
2523
static char cnt = 0;
2624
static char bled_cnt = 0;
27-
static int low_batt_cnt =0;
25+
static int low_batt_cnt = 0;
2826

2927
switch (cnt) {
3028
case 0:
@@ -81,13 +79,13 @@ void SENSOR::interrupt(void)
8179
} else {
8280
bledSet(2);
8381
}
84-
if(battery_value < BATT_MIN){
82+
if (battery_value < BATT_MIN) {
8583
low_batt_cnt++;
86-
if(low_batt_cnt>=100){
87-
buzzerEnable(400);
84+
if (low_batt_cnt >= 100) {
85+
buzzerEnable(400);
8886
}
89-
}else{
90-
low_batt_cnt=0;
87+
} else {
88+
low_batt_cnt = 0;
9189
}
9290
break;
9391
default:

‎pico_v2_STEP8_micromouse/webserver.ino

+26-25
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@
1717
AsyncWebServer server(80);
1818

1919
#ifdef AP_MODE
20-
const char* ssid = "PICO2";
21-
const char* password = "12345678";
20+
const char * ssid = "PICO2";
21+
const char * password = "12345678";
2222
#else
23-
const char* ssid = "使用しているルータのSSID";
24-
const char* password = "ルータのパスワード";
23+
const char * ssid = "使用しているルータのSSID";
24+
const char * password = "ルータのパスワード";
2525
#endif
2626

27-
28-
29-
void webServerSetup(void) {
30-
27+
void webServerSetup(void)
28+
{
3129
#ifdef AP_MODE
3230
WiFi.softAP(ssid, password);
3331
IPAddress myIP = WiFi.softAPIP();
@@ -43,7 +41,7 @@ void webServerSetup(void) {
4341
Serial.println(WiFi.localIP());
4442
#endif
4543

46-
server.on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
44+
server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
4745
String html = "";
4846
html += "<!DOCTYPE html>";
4947
html += "<html lang=\"en\">";
@@ -108,12 +106,14 @@ void webServerSetup(void) {
108106
html += "></th><th><input name=\"ref_right\" type=\"text\" size=\"10\" value=";
109107
html += String(g_sensor.sen_r.ref);
110108
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=";
112111
html += String(g_sensor.sen_l.th_wall);
113112
html += "></td><td><input name=\"th_right\" type=\"text\" size=\"10\" value=";
114113
html += String(g_sensor.sen_r.th_wall);
115114
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=";
117117
html += String(g_sensor.sen_fl.th_wall);
118118
html += "></th><th><input name=\"th_fr\" type=\"text\" size=\"10\" value=";
119119
html += String(g_sensor.sen_fr.th_wall);
@@ -130,10 +130,12 @@ void webServerSetup(void) {
130130

131131
html += "<p><h2>Tire Parameter</h2></p>";
132132
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=";
134135
html += String(g_run.tire_diameter, 3);
135136
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=";
137139
html += String(g_run.tread_width, 3);
138140
html += ">mm</td></tr>";
139141
html += "</table>";
@@ -154,7 +156,8 @@ void webServerSetup(void) {
154156

155157
html += "<p><h2>Accel Parameter</h2></p>";
156158
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=";
158161
html += String(g_run.search_accel, 3);
159162
html += ">mm</td></tr>";
160163
html += "<tr><th>Turn accel</th><td><input name=\"turn_acc\" type=\"text\" size=\"10\" value=";
@@ -166,7 +169,8 @@ void webServerSetup(void) {
166169

167170
html += "<p><h2>Speed Parameter</h2></p>";
168171
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=";
170174
html += String(g_run.search_speed);
171175
html += ">mm</td></tr>";
172176
html += "<tr><th>max speed</th><td><input name=\"max_spd\" type=\"text\" size=\"10\" value=";
@@ -176,7 +180,6 @@ void webServerSetup(void) {
176180
html += "<br>";
177181
html += "<br>";
178182

179-
180183
html += "<input type=\"submit\" value=\"Save\">";
181184
html += "</form><br>";
182185
html += "</body>";
@@ -247,28 +250,27 @@ void webServerSetup(void) {
247250
request->send(200, "text/html", html);
248251
});
249252

250-
server.on("/voltage", HTTP_GET, [](AsyncWebServerRequest* request) {
253+
server.on("/voltage", HTTP_GET, [](AsyncWebServerRequest * request) {
251254
request->send(200, "text/plain", String(g_sensor.battery_value) + "mV");
252255
});
253256

254-
server.on("/left_value", HTTP_GET, [](AsyncWebServerRequest* request) {
257+
server.on("/left_value", HTTP_GET, [](AsyncWebServerRequest * request) {
255258
request->send(200, "text/plain", String(g_sensor.sen_l.value));
256259
});
257260

258-
server.on("/right_value", HTTP_GET, [](AsyncWebServerRequest* request) {
261+
server.on("/right_value", HTTP_GET, [](AsyncWebServerRequest * request) {
259262
request->send(200, "text/plain", String(g_sensor.sen_r.value));
260263
});
261264

262-
server.on("/left_front_value", HTTP_GET, [](AsyncWebServerRequest* request) {
265+
server.on("/left_front_value", HTTP_GET, [](AsyncWebServerRequest * request) {
263266
request->send(200, "text/plain", String(g_sensor.sen_fl.value));
264267
});
265268

266-
server.on("/right_front_value", HTTP_GET, [](AsyncWebServerRequest* request) {
269+
server.on("/right_front_value", HTTP_GET, [](AsyncWebServerRequest * request) {
267270
request->send(200, "text/plain", String(g_sensor.sen_fr.value));
268271
});
269272

270-
271-
server.on("/get", HTTP_GET, [](AsyncWebServerRequest* request) {
273+
server.on("/get", HTTP_GET, [](AsyncWebServerRequest * request) {
272274
String inputMessage;
273275

274276
inputMessage = request->getParam("tire_dia")->value();
@@ -309,10 +311,9 @@ void webServerSetup(void) {
309311
inputMessage = request->getParam("max_spd")->value();
310312
g_run.max_speed = inputMessage.toInt();
311313

312-
313314
Serial.println("saved");
314315
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);
316317

317318
buzzerEnable(INC_FREQ);
318319
delay(30);

0 commit comments

Comments
 (0)