Skip to content

Commit

Permalink
feature: in case of two announced schemas and the charger chose DIN, …
Browse files Browse the repository at this point in the history
…then use DIN. Reduced logging.
  • Loading branch information
uhi22 committed May 15, 2024
1 parent 875fe0b commit 661d232
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
18 changes: 16 additions & 2 deletions ccs/pevStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,22 @@ static void stateFunctionWaitForSupportedApplicationProtocolResponse(void)
pev_enterState(PEV_STATE_End); /* nothing more to do here */
} else if ((Param::GetInt(Param::PlcSchema) == 2) && (aphsDoc.supportedAppProtocolRes.SchemaID_isUsed==1)) {
/* we requested DIN+ISO, and the charger should decide for one of those. */
/* todo: evaluate the SchemaID */
addToTrace(MOD_PEV, "Todo:select the intended schema");
if (aphsDoc.supportedAppProtocolRes.SchemaID == 1) {
/* The charger decided to use Schema 1, which we announced as DIN */
addToTrace(MOD_PEV, "Checkpoint403: Schema DIN negotiated (decided by charger). And Checkpoint500: Will send SessionSetupReq");
setCheckpoint(500);
pev_sendSessionSetupRequest();
pev_enterState(PEV_STATE_WaitForSessionSetupResponse);
} else if (aphsDoc.supportedAppProtocolRes.SchemaID == 2) {
/* The charger decided to use Schema 2, which we announced as ISO */
#ifdef USE_ISO1
addToTrace(MOD_PEV, "Checkpoint403: Schema ISO1 negotiated (decided by charger).");
pevStateMachineISO1_Start(); /* Start the ISO1 state machine */
#endif
pev_enterState(PEV_STATE_End); /* nothing more to do here */
} else {
addToTrace(MOD_PEV, "Error: Charger decided for a schema which we did not announce.");
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ccs/tcp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ static void tcp_sendFirstAck(void)

static void tcp_sendAck(void)
{
addToTrace(MOD_TCP, "[TCP] sending ACK");
//addToTrace(MOD_TCP, "[TCP] sending ACK");
tcpHeaderLen = 20; /* 20 bytes normal header, no options */
tcpPayloadLen = 0; /* only the TCP header, no data is in the first ACK message. */
tcp_prepareTcpHeader(TCP_FLAG_ACK);
Expand All @@ -195,7 +195,7 @@ void tcp_transmit(void)
if (tcpPayloadLen+tcpHeaderLen<TCP_TRANSMIT_PACKET_LEN)
{
/* The packet fits into our transmit buffer. */
addToTrace(MOD_TCPTRAFFIC, "TCP will transmit:", tcpPayload, tcpPayloadLen);
//addToTrace(MOD_TCPTRAFFIC, "TCP will transmit:", tcpPayload, tcpPayloadLen);
tcp_prepareTcpHeader(TCP_FLAG_PSH + TCP_FLAG_ACK); /* data packets are always sent with flags PUSH and ACK. */
tcp_packRequestIntoIp();
lastUnackTransmissionTime = rtc_get_ms(); /* record the time of transmission, to be able to detect the timeout */
Expand Down

0 comments on commit 661d232

Please sign in to comment.