From 11dc2b7db09d584c55206ad4f6dd6c08820d43d2 Mon Sep 17 00:00:00 2001 From: Hans Date: Mon, 23 Feb 2015 21:41:03 +0100 Subject: [PATCH] Fixed fuel warning field. --- ets2-client/C#/Ets2SdkClient/Ets2SdkData.cs | 2 +- ets2-client/C#/Ets2SdkClient/Ets2Telemetry.cs | 5 ++++- ets2-telemetry/inc/ets2-telemetry-common.hpp | 2 +- ets2-telemetry/src/ets2-telemetry.cpp | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ets2-client/C#/Ets2SdkClient/Ets2SdkData.cs b/ets2-client/C#/Ets2SdkClient/Ets2SdkData.cs index 722dbab..5bc0258 100644 --- a/ets2-client/C#/Ets2SdkClient/Ets2SdkData.cs +++ b/ets2-client/C#/Ets2SdkClient/Ets2SdkData.cs @@ -166,7 +166,7 @@ public struct Ets2SdkData [FieldOffset(608)] public float brakeTemperature; [FieldOffset(612)] - public float fuelWarning; + public int fuelWarning; [FieldOffset(616)] public float adblue; [FieldOffset(620)] diff --git a/ets2-client/C#/Ets2SdkClient/Ets2Telemetry.cs b/ets2-client/C#/Ets2SdkClient/Ets2Telemetry.cs index 00d896c..8b815c6 100644 --- a/ets2-client/C#/Ets2SdkClient/Ets2Telemetry.cs +++ b/ets2-client/C#/Ets2SdkClient/Ets2Telemetry.cs @@ -58,7 +58,10 @@ public class _Drivetrain public float Fuel { get; internal set; } public float FuelMax { get; internal set; } + + // Deprecated: was never actually functional public float FuelWarning { get; internal set; } + public bool FuelWarningLight { get; internal set; } public float FuelRate { get; internal set; } public float FuelAvgConsumption { get; internal set; } @@ -244,7 +247,7 @@ public Ets2Telemetry(Ets2SdkData raw, Ets2SdkUnmanaged rawUnmanaged) Drivetrain.FuelAvgConsumption = raw.fuelAvgConsumption; Drivetrain.FuelMax = raw.fuelCapacity; Drivetrain.FuelRate = raw.fuelRate; - Drivetrain.FuelWarning = raw.fuelWarning; + Drivetrain.FuelWarningLight = raw.fuelWarning == 0 ? false : true; Drivetrain.Gear = raw.gear; Drivetrain.GearRange = raw.gearRangeActive; diff --git a/ets2-telemetry/inc/ets2-telemetry-common.hpp b/ets2-telemetry/inc/ets2-telemetry-common.hpp index 28e807d..7fc163a 100644 --- a/ets2-telemetry/inc/ets2-telemetry-common.hpp +++ b/ets2-telemetry/inc/ets2-telemetry-common.hpp @@ -152,7 +152,7 @@ typedef struct ets2TelemetryMap_s float airPressure; float brakeTemperature; - float fuelWarning; + int fuelWarning; float adblue; float adblueConsumption; float oilPressure; diff --git a/ets2-telemetry/src/ets2-telemetry.cpp b/ets2-telemetry/src/ets2-telemetry.cpp index 0f52a0f..9d4ab3e 100644 --- a/ets2-telemetry/src/ets2-telemetry.cpp +++ b/ets2-telemetry/src/ets2-telemetry.cpp @@ -377,7 +377,7 @@ SCSAPI_RESULT scs_telemetry_init(const scs_u32_t version, const scs_telemetry_in // Floats registerChannel(TRUCK_CHANNEL_brake_air_pressure, float, telemPtr->tel_rev3.airPressure); registerChannel(TRUCK_CHANNEL_brake_temperature, float, telemPtr->tel_rev3.brakeTemperature); - registerChannel(TRUCK_CHANNEL_fuel_warning, float, telemPtr->tel_rev3.fuelWarning); + registerChannel(TRUCK_CHANNEL_fuel_warning, bool, telemPtr->tel_rev3.fuelWarning); registerChannel(TRUCK_CHANNEL_adblue, float, telemPtr->tel_rev3.adblue); registerChannel(TRUCK_CHANNEL_adblue_average_consumption, float, telemPtr->tel_rev3.adblueConsumption); registerChannel(TRUCK_CHANNEL_oil_pressure, float, telemPtr->tel_rev3.oilPressure);