Skip to content

Commit

Permalink
Merge pull request #286 from enviroCar/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
dewall committed Jan 26, 2016
2 parents 517a5e2 + fd1b83a commit 93a8a46
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion org.envirocar.app/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package="org.envirocar.app"
android:installLocation="internalOnly"
android:versionCode="28"
android:versionName="0.21.0">
android:versionName="0.21.0-SNAPSHOT">

<uses-sdk
android:minSdkVersion="16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
* @author dewall
*/
public class BaseMainActivity extends BaseInjectorActivity {
private static final Logger LOGGER = Logger.getLogger(BaseApplication.class);
private static final Logger LOGGER = Logger.getLogger(BaseMainActivity.class);

public static final int TRACK_MODE_SINGLE = 0;
public static final int TRACK_MODE_AUTO = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.test.InstrumentationTestCase;

import org.envirocar.obd.commands.PID;
import org.envirocar.obd.commands.response.entity.LambdaProbeVoltageResponse;
import org.envirocar.obd.exception.AdapterSearchingException;
import org.envirocar.obd.exception.InvalidCommandResponseException;
import org.envirocar.obd.exception.NoDataReceivedException;
Expand Down Expand Up @@ -32,4 +33,14 @@ public void testLambdaParsing() throws InvalidCommandResponseException, NoDataRe
Assert.assertThat(composites[1], CoreMatchers.is(((0*256)+40)/8192d));
}

public void testLambdaSwitched() throws InvalidCommandResponseException, NoDataReceivedException, UnmatchedResponseException, AdapterSearchingException {
ResponseParser responseParser = new ResponseParser();

DataResponse parse = responseParser.parse("41241DBC3B48".getBytes());

DataResponse parseSwitch = responseParser.parse("41243B481DBC".getBytes());

Assert.assertThat(parse, CoreMatchers.instanceOf(LambdaProbeVoltageResponse.class));
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ protected Set<PID> getSupportedPIDs() {
private DataResponse parsePIDResponse(String pid, byte[] rawBytes) throws InvalidCommandResponseException, NoDataReceivedException,
UnmatchedResponseException, AdapterSearchingException {

logger.verbose(String.format("Processing PID Response: %s; %s", pid, Base64.encodeToString(rawBytes, Base64.DEFAULT)).trim());
logger.verbose(String.format("PID Response: %s; %s", pid, Base64.encodeToString(rawBytes, Base64.DEFAULT)).trim());

/*
* resulting HEX values are 0x0d additive to the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package org.envirocar.obd.commands.response;

import org.envirocar.core.logging.Logger;
import org.envirocar.obd.commands.PID;
import org.envirocar.obd.commands.PIDUtil;
import org.envirocar.obd.commands.response.entity.GenericDataResponse;
import org.envirocar.obd.exception.AdapterSearchingException;
import org.envirocar.obd.exception.NoDataReceivedException;
import org.envirocar.obd.exception.UnmatchedResponseException;
import org.envirocar.obd.commands.response.entity.EngineLoadResponse;
import org.envirocar.obd.commands.response.entity.EngineRPMResponse;
import org.envirocar.obd.commands.response.entity.FuelPressureResponse;
import org.envirocar.obd.commands.response.entity.FuelSystemStatusResponse;
import org.envirocar.obd.commands.response.entity.GenericDataResponse;
import org.envirocar.obd.commands.response.entity.IntakeAirTemperatureResponse;
import org.envirocar.obd.commands.response.entity.IntakeManifoldAbsolutePressureResponse;
import org.envirocar.obd.commands.response.entity.LambdaProbeCurrentResponse;
Expand All @@ -19,10 +17,15 @@
import org.envirocar.obd.commands.response.entity.ShortTermFuelTrimResponse;
import org.envirocar.obd.commands.response.entity.SpeedResponse;
import org.envirocar.obd.commands.response.entity.ThrottlePositionResponse;
import org.envirocar.obd.exception.AdapterSearchingException;
import org.envirocar.obd.exception.InvalidCommandResponseException;
import org.envirocar.obd.exception.NoDataReceivedException;
import org.envirocar.obd.exception.UnmatchedResponseException;

public class ResponseParser {

private static final Logger LOGGER = Logger.getLogger(ResponseParser.class);

private static final CharSequence SEARCHING = "SEARCHING";
private static final CharSequence STOPPED = "STOPPED";
private static final CharSequence NO_DATA = "NODATA";
Expand Down Expand Up @@ -125,9 +128,10 @@ private DataResponse createDataResponse(PID pid, int[] processedData, byte[] raw
case O2_LAMBDA_PROBE_6_VOLTAGE:
case O2_LAMBDA_PROBE_7_VOLTAGE:
case O2_LAMBDA_PROBE_8_VOLTAGE:
return new LambdaProbeVoltageResponse(
((processedData[4]*256d) + processedData[5] )/ 8192d,
((processedData[2]*256d) + processedData[3]) / 32768d);
LambdaProbeVoltageResponse lambda = new LambdaProbeVoltageResponse(
((processedData[4] * 256d) + processedData[5]) / 8192d,
((processedData[2] * 256d) + processedData[3]) / 32768d);
return lambda;
case O2_LAMBDA_PROBE_1_CURRENT:
case O2_LAMBDA_PROBE_2_CURRENT:
case O2_LAMBDA_PROBE_3_CURRENT:
Expand All @@ -144,7 +148,6 @@ private DataResponse createDataResponse(PID pid, int[] processedData, byte[] raw
return new GenericDataResponse(pid, processedData, rawData);
}


private boolean isSearching(String dataString) {
return dataString.contains(SEARCHING) || dataString.contains(STOPPED);
}
Expand Down

0 comments on commit 93a8a46

Please sign in to comment.