Doesn't halt in while() loop

This commit is contained in:
EspoTek 2017-05-28 16:40:23 +10:00
parent 8bd771f02d
commit a1075b97fd
9 changed files with 14 additions and 2 deletions

Binary file not shown.

View File

@ -228,9 +228,14 @@ void isoBuffer::serialDecode(double baudRate)
qDebug() << bitPeriod_seconds;
qDebug() << dist_seconds;
return;
while(dist_seconds > (bitPeriod_seconds + SERIAL_DELAY)){
//Read next uart bit
//Process it
//Update the pointer, accounting for jitter
updateSerialPtr(baudRate);
//Calculate stopping condition
dist_seconds = (double)serialDistance()/sampleRate_bit;
}
}
@ -242,3 +247,9 @@ int isoBuffer::serialDistance()
return back_bit - serialPtr_bit;
}else return bufferEnd_bit - serialPtr_bit + back_bit;
}
void isoBuffer::updateSerialPtr(double baudRate)
{
int distance_between_bits = sampleRate_bit/baudRate;
serialPtr_bit += distance_between_bits;
}

View File

@ -61,6 +61,7 @@ private:
bool uartTransmitting = false;
isoBufferBuffer *serialBuffer;
bool symbolUpdated = false;
void updateSerialPtr(double baudRate);
//Generic Functions
double sampleConvert(short sample, int TOP, bool AC);
public slots:

Binary file not shown.