rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
tunerstudio_commands.cpp
Go to the documentation of this file.
1#include "pch.h"
2
3#include "tunerstudio_impl.h"
4#include "tunerstudio.h"
5#include "tunerstudio_io.h"
6
7#include "live_data.h"
8
9#include "status_loop.h"
10
11#if EFI_TUNER_STUDIO
12
14
16 return channelsRequestTimer.getElapsedSeconds();
17}
18
19/**
20 * @brief 'Output' command sends out a snapshot of current values
21 * Gauges refresh
22 */
23void TunerStudio::cmdOutputChannels(TsChannelBase* tsChannel, uint16_t offset, uint16_t count) {
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}
48
49#endif // EFI_TUNER_STUDIO
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="")
void cmdOutputChannels(TsChannelBase *tsChannel, uint16_t offset, uint16_t count) override
'Output' command sends out a snapshot of current values Gauges refresh
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
int getSecondsSinceChannelsRequest()