Refactoring of commandQueue to support stxChar defined for each command

This commit is contained in:
Ján Mátik
2020-12-28 12:21:15 +01:00
parent b1d8f3a68d
commit 6cc3c5dcf4
10 changed files with 106 additions and 111 deletions

View File

@@ -1,6 +1,7 @@
#include "CarKiaDebugObd2.h"
#include <vector>
#define commandQueueCountDebugObd2Kia 256
//#define commandQueueCountDebugObd2Kia 256
#define commandQueueLoopFromDebugObd2Kia 8
/**
@@ -8,7 +9,7 @@
*/
void CarKiaDebugObd2::activateCommandQueue() {
String commandQueueDebugObd2Kia[commandQueueCountDebugObd2Kia] = {
std::vector<String> commandQueueDebugObd2Kia = {
"AT Z", // Reset all
"AT I", // Print the version ID
"AT E0", // Echo off
@@ -219,15 +220,13 @@ void CarKiaDebugObd2::activateCommandQueue() {
liveData->params.batteryTotalAvailableKWh = 64;
// Empty and fill command queue
for (uint16_t i = 0; i < 300; i++) {
liveData->commandQueue[i] = "";
}
for (uint16_t i = 0; i < commandQueueCountDebugObd2Kia; i++) {
liveData->commandQueue[i] = commandQueueDebugObd2Kia[i];
liveData->commandQueue.clear();
for (auto cmd : commandQueueDebugObd2Kia) {
liveData->commandQueue.push_back({ 0, cmd });
}
liveData->commandQueueLoopFrom = commandQueueLoopFromDebugObd2Kia;
liveData->commandQueueCount = commandQueueCountDebugObd2Kia;
liveData->commandQueueCount = commandQueueDebugObd2Kia.size();
}
/**