rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
tunerstudio.cpp File Reference

Detailed Description

Binary protocol implementation.

This implementation would not happen without the documentation provided by Jon Zeeff (jon@z.nosp@m.eeff.nosp@m..com)

Integration with EFI Analytics Tuner Studio software

Tuner Studio has a really simple protocol, a minimal implementation capable of displaying current engine state on the gauges would require only two commands: queryCommand and ochGetCommand

queryCommand: Communication initialization command. TunerStudio sends a single byte H ECU response: One of the known ECU id strings.

ochGetCommand: Request for output channels state.TunerStudio sends a single byte O ECU response: A snapshot of output channels as described in [OutputChannels] section of the .ini file The length of this block is 'ochBlockSize' property of the .ini file

These two commands are enough to get working gauges. In order to start configuring the ECU using tuner studio, three more commands should be implemented:

Date
Oct 22, 2013
Author
Andrey Belomutskiy, (c) 2012-2020

This file is part of rusEfi - see http://rusefi.com

rusEfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

This file is part of rusEfi - see http://rusefi.com

rusEfi is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

rusEfi is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file tunerstudio.cpp.

Functions

static void printErrorCounters ()
 
static void printScatterList ()
 
static void resetTs ()
 
static void printTsStats (void)
 
static void setTsSpeed (int value)
 
void tunerStudioDebug (TsChannelBase *tsChannel, const char *msg)
 
uint8_t * getWorkingPageAddr ()
 
static void sendOkResponse (TsChannelBase *tsChannel)
 
void sendErrorCode (TsChannelBase *tsChannel, uint8_t code, const char *msg)
 
bool validateOffsetCount (size_t offset, size_t count, TsChannelBase *tsChannel)
 
bool wasPresetJustApplied ()
 
void onApplyPreset ()
 
void requestBurn ()
 
static void handleBurnCommand (TsChannelBase *tsChannel)
 
static bool isKnownCommand (char command)
 
static void handleTestCommand (TsChannelBase *tsChannel)
 
static int tsProcessOne (TsChannelBase *tsChannel)
 
void tunerStudioError (TsChannelBase *tsChannel, const char *msg)
 
static void handleGetVersion (TsChannelBase *tsChannel)
 
static void handleGetText (TsChannelBase *tsChannel)
 
void startTunerStudioConnectivity ()
 

Variables

TunerStudio tsInstance
 
tunerstudio_counters_s tsState
 
CommandHandler console_line_callback
 

Function Documentation

◆ getWorkingPageAddr()

uint8_t * getWorkingPageAddr ( )

Definition at line 153 of file tunerstudio.cpp.

153 {
154 return (uint8_t*)engineConfiguration;
155}
static constexpr engine_configuration_s * engineConfiguration

Referenced by TunerStudio::handleCrc32Check(), TunerStudio::handlePageReadCommand(), and TunerStudio::handleWriteChunkCommand().

Here is the caller graph for this function:

◆ handleBurnCommand()

static void handleBurnCommand ( TsChannelBase tsChannel)
static

'Burn' command is a command to commit the changes

Definition at line 363 of file tunerstudio.cpp.

363 {
364 Timer t;
365 t.reset();
366
368
369 efiPrintf("TS -> Burn");
371
372 // Skip the burn if a preset was just loaded - we don't want to overwrite it
373 if (!wasPresetJustApplied()) {
374 requestBurn();
375 }
376
377 tsChannel->writeCrcResponse(TS_RESPONSE_BURN_OK);
378 efiPrintf("Burned in %.1fms", t.getElapsedSeconds() * 1e3);
379}
void writeCrcResponse(uint8_t responseCode)
bool validateConfigOnStartUpOrBurn()
bool wasPresetJustApplied()
tunerstudio_counters_s tsState
void requestBurn()

Referenced by TunerStudio::handleCrcCommand().

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

◆ handleGetText()

static void handleGetText ( TsChannelBase tsChannel)
static

Definition at line 659 of file tunerstudio.cpp.

659 {
661
663
664 size_t outputSize;
665 const char* output = swapOutputBuffers(&outputSize);
666#if EFI_SIMULATOR
667 logMsg("get test sending [%d]\r\n", outputSize);
668#endif
669
670 tsChannel->writeCrcPacket(TS_RESPONSE_OK, reinterpret_cast<const uint8_t*>(output), outputSize, true);
671#if EFI_SIMULATOR
672 logMsg("sent [%d]\r\n", outputSize);
673#endif // EFI_SIMULATOR
674}
virtual void writeCrcPacket(uint8_t responseCode, const uint8_t *buf, size_t size, bool allowLongPackets=false)
const char * swapOutputBuffers(size_t *actualOutputBufferSize)
void printOverallStatus()

Referenced by TunerStudio::handleCrcCommand().

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

◆ handleGetVersion()

static void handleGetVersion ( TsChannelBase tsChannel)
static

Definition at line 652 of file tunerstudio.cpp.

652 {
653 char versionBuffer[32];
654 chsnprintf(versionBuffer, sizeof(versionBuffer), "%s v%d@%u", FRONTEND_TITLE_BAR_NAME, getRusEfiVersion(), SIGNATURE_HASH);
655 tsChannel->sendResponse(TS_CRC, (const uint8_t *) versionBuffer, strlen(versionBuffer) + 1);
656}
void sendResponse(ts_response_format_e mode, const uint8_t *buffer, int size, bool allowLongPackets=false)
int getRusEfiVersion()
@ TS_CRC

Referenced by TunerStudio::handleCrcCommand().

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

◆ handleTestCommand()

static void handleTestCommand ( TsChannelBase tsChannel)
static

rusEfi own test command

this is NOT a standard TunerStudio command, this is my own extension of the protocol to simplify troubleshooting

Definition at line 408 of file tunerstudio.cpp.

408 {
410 char testOutputBuffer[64];
411 /**
412 * this is NOT a standard TunerStudio command, this is my own
413 * extension of the protocol to simplify troubleshooting
414 */
415 tunerStudioDebug(tsChannel, "got T (Test)");
416 tsChannel->write((const uint8_t*)QUOTE(SIGNATURE_HASH), sizeof(QUOTE(SIGNATURE_HASH)));
417
418 chsnprintf(testOutputBuffer, sizeof(testOutputBuffer), " %d %d", engine->engineState.warnings.lastErrorCode, tsState.testCommandCounter);
419 tsChannel->write((const uint8_t*)testOutputBuffer, strlen(testOutputBuffer));
420
421 chsnprintf(testOutputBuffer, sizeof(testOutputBuffer), " uptime=%ds ", (int)getTimeNowS());
422 tsChannel->write((const uint8_t*)testOutputBuffer, strlen(testOutputBuffer));
423
424 chsnprintf(testOutputBuffer, sizeof(testOutputBuffer), __DATE__ " %s\r\n", PROTOCOL_TEST_RESPONSE_TAG);
425 tsChannel->write((const uint8_t*)testOutputBuffer, strlen(testOutputBuffer));
426
427 if (hasFirmwareError()) {
428 const char* error = getCriticalErrorMessage();
429 chsnprintf(testOutputBuffer, sizeof(testOutputBuffer), "error=%s\r\n", error);
430 tsChannel->write((const uint8_t*)testOutputBuffer, strlen(testOutputBuffer));
431 }
432 tsChannel->flush();
433}
EngineState engineState
Definition engine.h:325
WarningCodeState warnings
virtual void flush()
virtual void write(const uint8_t *buffer, size_t size, bool isEndOfPacket=false)=0
ObdCode lastErrorCode
efitimesec_t getTimeNowS()
Current system time in seconds (32 bits)
Definition efitime.cpp:42
static Engine *const engine
Definition engine.h:389
const char * getCriticalErrorMessage()
void tunerStudioDebug(TsChannelBase *tsChannel, const char *msg)

Referenced by TunerStudio::handleCrcCommand(), and TunerStudio::handlePlainCommand().

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

◆ isKnownCommand()

static bool isKnownCommand ( char  command)
static

Definition at line 383 of file tunerstudio.cpp.

383 {
384 return command == TS_HELLO_COMMAND || command == TS_READ_COMMAND || command == TS_OUTPUT_COMMAND
385 || command == TS_BURN_COMMAND || command == TS_SINGLE_WRITE_COMMAND
386 || command == TS_CHUNK_WRITE_COMMAND || command == TS_EXECUTE
387 || command == TS_IO_TEST_COMMAND
388#if EFI_SIMULATOR
389 || command == TS_SIMULATE_CAN
390#endif // EFI_SIMULATOR
391#if EFI_TS_SCATTER
392 || command == TS_GET_SCATTERED_GET_COMMAND
393#endif
394 || command == TS_SET_LOGGER_SWITCH
395 || command == TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY
396 || command == TS_GET_TEXT
397 || command == TS_CRC_CHECK_COMMAND
398 || command == TS_GET_FIRMWARE_VERSION
399 || command == TS_PERF_TRACE_BEGIN
400 || command == TS_PERF_TRACE_GET_BUFFER
401 || command == TS_GET_CONFIG_ERROR
402 || command == TS_QUERY_BOOTLOADER;
403}

Referenced by tsProcessOne().

Here is the caller graph for this function:

◆ onApplyPreset()

void onApplyPreset ( )

Definition at line 200 of file tunerstudio.cpp.

200 {
202}
Timer engineTypeChangeTimer
Definition engine.h:290

Referenced by applyPreset().

Here is the caller graph for this function:

◆ printErrorCounters()

static void printErrorCounters ( )
static

Definition at line 92 of file tunerstudio.cpp.

92 {
93 efiPrintf("TunerStudio size=%d / total=%d / errors=%d / H=%d / O=%d / P=%d / B=%d",
96 efiPrintf("TunerStudio W=%d / C=%d", tsState.writeValueCommandCounter,
98 efiPrintf("TunerStudio errors: underrun=%d / overrun=%d / crc=%d / unrecognized=%d / outofrange=%d / other=%d",
101}
TunerStudioOutputChannels outputChannels
Definition engine.h:102

Referenced by printTsStats(), and tunerStudioError().

Here is the caller graph for this function:

◆ printScatterList()

static void printScatterList ( )
static

Definition at line 103 of file tunerstudio.cpp.

103 {
104 efiPrintf("Scatter list (global)");
105 for (int i = 0; i < HIGH_SPEED_COUNT; i++) {
106 uint16_t packed = engineConfiguration->highSpeedOffsets[i];
107 uint16_t type = packed >> 13;
108 uint16_t offset = packed & 0x1FFF;
109
110 if (type == 0)
111 continue;
112 size_t size = 1 << (type - 1);
113
114 efiPrintf("%02d offset 0x%04x size %d", i, offset, size);
115 }
116}
composite packet size

Referenced by printTsStats().

Here is the caller graph for this function:

◆ printTsStats()

static void printTsStats ( void  )
static

Definition at line 127 of file tunerstudio.cpp.

127 {
128#ifdef EFI_CONSOLE_RX_BRAIN_PIN
129 efiPrintf("Primary UART RX %s", hwPortname(EFI_CONSOLE_RX_BRAIN_PIN));
130 efiPrintf("Primary UART TX %s", hwPortname(EFI_CONSOLE_TX_BRAIN_PIN));
131#endif /* EFI_CONSOLE_RX_BRAIN_PIN */
132
133#if EFI_USB_SERIAL
135#endif // EFI_USB_SERIAL
136
138
140}
void printUsbConnectorStats()
const char * hwPortname(brain_pin_e brainPin)
static void printScatterList()
static void printErrorCounters()

Referenced by setTsSpeed(), and startTunerStudioConnectivity().

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

◆ requestBurn()

void requestBurn ( )

Definition at line 348 of file tunerstudio.cpp.

348 {
349#if !EFI_UNIT_TEST
351
352#if EFI_CONFIGURATION_STORAGE
354#endif /* EFI_CONFIGURATION_STORAGE */
355#endif // !EFI_UNIT_TEST
356}
void onBurnRequest()
void setNeedToWriteConfiguration()

Referenced by configureRusefiLuaHooks(), handleBurnCommand(), initFlash(), and unlockEcu().

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

◆ resetTs()

static void resetTs ( )
static

Definition at line 123 of file tunerstudio.cpp.

123 {
124 memset(&tsState, 0, sizeof(tsState));
125}

Referenced by startTunerStudioConnectivity().

Here is the caller graph for this function:

◆ sendErrorCode()

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

Definition at line 161 of file tunerstudio.cpp.

161 {
162//TODO uncomment once I have test it myself if (msg != DO_NOT_LOG) {
163// efiPrintf("TS <- Err: %d [%s]", code, msg);
164// }
165
166 switch (code) {
167 case TS_RESPONSE_UNDERRUN:
169 break;
170 case TS_RESPONSE_OVERRUN:
172 break;
173 case TS_RESPONSE_CRC_FAILURE:
175 break;
176 case TS_RESPONSE_UNRECOGNIZED_COMMAND:
178 break;
179 case TS_RESPONSE_OUT_OF_RANGE:
181 break;
182 default:
184 break;
185 }
186
187 tsChannel->writeCrcResponse(code);
188}
uint8_t code
Definition bluetooth.cpp:40

Referenced by tsProcessOne(), and validateOffsetCount().

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

◆ sendOkResponse()

static void sendOkResponse ( TsChannelBase tsChannel)
static

Definition at line 157 of file tunerstudio.cpp.

157 {
158 tsChannel->sendResponse(TS_CRC, nullptr, 0);
159}

Referenced by TunerStudio::handleCrcCommand(), and TunerStudio::handleWriteChunkCommand().

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

◆ setTsSpeed()

static void setTsSpeed ( int  value)
static

Definition at line 142 of file tunerstudio.cpp.

Referenced by startTunerStudioConnectivity().

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

◆ startTunerStudioConnectivity()

void startTunerStudioConnectivity ( )

Definition at line 910 of file tunerstudio.cpp.

910 {
911 // Assert tune & output channel struct sizes
912 static_assert(sizeof(persistent_config_s) == TOTAL_CONFIG_SIZE, "TS datapage size mismatch");
913// useful trick if you need to know how far off is the static_assert
914// char (*__kaboom)[sizeof(persistent_config_s)] = 1;
915// another useful trick
916// static_assert(offsetof (engine_configuration_s,HD44780_e) == 700);
917
918 memset(&tsState, 0, sizeof(tsState));
919
921 addConsoleAction("reset_ts", resetTs);
922 addConsoleActionI("set_ts_speed", setTsSpeed);
923
924#if EFI_BLUETOOTH_SETUP
925 // module initialization start (it waits for disconnect and then communicates to the module)
926 // Usage: "bluetooth_hc06 <baud> <name> <pincode>"
927 // Example: "bluetooth_hc06 38400 rusefi 1234"
928 // bluetooth_jdy 115200 alphax 1234
929 addConsoleActionSSS("bluetooth_hc05", [](const char *baudRate, const char *name, const char *pinCode) {
930 bluetoothStart(BLUETOOTH_HC_05, baudRate, name, pinCode);
931 });
932 addConsoleActionSSS("bluetooth_hc06", [](const char *baudRate, const char *name, const char *pinCode) {
933 bluetoothStart(BLUETOOTH_HC_06, baudRate, name, pinCode);
934 });
935 addConsoleActionSSS("bluetooth_bk", [](const char *baudRate, const char *name, const char *pinCode) {
936 bluetoothStart(BLUETOOTH_BK3231, baudRate, name, pinCode);
937 });
938 addConsoleActionSSS("bluetooth_jdy", [](const char *baudRate, const char *name, const char *pinCode) {
939 bluetoothStart(BLUETOOTH_JDY_3x, baudRate, name, pinCode);
940 });
941 addConsoleActionSSS("bluetooth_jdy31", [](const char *baudRate, const char *name, const char *pinCode) {
942 bluetoothStart(BLUETOOTH_JDY_31, baudRate, name, pinCode);
943 });
944#endif /* EFI_BLUETOOTH_SETUP */
945}
void bluetoothStart(bluetooth_module_e moduleType, const char *baudRate, const char *name, const char *pinCode)
@ BLUETOOTH_HC_05
Definition bluetooth.h:22
@ BLUETOOTH_BK3231
Definition bluetooth.h:27
@ BLUETOOTH_JDY_3x
Definition bluetooth.h:29
@ BLUETOOTH_JDY_31
Definition bluetooth.h:30
@ BLUETOOTH_HC_06
Definition bluetooth.h:23
void addConsoleAction(const char *token, Void callback)
Register console action without parameters.
void addConsoleActionSSS(const char *token, VoidCharPtrCharPtrCharPtr callback)
void addConsoleActionI(const char *token, VoidInt callback)
Register a console command with one Integer parameter.
static void setTsSpeed(int value)
static void resetTs()

Referenced by runRusEfi().

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

◆ tsProcessOne()

static int tsProcessOne ( TsChannelBase tsChannel)
static

Definition at line 487 of file tunerstudio.cpp.

487 {
488 assertStack("communication", ObdCode::STACK_USAGE_COMMUNICATION, EXPECTED_REMAINING_STACK, -1);
489
490 if (!tsChannel->isReady()) {
491 chThdSleepMilliseconds(10);
492 return -1;
493 }
494
496
497 uint8_t firstByte;
498 size_t received = tsChannel->readTimeout(&firstByte, 1, TS_COMMUNICATION_TIMEOUT);
499#if EFI_SIMULATOR
500 logMsg("received %d\r\n", received);
501#endif // EFI_SIMULATOR
502
503 if (received != 1) {
504// tunerStudioError("ERROR: no command");
505#if EFI_BLUETOOTH_SETUP
506 if (tsChannel == getBluetoothChannel()) {
507 // no data in a whole second means time to disconnect BT
508 // assume there's connection loss and notify the bluetooth init code
510 }
511#endif /* EFI_BLUETOOTH_SETUP */
512 tsChannel->in_sync = false;
513 return -1;
514 }
515
516 if (tsInstance.handlePlainCommand(tsChannel, firstByte)) {
517 return 0;
518 }
519
520 uint8_t secondByte;
521 /* second byte should be received within minimal delay */
522 received = tsChannel->readTimeout(&secondByte, 1, TS_COMMUNICATION_TIMEOUT_SHORT);
523 if (received != 1) {
524 tunerStudioError(tsChannel, "TS: ERROR: no second byte");
525 tsChannel->in_sync = false;
526 return -1;
527 }
528
529 uint16_t incomingPacketSize = firstByte << 8 | secondByte;
530 size_t expectedSize = incomingPacketSize + TS_PACKET_TAIL_SIZE;
531
532 if ((incomingPacketSize == 0) || (expectedSize > sizeof(tsChannel->scratchBuffer))) {
533 if (tsChannel->in_sync) {
534 efiPrintf("process_ts: channel=%s invalid size: %d", tsChannel->name, incomingPacketSize);
535 tunerStudioError(tsChannel, "process_ts: ERROR: packet size");
536 /* send error only if previously we were in sync */
537 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "invalid size");
538 }
539 tsChannel->in_sync = false;
540 return -1;
541 }
542
543 char command;
544 if (tsChannel->in_sync) {
545 /* we are in sync state, packet size should be correct so lets receive full packet and then check if command is supported
546 * otherwise (if abort reception in middle of packet) it will break synchronization and cause error on next packet */
547 received = tsChannel->readTimeout((uint8_t*)(tsChannel->scratchBuffer), expectedSize, TS_COMMUNICATION_TIMEOUT);
548 command = tsChannel->scratchBuffer[0];
549
550 if (received != expectedSize) {
551 /* print and send error as we were in sync */
552 efiPrintf("Got only %d bytes while expecting %d for command 0x%02x", received,
553 expectedSize, command);
554 tunerStudioError(tsChannel, "ERROR: not enough bytes in stream");
555 // MS serial protocol spec: There was a timeout before all data was received. (25ms per character.)
556 sendErrorCode(tsChannel, TS_RESPONSE_UNDERRUN, "underrun");
557 tsChannel->in_sync = false;
558 return -1;
559 }
560
561 if (!isKnownCommand(command)) {
562 /* print and send error as we were in sync */
563 efiPrintf("unexpected command %x", command);
564 sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND, "unknown");
565 tsChannel->in_sync = false;
566 return -1;
567 }
568 } else {
569 /* receive only command byte to check if it is supported */
570 received = tsChannel->readTimeout((uint8_t*)(tsChannel->scratchBuffer), 1, TS_COMMUNICATION_TIMEOUT_SHORT);
571 command = tsChannel->scratchBuffer[0];
572
573 if (!isKnownCommand(command)) {
574 /* do not report any error as we are not in sync */
575 return -1;
576 }
577
578 received = tsChannel->readTimeout((uint8_t*)(tsChannel->scratchBuffer) + 1, expectedSize - 1, TS_COMMUNICATION_TIMEOUT);
579 if (received != expectedSize - 1) {
580 /* do not report any error as we are not in sync */
581 return -1;
582 }
583 }
584
585#if EFI_SIMULATOR
586 logMsg("command %c\r\n", command);
587#endif
588
589 uint32_t expectedCrc = *(uint32_t*) (tsChannel->scratchBuffer + incomingPacketSize);
590
591 expectedCrc = SWAP_UINT32(expectedCrc);
592
593 uint32_t actualCrc = crc32(tsChannel->scratchBuffer, incomingPacketSize);
594 if (actualCrc != expectedCrc) {
595 /* send error only if previously we were in sync */
596 if (tsChannel->in_sync) {
597 efiPrintf("TunerStudio: command %c actual CRC %x/expected %x", tsChannel->scratchBuffer[0],
598 (unsigned int)actualCrc, (unsigned int)expectedCrc);
599 tunerStudioError(tsChannel, "ERROR: CRC issue");
600 sendErrorCode(tsChannel, TS_RESPONSE_CRC_FAILURE, "crc_issue");
601 tsChannel->in_sync = false;
602 }
603 return -1;
604 }
605
606 /* we were able to receive known command with correct crc and size! */
607 tsChannel->in_sync = true;
608
609 int success = tsInstance.handleCrcCommand(tsChannel, tsChannel->scratchBuffer, incomingPacketSize);
610
611 if (!success) {
612 efiPrintf("got unexpected TunerStudio command %x:%c", command, command);
613 return -1;
614 }
615
616 return 0;
617}
void bluetoothSoftwareDisconnectNotify(SerialTsChannelBase *tsChannel)
virtual bool isReady() const
const char * name
char scratchBuffer[BLOCKING_FACTOR+30]
virtual size_t readTimeout(uint8_t *buffer, size_t size, int timeout)=0
bool handlePlainCommand(TsChannelBase *tsChannel, uint8_t command)
int handleCrcCommand(TsChannelBase *tsChannel, char *data, int incomingPacketSize)
uint32_t SWAP_UINT32(uint32_t x)
Definition efilib.h:27
@ STACK_USAGE_COMMUNICATION
static bool isKnownCommand(char command)
TunerStudio tsInstance
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code, const char *msg)
void tunerStudioError(TsChannelBase *tsChannel, const char *msg)
SerialTsChannelBase * getBluetoothChannel()

Referenced by TunerstudioThread::ThreadTask().

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

◆ tunerStudioDebug()

void tunerStudioDebug ( TsChannelBase tsChannel,
const char msg 
)

Definition at line 147 of file tunerstudio.cpp.

147 {
148#if EFI_TUNER_STUDIO_VERBOSE
149 efiPrintf("%s: %s", tsChannel->name, msg);
150#endif /* EFI_TUNER_STUDIO_VERBOSE */
151}

Referenced by TunerStudio::handleCrcCommand(), TunerStudio::handlePlainCommand(), handleTestCommand(), and tunerStudioError().

Here is the caller graph for this function:

◆ tunerStudioError()

void tunerStudioError ( TsChannelBase tsChannel,
const char msg 
)

Definition at line 640 of file tunerstudio.cpp.

640 {
641 tunerStudioDebug(tsChannel, msg);
644}

Referenced by TunerStudio::handleCrc32Check(), TunerStudio::handleCrcCommand(), TunerStudio::handlePageReadCommand(), TunerStudio::handleWriteChunkCommand(), tsProcessOne(), and validateOffsetCount().

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

◆ validateOffsetCount()

bool validateOffsetCount ( size_t  offset,
size_t  count,
TsChannelBase tsChannel 
)

Definition at line 19 of file tunerstudio_commands.cpp.

19 {
20 if (offset + count > getTunerStudioPageSize()) {
21 efiPrintf("TS: Project mismatch? Too much configuration requested %d/%d", offset, count);
22 tunerStudioError(tsChannel, "ERROR: out of range");
23 sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE, "bad_offset");
24 return true;
25 }
26
27 return false;
28}
static constexpr size_t getTunerStudioPageSize()

Referenced by TunerStudio::handleCrc32Check(), TunerStudio::handlePageReadCommand(), and TunerStudio::handleWriteChunkCommand().

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

◆ wasPresetJustApplied()

bool wasPresetJustApplied ( )

Definition at line 196 of file tunerstudio.cpp.

196 {
197 return !engine->engineTypeChangeTimer.hasElapsedSec(1);
198}

Referenced by handleBurnCommand(), TunerStudio::handleWriteChunkCommand(), and updateTunerStudioState().

Here is the caller graph for this function:

Variable Documentation

◆ console_line_callback

CommandHandler console_line_callback
extern

Definition at line 53 of file console_io.cpp.

Referenced by TunerStudio::handleExecuteCommand(), and startConsole().

◆ tsInstance

TunerStudio tsInstance

Definition at line 485 of file tunerstudio.cpp.

Referenced by tsProcessOne().

◆ tsState

Go to the source code of this file.