Skip to content

Commit 7a846a5

Browse files
authored
Enhance configServer (#191)
- avoid duplicate content in const strings - move style definition to header for faster rendering - Add a title to each page (#141) - "Stream" upload page while uploading - Show upload results in upload page (fixes #109) - "Stream" SD content page - Add content-type for cvs in download - Refine / handling in SD download - Add icons to SD file browser - back arrow calls history.back() - html cleanup - read GPS always in config mode - add system info page - Place "Upload Track" at top (fixes #167) - collect GPS messages to determine version of GPS module - add TOF sensor reading with no wait - collect TOF sensor statistics, allows to distinguish sensor versions - start TOF sensors also in server mode - set system time early in server mode - start GPS early in server mode
1 parent 35005f9 commit 7a846a5

File tree

8 files changed

+432
-192
lines changed

8 files changed

+432
-192
lines changed

platformio.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ lib_deps =
3838
pololu/VL53L0X@^1.3.0
3939
build_flags =
4040
; build number "-dev" will be replaced in github action
41-
-DBUILD_NUMBER=\"-dev\"
41+
-DBUILD_NUMBER=\"-dev\"

src/OpenBikeSensorFirmware.cpp

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,28 @@ void setup() {
214214
displayTest->showTextOnGrid(2, 2, "SD... ok",DEFAULT_FONT);
215215
}
216216

217+
//##############################################################
218+
// Init HCSR04
219+
//##############################################################
220+
221+
sensorManager = new HCSR04SensorManager;
222+
223+
HCSR04SensorInfo sensorManaged1;
224+
sensorManaged1.triggerPin = (config.displayConfig & DisplaySwapSensors) ? 25 : 15;
225+
sensorManaged1.echoPin = (config.displayConfig & DisplaySwapSensors) ? 26 : 4;
226+
sensorManaged1.sensorLocation = (char*) "Right"; // TODO
227+
sensorManager->registerSensor(sensorManaged1);
228+
229+
HCSR04SensorInfo sensorManaged2;
230+
sensorManaged2.triggerPin = (config.displayConfig & DisplaySwapSensors) ? 15 : 25;
231+
sensorManaged2.echoPin = (config.displayConfig & DisplaySwapSensors) ? 4 : 26;
232+
sensorManaged2.sensorLocation = (char*) "Left"; // TODO
233+
sensorManager->registerSensor(sensorManaged2);
234+
235+
sensorManager->setOffsets(config.sensorOffsets);
236+
237+
sensorManager->setPrimarySensor(LEFT_SENSOR_ID);
238+
217239
//##############################################################
218240
// Check, if the button is pressed
219241
// Enter configuration mode and enable OTA
@@ -231,36 +253,16 @@ void setup() {
231253
OtaInit(esp_chipid);
232254

233255
while (true) {
256+
readGPSData();
234257
server.handleClient();
235258
delay(1);
236259
ArduinoOTA.handle();
260+
sensorManager->getDistancesNoWait();
237261
}
238262
}
239263
SPIFFS.end();
240264
WiFiGenericClass::mode(WIFI_OFF);
241265

242-
//##############################################################
243-
// Init HCSR04
244-
//##############################################################
245-
246-
sensorManager = new HCSR04SensorManager;
247-
248-
HCSR04SensorInfo sensorManaged1;
249-
sensorManaged1.triggerPin = (config.displayConfig & DisplaySwapSensors) ? 25 : 15;
250-
sensorManaged1.echoPin = (config.displayConfig & DisplaySwapSensors) ? 26 : 4;
251-
sensorManaged1.sensorLocation = (char*) "Right"; // TODO
252-
sensorManager->registerSensor(sensorManaged1);
253-
254-
HCSR04SensorInfo sensorManaged2;
255-
sensorManaged2.triggerPin = (config.displayConfig & DisplaySwapSensors) ? 15 : 25;
256-
sensorManaged2.echoPin = (config.displayConfig & DisplaySwapSensors) ? 4 : 26;
257-
sensorManaged2.sensorLocation = (char*) "Left"; // TODO
258-
sensorManager->registerSensor(sensorManaged2);
259-
260-
sensorManager->setOffsets(config.sensorOffsets);
261-
262-
sensorManager->setPrimarySensor(LEFT_SENSOR_ID);
263-
264266
//##############################################################
265267
// Prepare CSV file
266268
//##############################################################

0 commit comments

Comments
 (0)