mirror of https://github.com/FOME-Tech/fome-fw.git
TS helper for no-payload responses
This commit is contained in:
parent
0b9e0cc983
commit
35b46d0e92
|
@ -125,7 +125,7 @@ static void sendOkResponse(TsChannelBase *tsChannel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code) {
|
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code) {
|
||||||
tsChannel->writeCrcPacket(code, nullptr, 0);
|
tsChannel->writeCrcResponse(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TunerStudio::sendErrorCode(TsChannelBase* tsChannel, uint8_t code) {
|
void TunerStudio::sendErrorCode(TsChannelBase* tsChannel, uint8_t code) {
|
||||||
|
@ -256,12 +256,6 @@ void requestBurn(void) {
|
||||||
#endif // !EFI_UNIT_TEST
|
#endif // !EFI_UNIT_TEST
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendResponseCode(ts_response_format_e mode, TsChannelBase *tsChannel, const uint8_t responseCode) {
|
|
||||||
if (mode == TS_CRC) {
|
|
||||||
tsChannel->writeCrcPacket(responseCode, nullptr, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'Burn' command is a command to commit the changes
|
* 'Burn' command is a command to commit the changes
|
||||||
*/
|
*/
|
||||||
|
@ -278,7 +272,7 @@ static void handleBurnCommand(TsChannelBase* tsChannel) {
|
||||||
requestBurn();
|
requestBurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
sendResponseCode(TS_CRC, tsChannel, TS_RESPONSE_BURN_OK);
|
tsChannel->writeCrcResponse(TS_RESPONSE_BURN_OK);
|
||||||
efiPrintf("BURN in %dms", (int)(t.getElapsedSeconds() * 1e3));
|
efiPrintf("BURN in %dms", (int)(t.getElapsedSeconds() * 1e3));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +575,7 @@ void TunerStudio::handleExecuteCommand(TsChannelBase* tsChannel, char *data, int
|
||||||
#endif
|
#endif
|
||||||
(console_line_callback)(trimmed);
|
(console_line_callback)(trimmed);
|
||||||
|
|
||||||
tsChannel->writeCrcPacket(TS_RESPONSE_COMMAND_OK, nullptr, 0);
|
tsChannel->writeCrcResponse(TS_RESPONSE_COMMAND_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int incomingPacketSize) {
|
int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int incomingPacketSize) {
|
||||||
|
|
|
@ -56,6 +56,11 @@ public:
|
||||||
void crcAndWriteBuffer(const uint8_t responseCode, const size_t size);
|
void crcAndWriteBuffer(const uint8_t responseCode, const size_t size);
|
||||||
void copyAndWriteSmallCrcPacket(uint8_t responseCode, const uint8_t* buf, size_t size);
|
void copyAndWriteSmallCrcPacket(uint8_t responseCode, const uint8_t* buf, size_t size);
|
||||||
|
|
||||||
|
// Write a response code with no data
|
||||||
|
void writeCrcResponse(uint8_t responseCode) {
|
||||||
|
writeCrcPacketLarge(responseCode, nullptr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/* When TsChannel is in "not in sync" state tsProcessOne will silently try to find
|
/* When TsChannel is in "not in sync" state tsProcessOne will silently try to find
|
||||||
* begining of packet.
|
* begining of packet.
|
||||||
* As soon as tsProcessOne was able to receive valid packet with valid size and crc
|
* As soon as tsProcessOne was able to receive valid packet with valid size and crc
|
||||||
|
|
Loading…
Reference in New Issue