diff --git a/emulator/obd2_emulator.py b/emulator/obd2_emulator.py index 8010000..6a3f4ec 100755 --- a/emulator/obd2_emulator.py +++ b/emulator/obd2_emulator.py @@ -63,8 +63,8 @@ class VehicleState: self.speed = 15.0 + 160.0 * ((self.rpm - 800.0) / 5200.0) if self.speed < 0: self.speed = 0.0 - # Coolant temp rises slightly with engine load (88°C -> 102°C, showing warn RED past 100°C) - self.coolant_temp = 88.0 + 14.0 * ((self.rpm - 800.0) / 5200.0) + # Coolant temp rises with engine load (88°C -> 108°C: Green <98, Yellow 98-105, Red >=106) + self.coolant_temp = 88.0 + 20.0 * ((self.rpm - 800.0) / 5200.0) self.oil_temp = 90.0 + 12.0 * ((self.rpm - 800.0) / 5200.0) self.trans_temp = 82.0 + 1.0 * math.cos(t * 0.09) self.pcm_volt = 14.2 + 0.15 * math.sin(t * 0.5) diff --git a/sketch/obd2_gauge/meter.h b/sketch/obd2_gauge/meter.h index 38a6a32..dc3ab99 100644 --- a/sketch/obd2_gauge/meter.h +++ b/sketch/obd2_gauge/meter.h @@ -695,9 +695,15 @@ inline void drawQuadrantDividers() { } // Determine display color for meter: +// ECT (PID 0): VERDE (< 98), AMARILLO (98-105), ROJO (>= 106) // RPM (PID 1): VERDE (< 3500), AMARILLO (3500-5000), ROJO (5000-6000) // Otros instrumentos: VERDE / ROJO (según umbral de advertencia) inline uint16_t getMeterColor(uint8_t pidIdx, float data, int warn) { + if (pidIdx == 0) { // 0 = Temperatura ECT (PID 0105) + if (data >= 106.0f) return TFT_RED; + if (data >= 98.0f) return TFT_YELLOW; + return TFT_GREEN; + } if (pidIdx == 1) { // 1 = RPM (PID 010C) if (data >= 5000.0f) return TFT_RED; if (data >= 3500.0f) return TFT_YELLOW; diff --git a/sketch/obd2_gauge/obd2_gauge.ino b/sketch/obd2_gauge/obd2_gauge.ino index e99b482..db0ab14 100644 --- a/sketch/obd2_gauge/obd2_gauge.ino +++ b/sketch/obd2_gauge/obd2_gauge.ino @@ -83,14 +83,14 @@ warn = default warning value */ const String pidConfig[4][9] = { //[pid][data] - { "Temperatura", "`C", "0105", "1", "0", "120", "2", "0", "100" }, //0 = Temperatura (0105) + { "Temperatura", "`C", "0105", "1", "0", "120", "2", "0", "106" }, //0 = Temperatura (0105) { "RPM", "rpm", "010C", "3", "0", "6000", "0", "0", "5000" }, //1 = RPM (010C) { "Voltaje", "V", "0142", "4", "0", "16", "1", "1", "15" }, //2 = Voltaje (0142) { "Velocidad", "km/h", "010D", "7", "0", "180", "0", "0", "130" } //3 = Velocidad (010D) }; //hold warning value -String warningValue[4] = { "100", "5000", "15", "130" }; +String warningValue[4] = { "106", "5000", "15", "130" }; /* 0 - Refrigerante