Skip to content

Commit 9fc134c

Browse files
committed
Remove dead code, commenting fixes
1 parent 19e3f21 commit 9fc134c

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed

odbsim.ino

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,6 @@ void loop() {
154154
}
155155
}
156156

157-
// Alternative implementation: read a full command on each loop
158-
//
159-
// String OBDRequest = "";
160-
//
161-
// // Read characters from the serial port while available
162-
// while (BtSerial.available()) {
163-
// delay(3); //wait for buffer to fill up
164-
// if (BtSerial.available() > 0) { //Serial port ready?
165-
// char c = BtSerial.read(); //write character to c
166-
// OBDRequest += c; //write c to request variable
167-
// }
168-
// OBDRequest.trim(); //get rid of line feeds
169-
// }
170-
//
171-
// processRequest(OBDRequest);
172-
173157
}
174158

175159
// Process the requests (commands) sent from the client app
@@ -354,7 +338,7 @@ void processRequest(String request) {
354338

355339
replyPrompt();
356340

357-
request = ""; // Clear the request buffer once processed
341+
request = ""; // Clear the request buffer once processed
358342
}
359343

360344
// Sends a reply to an OBD2 request
@@ -413,21 +397,17 @@ void replyOBDResponse(const String response) {
413397

414398
// Updates the sensor values
415399
void updateSensorValues() {
400+
// Update RPM every n sample counts:
401+
// - increase n for better RPM resolution,
402+
// - decrease for faster update
403+
const int RPM_SAMPLE_COUNT = 30;
416404

417405
// Sensor data sent as mode 1 PIDs
418406
if (rpm_pulse_count >= 30) {
419-
// Update RPM every n counts, increase this for better RPM resolution,
420-
// decrease for faster update
421-
//rpm = (30 * 1000 * 1000 / (micros() - time_old)) * rpm_pulse_count;
422-
//time_old = micros();
423-
424-
rpm = (30 * 1000 / (millis() - time_old)) * rpm_pulse_count;
425-
time_old = millis();
426407

427-
/*
428408
rpm = (30UL * 1000UL * 1000UL / (micros() - time_old)) * rpm_pulse_count;
429409
time_old = micros();
430-
*/
410+
431411
rpm_pulse_count = 0;
432412
eng_rpm = rpm;
433413
}

0 commit comments

Comments
 (0)