diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index 099aae579f..6333f9f385 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -233,7 +233,7 @@ static void sendErrorCode(ts_channel_s *tsChannel) { sr5WriteCrcPacket(tsChannel, TS_RESPONSE_CRC_FAILURE, NULL, 0); } -void handlePageSelectCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId) { +static void handlePageSelectCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId) { tsState.pageCommandCounter++; scheduleMsg(&tsLogger, "PAGE %d", pageId); @@ -345,7 +345,7 @@ static void handleReadFileContent(ts_channel_s *tsChannel, short fileId, uint16_ * This command is needed to make the whole transfer a bit faster * @note See also handleWriteValueCommand */ -void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count, +static void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count, void *content) { tsState.writeChunkCommandCounter++; @@ -362,15 +362,12 @@ void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode, sendOkResponse(tsChannel, mode); } -void handleCrc32Check(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId, uint16_t offset, - uint16_t count) { +static void handleCrc32Check(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId) { UNUSED(pageId); tsState.crc32CheckCommandCounter++; - count = getTunerStudioPageSize(); - - scheduleMsg(&tsLogger, "CRC32 request: offset %d size %d", offset, count); + uint16_t count = getTunerStudioPageSize(); uint32_t crc = SWAP_UINT32(crc32((void * ) getWorkingPageAddr(), count)); @@ -383,7 +380,7 @@ void handleCrc32Check(ts_channel_s *tsChannel, ts_response_format_e mode, uint16 * 'Write' command receives a single value at a given offset * @note Writing values one by one is pretty slow */ -void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page, uint16_t offset, +static void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page, uint16_t offset, uint8_t value) { UNUSED(tsChannel); UNUSED(mode); @@ -414,7 +411,7 @@ void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode, // scheduleMsg(logger, "va=%d", configWorkingCopy.boardConfiguration.idleValvePin); } -void handlePageReadCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId, uint16_t offset, +static void handlePageReadCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId, uint16_t offset, uint16_t count) { tsState.readPageCommandsCounter++; @@ -455,7 +452,7 @@ static void sendResponseCode(ts_response_format_e mode, ts_channel_s *tsChannel, /** * 'Burn' command is a command to commit the changes */ -void handleBurnCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page) { +static void handleBurnCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page) { UNUSED(page); efitimems_t nowMs = currentTimeMillis(); @@ -645,8 +642,9 @@ void handleQueryCommand(ts_channel_s *tsChannel, ts_response_format_e mode) { /** * @brief 'Output' command sends out a snapshot of current values + * Gauges refresh */ -void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count) { +static void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count) { if (offset + count > sizeof(TunerStudioOutputChannels)) { scheduleMsg(&tsLogger, "TS: Version Mismatch? Too much data requested %d+%d", offset, count); sendErrorCode(tsChannel); @@ -659,7 +657,10 @@ void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e m sr5SendResponse(tsChannel, mode, ((const uint8_t *) &tsOutputChannels) + offset, count); } -void handleTestCommand(ts_channel_s *tsChannel) { +/** + * rusEfi own test command + */ +static void handleTestCommand(ts_channel_s *tsChannel) { tsState.testCommandCounter++; static char testOutputBuffer[24]; /** @@ -794,7 +795,7 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin } break; case TS_CRC_CHECK_COMMAND: - handleCrc32Check(tsChannel, TS_CRC, data16[0], data16[1], data16[2]); + handleCrc32Check(tsChannel, TS_CRC, data16[0]); break; case TS_BURN_COMMAND: handleBurnCommand(tsChannel, TS_CRC, data16[0]); diff --git a/firmware/console/binary/tunerstudio.h b/firmware/console/binary/tunerstudio.h index 68de8966fb..849fee1b2b 100644 --- a/firmware/console/binary/tunerstudio.h +++ b/firmware/console/binary/tunerstudio.h @@ -35,25 +35,12 @@ extern tunerstudio_counters_s tsState; bool handlePlainCommand(ts_channel_s *tsChannel, uint8_t command); int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomingPacketSize); -/** - * rusEfi own test command - */ -void handleTestCommand(ts_channel_s *tsChannel); /** * this command is part of protocol initialization */ void handleQueryCommand(ts_channel_s *tsChannel, ts_response_format_e mode); -/** - * Gauges refresh - */ -void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode); char *getWorkingPageAddr(); -void handleWriteValueCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page, uint16_t offset, uint8_t value); -void handleWriteChunkCommand(ts_channel_s *tsChannel, ts_response_format_e mode, short offset, short count, void *content); -void handlePageSelectCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId); -void handlePageReadCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t pageId, uint16_t offset, uint16_t count); -void handleBurnCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t page); void tunerStudioDebug(const char *msg); void tunerStudioError(const char *msg); diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index a7b3f49b45..b5a98efe9c 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -63,12 +63,8 @@ enable2ndByteCanID = false pageActivate = "P\x00\x00" pageValueWrite = "W\x00\x00%2o%v" pageChunkWrite = "C\x00\x00%2o%2c%v" -; crc32CheckCommand = "k%2i%2o\xB8\x36" - ; - ; TODO: interesting - 0x36B8 equals 14008 which looks like pageSize at some point in the past? is this a defect here - should - ; we have current pageSize or (pageSize + 8) here? - ; - crc32CheckCommand = "k\x00\x00\x00\x00\x36\xB8" + ; todo: make this command shorter one day, no need to have all these zeros + crc32CheckCommand = "k\x00\x00\x00\x00\x00\x00" retrieveConfigError = "e" ;communication settings