Modbus Driver fixing multiRequest
This commit is contained in:
37
lib/utils/utils.cpp
Normal file
37
lib/utils/utils.cpp
Normal file
@@ -0,0 +1,37 @@
|
||||
#include "utils.h"
|
||||
|
||||
void printBytes(const char title[], const std::vector<uint8_t> &b)
|
||||
{
|
||||
Serial0.flush();
|
||||
printf("%s: ", title);
|
||||
for (auto v : b)
|
||||
{
|
||||
printf("0x%02x ", v);
|
||||
}
|
||||
printf("\n");
|
||||
Serial0.flush();
|
||||
}
|
||||
|
||||
void printBytes(const char title[], const std::vector<uint16_t> &b)
|
||||
{
|
||||
Serial0.flush();
|
||||
printf("%s: ", title);
|
||||
for (auto v : b)
|
||||
{
|
||||
printf("0x%04x ", v);
|
||||
}
|
||||
printf("\n");
|
||||
Serial0.flush();
|
||||
}
|
||||
|
||||
void printBool(const char title[], const std::vector<bool> &vals)
|
||||
{
|
||||
Serial0.flush();
|
||||
printf("%s: ", title);
|
||||
for (auto j(0); j < vals.size(); j++)
|
||||
{
|
||||
printf("%s ", vals.at(j) ? "True" : "False");
|
||||
}
|
||||
printf("\n");
|
||||
Serial0.flush();
|
||||
}
|
||||
13
lib/utils/utils.h
Normal file
13
lib/utils/utils.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <DebugLog.h>
|
||||
#include <vector>
|
||||
|
||||
///////////// UTIL Functions /////////////////
|
||||
|
||||
void printBytes(const char title[], const std::vector<uint8_t> &b);
|
||||
|
||||
void printBytes(const char title[], const std::vector<uint16_t> &b);
|
||||
|
||||
void printBool(const char title[], const std::vector<bool> &vals);
|
||||
Reference in New Issue
Block a user