Refactoring of commandQueue to support stxChar defined for each command
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user