Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't wait for PCM to restart after flashing.
  • Loading branch information
LegacyNsfw committed Jan 16, 2019
1 parent d61b2dd commit 01544bb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Apps/PcmApps.sln
Expand Up @@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PcmHammer", "PcmHammer\PcmH
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{0AA6F273-995D-4ADE-8CBB-DB1B6E8A0FCE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PcmLibrary", "PcmLibrary\PcmLibrary.csproj", "{0B317C5A-E078-4A96-8E7A-00601BCA1429}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PcmLibrary", "PcmLibrary\PcmLibrary.csproj", "{0B317C5A-E078-4A96-8E7A-00601BCA1429}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
2 changes: 1 addition & 1 deletion Apps/PcmLibrary/Messages/Protocol.Misc.cs
Expand Up @@ -27,7 +27,7 @@ public Message CreateClearDiagnosticTroubleCodesRequest()
/// <summary>
/// Create a broadcast message telling all modules to clear diagnostic information.
/// </summary>
public Message CreateClearPcmDiagnosticInformationRequest()
public Message CreateClearDiagnosticInformationRequest()
{
byte[] bytes = new byte[] { Priority.Physical0High, DeviceId.Broadcast, DeviceId.Tool, Mode.ClearDiagnosticInformation };
return new Message(bytes);
Expand Down
10 changes: 8 additions & 2 deletions Apps/PcmLibrary/Vehicle.Kernel.cs
Expand Up @@ -131,13 +131,18 @@ public async Task Cleanup()
this.logger.AddDebugMessage("Halting the kernel.");
await this.ExitKernel();

/* Waiting for the PCM to reboot didn't make any difference.
* But I still hope that if we send the right messages after
* restarting the PCM, we can clear the TAC's P1518 code.
*
this.logger.AddUserMessage("Waiting for the PCM to restart...");
for(int remaining = 10; remaining > 0; remaining--)
{
this.logger.AddUserMessage(remaining.ToString() + " seconds left.");
await Task.Delay(1000);
}
this.logger.AddUserMessage("Clearing trouble codes.");
*/

await this.ClearTroubleCodes();
}

Expand Down Expand Up @@ -171,6 +176,7 @@ public async Task ExitKernel()
/// </remarks>
public async Task ClearTroubleCodes()
{
this.logger.AddUserMessage("Clearing trouble codes.");
this.device.ClearMessageQueue();

// The response is not checked because the priority byte and destination address are odd.
Expand All @@ -182,7 +188,7 @@ public async Task ClearTroubleCodes()

// This is a conventional message, but the response from the PCM might get lost
// among the responses from other modules on the bus, so again we just send it twice.
Message clearDiagnosticInformationRequest = this.protocol.CreateClearPcmDiagnosticInformationRequest();
Message clearDiagnosticInformationRequest = this.protocol.CreateClearDiagnosticInformationRequest();
await this.device.SendMessage(clearDiagnosticInformationRequest);
await this.device.SendMessage(clearDiagnosticInformationRequest);
}
Expand Down

0 comments on commit 01544bb

Please sign in to comment.