wip wireless

payload max 32byte problem
This commit is contained in:
2019-05-26 22:29:00 +02:00
parent b8114e3832
commit ee57e22b26
5 changed files with 305 additions and 95 deletions
+46
View File
@@ -0,0 +1,46 @@
#include "TransferDataStructure.h"
dataStruct2 GetSerialData(dataStruct2 dataIn, bool debug = false)
{
if (Serial.available())
{
String data = Serial.readStringUntil('\r');
int maxIndex = data.length() - 1;
int index = 0;
int next_index;
String data_word;
String channel;
String angle;
do {
next_index = data.indexOf(',', index);
data_word = data.substring(index, next_index);
channel = data_word.substring(0, data_word.indexOf('_'));
angle = data_word.substring(data_word.indexOf('_') + 1);
if (isDigit(angle[0])) // prevent error overwriting first entry.
// dataIn.servoPositions[channel.toInt()] = angle.toFloat();
index = next_index + 1;
} while ((next_index != -1) && (next_index < maxIndex));
// dataIn.remotePasstroughControl = true;
if (debug)
{
Serial.println("Enabled Servo Passtrough mode!");
Serial.println("Output line: ");
for (int i = 0; i < 18; i++)
{
Serial.print(i);
Serial.print(", ");
// Serial.print(dataIn.servoPositions[i]);
Serial.println("");
}
Serial.println("");
}
}
return dataIn;
}