Timing Problem dummy solution

This commit is contained in:
Lukas Loidold 2020-04-23 14:39:34 +02:00
parent 39c171c186
commit 8536d04868

View File

@ -43,12 +43,7 @@ void sendData(uint8_t *data, size_t len) {
if (result != HasReturnvaluesIF::RETURN_OK) {
return;
}
for (size_t i = 0; i < writtenLen; i++)
{
Serial.print("buffer is: ");Serial.println(buffer[i]);
}
Serial.write(buffer, writtenLen);
}
@ -59,9 +54,9 @@ void transferSPI(uint8_t address, uint8_t *data, size_t datalen) {
//included
for (size_t i = 0; i < datalen; i++)
{
Serial.print("SentData is: ");Serial.println(data[i]);
//Serial.print("SentData is: ");Serial.println(data[i]);
data[i] = SPI.transfer(data[i]);
Serial.print("Back from n-1 ");Serial.println(data[i]);
//Serial.print("Back from n-1 ");Serial.println(data[i]);
}
//SPI.transfer(data, datalen);
@ -83,14 +78,14 @@ void handlePacket(uint8_t *packet, size_t packetLen) {
if (crc != 0) {
Serial.println("invalid Checksum");
//Serial.println("invalid Checksum");
return;
}
uint16_t payloadLen = (packet[2] << 8) | packet[3];
if (payloadLen != packetLen - 6) {
Serial.println("invalid len");
//Serial.println("invalid len");
return;
}
@ -105,14 +100,11 @@ void handlePacket(uint8_t *packet, size_t packetLen) {
//echo the data back, no need to change the header fields, they are the same
//checksum will be written by sendData()
//check reply:
Serial.println("Data response check: ");
for(size_t i =0; i< packetLen; i++){
Serial.print("packet nr ");Serial.print(i);Serial.print(" ");Serial.println(packet[i]);
}
sendData(packet, packetLen);
break;
default:
Serial.println("invalid command");
//Serial.println("invalid command");
break;
}
@ -129,13 +121,13 @@ void handleNewData() {
size_t firstSTXinRawData = 0;
while ((firstSTXinRawData < rawDataSize)
&& (rawData[firstSTXinRawData] != DleEncoder::STX)) {
Serial.println(rawData[firstSTXinRawData]);
//Serial.println(rawData[firstSTXinRawData]);
firstSTXinRawData++;
}
if (rawData[firstSTXinRawData] != DleEncoder::STX) {
//there is no STX in our data, throw it away...
Serial.println("NO STX");
//Serial.println("NO STX");
ringBuffer.deleteData(rawDataSize);
return;
}