ts: handle pageValueWrite and pageChunkWrite with one func (#7041)
Also fix bug with incorrect data picked in pageValueWrite. Seems pageValueWrite was never used by TS
This commit is contained in:
parent
c6764453df
commit
912b0959fd
|
@ -205,7 +205,6 @@ extern bool rebootForPresetPending;
|
|||
|
||||
/**
|
||||
* This command is needed to make the whole transfer a bit faster
|
||||
* @note See also handleWriteValueCommand
|
||||
*/
|
||||
void TunerStudio::handleWriteChunkCommand(TsChannelBase* tsChannel, uint16_t offset, uint16_t count,
|
||||
void *content) {
|
||||
|
@ -312,35 +311,6 @@ void TunerStudio::handleScatteredReadCommand(TsChannelBase* tsChannel) {
|
|||
}
|
||||
#endif // EFI_TS_SCATTER
|
||||
|
||||
/**
|
||||
* 'Write' command receives a single value at a given offset
|
||||
* @note Writing values one by one is pretty slow
|
||||
*/
|
||||
void TunerStudio::handleWriteValueCommand(TsChannelBase* tsChannel, uint16_t offset, uint8_t value) {
|
||||
UNUSED(tsChannel);
|
||||
|
||||
tsState.writeValueCommandCounter++;
|
||||
if (isLockedFromUser()) {
|
||||
sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND, "locked");
|
||||
return;
|
||||
}
|
||||
|
||||
efiPrintf("TS -> Write value offset %d value %d", offset, value);
|
||||
|
||||
if (validateOffsetCount(offset, 1, tsChannel)) {
|
||||
tunerStudioError(tsChannel, "ERROR: WR out of range");
|
||||
sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
|
||||
return;
|
||||
}
|
||||
|
||||
// Skip the write if a preset was just loaded - we don't want to overwrite it
|
||||
if (!rebootForPresetPending) {
|
||||
getWorkingPageAddr()[offset] = value;
|
||||
}
|
||||
// Force any board configuration options that humans shouldn't be able to change
|
||||
setBoardConfigOverrides();
|
||||
}
|
||||
|
||||
void TunerStudio::handlePageReadCommand(TsChannelBase* tsChannel, uint16_t offset, uint16_t count) {
|
||||
tsState.readPageCommandsCounter++;
|
||||
|
||||
|
@ -770,10 +740,9 @@ int TunerStudio::handleCrcCommand(TsChannelBase* tsChannel, char *data, int inco
|
|||
handleWriteChunkCommand(tsChannel, offset, count, data + sizeof(TunerStudioWriteChunkRequest));
|
||||
break;
|
||||
case TS_SINGLE_WRITE_COMMAND:
|
||||
{
|
||||
uint8_t value = data[4];
|
||||
handleWriteValueCommand(tsChannel, offset, value);
|
||||
}
|
||||
// This command writes 1 byte
|
||||
count = 1;
|
||||
handleWriteChunkCommand(tsChannel, offset, count, data + sizeof(offset));
|
||||
break;
|
||||
case TS_GET_SCATTERED_GET_COMMAND:
|
||||
#if EFI_TS_SCATTER
|
||||
|
|
|
@ -36,7 +36,6 @@ public:
|
|||
void handleWriteChunkCommand(TsChannelBase* tsChannel, uint16_t offset, uint16_t count,
|
||||
void *content);
|
||||
void handleCrc32Check(TsChannelBase *tsChannel, uint16_t offset, uint16_t count);
|
||||
void handleWriteValueCommand(TsChannelBase* tsChannel, uint16_t offset, uint8_t value);
|
||||
void handlePageReadCommand(TsChannelBase* tsChannel, uint16_t offset, uint16_t count);
|
||||
void handleScatteredReadCommand(TsChannelBase* tsChannel);
|
||||
|
||||
|
|
Loading…
Reference in New Issue