Commit 87946350 authored by Manojav Sridhar's avatar Manojav Sridhar Committed by Andrew Leech

Add new dash gauges: Ambient Temperature, Engine Oil Temperature & Intake Pressure

These will now be available as gauges in dash mode if exposed on standard pid by your car.

cleanup Pids, and unused imports
fix left gauge, change colors, adjust bounds

The intake manifold pressure gauge limits can be adjusted with:
```
setprop persist.sys.ip.low 95
setprop persist.sys.ip.high 110
setprop persist.sys.ip.lower 80
setprop persist.sys.ip.mid 150
setprop persist.sys.ip.upper 220
```
Engine Oil Temp bounds:
```
setprop persist.sys.eot.cold 64.7
setprop persist.sys.eot.hot 150.0
setprop persist.sys.eot.lower 0.0
setprop persist.sys.eot.mid 76.5
setprop persist.sys.eot.upper 215.0
```
Ambient Temp bounds:
```
setprop persist.sys.at.cold -3
setprop persist.sys.at.hot 30.0
setprop persist.sys.at.lower -40.0
setprop persist.sys.at.mid 0
setprop persist.sys.at.upper 50.0
```
parent 904dfd9d
......@@ -19,7 +19,12 @@ public final class ExtensionsKt
public static final double celsiusToFahrenheit(final double n) {
return 9 * n / 5 + 32;
}
public static final double kPaToPsi(final double n) {
return n * 0.145038;
}
public static final double clamp(final double n, double n2, final double n3) {
if (n >= n2) {
if (n > n3) {
......
......@@ -11,6 +11,9 @@ import com.navdy.hud.app.manager.MusicManager;
import com.navdy.hud.app.service.pandora.PandoraManager;
import com.navdy.hud.app.storage.cache.Cache;
import com.navdy.hud.app.storage.cache.DiskLruCacheAdapter;
import com.navdy.hud.app.view.AmbientTemperaturePresenter;
import com.navdy.hud.app.view.EngineOilTemperaturePresenter;
import com.navdy.hud.app.view.IntakePressurePresenter;
import com.navdy.service.library.events.audio.MusicCollectionResponse;
import com.navdy.hud.app.storage.cache.MessageCache;
import com.navdy.hud.app.manager.InputManager;
......@@ -90,7 +93,10 @@ import com.navdy.hud.app.R;
NotificationReceiver.class,
GestureVideosSyncService.class,
ObdCANBusDataUploadService.class,
EngineTemperaturePresenter.class },
EngineOilTemperaturePresenter.class,
EngineTemperaturePresenter.class,
AmbientTemperaturePresenter.class,
IntakePressurePresenter.class},
library = true)
public class ProdModule
{
......
......@@ -50,7 +50,6 @@ import com.navdy.service.library.util.IOUtils;
import com.squareup.otto.Bus;
import com.squareup.otto.Subscribe;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
......@@ -312,7 +311,7 @@ public final class ObdManager {
ObdManager.this.obdPidsCache.put(pid.getId(), pid.getValue());
break;
} else {
ObdManager.this.obdPidsCache.remove(47);
ObdManager.this.obdPidsCache.remove(Pids.FUEL_LEVEL);
break;
}
case 49:
......@@ -483,18 +482,21 @@ public final class ObdManager {
this.carServiceConnector = new CarServiceConnector(HudApplication.getAppContext());
this.obdDeviceConfigurationManager = new ObdDeviceConfigurationManager(this.carServiceConnector);
this.minimalScan = new ScanSchedule();
this.minimalScan.addPid(13, 100);
this.minimalScan.addPid(47, 15000);
this.minimalScan.addPid(49, 60000);
this.minimalScan.addPid(Pids.VEHICLE_SPEED, 100);
this.minimalScan.addPid(Pids.FUEL_LEVEL, 15000);
this.minimalScan.addPid(Pids.DISTANCE_TRAVELLED, 60000);
this.minimalScan.addPid(Pids.ENGINE_RPM, SLOW_RPM_UPDATE_INTERVAL);
this.fullScan = new ScanSchedule(this.minimalScan);
this.fullScan.addPid(12, 250);
this.fullScan.addPid(16, 1000);
this.fullScan.addPid(256, 1000);
this.fullScan.addPid(5, 2000);
this.fullScan.addPid(Pids.ENGINE_OIL_PRESSURE, 1000);
this.fullScan.addPid(Pids.ENGINE_TRIP_FUEL, 1000);
this.fullScan.addPid(Pids.TOTAL_VEHICLE_DISTANCE, 1000);
this.minimalScan.addPid(12, SLOW_RPM_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.MANIFOLD_AIR_PRESSURE, GENERIC_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.ENGINE_RPM, RPM_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.MASS_AIRFLOW, GENERIC_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.ENGINE_OIL_TEMPERATURE, GENERIC_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.AMBIENT_AIR_TEMRERATURE, GENERIC_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.INSTANTANEOUS_FUEL_CONSUMPTION, MPG_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.ENGINE_COOLANT_TEMPERATURE, GENERIC_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.ENGINE_OIL_PRESSURE, GENERIC_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.ENGINE_TRIP_FUEL, GENERIC_UPDATE_INTERVAL);
this.fullScan.addPid(Pids.TOTAL_VEHICLE_DISTANCE, GENERIC_UPDATE_INTERVAL);
this.bus.register(this);
this.bus.register(this.obdDeviceConfigurationManager);
this.bus.register(this.obdCanBusRecordingPolicy);
......@@ -841,6 +843,14 @@ public final class ObdManager {
return (int) getPidValue(12);
}
public int getDistanceToEmpty() {
return (int) getPidValue(Pids.DISTANCE_TO_EMPTY);
}
public int getIntakePressure() {
return (int) getPidValue(Pids.MANIFOLD_AIR_PRESSURE);
}
public double getInstantFuelConsumption() {
return (double) ((int) getPidValue(256));
}
......
package com.navdy.hud.app.ui.component.homescreen;
import com.navdy.hud.app.R;
import com.navdy.hud.app.view.AmbientTemperaturePresenter;
import com.navdy.hud.app.view.DriveScoreGaugePresenter;
import com.navdy.hud.app.view.EngineOilTemperaturePresenter;
import com.navdy.hud.app.view.EngineTemperaturePresenter;
import com.navdy.hud.app.view.GForcePresenter;
import com.navdy.hud.app.view.IntakePressurePresenter;
import com.navdy.hud.app.view.SpeedLimitSignPresenter;
import com.navdy.hud.app.view.MusicWidgetPresenter;
import com.navdy.hud.app.view.MPGGaugePresenter;
......@@ -18,6 +21,7 @@ import com.navdy.hud.app.view.DashboardWidgetPresenter;
import android.content.Context;
import java.util.HashMap;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.AMBIENT_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ANALOG_CLOCK_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.CALENDAR_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.COMPASS_WIDGET_ID;
......@@ -26,9 +30,11 @@ import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.D
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.DRIVE_SCORE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.EMPTY_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ENGINE_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ENGINE_OIL_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ETA_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.FUEL_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.GFORCE_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.INTAKE_PRESSURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.MPG_AVG_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.MPG_GRAPH_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.MUSIC_WIDGET_ID;
......@@ -95,6 +101,15 @@ public class DashWidgetPresenterFactory
case ENGINE_TEMPERATURE_GAUGE_ID:
dashboardWidgetPresenter = new EngineTemperaturePresenter(context);
break;
case ENGINE_OIL_TEMPERATURE_GAUGE_ID:
dashboardWidgetPresenter = new EngineOilTemperaturePresenter(context);
break;
case AMBIENT_TEMPERATURE_GAUGE_ID:
dashboardWidgetPresenter = new AmbientTemperaturePresenter(context);
break;
case INTAKE_PRESSURE_GAUGE_ID:
dashboardWidgetPresenter = new IntakePressurePresenter(context);
break;
case DRIVE_SCORE_GAUGE_ID:
dashboardWidgetPresenter = new DriveScoreGaugePresenter(context, R.layout.drive_score_gauge_layout, true);
break;
......
......@@ -3,6 +3,7 @@ package com.navdy.hud.app.ui.component.homescreen;
import com.navdy.hud.app.R;
import com.navdy.hud.app.maps.MapEvents$LocationFix;
import com.navdy.hud.app.maps.MapEvents$ManeuverDisplay;
import com.navdy.obd.Pids;
import com.navdy.service.library.events.preferences.MiddleGauge;
import com.navdy.service.library.events.preferences.ScrollableSide;
import android.os.Bundle;
......@@ -38,6 +39,8 @@ import com.navdy.hud.app.obd.ObdManager;
import com.navdy.hud.app.framework.DriverProfileHelper;
import android.util.AttributeSet;
import android.content.Context;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
import com.navdy.hud.app.view.TachometerGaugePresenter;
import com.navdy.hud.app.view.SpeedometerGaugePresenter2;
......@@ -51,12 +54,16 @@ import android.widget.TextView;
import com.navdy.service.library.log.Logger;
import com.navdy.hud.app.ui.component.dashboard.IDashboardOptionsAdapter;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.AMBIENT_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ANALOG_CLOCK_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.COMPASS_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.DRIVE_SCORE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.EMPTY_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ENGINE_OIL_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ENGINE_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.FUEL_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.FUEL_GAUGE_RANGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.INTAKE_PRESSURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.MPG_AVG_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.SPEED_LIMIT_SIGN_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.TRAFFIC_INCIDENT_GAUGE_ID;
......@@ -264,7 +271,7 @@ public class SmartDashView extends BaseSmartDashView implements IDashboardOption
}
break;
case 47:
this.mSmartDashWidgetManager.updateWidget(FUEL_GAUGE_ID, obdPidChangeEvent.pid.getValue());
this.mSmartDashWidgetManager.updateWidget(FUEL_GAUGE_ID, obdPidChangeEvent.pid.getValue());
break;
case 256:
this.mSmartDashWidgetManager.updateWidget(MPG_AVG_WIDGET_ID, obdPidChangeEvent.pid.getValue());
......@@ -272,6 +279,19 @@ public class SmartDashView extends BaseSmartDashView implements IDashboardOption
case 5:
this.mSmartDashWidgetManager.updateWidget(ENGINE_TEMPERATURE_GAUGE_ID, obdPidChangeEvent.pid.getValue());
break;
case Pids.ENGINE_OIL_TEMPERATURE:
this.mSmartDashWidgetManager.updateWidget(ENGINE_OIL_TEMPERATURE_GAUGE_ID, obdPidChangeEvent.pid.getValue());
break;
case Pids.AMBIENT_AIR_TEMRERATURE:
this.mSmartDashWidgetManager.updateWidget(AMBIENT_TEMPERATURE_GAUGE_ID, obdPidChangeEvent.pid.getValue());
break;
case Pids.MANIFOLD_AIR_PRESSURE:
this.mSmartDashWidgetManager.updateWidget(INTAKE_PRESSURE_GAUGE_ID, obdPidChangeEvent.pid.getValue());
break;
case Pids.DISTANCE_TO_EMPTY:
this.mSmartDashWidgetManager.updateWidget(FUEL_GAUGE_RANGE_ID, obdPidChangeEvent.pid.getValue());
break;
}
}
......@@ -384,6 +404,8 @@ public class SmartDashView extends BaseSmartDashView implements IDashboardOption
public void init(final HomeScreenView homeScreenView) {
this.globalPreferences = homeScreenView.globalPreferences;
this.mSmartDashWidgetManager = new SmartDashWidgetManager(this.globalPreferences, this.getContext());
homeScreenView.getDriverPreferences();
this.mSmartDashWidgetManager.setFilter(new SmartDashWidgetManager.IWidgetFilter() {
@Override
......@@ -420,6 +442,15 @@ public class SmartDashView extends BaseSmartDashView implements IDashboardOption
}
return true;
}
case INTAKE_PRESSURE_GAUGE_ID: {
final PidSet supportedPids = ObdManager.getInstance().getSupportedPids();
if (supportedPids != null) {
if (supportedPids.contains(Pids.MANIFOLD_AIR_PRESSURE)) {
return b2;
}
}
return true;
}
case ENGINE_TEMPERATURE_GAUGE_ID: {
final PidSet supportedPids2 = ObdManager.getInstance().getSupportedPids();
if (supportedPids2 != null) {
......@@ -429,6 +460,24 @@ public class SmartDashView extends BaseSmartDashView implements IDashboardOption
}
return true;
}
case ENGINE_OIL_TEMPERATURE_GAUGE_ID: {
final PidSet supportedPids2 = ObdManager.getInstance().getSupportedPids();
if (supportedPids2 != null) {
if (supportedPids2.contains(Pids.ENGINE_OIL_TEMPERATURE)) {
return b2;
}
}
return true;
}
case AMBIENT_TEMPERATURE_GAUGE_ID: {
final PidSet supportedPids2 = ObdManager.getInstance().getSupportedPids();
if (supportedPids2 != null) {
if (supportedPids2.contains(Pids.AMBIENT_AIR_TEMRERATURE)) {
return b2;
}
}
return true;
}
case MPG_AVG_WIDGET_ID: {
final PidSet supportedPids3 = ObdManager.getInstance().getSupportedPids();
if (supportedPids3 != null) {
......
package com.navdy.hud.app.ui.component.homescreen;
import com.navdy.hud.app.view.AmbientTemperaturePresenter;
import com.navdy.hud.app.view.EngineOilTemperaturePresenter;
import com.navdy.hud.app.view.IntakePressurePresenter;
import com.navdy.hud.app.view.SpeedLimitSignPresenter;
import com.navdy.hud.app.view.MPGGaugePresenter;
import com.navdy.hud.app.view.CompassPresenter;
......@@ -18,9 +21,9 @@ import java.util.ArrayList;
import java.util.HashMap;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.SparseArray;
import com.navdy.obd.Pids;
import com.squareup.otto.Bus;
import com.navdy.service.library.log.Logger;
import java.util.HashSet;
......@@ -35,9 +38,14 @@ public class SmartDashWidgetManager
public static final String DIGITAL_CLOCK_WIDGET_ID = "DIGITAL_CLOCK_WIDGET";
public static final String DRIVE_SCORE_GAUGE_ID = "DRIVE_SCORE_GAUGE_ID";
public static final String EMPTY_WIDGET_ID = "EMPTY_WIDGET";
public static final String INTAKE_PRESSURE_GAUGE_ID = "INTAKE_PRESSURE_GAUGE_ID";
public static final String ENGINE_TEMPERATURE_GAUGE_ID = "ENGINE_TEMPERATURE_GAUGE_ID";
public static final String ENGINE_OIL_TEMPERATURE_GAUGE_ID = "ENGINE_OIL_TEMPERATURE_GAUGE_ID";
public static final String AMBIENT_TEMPERATURE_GAUGE_ID = "AMBIENT_TEMPERATURE_GAUGE_ID";
public static final String ETA_GAUGE_ID = "ETA_GAUGE_ID";
public static final String FUEL_GAUGE_ID = "FUEL_GAUGE_ID";
public static final String FUEL_GAUGE_RANGE_ID = "FUEL_GAUGE_RANGE_ID";
private static List<String> GAUGES;
private static HashSet<String> GAUGE_NAME_LOOKUP;
public static final String GFORCE_WIDGET_ID = "GFORCE_WIDGET";
......@@ -71,12 +79,15 @@ public class SmartDashWidgetManager
SmartDashWidgetManager.GAUGES.add(DIGITAL_CLOCK_2_WIDGET_ID);
SmartDashWidgetManager.GAUGES.add(DRIVE_SCORE_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(ENGINE_TEMPERATURE_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(ENGINE_OIL_TEMPERATURE_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(AMBIENT_TEMPERATURE_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(FUEL_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(GFORCE_WIDGET_ID);
SmartDashWidgetManager.GAUGES.add(MUSIC_WIDGET_ID);
SmartDashWidgetManager.GAUGES.add(MPG_AVG_WIDGET_ID);
SmartDashWidgetManager.GAUGES.add(SPEED_LIMIT_SIGN_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(TRAFFIC_INCIDENT_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(INTAKE_PRESSURE_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(ETA_GAUGE_ID);
SmartDashWidgetManager.GAUGES.add(EMPTY_WIDGET_ID);
SmartDashWidgetManager.GAUGE_NAME_LOOKUP.addAll(SmartDashWidgetManager.GAUGES);
......@@ -296,6 +307,7 @@ public class SmartDashWidgetManager
final int fuelLevel = ObdManager.getInstance().getFuelLevel();
if (fuelGaugePresenter2 != null) {
fuelGaugePresenter2.setFuelLevel(fuelLevel);
fuelGaugePresenter2.setFuelRange(0);
break;
}
break;
......@@ -320,6 +332,42 @@ public class SmartDashWidgetManager
}
break;
}
case ENGINE_OIL_TEMPERATURE_GAUGE_ID: {
final EngineOilTemperaturePresenter engineOilTemperaturePresenter = (EngineOilTemperaturePresenter)this.getWidgetPresenter(s);
double engineOilTemperature = ObdManager.getInstance().getPidValue(Pids.ENGINE_OIL_TEMPERATURE);
if (engineOilTemperaturePresenter != null) {
if (engineOilTemperature == -1.0) {
engineOilTemperature = EngineOilTemperaturePresenter.Companion.getTEMPERATURE_GAUGE_MID_POINT_CELSIUS();
}
engineOilTemperaturePresenter.setEngineTemperature(engineOilTemperature);
break;
}
break;
}
case AMBIENT_TEMPERATURE_GAUGE_ID: {
final AmbientTemperaturePresenter ambientTemperaturePresenter = (AmbientTemperaturePresenter)this.getWidgetPresenter(s);
double ambientTemperature = ObdManager.getInstance().getPidValue(Pids.AMBIENT_AIR_TEMRERATURE);
if (ambientTemperaturePresenter != null) {
if (ambientTemperature == -1.0) {
ambientTemperature = AmbientTemperaturePresenter.Companion.getTEMPERATURE_GAUGE_MID_POINT_CELSIUS();
}
ambientTemperaturePresenter.setEngineTemperature(ambientTemperature);
break;
}
break;
}
case INTAKE_PRESSURE_GAUGE_ID: {
final IntakePressurePresenter intakePressurePresenter = (IntakePressurePresenter)this.getWidgetPresenter(s);
double intakePressure = ObdManager.getInstance().getPidValue(Pids.MANIFOLD_AIR_PRESSURE);
if (intakePressurePresenter != null) {
if (intakePressure == -1.0) {
intakePressure = 0.0f;
}
intakePressurePresenter.setIntakePressure(intakePressure);
break;
}
break;
}
}
}
......@@ -379,10 +427,19 @@ public class SmartDashWidgetManager
final FuelGaugePresenter2 fuelGaugePresenter2 = (FuelGaugePresenter2)this.getWidgetPresenter(s);
if (fuelGaugePresenter2 != null && o instanceof Double) {
fuelGaugePresenter2.setFuelLevel(((Number)o).intValue());
break;
}
break;
}
case FUEL_GAUGE_RANGE_ID: {
final FuelGaugePresenter2 fuelGaugePresenter2 = (FuelGaugePresenter2)this.getWidgetPresenter(s);
if (fuelGaugePresenter2 != null && o instanceof Double) {
fuelGaugePresenter2.setFuelRange(((Number)o).intValue());
break;
}
break;
}
case COMPASS_WIDGET_ID: {
final CompassPresenter compassPresenter = (CompassPresenter)this.getWidgetPresenter(s);
if (compassPresenter != null) {
......@@ -407,6 +464,14 @@ public class SmartDashWidgetManager
}
break;
}
case ENGINE_OIL_TEMPERATURE_GAUGE_ID: {
final EngineOilTemperaturePresenter engineOilTemperaturePresenter = (EngineOilTemperaturePresenter)this.getWidgetPresenter(s);
if (engineOilTemperaturePresenter != null) {
engineOilTemperaturePresenter.setEngineTemperature(((Number)o).intValue());
break;
}
break;
}
case ENGINE_TEMPERATURE_GAUGE_ID: {
final EngineTemperaturePresenter engineTemperaturePresenter = (EngineTemperaturePresenter)this.getWidgetPresenter(s);
if (engineTemperaturePresenter != null) {
......@@ -415,6 +480,22 @@ public class SmartDashWidgetManager
}
break;
}
case AMBIENT_TEMPERATURE_GAUGE_ID: {
final AmbientTemperaturePresenter ambientTemperaturePresenter = (AmbientTemperaturePresenter)this.getWidgetPresenter(s);
if (ambientTemperaturePresenter != null) {
ambientTemperaturePresenter.setEngineTemperature(((Number)o).intValue());
break;
}
break;
}
case INTAKE_PRESSURE_GAUGE_ID: {
final IntakePressurePresenter intakePressurePresenter = (IntakePressurePresenter)this.getWidgetPresenter(s);
if (intakePressurePresenter != null) {
intakePressurePresenter.setIntakePressure(((Number)o).intValue());
break;
}
break;
}
}
}
}
......
......@@ -19,6 +19,7 @@ import com.navdy.hud.app.ui.component.vlist.viewholder.SwitchViewHolder;
import kotlin.NoWhenBranchMatchedException;
import java.util.List;
import com.navdy.hud.app.obd.ObdManager;
import com.navdy.obd.Pids;
import com.squareup.otto.Subscribe;
import android.view.View;
import android.view.ViewGroup;
......@@ -44,10 +45,13 @@ import java.util.ArrayList;
import com.navdy.hud.app.ui.component.vlist.VerticalList;
import kotlin.Metadata;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.AMBIENT_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.COMPASS_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.DRIVE_SCORE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ENGINE_OIL_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.ENGINE_TEMPERATURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.FUEL_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.INTAKE_PRESSURE_GAUGE_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.MPG_AVG_WIDGET_ID;
import static com.navdy.hud.app.ui.component.homescreen.SmartDashWidgetManager.SPEED_LIMIT_SIGN_GAUGE_ID;
......@@ -331,24 +335,44 @@ public final class DashGaugeConfiguratorMenu implements IMenu
PidSet pidSet = ObdManager.getInstance().getSupportedPids();
if (identifier != null) {
boolean z;
switch (identifier.hashCode()) {
case -1158963060:
switch (identifier) {
case SmartDashWidgetManager.MPG_AVG_WIDGET_ID:
if (identifier.equals(MPG_AVG_WIDGET_ID)) {
z = pidSet != null && pidSet.contains(256);
z = pidSet != null && pidSet.contains(Pids.INSTANTANEOUS_FUEL_CONSUMPTION);
isGaugeEnabled = z;
break;
}
break;
case -131933527:
case SmartDashWidgetManager.ENGINE_TEMPERATURE_GAUGE_ID:
if (identifier.equals(ENGINE_TEMPERATURE_GAUGE_ID)) {
z = pidSet != null && pidSet.contains(5);
z = pidSet != null && pidSet.contains(Pids.ENGINE_COOLANT_TEMPERATURE);
isGaugeEnabled = z;
break;
}
break;
case 1168400042:
case SmartDashWidgetManager.FUEL_GAUGE_ID:
if (identifier.equals(FUEL_GAUGE_ID)) {
z = pidSet != null && pidSet.contains(47);
z = pidSet != null && pidSet.contains(Pids.FUEL_LEVEL);
isGaugeEnabled = z;
break;
}
break;
case INTAKE_PRESSURE_GAUGE_ID:
if (identifier.equals(INTAKE_PRESSURE_GAUGE_ID)) {
z = pidSet != null && pidSet.contains(Pids.MANIFOLD_AIR_PRESSURE);
isGaugeEnabled = z;
break;
}
break;
case ENGINE_OIL_TEMPERATURE_GAUGE_ID:
if (identifier.equals(ENGINE_OIL_TEMPERATURE_GAUGE_ID)) {
z = pidSet != null && pidSet.contains(Pids.ENGINE_OIL_TEMPERATURE);
isGaugeEnabled = z;
break;
}
case AMBIENT_TEMPERATURE_GAUGE_ID:
if (identifier.equals(AMBIENT_TEMPERATURE_GAUGE_ID)) {
z = pidSet != null && pidSet.contains(Pids.AMBIENT_AIR_TEMRERATURE);
isGaugeEnabled = z;
break;
}
......
package com.navdy.hud.app.view.drawable;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.graphics.RectF;
import com.navdy.hud.app.R;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
@Metadata(bv = {1, 0, 1}, d1 = {"\u0000,\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001B\u0017\b\u0016\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0005\u00a2\u0006\u0002\u0010\u0006J\u0012\u0010\u000b\u001a\u00020\f2\b\u0010\r\u001a\u0004\u0018\u00010\u000eH\u0016J\u000e\u0010\u000f\u001a\u00020\f2\u0006\u0010\u0010\u001a\u00020\nR\u000e\u0010\u0007\u001a\u00020\u0005X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\b\u001a\u00020\u0005X\u0082\u000e\u00a2\u0006\u0002\n\u0000R\u000e\u0010\t\u001a\u00020\nX\u0082\u000e\u00a2\u0006\u0002\n\u0000\u00a8\u0006\u0011"}, d2 = {"Lcom/navdy/hud/app/view/drawable/EngineTemperatureDrawable;", "Lcom/navdy/hud/app/view/drawable/GaugeDrawable;", "context", "Landroid/content/Context;", "stateColorsResId", "", "(Landroid/content/Context;I)V", "mBackgroundColor", "mFuelGaugeWidth", "mLeftOriented", "", "draw", "", "canvas", "Landroid/graphics/Canvas;", "setLeftOriented", "leftOriented", "app_hudRelease"}, k = 1, mv = {1, 1, 6})
/* compiled from: EngineTemperatureDrawable.kt */
public final class IntakePressureDrawable extends GaugeDrawable {
private int mBackgroundColor;
private int mFuelGaugeWidth;
private boolean mLeftOriented = true;
public IntakePressureDrawable(@NotNull Context context, int stateColorsResId) {
super(context, 0, stateColorsResId);
Intrinsics.checkParameterIsNotNull(context, "context");
this.mFuelGaugeWidth = context.getResources().getDimensionPixelSize(R.dimen.fuel_gauge_width);
this.mBackgroundColor = this.mColorTable[3];
}
public final void setLeftOriented(boolean leftOriented) {
this.mLeftOriented = leftOriented;
}
public void draw(@Nullable Canvas canvas) {
RectF fuelGaugeArcBounds;
int valueStartAngle = 90;
super.draw(canvas);
Rect bounds = getBounds();
if (this.mLeftOriented) {
fuelGaugeArcBounds = new RectF((float) bounds.left, (float) bounds.top, (float) (bounds.right + bounds.width()), (float) bounds.bottom);
} else {
fuelGaugeArcBounds = new RectF((float) (bounds.left - bounds.width()), (float) bounds.top, (float) bounds.right, (float) bounds.bottom);
}
fuelGaugeArcBounds.inset((float) ((this.mFuelGaugeWidth / 2) + 1), (float) ((this.mFuelGaugeWidth / 2) + 1));
this.mPaint.setStyle(Style.STROKE);
this.mPaint.setStrokeWidth((float) this.mFuelGaugeWidth);
this.mPaint.setColor(this.mBackgroundColor);
int startAngle = this.mLeftOriented ? 90 : 270;
int endAngle = startAngle + 180;
if (canvas != null) {
canvas.drawArc(fuelGaugeArcBounds, (float) startAngle, (float) 180, false, this.mPaint);
}
this.mPaint.setColor(this.mDefaultColor);
int valueSweepAngle = (int) (((this.mValue - this.mMinValue) / (this.mMaxValue - this.mMinValue)) * ((float) 180));
if (!this.mLeftOriented) {
valueStartAngle = 450 - valueSweepAngle;
}
boolean z = this.mLeftOriented;
if (z) {
if (canvas != null) {
canvas.drawArc(fuelGaugeArcBounds, (float) valueStartAngle, ((float) valueSweepAngle) - 5.0f, false, this.mPaint);
}
} else if (!(z || canvas == null)) {
canvas.drawArc(fuelGaugeArcBounds, ((float) valueStartAngle) + 5.0f, (float) valueSweepAngle, false, this.mPaint);
}
this.mPaint.setColor(-16777216);
z = this.mLeftOriented;
if (z) {
if (canvas != null) {
canvas.drawArc(fuelGaugeArcBounds, ((float) valueSweepAngle) + ((float) valueStartAngle), -5.0f, false, this.mPaint);
}
} else if (!z && canvas != null) {
canvas.drawArc(fuelGaugeArcBounds, (float) valueStartAngle, 5.0f, false, this.mPaint);
}
}
}
......@@ -2,22 +2,26 @@ package com.navdy.obd;
public class Pids
{
public static final int CUSTOM_PIDS = 64;
public static final int CUSTOM_PID_START = 256;
public static final int DISTANCE_TO_EMPTY = 257;
public static final int DISTANCE_TRAVELLED = 49;
public static final int FUEL_SYSTEM_STATUS = 3;
public static final int ENGINE_COOLANT_TEMPERATURE = 5;
public static final int ENGINE_OIL_PRESSURE = 258;
public static final int MANIFOLD_AIR_PRESSURE = 11;
public static final int ENGINE_RPM = 12;
public static final int ENGINE_TRIP_FUEL = 259;
public static final int FUEL_LEVEL = 47;
public static final int FUEL_SYSTEM_STATUS = 3;
public static final int INSTANTANEOUS_FUEL_CONSUMPTION = 256;
public static final int VEHICLE_SPEED = 13;
public static final int INTAKE_AIR_TEMPERATURE = 15;
public static final int MANIFOLD_AIR_PRESSURE = 11;
public static final int MASS_AIRFLOW = 16;
public static final int MAX_PID = 320;
public static final int THROTTLE_POSITION = 17;
public static final int DISTANCE_TRAVELLED = 49;
public static final int FUEL_LEVEL = 47;
public static final int AMBIENT_AIR_TEMRERATURE = 70;
public static final int ENGINE_OIL_TEMPERATURE = 92;
public static final int CUSTOM_PIDS = 64;
public static final int CUSTOM_PID_START = 256;
public static final int INSTANTANEOUS_FUEL_CONSUMPTION = 256;
public static final int ENGINE_OIL_PRESSURE = 258;
public static final int TOTAL_VEHICLE_DISTANCE = 260;
public static final int VEHICLE_SPEED = 13;
public static final int ENGINE_TRIP_FUEL = 259;
public static final int DISTANCE_TO_EMPTY = 257;
public static final int MAX_PID = 320;
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<View android:id="@id/custom_drawable" android:layout_width="50.0dip" android:layout_height="100.0dip" android:layout_marginLeft="30.0dip" android:layout_centerVertical="true" />
<ImageView android:id="@id/ambient_air_temp_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="57.0dip" android:src="@drawable/icon_ambient_air_temperature" android:layout_centerVertical="true" />
<LinearLayout android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20.0dip" android:minWidth="48.0dip" android:layout_toRightOf="@id/custom_drawable" android:layout_centerVertical="true">
<TextView android:textSize="26.0sp" android:textColor="@android:color/white" android:id="@id/txt_value" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/Roboto.Bold" />
<TextView android:textSize="16.0sp" android:textColor="@android:color/white" android:id="@id/txt_unit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="-4.0dip" style="@style/Roboto.Bold" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<View android:id="@id/custom_drawable" android:layout_width="50.0dip" android:layout_height="100.0dip" android:layout_marginRight="30.0dip" android:layout_alignParentRight="true" android:layout_centerVertical="true" />
<ImageView android:id="@id/engine_oil_temp_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="57.0dip" android:src="@drawable/icon_engine_oil_temperature" android:layout_alignParentRight="true" android:layout_centerVertical="true" />
<LinearLayout android:gravity="right" android:orientation="vertical" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="7.0dip" android:minWidth="48.0dip" android:layout_centerVertical="true">
<TextView android:textSize="26.0sp" android:textColor="@android:color/white" android:id="@id/txt_value" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/Roboto.Bold" />
<TextView android:textSize="16.0sp" android:textColor="@android:color/white" android:id="@id/txt_unit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="-4.0dip" style="@style/Roboto.Bold" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>