Skip to content

Commit

Permalink
Merge pull request #180 from intel-isl/bugfixes
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
thias15 authored Apr 15, 2021
2 parents 7f832a8 + 2077521 commit f5c88aa
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
18 changes: 18 additions & 0 deletions android/app/src/main/java/org/openbot/ai/AIFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,24 @@ protected void processControllerKeyData(String commandType) {
String.format(Locale.US, "%.0f,%.0f", vehicle.getLeftSpeed(), vehicle.getRightSpeed()));
break;

case Constants.CMD_DRIVE_MODE:
setDriveMode(Enums.switchDriveMode(vehicle.getDriveMode()));
break;

case Constants.CMD_SPEED_DOWN:
setSpeedMode(
Enums.toggleSpeed(
Enums.Direction.DOWN.getValue(),
Enums.SpeedMode.getByID(preferencesManager.getSpeedMode())));
break;

case Constants.CMD_SPEED_UP:
setSpeedMode(
Enums.toggleSpeed(
Enums.Direction.UP.getValue(),
Enums.SpeedMode.getByID(preferencesManager.getSpeedMode())));
break;

case Constants.CMD_NETWORK:
setNetworkEnabledWithAudio(!binding.autoSwitch.isChecked());
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ private void processKeyEvent(KeyEvent keyCode) {
toggleIndicatorEvent(Enums.VehicleIndicator.RIGHT.getValue());
processControllerKeyData(Constants.CMD_INDICATOR_RIGHT);
break;

case KeyEvent.KEYCODE_BUTTON_A: // x
processControllerKeyData(Constants.CMD_LOGS);
break;
Expand All @@ -126,15 +125,20 @@ private void processKeyEvent(KeyEvent keyCode) {
break;
case KeyEvent.KEYCODE_BUTTON_L1:
processControllerKeyData(Constants.CMD_DRIVE_MODE);
audioPlayer.playDriveMode(voice, vehicle.getDriveMode());
break;
case KeyEvent.KEYCODE_BUTTON_R1:
processControllerKeyData(Constants.CMD_NETWORK);
break;
case KeyEvent.KEYCODE_BUTTON_THUMBL:
processControllerKeyData(Constants.CMD_SPEED_DOWN);
audioPlayer.playSpeedMode(
voice, Enums.SpeedMode.getByID(preferencesManager.getSpeedMode()));
break;
case KeyEvent.KEYCODE_BUTTON_THUMBR:
processControllerKeyData(Constants.CMD_SPEED_UP);
audioPlayer.playSpeedMode(
voice, Enums.SpeedMode.getByID(preferencesManager.getSpeedMode()));
break;

default:
Expand Down Expand Up @@ -202,9 +206,9 @@ private void handlePhoneControllerEvents() {
}

protected void toggleNoise() {
vehicle.toggleNoise();
BotToControllerEventBus.emitEvent(Utils.createStatus("NOISE", vehicle.isNoiseEnabled()));
audioPlayer.playNoise(voice, vehicle.isNoiseEnabled());
vehicle.toggleNoise();
}

private void toggleIndicatorEvent(int value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,7 @@ protected void processControllerKeyData(String commandType) {
case Constants.CMD_LOGS:
handleLogging();
break;
// case "Constants.CMD_NOISE":
// handleNoise();
// break;

case Constants.CMD_INDICATOR_LEFT:
case Constants.CMD_INDICATOR_RIGHT:
case Constants.CMD_INDICATOR_STOP:
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/java/org/openbot/main/MainFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,23 @@ public void onItemClick(SubCategory subCategory) {
case FeatureList.DATA_COLLECTION:
Navigation.findNavController(requireView())
.navigate(R.id.action_mainFragment_to_loggerFragment);
break;

case FeatureList.CONTROLLER:
// For a library module, uncomment the following line
// intent = new Intent(this, ControllerActivity.class);
// startActivity(intent);
break;

case FeatureList.AI_MODELS:
Navigation.findNavController(requireView())
.navigate(R.id.action_mainFragment_to_AIFragment);
break;

case FeatureList.CONTROLLER_MAPPING:
Navigation.findNavController(requireView())
.navigate(R.id.action_mainFragment_to_controllerMappingFragment);
break;
}
}
}

0 comments on commit f5c88aa

Please sign in to comment.