Skip to content

Commit

Permalink
Merge branch 'main' of github.com:TeamOpenSmartGlasses/SmartGlassesDr…
Browse files Browse the repository at this point in the history
…iveAssistant
  • Loading branch information
alex1115alex committed May 9, 2023
2 parents 0640daf + 0eee1af commit 4782416
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public void driveCommandCallback(String args, long commandTriggeredTime){

// Make sure we aren't already connected...
stopObdTasks();
obdManager = new ObdManager();

sgmLib.sendReferenceCard(appName, "Searching for OBDII connection...");
obdManager.Connect();
Expand All @@ -97,7 +98,7 @@ public void listenToDriveStuff(){
@Override
public void onTachChanged(ObdManager manager) {
//tachString = String.format("%.1f", (manager.getTach() / 1000f));
//Log.d(TAG,"HOLYFUCK NEW TACH: " + manager.getTach());
//Log.d(TAG,"NEW TACH: " + manager.getTach());
tachString = String.valueOf(manager.getTach());

if(!displayRefreshStarted)
Expand Down Expand Up @@ -127,9 +128,9 @@ public void startDriveDisplayRefresh(){
handler.postDelayed(new Runnable() {
public void run() {
String toSend = padding;
toSend += speedString + "mph | " + tachString + "rpm";
toSend += tachString + "rpm | " + speedString + "mph";

sgmLib.sendReferenceCard(appName, toSend);
sgmLib.sendReferenceCard("", toSend);

handler.postDelayed(this, delay);
}
Expand Down Expand Up @@ -157,19 +158,19 @@ public void onObdDisonnectedEvent(ObdDisconnectedEvent receivedEvent){
public String maybeGeneratePadding(){
String pad = "";
if(displayBottom) {
for (int i = 0; i < 8; i++) {
for (int i = 0; i < 7; i++) {
//25 spaces = 1 line on ActiveLook Engo 2
pad += " ";
}
}
if(displayRight){
pad += " ";
pad += ""; //TODO: investigate weirdness here
}
return pad;
}

public void displayAppStopped(String reason){
sgmLib.sendReferenceCard(appName, appName + " stopped:\n" + reason);
sgmLib.sendReferenceCard(appName, appName + " stopped: " + reason);
}

public void stopObdTasks(){
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.teamopensmartglasses.driveassistant;

import android.util.Log;

import com.teamopensmartglasses.driveassistant.events.FocusChangedEvent;
import com.teamopensmartglasses.driveassistant.events.ObdDisconnectedEvent;
import com.teamopensmartglasses.sgmlib.FocusCallback;
Expand All @@ -8,10 +10,9 @@
import org.greenrobot.eventbus.EventBus;

public class FocusHandler implements FocusCallback {

final String TAG = "SmartGlassesDriveAssistant_FocusHandler";
@Override
public void runFocusChange(FocusStates focusState) {
if(focusState == FocusStates.OUT_FOCUS)
EventBus.getDefault().post(new ObdDisconnectedEvent("Lost focus"));
if(focusState == FocusStates.OUT_FOCUS){}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ else if (words[1].equals("10")) {
// throw new RuntimeException(e);
//}
}
EventBus.getDefault().post(new ObdDisconnectedEvent("Dead connection"));
}


Expand Down

0 comments on commit 4782416

Please sign in to comment.