rusEFI
The most advanced open source ECU
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 More...
 
void handleQueryCommand (TsChannelBase *tsChannel, ts_response_format_e mode)
 
void handleExecuteCommand (TsChannelBase *tsChannel, char *data, int incomingPacketSize)
 
void handlePageSelectCommand (TsChannelBase *tsChannel, ts_response_format_e mode)
 
void handleWriteChunkCommand (TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count, void *content)
 
void handleCrc32Check (TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count)
 
void handleWriteValueCommand (TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint8_t value)
 
void handlePageReadCommand (TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count)
 
void handleScatteredReadCommand (TsChannelBase *tsChannel)
 

Private Member Functions

void sendErrorCode (TsChannelBase *tsChannel, uint8_t code)
 

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 46 of file tunerstudio_commands.cpp.

46  {
47  if (offset + count > TS_TOTAL_OUTPUT_SIZE) {
48  efiPrintf("TS: Version Mismatch? Too much outputs requested offset=%d + count=%d/total=%d", offset, count,
50  sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
51  return;
52  }
53 
54  if (offset < BLOCKING_FACTOR) {
56  channelsRequestTimer.reset();
57  }
58 
61  tsChannel->assertPacketSize(count, false);
62  // this method is invoked too often to print any debug information
63  uint8_t * scratchBuffer = (uint8_t *)tsChannel->scratchBuffer;
64  /**
65  * collect data from all models
66  */
67  copyRange(scratchBuffer + 3, getLiveDataFragments(), offset, count);
68 
69  tsChannel->crcAndWriteBuffer(TS_RESPONSE_OK, count);
70 }
TunerStudioOutputChannels outputChannels
Definition: engine.h:96
void crcAndWriteBuffer(const uint8_t responseCode, const size_t size)
char scratchBuffer[BLOCKING_FACTOR+30]
void assertPacketSize(size_t size, bool allowLongPackets)
void sendErrorCode(TsChannelBase *tsChannel, uint8_t code)
Engine * engine
FragmentList getLiveDataFragments()
Definition: live_data.cpp:222
tunerstudio_counters_s tsState
void updateTunerStudioState()
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,
ts_response_format_e  mode,
uint16_t  offset,
uint16_t  count 
)

Definition at line 205 of file tunerstudio.cpp.

205  {
207 
208  // Ensure we are reading from in bounds
209  if (validateOffsetCount(offset, count, tsChannel)) {
210  return;
211  }
212 
213 #if EFI_TS_SCATTER
214  /*
215  * highSpeedOffsets is noMsqSave, but located on settings page,
216  * zero highSpeedOffsets as TS expect all noMsqSave data to be zero during CRC matching
217  * TODO:
218  * Move highSpeedOffsets to separate page as it is done on MS devices
219  * Zero highSpeedOffsets on start and reconnect
220  * TODO:
221  * Is Crc check commang good sing of new TS session?
222  * TODO:
223  * Support settings pages!
224  */
226 #endif // EFI_TS_SCATTER
227 
228  const uint8_t* start = getWorkingPageAddr() + offset;
229 
230  uint32_t crc = SWAP_UINT32(crc32(start, count));
231  tsChannel->sendResponse(mode, (const uint8_t *) &crc, 4);
232 }
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
engine_configuration_s * engineConfiguration
bool validateOffsetCount(size_t offset, size_t count, TsChannelBase *tsChannel)
uint8_t * getWorkingPageAddr()

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

680  {
682 
683  char command = data[0];
684  data++;
685 
686  const uint16_t* data16 = reinterpret_cast<uint16_t*>(data);
687 
688  uint16_t offset = data16[0];
689  uint16_t count = data16[1];
690 
691  switch(command)
692  {
693  case TS_OUTPUT_COMMAND:
694  cmdOutputChannels(tsChannel, offset, count);
695  break;
696  case TS_HELLO_COMMAND:
697  tunerStudioDebug(tsChannel, "got Query command");
698  handleQueryCommand(tsChannel, TS_CRC);
699  break;
700  case TS_GET_FIRMWARE_VERSION:
701  handleGetVersion(tsChannel);
702  break;
703 #if EFI_TEXT_LOGGING
704  case TS_GET_TEXT:
705  handleGetText(tsChannel);
706  break;
707 #endif // EFI_TEXT_LOGGING
708  case TS_EXECUTE:
709  handleExecuteCommand(tsChannel, data, incomingPacketSize - 1);
710  break;
711  case TS_PAGE_COMMAND:
712  handlePageSelectCommand(tsChannel, TS_CRC);
713  break;
714  case TS_CHUNK_WRITE_COMMAND:
715  handleWriteChunkCommand(tsChannel, TS_CRC, offset, count, data + sizeof(TunerStudioWriteChunkRequest));
716  break;
717  case TS_SINGLE_WRITE_COMMAND:
718  {
719  uint8_t value = data[4];
720  handleWriteValueCommand(tsChannel, TS_CRC, offset, value);
721  }
722  break;
723  case TS_GET_SCATTERED_GET_COMMAND:
724 #if EFI_TS_SCATTER
725  handleScatteredReadCommand(tsChannel);
726 #else
727  criticalError("Slow/wireless mode not supported");
728 #endif // EFI_TS_SCATTER
729  break;
730  case TS_CRC_CHECK_COMMAND:
731  handleCrc32Check(tsChannel, TS_CRC, offset, count);
732  break;
733  case TS_BURN_COMMAND:
734  handleBurnCommand(tsChannel, TS_CRC);
735  break;
736  case TS_READ_COMMAND:
737  handlePageReadCommand(tsChannel, TS_CRC, offset, count);
738  break;
739  case TS_TEST_COMMAND:
740  [[fallthrough]];
741  case 'T':
742  handleTestCommand(tsChannel);
743  break;
744 #if EFI_SIMULATOR
745  case TS_SIMULATE_CAN:
746  void handleWrapCan(TsChannelBase* tsChannel, char *data, int incomingPacketSize);
747  handleWrapCan(tsChannel, data, incomingPacketSize - 1);
748  break;
749 #endif // EFI_SIMULATOR
750  case TS_IO_TEST_COMMAND:
751  {
752 #if EFI_PROD_CODE
753  uint16_t subsystem = SWAP_UINT16(data16[0]);
754  uint16_t index = SWAP_UINT16(data16[1]);
755 
756  executeTSCommand(subsystem, index);
757 #endif /* EFI_PROD_CODE */
758  sendOkResponse(tsChannel, TS_CRC);
759  }
760  break;
761 #if EFI_TOOTH_LOGGER
762  case TS_SET_LOGGER_SWITCH:
763  switch(data[0]) {
764  case TS_COMPOSITE_ENABLE:
766  break;
767  case TS_COMPOSITE_DISABLE:
769  break;
770  case TS_COMPOSITE_READ:
771  {
772  auto toothBuffer = GetToothLoggerBufferNonblocking();
773 
774  if (toothBuffer) {
775  tsChannel->sendResponse(TS_CRC, reinterpret_cast<const uint8_t*>(toothBuffer->buffer), toothBuffer->nextIdx * sizeof(composite_logger_s), true);
776 
777  ReturnToothLoggerBuffer(toothBuffer);
778  } else {
779  // TS asked for a tooth logger buffer, but we don't have one to give it.
780  sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
781  }
782  }
783  break;
784 #ifdef TRIGGER_SCOPE
785  case TS_TRIGGER_SCOPE_ENABLE:
787  break;
788  case TS_TRIGGER_SCOPE_DISABLE:
790  break;
791  case TS_TRIGGER_SCOPE_READ:
792  {
793  const auto& buffer = triggerScopeGetBuffer();
794 
795  if (buffer) {
796  tsChannel->sendResponse(TS_CRC, buffer.get<uint8_t>(), buffer.size(), true);
797  } else {
798  // TS asked for a tooth logger buffer, but we don't have one to give it.
799  sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
800  }
801  }
802  break;
803 #endif // TRIGGER_SCOPE
804  default:
805  // dunno what that was, send NAK
806  return false;
807  }
808 
809  sendOkResponse(tsChannel, TS_CRC);
810 
811  break;
812  case TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY:
813  {
815 
816  auto toothBuffer = GetToothLoggerBufferNonblocking();
817 
818  if (toothBuffer) {
819  tsChannel->sendResponse(TS_CRC, reinterpret_cast<const uint8_t*>(toothBuffer->buffer), toothBuffer->nextIdx * sizeof(composite_logger_s), true);
820 
821  ReturnToothLoggerBuffer(toothBuffer);
822  } else {
823  // TS asked for a tooth logger buffer, but we don't have one to give it.
824  sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
825  }
826  }
827 
828  break;
829 #else // EFI_TOOTH_LOGGER
830  case TS_GET_COMPOSITE_BUFFER_DONE_DIFFERENTLY:
831  sendErrorCode(tsChannel, TS_RESPONSE_OUT_OF_RANGE);
832  break;
833 #endif /* EFI_TOOTH_LOGGER */
834 #if ENABLE_PERF_TRACE
835  case TS_PERF_TRACE_BEGIN:
836  perfTraceEnable();
837  sendOkResponse(tsChannel, TS_CRC);
838  break;
839  case TS_PERF_TRACE_GET_BUFFER:
840  {
841  auto trace = perfTraceGetBuffer();
842  tsChannel->sendResponse(TS_CRC, trace.get<uint8_t>(), trace.size(), true);
843  }
844 
845  break;
846 #endif /* ENABLE_PERF_TRACE */
847  case TS_GET_CONFIG_ERROR: {
848  const char* configError = getCriticalErrorMessage();
849 #if HW_CHECK_MODE
850  // analog input errors are returned as firmware error in QC mode
851  if (!hasFirmwareError()) {
852  strcpy((char*)configError, "FACTORY_MODE_PLEASE_CONTACT_SUPPORT");
853  }
854 #endif // HW_CHECK_MODE
855  tsChannel->sendResponse(TS_CRC, reinterpret_cast<const uint8_t*>(configError), strlen(configError), true);
856  break;
857  }
858  case TS_QUERY_BOOTLOADER: {
859  uint8_t bldata = TS_QUERY_BOOTLOADER_NONE;
860 #if EFI_USE_OPENBLT
861  bldata = TS_QUERY_BOOTLOADER_OPENBLT;
862 #endif
863 
864  tsChannel->sendResponse(TS_CRC, &bldata, 1, false);
865  break;
866  }
867  default:
868  sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND);
869 static char tsErrorBuff[80];
870  chsnprintf(tsErrorBuff, sizeof(tsErrorBuff), "ERROR: ignoring unexpected command %d [%c]", command, command);
871  tunerStudioError(tsChannel, tsErrorBuff);
872  return false;
873  }
874 
875  return true;
876 }
void executeTSCommand(uint16_t subsystem, uint16_t index)
Definition: bench_test.cpp:543
size_t size() const
Definition: big_buffer.h:41
const TBuffer * get() const
Definition: big_buffer.h:32
void handleScatteredReadCommand(TsChannelBase *tsChannel)
void handleCrc32Check(TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count)
void handleWriteChunkCommand(TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count, void *content)
void handleQueryCommand(TsChannelBase *tsChannel, ts_response_format_e mode)
void handleWriteValueCommand(TsChannelBase *tsChannel, ts_response_format_e mode, uint16_t offset, uint8_t value)
void handlePageSelectCommand(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, ts_response_format_e mode, uint16_t offset, uint16_t count)
void handleExecuteCommand(TsChannelBase *tsChannel, char *data, int incomingPacketSize)
uint16_t SWAP_UINT16(uint16_t x)
Definition: efilib.h:22
const char * getCriticalErrorMessage(void)
const BigBufferHandle perfTraceGetBuffer()
Definition: perf_trace.cpp:132
void perfTraceEnable()
Definition: perf_trace.cpp:119
@ TunerStudioHandleCrcCommand
void DisableToothLogger()
void EnableToothLogger()
CompositeBuffer * GetToothLoggerBufferNonblocking()
void ReturnToothLoggerBuffer(CompositeBuffer *buffer)
void EnableToothLoggerIfNotEnabled()
composite_logger_s
Definition: tooth_logger.h:48
void triggerScopeEnable()
const BigBufferHandle & triggerScopeGetBuffer()
static BigBufferHandle buffer
void triggerScopeDisable()
static void handleGetVersion(TsChannelBase *tsChannel)
void sendOkResponse(TsChannelBase *tsChannel, ts_response_format_e mode)
static void handleGetText(TsChannelBase *tsChannel)
static void handleTestCommand(TsChannelBase *tsChannel)
void tunerStudioDebug(TsChannelBase *tsChannel, const char *msg)
static void handleBurnCommand(TsChannelBase *tsChannel, ts_response_format_e mode)
void tunerStudioError(TsChannelBase *tsChannel, const char *msg)
@ TS_CRC

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

669  {
670  data[incomingPacketSize] = 0;
671  char *trimmed = efiTrim(data);
672 #if EFI_SIMULATOR
673  logMsg("execute [%s]\r\n", trimmed);
674 #endif // EFI_SIMULATOR
675  (console_line_callback)(trimmed);
676 
677  tsChannel->writeCrcPacket(TS_RESPONSE_COMMAND_OK, nullptr, 0);
678 }
virtual void writeCrcPacket(uint8_t responseCode, const uint8_t *buf, size_t size, bool allowLongPackets=false)
char * efiTrim(char *param)
Definition: efilib.cpp:39
CommandHandler console_line_callback
Definition: console_io.cpp:53

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,
ts_response_format_e  mode,
uint16_t  offset,
uint16_t  count 
)

Definition at line 308 of file tunerstudio.cpp.

308  {
310 
312  sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND);
313  return;
314  }
315 
316 #if EFI_TUNER_STUDIO_VERBOSE
317  efiPrintf("READ mode=%d offset=%d size=%d", mode, offset, count);
318 #endif
319 
320  if (validateOffsetCount(offset, count, tsChannel)) {
321  return;
322  }
323 
324  uint8_t* addr;
325  if (isLockedFromUser()) {
326  // to have rusEFI console happy just send all zeros within a valid packet
327  addr = (uint8_t*)&tsChannel->scratchBuffer + SCRATCH_BUFFER_PREFIX_SIZE;
328  memset(addr, 0, count);
329  } else {
330  addr = getWorkingPageAddr() + offset;
331  }
332  tsChannel->sendResponse(mode, addr, count);
333 #if EFI_TUNER_STUDIO_VERBOSE
334 // efiPrintf("Sending %d done", count);
335 #endif
336 }
constexpr uint8_t addr
Definition: ads1015.cpp:5
bool isLockedFromUser()
Definition: engine2.cpp:256
bool rebootForPresetPending

Referenced by handleCrcCommand().

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

◆ handlePageSelectCommand()

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

Definition at line 166 of file tunerstudio.cpp.

166  {
168 
169  sendOkResponse(tsChannel, mode);
170 }

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

449  {
450  // Bail fast if guaranteed not to be a plain command
451  if (command == 0) {
452  return false;
453  } else if (command == TS_HELLO_COMMAND || command == TS_QUERY_COMMAND) {
454  // We interpret 'Q' as TS_HELLO_COMMAND, since TS uses hardcoded 'Q' during ECU detection (scan all serial ports)
455  efiPrintf("Got naked Query command");
456  handleQueryCommand(tsChannel, TS_PLAIN);
457  return true;
458  } else if (command == TS_TEST_COMMAND || command == 'T') {
459  handleTestCommand(tsChannel);
460  return true;
461  } else if (command == TS_COMMAND_F) {
462  /**
463  * http://www.msextra.com/forums/viewtopic.php?f=122&t=48327
464  * Response from TS support: This is an optional command *
465  * "The F command is used to find what ini. file needs to be loaded in TunerStudio to match the controller.
466  * If you are able to just make your firmware ignore the command that would work.
467  * Currently on some firmware versions the F command is not used and is just ignored by the firmware as a unknown command."
468  */
469 
470  tunerStudioDebug(tsChannel, "not ignoring F");
471  tsChannel->write((const uint8_t *)TS_PROTOCOL, strlen(TS_PROTOCOL));
472  tsChannel->flush();
473  return true;
474  } else {
475  // This wasn't a valid command
476  return false;
477  }
478 }
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 434 of file tunerstudio.cpp.

434  {
436 #if EFI_TUNER_STUDIO_VERBOSE
437  efiPrintf("got S/H (queryCommand) mode=%d", mode);
438  printTsStats();
439 #endif // EFI_TUNER_STUDIO_VERBOSE
440  const char *signature = getTsSignature();
441  tsChannel->sendResponse(mode, (const uint8_t *)signature, strlen(signature) + 1);
442 }
const char * getTsSignature()
Definition: signature.cpp:31
static void printTsStats(void)

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

235  {
236  int totalResponseSize = 0;
237  for (int i = 0; i < HIGH_SPEED_COUNT; i++) {
238  uint16_t packed = engineConfiguration->highSpeedOffsets[i];
239  uint16_t type = packed >> 13;
240 
241  size_t size = type == 0 ? 0 : 1 << (type - 1);
242 #if EFI_SIMULATOR
243 // printf("handleScatteredReadCommand 0x%x %d %d\n", packed, size, offset);
244 #endif /* EFI_SIMULATOR */
245  totalResponseSize += size;
246  }
247 #if EFI_SIMULATOR
248 // printf("totalResponseSize %d\n", totalResponseSize);
249 #endif /* EFI_SIMULATOR */
250 
251 
252  // Command part of CRC
253  uint32_t crc = tsChannel->writePacketHeader(TS_RESPONSE_OK, totalResponseSize);
254 
255  uint8_t dataBuffer[8];
256  for (int i = 0; i < HIGH_SPEED_COUNT; i++) {
257  uint16_t packed = engineConfiguration->highSpeedOffsets[i];
258  uint16_t type = packed >> 13;
259  uint16_t offset = packed & 0x1FFF;
260 
261  if (type == 0)
262  continue;
263  size_t size = 1 << (type - 1);
264 
265  // write each data point and CRC incrementally
266  copyRange(dataBuffer, getLiveDataFragments(), offset, size);
267  tsChannel->write(dataBuffer, size, false);
268  crc = crc32inc((void*)dataBuffer, crc, size);
269  }
270 #if EFI_SIMULATOR
271 // printf("CRC %x\n", crc);
272 #endif /* EFI_SIMULATOR */
273  // now write total CRC
274  *(uint32_t*)dataBuffer = SWAP_UINT32(crc);
275  tsChannel->write(reinterpret_cast<uint8_t*>(dataBuffer), 4, true);
276  tsChannel->flush();
277 }
uint32_t writePacketHeader(const uint8_t responseCode, const size_t size)
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,
ts_response_format_e  mode,
uint16_t  offset,
uint16_t  count,
void *  content 
)

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

Note
See also handleWriteValueCommand

Definition at line 180 of file tunerstudio.cpp.

181  {
183  if (isLockedFromUser()) {
184  sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND);
185  return;
186  }
187 
188  efiPrintf("WRITE CHUNK mode=%d o=%d s=%d", mode, offset, count);
189 
190  if (validateOffsetCount(offset, count, tsChannel)) {
191  return;
192  }
193 
194  // Skip the write if a preset was just loaded - we don't want to overwrite it
195  if (!rebootForPresetPending) {
196  uint8_t * addr = (uint8_t *) (getWorkingPageAddr() + offset);
197  memcpy(addr, content, count);
198  }
199  // Force any board configuration options that humans shouldn't be able to change
201 
202  sendOkResponse(tsChannel, mode);
203 }
void setBoardConfigOverrides()

Referenced by handleCrcCommand().

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

◆ handleWriteValueCommand()

void TunerStudio::handleWriteValueCommand ( TsChannelBase tsChannel,
ts_response_format_e  mode,
uint16_t  offset,
uint8_t  value 
)

'Write' command receives a single value at a given offset

Note
Writing values one by one is pretty slow

Definition at line 284 of file tunerstudio.cpp.

284  {
285  UNUSED(tsChannel);
286  UNUSED(mode);
287 
289  if (isLockedFromUser()) {
290  sendErrorCode(tsChannel, TS_RESPONSE_UNRECOGNIZED_COMMAND);
291  return;
292  }
293 
294  tunerStudioDebug(tsChannel, "got W (Write)"); // we can get a lot of these
295 
296  if (validateOffsetCount(offset, 1, tsChannel)) {
297  return;
298  }
299 
300  // Skip the write if a preset was just loaded - we don't want to overwrite it
301  if (!rebootForPresetPending) {
302  getWorkingPageAddr()[offset] = value;
303  }
304  // Force any board configuration options that humans shouldn't be able to change
306 }
UNUSED(samplingTimeSeconds)

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 
)
private

Definition at line 162 of file tunerstudio.cpp.

162  {
163  ::sendErrorCode(tsChannel, code);
164 }
uint8_t code
Definition: bluetooth.cpp:39

Referenced by cmdOutputChannels(), handleCrcCommand(), handlePageReadCommand(), handleWriteChunkCommand(), and handleWriteValueCommand().

Here is the caller graph for this function:

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