mirror of
https://github.com/SemvdH/OBD2-car-display.git
synced 2025-12-16 12:41:05 +00:00
Show first bars of data
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "obd2_elm327.h"
|
||||
#include "defines.h"
|
||||
|
||||
#define DEBUG_VALUES 1
|
||||
|
||||
@@ -37,15 +38,21 @@ char obd2_elm327_init(obd2_elm327_t *elm327)
|
||||
#if (DEBUG == 1)
|
||||
Serial.println("initting elm327");
|
||||
#endif
|
||||
current_value_slow = COOLANT_TEMP_V;
|
||||
current_value_fast = ENGINE_LOAD_V;
|
||||
|
||||
ELM327_SERIAL.begin(ELM327_BAUD);
|
||||
|
||||
elm327->bt_state = BT_INITIALISING;
|
||||
elm327->elm327 = &elm327_obj;
|
||||
|
||||
#if (SKIP_BT_CHECK == 0)
|
||||
if (!elm327->elm327->begin(ELM327_SERIAL, false, 2000))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif // !SKIP_BT_CHECK
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -92,9 +99,9 @@ void obd2_elm327_process_fast(obd2_elm327_t *elm327)
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
current_value_fast = FUEL_PRESSURE_V;
|
||||
elm327->engine_load = ++elm327->engine_load % 100;
|
||||
elm327->engine_load = (elm327->engine_load + 1) % 100;
|
||||
elm327->value_updates |= (1 << UPDATE_ENGINE_LOAD_POS);
|
||||
#else
|
||||
#else
|
||||
float engine_load = elm327->elm327->engineLoad();
|
||||
if (elm327->elm327->nb_rx_state == ELM_SUCCESS)
|
||||
{
|
||||
@@ -113,7 +120,7 @@ void obd2_elm327_process_fast(obd2_elm327_t *elm327)
|
||||
case FUEL_PRESSURE_V:
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
elm327->fuel_pressure = ++elm327->fuel_pressure % 20;
|
||||
elm327->fuel_pressure = (elm327->fuel_pressure + 1) % 20;
|
||||
elm327->value_updates |= (1 << UPDATE_FUEL_PRESSURE_POS);
|
||||
current_value_fast = MANIFOLD_PRESSURE_V;
|
||||
#else
|
||||
@@ -135,7 +142,7 @@ void obd2_elm327_process_fast(obd2_elm327_t *elm327)
|
||||
case MANIFOLD_PRESSURE_V:
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
elm327->manifold_pressure = ++elm327->manifold_pressure % 20;
|
||||
elm327->manifold_pressure = (elm327->manifold_pressure + 1) % 20;
|
||||
elm327->value_updates |= (1 << UPDATE_MANIFOLD_PRESSURE_POS);
|
||||
current_value_fast = ENGINE_LOAD_V;
|
||||
#else
|
||||
@@ -165,7 +172,7 @@ void obd2_elm327_process_slow(obd2_elm327_t *elm327)
|
||||
case COOLANT_TEMP_V:
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
elm327->engine_coolant_temp = ++elm327->engine_coolant_temp % 150;
|
||||
elm327->engine_coolant_temp = (elm327->engine_coolant_temp + 10) % 150;
|
||||
elm327->value_updates |= (1 << UPDATE_COOLANT_TEMP_POS);
|
||||
current_value_slow = INTAKE_AIR_TEMP_V;
|
||||
#else
|
||||
@@ -187,7 +194,7 @@ void obd2_elm327_process_slow(obd2_elm327_t *elm327)
|
||||
case INTAKE_AIR_TEMP_V:
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
elm327->intake_air_temp = ++elm327->intake_air_temp % 60;
|
||||
elm327->intake_air_temp = (elm327->intake_air_temp + 10) % 60;
|
||||
elm327->value_updates |= (1 << UPDATE_INTAKE_AIR_TEMP_POS);
|
||||
current_value_slow = AMBIENT_AIR_TEMP_V;
|
||||
#else
|
||||
@@ -209,7 +216,7 @@ void obd2_elm327_process_slow(obd2_elm327_t *elm327)
|
||||
case AMBIENT_AIR_TEMP_V:
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
elm327->ambient_air_temp = ++elm327->ambient_air_temp % 60;
|
||||
elm327->ambient_air_temp = (elm327->ambient_air_temp + 10) % 60;
|
||||
elm327->value_updates |= (1 << UPDATE_AMBIENT_AIR_TEMP_POS);
|
||||
current_value_slow = OIL_TEMP_V;
|
||||
#else
|
||||
@@ -231,7 +238,7 @@ void obd2_elm327_process_slow(obd2_elm327_t *elm327)
|
||||
case OIL_TEMP_V:
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
elm327->engine_oil_temp = ++elm327->engine_oil_temp % 150;
|
||||
elm327->engine_oil_temp = (elm327->engine_oil_temp + 10) % 150;
|
||||
elm327->value_updates |= (1 << UPDATE_OIL_TEMP_POS);
|
||||
current_value_slow = FUEL_LEVEL_V;
|
||||
#else
|
||||
@@ -253,7 +260,7 @@ void obd2_elm327_process_slow(obd2_elm327_t *elm327)
|
||||
case FUEL_LEVEL_V:
|
||||
{
|
||||
#if (DEBUG_VALUES == 1)
|
||||
elm327->fuel_level = ++elm327->fuel_level % 100;
|
||||
elm327->fuel_level = (elm327->fuel_level + 1) % 100;
|
||||
elm327->value_updates |= (1 << UPDATE_FUEL_LEVEL_POS);
|
||||
current_value_slow = COOLANT_TEMP_V;
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user