rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions
TunerStudio Class Reference

#include <tunerstudio_impl.h>

Inheritance diagram for TunerStudio:
Inheritance graph
[legend]
Collaboration diagram for TunerStudio:
Collaboration graph
[legend]

Public Member Functions

int handleCrcCommand (TsChannelBase *tsChannel, char *data, int incomingPacketSize)
 
bool handlePlainCommand (TsChannelBase *tsChannel, uint8_t command)
 
void cmdOutputChannels (TsChannelBase *tsChannel, uint16_t offset, uint16_t count) override
 'Output' command sends out a snapshot of current values Gauges refresh
 
void handleQueryCommand (TsChannelBase *tsChannel, ts_response_format_e mode)
 
void handleExecuteCommand (TsChannelBase *tsChannel, char *data, int incomingPacketSize)
 
void handleWriteChunkCommand (TsChannelBase *tsChannel, uint16_t page, uint16_t offset, uint16_t count, void *content)
 
void handleCrc32Check (TsChannelBase *tsChannel, uint16_t page, uint16_t offset, uint16_t count)
 
void handlePageReadCommand (TsChannelBase *tsChannel, uint16_t page, uint16_t offset, uint16_t count)
 
void handleScatteredReadCommand (TsChannelBase *tsChannel)
 

Private Member Functions

void sendErrorCode (TsChannelBase *tsChannel, uint8_t code, const char *msg="")
 

Additional Inherited Members

Detailed Description

Definition at line 23 of file tunerstudio_impl.h.

Member Function Documentation

◆ cmdOutputChannels()

void TunerStudio::cmdOutputChannels ( TsChannelBase tsChannel,
uint16_t  offset,
uint16_t  count 
)
overridevirtual

'Output' command sends out a snapshot of current values Gauges refresh

collect data from all models

Implements TunerStudioBase.

Definition at line 23 of file tunerstudio_commands.cpp.

23 {
24 if (offset + count > TS_TOTAL_OUTPUT_SIZE) {
25 efiPrintf("TS: Version Mismatch? Too much outputs requested offset=%d + count=%d/total=%d", offset, count,
26 TS_TOTAL_OUTPUT_SIZE);
27 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "cmd_size");
28 return;
29 }
30
31 if (offset < BLOCKING_FACTOR) {
34 }
35
38 tsChannel->assertPacketSize(count, false);
39 // this method is invoked too often to print any debug information
40 uint8_t * scratchBuffer = (uint8_t *)tsChannel->scratchBuffer;
41 /**
42 * collect data from all models
43 */
44 copyRange(scratchBuffer + 3, getLiveDataFragments(), offset, count);
45
46 tsChannel->crcAndWriteBuffer(TS_RESPONSE_OK, count);
47}
TunerStudioOutputChannels outputChannels
Definition engine.h:109
void crcAndWriteBuffer(const uint8_t responseCode, const size_t size)
char scratchBuffer[scratchBuffer_SIZE+30]
void assertPacketSize(size_t size, bool allowLongPackets)
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code, const char *msg="")
static EngineAccessor engine
Definition engine.h:413
FragmentList getLiveDataFragments()
tunerstudio_counters_s tsState
void updateTunerStudioState()
uint16_t offset
Definition tunerstudio.h:0
uint16_t count
Definition tunerstudio.h:1
static Timer channelsRequestTimer

Referenced by handleCrcCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCrc32Check()

void TunerStudio::handleCrc32Check ( TsChannelBase tsChannel,
uint16_t  page,
uint16_t  offset,
uint16_t  count 
)

Definition at line 350 of file tunerstudio.cpp.

350 {
352
353 // Ensure we are reading from in bounds
354 if (validateOffsetCount(page, offset, count, tsChannel)) {
355 tunerStudioError(tsChannel, "ERROR: CRC out of range");
356 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
357 return;
358 }
359
360 const uint8_t* start = getWorkingPageAddr(tsChannel, page, offset);
361 if (start == nullptr) {
362 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "ERROR: CRC invalid page");
363 return;
364 }
365
366 uint32_t crc = SWAP_UINT32(crc32(start, count));
367 tsChannel->sendResponse(TS_CRC, (const uint8_t *) &crc, 4);
368 efiPrintf("TS <- Get CRC page %d offset %d count %d result %08x", page, offset, count, (unsigned int)crc);
369}
void sendResponse(ts_response_format_e mode, const uint8_t *buffer, int size, bool allowLongPackets=false)
uint32_t SWAP_UINT32(uint32_t x)
Definition efilib.h:27
static uint8_t * getWorkingPageAddr(TsChannelBase *tsChannel, size_t page, size_t offset)
static bool validateOffsetCount(size_t page, size_t offset, size_t count, TsChannelBase *tsChannel)
void tunerStudioError(TsChannelBase *tsChannel, const char *msg)
uint16_t page
Definition tunerstudio.h:0
@ TS_CRC

Referenced by handleCrcCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleCrcCommand()

int TunerStudio::handleCrcCommand ( TsChannelBase tsChannel,
char data,
int  incomingPacketSize 
)

Definition at line 810 of file tunerstudio.cpp.

810 {
812
813 char command = data[0];
814 data++;
815
816 const uint16_t* data16 = reinterpret_cast<uint16_t*>(data);
817
818 // only few command have page argument, default page is 0
819 uint16_t page = 0;
820 uint16_t offset = 0;
821 uint16_t count = 0;
822
823 // command may not have offset field - keep safe default value
824 // not used by .ini at the moment TODO actually use that version of the command in the .ini
825 if (incomingPacketSize >= 3) {
826 offset = data16[0];
827 }
828 // command may not have count/size filed - keep safe default value
829 if (incomingPacketSize >= 5) {
830 count = data16[1];
831 }
832
833 switch(command)
834 {
835 case TS_OUTPUT_COMMAND:
836 if (incomingPacketSize == 1) {
837 // Read command with no offset and size - read whole livedata
838 count = TS_TOTAL_OUTPUT_SIZE;
839 }
840 cmdOutputChannels(tsChannel, offset, count);
841 break;
842 case TS_OUTPUT_ALL_COMMAND:
843 offset = 0;
844 count = TS_TOTAL_OUTPUT_SIZE;
845 // TS will not use this command until ochBlockSize is bigger than blockingFactor and prefer ochGetCommand :(
846 cmdOutputChannels(tsChannel, offset, count);
847 break;
848 case TS_GET_SCATTERED_GET_COMMAND:
849#if EFI_TS_SCATTER
851#else
852 criticalError("Slow/wireless mode not supported");
853#endif // EFI_TS_SCATTER
854 break;
855 case TS_HELLO_COMMAND:
856 tunerStudioDebug(tsChannel, "got Query command");
857 handleQueryCommand(tsChannel, TS_CRC);
858 break;
859 case TS_GET_FIRMWARE_VERSION:
860 handleGetVersion(tsChannel);
861 break;
862#if EFI_TEXT_LOGGING
863 case TS_GET_TEXT:
864 handleGetText(tsChannel);
865 break;
866#endif // EFI_TEXT_LOGGING
867 case TS_EXECUTE:
868 handleExecuteCommand(tsChannel, data, incomingPacketSize - 1);
869 break;
870 case TS_CHUNK_WRITE_COMMAND:
871 /* command with page argument */
872 page = data16[0];
873 offset = data16[1];
874 count = data16[2];
876 break;
877 case TS_CRC_CHECK_COMMAND:
878 /* command with page argument */
879 page = data16[0];
880 offset = data16[1];
881 count = data16[2];
882 handleCrc32Check(tsChannel, page, offset, count);
883 break;
884 case TS_BURN_COMMAND:
885 /* command with page argument */
886 page = data16[0];
887 handleBurnCommand(tsChannel, page);
888 break;
889 case TS_READ_COMMAND:
890 /* command with page argument */
891 page = data16[0];
892 offset = data16[1];
893 count = data16[2];
895 break;
896 case TS_TEST_COMMAND:
897 [[fallthrough]];
898 case 'T':
899 handleTestCommand(tsChannel);
900 break;
901 case TS_GET_CONFIG_ERROR:
902 handleGetConfigErorr(tsChannel);
903 break;
904#if EFI_SIMULATOR
905 case TS_SIMULATE_CAN:
906 void handleWrapCan(TsChannelBase* tsChannel, char *data, int incomingPacketSize);
907 handleWrapCan(tsChannel, data, incomingPacketSize - 1);
908 break;
909#endif // EFI_SIMULATOR
910 case TS_IO_TEST_COMMAND:
911#if EFI_SIMULATOR || EFI_PROD_CODE
912 //TODO: Why did we process `TS_IO_TEST_COMMAND` only in prod code? I've just turned it on for simulator as well, because
913 // I need test this functionality with simulator as well. We need to review the cases when we really need to turn off
914 // `TS_IO_TEST_COMMAND` processing. Do we really need guards below?
915 {
916 uint16_t subsystem = SWAP_UINT16(data16[0]);
917 uint16_t index = SWAP_UINT16(data16[1]);
918
919 executeTSCommand(subsystem, index);
920 }
921#endif /* EFI_SIMULATOR || EFI_PROD_CODE */
922 sendOkResponse(tsChannel);
923 break;
924#if EFI_TOOTH_LOGGER
925 case TS_SET_LOGGER_SWITCH:
926 switch(data[0]) {
927 case TS_COMPOSITE_ENABLE:
929 break;
930 case TS_COMPOSITE_DISABLE:
932 break;
933 case TS_COMPOSITE_READ:
934 {
935 auto toothBuffer = GetToothLoggerBufferNonblocking();
936
937 if (toothBuffer) {
938 tsChannel->sendResponse(TS_CRC, reinterpret_cast<const uint8_t*>(toothBuffer->buffer), toothBuffer->nextIdx * sizeof(composite_logger_s), true);
939
940 ReturnToothLoggerBuffer(toothBuffer);
941 } else {
942 // TS asked for a tooth logger buffer, but we don't have one to give it.
943 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
944 }
945 }
946 break;
947#ifdef TRIGGER_SCOPE
948 case TS_TRIGGER_SCOPE_ENABLE:
950 break;
951 case TS_TRIGGER_SCOPE_DISABLE:
953 break;
954 case TS_TRIGGER_SCOPE_READ:
955 {
956 const auto& buffer = triggerScopeGetBuffer();
957
958 if (buffer) {
959 tsChannel->sendResponse(TS_CRC, buffer.get<uint8_t>(), buffer.size(), true);
960 } else {
961 // TS asked for a tooth logger buffer, but we don't have one to give it.
962 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
963 }
964 }
965 break;
966#endif // TRIGGER_SCOPE
967 default:
968 // dunno what that was, send NAK
969 return false;
970 }
971
972 sendOkResponse(tsChannel);
973
974 break;
975 case TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY:
976 {
978
979 auto toothBuffer = GetToothLoggerBufferNonblocking();
980
981 if (toothBuffer) {
982 tsChannel->sendResponse(TS_CRC, reinterpret_cast<const uint8_t*>(toothBuffer->buffer), toothBuffer->nextIdx * sizeof(composite_logger_s), true);
983
984 ReturnToothLoggerBuffer(toothBuffer);
985 } else {
986 // TS asked for a tooth logger buffer, but we don't have one to give it.
987 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
988 }
989 }
990
991 break;
992#else // EFI_TOOTH_LOGGER
993 case TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY:
994 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, DO_NOT_LOG);
995 break;
996#endif /* EFI_TOOTH_LOGGER */
997#if ENABLE_PERF_TRACE
998 case TS_PERF_TRACE_BEGIN:
1000 sendOkResponse(tsChannel);
1001 break;
1002 case TS_PERF_TRACE_GET_BUFFER:
1003 {
1004 auto trace = perfTraceGetBuffer();
1005 tsChannel->sendResponse(TS_CRC, trace.get<uint8_t>(), trace.size(), true);
1006 }
1007
1008 break;
1009#else
1010 case TS_PERF_TRACE_BEGIN:
1011 criticalError("TS_PERF_TRACE not supported");
1012 break;
1013 case TS_PERF_TRACE_GET_BUFFER:
1014 criticalError("TS_PERF_TRACE_GET_BUFFER not supported");
1015 break;
1016#endif /* ENABLE_PERF_TRACE */
1017 case TS_QUERY_BOOTLOADER: {
1018 uint8_t bldata = TS_QUERY_BOOTLOADER_NONE;
1019#if EFI_USE_OPENBLT
1020 bldata = TS_QUERY_BOOTLOADER_OPENBLT;
1021#endif
1022
1023 tsChannel->sendResponse(TS_CRC, &bldata, 1, false);
1024 break;
1025 }
1026 default:
1027 sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND, "unknown_command");
1028static char tsErrorBuff[80];
1029 chsnprintf(tsErrorBuff, sizeof(tsErrorBuff), "ERROR: ignoring unexpected command %d [%c]", command, command);
1030 tunerStudioError(tsChannel, tsErrorBuff);
1031 return false;
1032 }
1033
1034 return true;
1035}
void executeTSCommand(uint16_t subsystem, uint16_t index)
size_t size() const
Definition big_buffer.h:43
const TBuffer * get() const
Definition big_buffer.h:34
void handleScatteredReadCommand(TsChannelBase *tsChannel)
void handleCrc32Check(TsChannelBase *tsChannel, uint16_t page, uint16_t offset, uint16_t count)
void handleQueryCommand(TsChannelBase *tsChannel, ts_response_format_e mode)
void cmdOutputChannels(TsChannelBase *tsChannel, uint16_t offset, uint16_t count) override
'Output' command sends out a snapshot of current values Gauges refresh
void handlePageReadCommand(TsChannelBase *tsChannel, uint16_t page, uint16_t offset, uint16_t count)
void handleWriteChunkCommand(TsChannelBase *tsChannel, uint16_t page, uint16_t offset, uint16_t count, void *content)
void handleExecuteCommand(TsChannelBase *tsChannel, char *data, int incomingPacketSize)
uint16_t SWAP_UINT16(uint16_t x)
Definition efilib.h:22
const BigBufferHandle perfTraceGetBuffer()
void perfTraceEnable()
@ TunerStudioHandleCrcCommand
void DisableToothLogger()
void EnableToothLogger()
CompositeBuffer * GetToothLoggerBufferNonblocking()
void ReturnToothLoggerBuffer(CompositeBuffer *buffer)
void EnableToothLoggerIfNotEnabled()
composite_logger_s
void triggerScopeEnable()
const BigBufferHandle & triggerScopeGetBuffer()
static BigBufferHandle buffer
void triggerScopeDisable()
static void handleGetVersion(TsChannelBase *tsChannel)
static void handleGetConfigErorr(TsChannelBase *tsChannel)
static void handleGetText(TsChannelBase *tsChannel)
static void sendOkResponse(TsChannelBase *tsChannel)
static void handleTestCommand(TsChannelBase *tsChannel)
void tunerStudioDebug(TsChannelBase *tsChannel, const char *msg)
static void handleBurnCommand(TsChannelBase *tsChannel, uint16_t page)

Referenced by tsProcessOne().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleExecuteCommand()

void TunerStudio::handleExecuteCommand ( TsChannelBase tsChannel,
char data,
int  incomingPacketSize 
)

Definition at line 799 of file tunerstudio.cpp.

799 {
800 data[incomingPacketSize] = 0;
801 char *trimmed = efiTrim(data);
802#if EFI_SIMULATOR
803 logMsg("execute [%s]\r\n", trimmed);
804#endif // EFI_SIMULATOR
805 (console_line_callback)(trimmed);
806
807 tsChannel->writeCrcResponse(TS_RESPONSE_OK);
808}
void writeCrcResponse(uint8_t responseCode)
char * efiTrim(char *param)
Definition efilib.cpp:40
CommandHandler console_line_callback

Referenced by handleCrcCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePageReadCommand()

void TunerStudio::handlePageReadCommand ( TsChannelBase tsChannel,
uint16_t  page,
uint16_t  offset,
uint16_t  count 
)

Definition at line 418 of file tunerstudio.cpp.

418 {
420 efiPrintf("TS <- Page %d read chunk offset %d count %d", page, offset, count);
421
422 if (validateOffsetCount(page, offset, count, tsChannel)) {
423 tunerStudioError(tsChannel, "ERROR: RD out of range");
424 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
425 return;
426 }
427
428 uint8_t* addr = getWorkingPageAddr(tsChannel, page, offset);
429 if (page == TS_PAGE_SETTINGS) {
430 if (isLockedFromUser()) {
431 // to have rusEFI console happy just send all zeros within a valid packet
432 addr = (uint8_t*)&tsChannel->scratchBuffer + TS_PACKET_HEADER_SIZE;
433 memset(addr, 0, count);
434 }
435 }
436
437 if (addr == nullptr) {
438 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "ERROR: RD invalid page");
439 return;
440 }
441
442 tsChannel->sendResponse(TS_CRC, addr, count);
443#if EFI_TUNER_STUDIO_VERBOSE
444// efiPrintf("Sending %d done", count);
445#endif
446}
constexpr uint8_t addr
Definition ads1015.cpp:14
bool isLockedFromUser()
Definition engine2.cpp:310

Referenced by handleCrcCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handlePlainCommand()

bool TunerStudio::handlePlainCommand ( TsChannelBase tsChannel,
uint8_t  command 
)

handle non CRC wrapped command

Returns
true if legacy command was processed, false otherwise

http://www.msextra.com/forums/viewtopic.php?f=122&t=48327 Response from TS support: This is an optional command * "The F command is used to find what ini. file needs to be loaded in TunerStudio to match the controller. If you are able to just make your firmware ignore the command that would work. Currently on some firmware versions the F command is not used and is just ignored by the firmware as a unknown command."

Definition at line 576 of file tunerstudio.cpp.

576 {
577 // Bail fast if guaranteed not to be a plain command
578 if (command == 0) {
579 return false;
580 } else if (command == TS_HELLO_COMMAND || command == TS_QUERY_COMMAND) {
581 // We interpret 'Q' as TS_HELLO_COMMAND, since TS uses hardcoded 'Q' during ECU detection (scan all serial ports)
582 efiPrintf("Got naked Query command");
583 handleQueryCommand(tsChannel, TS_PLAIN);
584 return true;
585 } else if (command == TS_TEST_COMMAND || command == 'T') {
586 handleTestCommand(tsChannel);
587 return true;
588 } else if (command == TS_COMMAND_F) {
589 /**
590 * http://www.msextra.com/forums/viewtopic.php?f=122&t=48327
591 * Response from TS support: This is an optional command *
592 * "The F command is used to find what ini. file needs to be loaded in TunerStudio to match the controller.
593 * If you are able to just make your firmware ignore the command that would work.
594 * Currently on some firmware versions the F command is not used and is just ignored by the firmware as a unknown command."
595 */
596
597 tunerStudioDebug(tsChannel, "not ignoring F");
598 tsChannel->write((const uint8_t *)TS_PROTOCOL, strlen(TS_PROTOCOL));
599 tsChannel->flush();
600 return true;
601 } else {
602 // This wasn't a valid command
603 return false;
604 }
605}
virtual void flush()
virtual void write(const uint8_t *buffer, size_t size, bool isEndOfPacket=false)=0
@ TS_PLAIN

Referenced by tsProcessOne().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleQueryCommand()

void TunerStudio::handleQueryCommand ( TsChannelBase tsChannel,
ts_response_format_e  mode 
)

this command is part of protocol initialization

this command is part of protocol initialization

Query with CRC takes place while re-establishing connection Query without CRC takes place on TunerStudio startup

Definition at line 563 of file tunerstudio.cpp.

563 {
565 const char *signature = getTsSignature();
566
567 efiPrintf("TS <- Query signature: %s", signature);
568 tsChannel->sendResponse(mode, (const uint8_t *)signature, strlen(signature) + 1);
569}
const char * getTsSignature()
Definition signature.cpp:31

Referenced by handleCrcCommand(), and handlePlainCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleScatteredReadCommand()

void TunerStudio::handleScatteredReadCommand ( TsChannelBase tsChannel)

Definition at line 372 of file tunerstudio.cpp.

372 {
374
375 int totalResponseSize = 0;
376 for (size_t i = 0; i < TS_SCATTER_OFFSETS_COUNT; i++) {
377 uint16_t packed = tsChannel->page1.highSpeedOffsets[i];
378 uint16_t type = packed >> 13;
379
380 size_t size = type == 0 ? 0 : 1 << (type - 1);
381#if EFI_SIMULATOR
382// printf("handleScatteredReadCommand 0x%x %d %d\n", packed, size, offset);
383#endif /* EFI_SIMULATOR */
384 totalResponseSize += size;
385 }
386#if EFI_SIMULATOR
387// printf("totalResponseSize %d\n", totalResponseSize);
388#endif /* EFI_SIMULATOR */
389
390 // Command part of CRC
391 uint32_t crc = tsChannel->writePacketHeader(TS_RESPONSE_OK, totalResponseSize);
392
393 uint8_t dataBuffer[8];
394 for (size_t i = 0; i < TS_SCATTER_OFFSETS_COUNT; i++) {
395 uint16_t packed = tsChannel->page1.highSpeedOffsets[i];
396 uint16_t type = packed >> 13;
397 uint16_t offset = packed & 0x1FFF;
398
399 if (type == 0)
400 continue;
401 size_t size = 1 << (type - 1);
402
403 // write each data point and CRC incrementally
404 copyRange(dataBuffer, getLiveDataFragments(), offset, size);
405 tsChannel->write(dataBuffer, size, false);
406 crc = crc32inc((void*)dataBuffer, crc, size);
407 }
408#if EFI_SIMULATOR
409// printf("CRC %x\n", crc);
410#endif /* EFI_SIMULATOR */
411 // now write total CRC
412 *(uint32_t*)dataBuffer = SWAP_UINT32(crc);
413 tsChannel->write(dataBuffer, 4, true);
414 tsChannel->flush();
415}
uint32_t writePacketHeader(const uint8_t responseCode, const size_t size)
uint16_t highSpeedOffsets[TS_SCATTER_OFFSETS_COUNT]
composite packet size

Referenced by handleCrcCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleWriteChunkCommand()

void TunerStudio::handleWriteChunkCommand ( TsChannelBase tsChannel,
uint16_t  page,
uint16_t  offset,
uint16_t  count,
void *  content 
)

This command is needed to make the whole transfer a bit faster

Definition at line 299 of file tunerstudio.cpp.

300 {
302
303 efiPrintf("TS -> Page %d write chunk offset %d count %d (output_count=%d)",
305
306
307 if (validateOffsetCount(page, offset, count, tsChannel)) {
308 tunerStudioError(tsChannel, "ERROR: WR out of range");
309 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
310 return;
311 }
312
313 uint8_t * addr = getWorkingPageAddr(tsChannel, page, offset);
314 if (addr == nullptr) {
315 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "ERROR: WR invalid page");
316 return;
317 }
318
320
321 // Special case
322 if (page == TS_PAGE_SETTINGS) {
323 if (isLockedFromUser()) {
324 sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND, "locked");
325 return;
326 }
327
328 // Skip the write if a preset was just loaded - we don't want to overwrite it
329 // [tag:popular_vehicle]
330 if (!needToTriggerTsRefresh()) {
331 memcpy(addr, content, count);
332 } else {
333 efiPrintf("Ignoring TS -> Page %d write chunk offset %d count %d (output_count=%d)",
334 page,
335 offset,
336 count,
338 );
339 }
340 // Force any board configuration options that humans shouldn't be able to change
341 // huh, why is this NOT within above 'needToTriggerTsRefresh()' condition?
343 } else {
344 memcpy(addr, content, count);
345 }
346
347 sendOkResponse(tsChannel);
348}
static bool call_board_override(std::optional< setup_custom_board_overrides_type > board_override)
std::optional< setup_custom_board_overrides_type > custom_board_ConfigOverrides
bool needToTriggerTsRefresh()
static void onCalibrationWrite(uint16_t page, uint16_t offset, uint16_t count)

Referenced by handleCrcCommand().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendErrorCode()

void TunerStudio::sendErrorCode ( TsChannelBase tsChannel,
uint8_t  code,
const char msg = "" 
)
private

Definition at line 257 of file tunerstudio.cpp.

257 {
258 ::sendErrorCode(tsChannel, code, msg);
259}
uint8_t code
Definition bluetooth.cpp:40

Referenced by cmdOutputChannels(), handleCrc32Check(), handleCrcCommand(), handlePageReadCommand(), handleWriteChunkCommand(), and sendErrorCode().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following files: