This commit is contained in:
rusefi 2017-05-27 09:00:18 -04:00
parent badbdf7bb1
commit 273ee75200
6 changed files with 33 additions and 9 deletions

View File

@ -409,6 +409,7 @@ void handleBurnCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint1
static TunerStudioReadRequest readRequest;
static TunerStudioWriteChunkRequest writeChunkRequest;
static TunerStudioOchRequest ochRequest;
static short int pageIn;
static bool isKnownCommand(char command) {
@ -587,11 +588,20 @@ void handleQueryCommand(ts_channel_s *tsChannel, ts_response_format_e mode) {
/**
* @brief 'Output' command sends out a snapshot of current values
*/
void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode) {
void handleOutputChannelsCommand(ts_channel_s *tsChannel, ts_response_format_e mode, uint16_t offset, uint16_t count) {
//
// if (size < offset + count) {
// scheduleMsg(&tsLogger, "invalid offset/count %d/%d", offset, count);
// sendErrorCode(tsChannel);
// return;
// }
tsState.outputChannelsCommandCounter++;
prepareTunerStudioOutputs();
// this method is invoked too often to print any debug information
sr5SendResponse(tsChannel, mode, (const uint8_t *) &tsOutputChannels, sizeof(TunerStudioOutputChannels));
sr5SendResponse(tsChannel, mode, ((const uint8_t *) &tsOutputChannels) + offset, count);
}
#define TEST_RESPONSE_TAG " ts_p_alive\r\n"
@ -706,8 +716,14 @@ bool handlePlainCommand(ts_channel_s *tsChannel, uint8_t command) {
handlePageReadCommand(tsChannel, TS_PLAIN, readRequest.page, readRequest.offset, readRequest.count);
return true;
} else if (command == TS_OUTPUT_COMMAND) {
int received = sr5ReadData(tsChannel, (uint8_t * )&ochRequest, sizeof(ochRequest));
if (received != sizeof(ochRequest)) {
tunerStudioError("Not enough for OutputChannelsCommand");
return true;
}
//scheduleMsg(logger, "Got naked Channels???");
handleOutputChannelsCommand(tsChannel, TS_PLAIN);
handleOutputChannelsCommand(tsChannel, TS_PLAIN, ochRequest.offset, ochRequest.count);
return true;
} else if (command == TS_LEGACY_HELLO_COMMAND) {
tunerStudioDebug("ignoring LEGACY_HELLO_COMMAND");
@ -735,7 +751,9 @@ int tunerStudioHandleCrcCommand(ts_channel_s *tsChannel, char *data, int incomin
} else if (command == TS_EXECUTE) {
handleExecuteCommand(tsChannel, data, incomingPacketSize - 1);
} else if (command == TS_OUTPUT_COMMAND) {
handleOutputChannelsCommand(tsChannel, TS_CRC);
uint16_t offset = *(uint16_t *) (data);
uint16_t count = *(uint16_t *) (data + 2);
handleOutputChannelsCommand(tsChannel, TS_CRC, offset, count);
} else if (command == TS_PAGE_COMMAND) {
uint16_t page = *(uint16_t *) data;
handlePageSelectCommand(tsChannel, TS_CRC, page);

View File

@ -251,5 +251,5 @@ int getRusEfiVersion(void) {
return 123; // this is here to make the compiler happy about the unused array
if (UNUSED_CCM_SIZE[0] * 0 != 0)
return 3211; // this is here to make the compiler happy about the unused array
return 20170525;
return 20170527;
}

View File

@ -841,7 +841,7 @@ page = 1
; see TS_FILE_VERSION in firmware code
fileVersion = { 20161225 }
ochGetCommand = "O"
ochGetCommand = "O%2o%2c"
; see TS_OUTPUT_SIZE in console source code
ochBlockSize = 356

View File

@ -101,7 +101,7 @@ enable2ndByteCanID = false
; see TS_FILE_VERSION in firmware code
fileVersion = { 20161225 }
ochGetCommand = "O"
ochGetCommand = "O%2o%2c"
; see TS_OUTPUT_SIZE in console source code
ochBlockSize = 356

View File

@ -498,7 +498,13 @@ public class BinaryProtocol {
public boolean requestOutputChannels() {
if (isClosed)
return false;
byte[] response = executeCommand(new byte[]{COMMAND_OUTPUTS}, "output channels", false);
byte packet[] = new byte[5];
packet[0] = COMMAND_OUTPUTS;
putShort(packet, 1, 0); // offset
putShort(packet, 3, swap16(Fields.TS_OUTPUT_SIZE));
byte[] response = executeCommand(packet, "output channels", false);
if (response == null || response.length != (Fields.TS_OUTPUT_SIZE + 1) || response[0] != RESPONSE_OK)
return false;

View File

@ -44,7 +44,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20170522;
public static final int CONSOLE_VERSION = 20170527;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";