Live Data progress
This commit is contained in:
parent
89fb8b193f
commit
ed6c89ec10
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* FragmentEntry.cpp
|
||||
*
|
||||
* Created on: Jan 5, 2022
|
||||
* @author Andrey Belomutskiy, (c) 2012-2022
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
#include "FragmentEntry.h"
|
||||
|
||||
/**
|
||||
* copy dataLength of fragmented outputs starting at dataOffset into destination starting at zero
|
||||
*/
|
||||
void copyRange(uint8_t *destination, FragmentEntry *fragments, size_t dataOffset, size_t dataLength) {
|
||||
int fragmentIndex = 0;
|
||||
|
||||
// scroll to starting fragment
|
||||
while (dataOffset > fragments[fragmentIndex].size) {
|
||||
dataOffset -= fragments[fragmentIndex].size;
|
||||
fragmentIndex ++;
|
||||
}
|
||||
|
||||
int destinationIndex = 0;
|
||||
|
||||
while (dataLength > 0) {
|
||||
int copyNowSize = minI(dataLength, fragments[fragmentIndex].size - dataOffset);
|
||||
memcpy(destination + destinationIndex, fragments[fragmentIndex].data + dataOffset, copyNowSize);
|
||||
destinationIndex += copyNowSize;
|
||||
dataOffset = 0;
|
||||
dataLength -= copyNowSize;
|
||||
fragmentIndex++;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* FragmentEntry.h
|
||||
*
|
||||
* Created on: Jan 5, 2022
|
||||
* @author Andrey Belomutskiy, (c) 2012-2022
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct FragmentEntry {
|
||||
FragmentEntry(uint8_t *data, size_t size) {
|
||||
this->data = data;
|
||||
this->size = size;
|
||||
|
||||
}
|
||||
|
||||
uint8_t *data;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
void copyRange(uint8_t *destination, FragmentEntry *fragments, size_t dataOffset, size_t dataLength);
|
|
@ -5,6 +5,7 @@ TUNERSTUDIO_SRC_CPP = $(PROJECT_DIR)/console/binary/tunerstudio_io.cpp \
|
|||
$(PROJECT_DIR)/console/binary/ts_can_channel.cpp \
|
||||
$(PROJECT_DIR)/console/binary/serial_can.cpp \
|
||||
$(PROJECT_DIR)/console/binary/tunerstudio.cpp \
|
||||
$(PROJECT_DIR)/console/binary/FragmentEntry.cpp \
|
||||
$(PROJECT_DIR)/console/binary/tunerstudio_commands.cpp \
|
||||
$(PROJECT_DIR)/console/binary/bluetooth.cpp \
|
||||
$(PROJECT_DIR)/console/binary/signature.cpp
|
||||
|
|
|
@ -23,7 +23,7 @@ void TunerStudio::cmdOutputChannels(TsChannelBase* tsChannel, uint16_t offset, u
|
|||
tsState.outputChannelsCommandCounter++;
|
||||
prepareTunerStudioOutputs();
|
||||
// this method is invoked too often to print any debug information
|
||||
tsChannel->sendResponse(TS_CRC, reinterpret_cast<const uint8_t*>(&engine->outputChannels) + offset, count);
|
||||
tsChannel->writeCrcPacket(TS_RESPONSE_OK, reinterpret_cast<const uint8_t*>(&engine->outputChannels) + offset, count);
|
||||
}
|
||||
|
||||
#endif // EFI_TUNER_STUDIO
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* test_pwm_generator.cpp
|
||||
*
|
||||
* @date Dec 8, 2018
|
||||
* Author: user
|
||||
* @author Andrey Belomutskiy, (c) 2012-2020
|
||||
*/
|
||||
|
||||
#include "pch.h"
|
||||
|
|
Loading…
Reference in New Issue