added first code for OBD2 via CAN and K-Line

This commit is contained in:
2025-05-04 12:03:19 +02:00
parent b627f52272
commit 1ee326fd57
12 changed files with 277 additions and 53 deletions

View File

@@ -37,6 +37,8 @@
#include "gps.h"
#include "dtc.h"
#include "led_colors.h"
#include "obd2_kline.h"
#include "obd2_can.h"
#ifdef FEATURE_ENABLE_WIFI_CLIENT
#include <ESP8266WiFiMulti.h>
@@ -154,6 +156,16 @@ void setup()
wheelSpeedcapture = &Process_Impulse_WheelSpeed;
Serial.print("\nPulse-Input Init done");
break;
case SOURCE_OBD2_KLINE:
Init_OBD2_KLine(Serial);
wheelSpeedcapture = &Process_OBD2_KLine_Speed;
Serial.print("\nOBD2-KLine-Init done");
break;
case SOURCE_OBD2_CAN:
Init_OBD2_CAN();
wheelSpeedcapture = &Process_OBD2_CAN_Speed;
Serial.print("\nOBD2-CAN-Init done");
break;
default:
break;
}
@@ -227,19 +239,14 @@ void setup()
void loop()
{
// Run lubrication application with the calculated wheel distance
RunLubeApp(wheelSpeedcapture());
if (wheelSpeedcapture != nullptr)
RunLubeApp(wheelSpeedcapture());
#ifdef FEATURE_ENABLE_OLED
// Update OLED display if enabled
Display_Process();
#endif
// Process CAN messages if the speed source is not impulse
if (LubeConfig.SpeedSource != SOURCE_IMPULSE)
{
CAN_Process();
}
// Process button input, manage LED behavior, perform EEPROM tasks, handle webserver operations,
// process Diagnostic Trouble Codes (DTC), and manage debugging
Button_Process();