Skip to content

Commit

Permalink
J2534: only display j2534 window when DLL is available
Browse files Browse the repository at this point in the history
Signed-off-by: Connor Rigby <[email protected]>
  • Loading branch information
ConnorRigby committed Nov 5, 2022
1 parent 9d7f0cc commit 8ef6f19
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
*.o
*.so
conescan
/web
/lib/glfw
/lib/glew
/x64
/Debug
/Release

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ ifeq ($(UNAME_S), Linux) #LINUX
LIBS += $(LINUX_GL_LIBS) `pkg-config --cflags --libs gtk+-3.0`

CXXFLAGS += `pkg-config --cflags glfw3`
CXXFLAGS += -Wl,-R,'$$ORIGIN'
CFLAGS = $(CXXFLAGS)
endif

Expand Down
Binary file modified conescan.db
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/rx8-ecu-dump
Submodule rx8-ecu-dump updated 1 files
+1 −1 J2534/J2534.cpp
59 changes: 28 additions & 31 deletions src/conescan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ void RenderMenu(bool* exit_requested)

void RenderConnection()
{
if (j2534InitOK == false) return;

ImGui::SetNextWindowSize(ImVec2(200, 200), ImGuiCond_FirstUseEver);
char buf[255];
sprintf(buf, "J2534 Interface %s %s", dllName, dllVersion);
Expand All @@ -819,30 +817,31 @@ void RenderConnection()
}
ImGui::EndPopup();
}
if (j2534InitOK) {
if (ImGui::Button("Identify Vehicle")) {
if (vin) {
free(vin);
vin = NULL;
}
if (calID) {
free(calID);
calID = NULL;
}

if (ImGui::Button("Identify Vehicle")) {
if (vin) {
free(vin);
vin = NULL;
}
if (calID) {
free(calID);
calID = NULL;
}

if (ecu->getVIN(&vin)) {
console.AddLog("ERROR: Failed to get VIN");
}
else {
console.AddLog("Got VIN: %s", vin);
}
if (ecu->getVIN(&vin)) {
console.AddLog("ERROR: Failed to get VIN");
}
else {
console.AddLog("Got VIN: %s", vin);
}

if (ecu->getCalibrationID(&calID)) {
console.AddLog("ERROR: failed to read calibration ID");
}
else {
console.AddLog("Got CALID: %s", calID);
}
if (ecu->getCalibrationID(&calID)) {
console.AddLog("ERROR: failed to read calibration ID");
}
else {
console.AddLog("Got CALID: %s", calID);
}
}
}
ImGui::Separator();

Expand All @@ -858,11 +857,11 @@ void RenderConnection()
ImGui::SameLine();
ImGui::Text("SW%s", calID);
}
ImGui::End();
}

void ConeScan::RenderUI(bool* exit_requested)
{

if(show_console_window)
console.Draw("Console", &show_console_window);

Expand All @@ -879,8 +878,6 @@ void ConeScan::RenderUI(bool* exit_requested)
ImGui::End();

RenderConnection();

ImGui::End();
}

void ConeScan::Cleanup()
Expand All @@ -897,15 +894,16 @@ void ConeScan::Cleanup()
conescan_db_save_layout(&db, layoutID, iniData);

conescan_db_close(&db);
if (j2534.valid()) {
j2534.PassThruClose(devID);
j2534.PassThruDisconnect(chanID);
if (j2534InitOK) {
j2534.PassThruClose(devID);
j2534.PassThruDisconnect(chanID);
}
}

size_t j2534Initialize()
{
console.AddLog("initializing J2534\n");
j2534.getDLLName(dllName);
#ifdef DEBUG
j2534.debug(true);
#endif
Expand All @@ -924,7 +922,6 @@ size_t j2534Initialize()
return 1;
}

j2534.getDLLName(dllName);
j2534.PassThruReadVersion(apiVersion, dllVersion, firmwareVersion, devID);
console.AddLog("Connected to J2534 Interface: %s\n API Version: %s\n DLL Version: %s\n Firmware Version: %s", dllName, apiVersion, dllVersion, firmwareVersion);

Expand Down

0 comments on commit 8ef6f19

Please sign in to comment.