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 349 of file tunerstudio.cpp.

349 {
351
352 // Ensure we are reading from in bounds
353 if (validateOffsetCount(page, offset, count, tsChannel)) {
354 tunerStudioError(tsChannel, "ERROR: CRC out of range");
355 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
356 return;
357 }
358
359 const uint8_t* start = getWorkingPageAddr(tsChannel, page, offset);
360 if (start == nullptr) {
361 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "ERROR: CRC invalid page");
362 return;
363 }
364
365 uint32_t crc = SWAP_UINT32(crc32(start, count));
366 tsChannel->sendResponse(TS_CRC, (const uint8_t *) &crc, 4);
367 efiPrintf("TS <- Get CRC page %d offset %d count %d result %08x", page, offset, count, (unsigned int)crc);
368 // todo: rename to onConfigCrc?
370}
static void onConfigOnStartUpOrBurn(bool isRunningOnBurn)
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 812 of file tunerstudio.cpp.

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

801 {
802 data[incomingPacketSize] = 0;
803 char *trimmed = efiTrim(data);
804#if EFI_SIMULATOR
805 logMsg("execute [%s]\r\n", trimmed);
806#endif // EFI_SIMULATOR
807 (console_line_callback)(trimmed);
808
809 tsChannel->writeCrcResponse(TS_RESPONSE_OK);
810}
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 419 of file tunerstudio.cpp.

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

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 578 of file tunerstudio.cpp.

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

565 {
567 const char *signature = getTsSignature();
568
569 efiPrintf("TS <- Query signature: %s", signature);
570 tsChannel->sendResponse(mode, (const uint8_t *)signature, strlen(signature) + 1);
571}
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 373 of file tunerstudio.cpp.

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

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

256 {
257 ::sendErrorCode(tsChannel, code, msg);
258}
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: