32 lines
716 B
C++
32 lines
716 B
C++
|
|
|
|
#include <Arduino.h>
|
|
#include "DebugLog.h"
|
|
|
|
void DebugLog::log(const String &log)
|
|
{
|
|
// WriteToSerial(log);
|
|
}
|
|
|
|
void DebugLog::init(const long &bound)
|
|
{
|
|
Serial.begin(bound);
|
|
Serial.println("Serial Port Initialized");
|
|
}
|
|
|
|
void DebugLog::WriteToSerial(const String &dataString)
|
|
{
|
|
const byte chunkSize = 60;
|
|
unsigned int stringIndex = 0;
|
|
while (stringIndex < dataString.length())
|
|
{
|
|
int chunkLength = min(chunkSize, dataString.length() - stringIndex);
|
|
String chunk = dataString.substring(stringIndex, stringIndex + chunkLength);
|
|
|
|
Serial.print(chunk);
|
|
stringIndex += chunkLength;
|
|
delay(4); // Optional delay between chunks
|
|
}
|
|
Serial.println("");
|
|
}
|