mirror of https://github.com/EspoTek/Labrador.git
Doesn't halt in while() loop
This commit is contained in:
parent
8bd771f02d
commit
a1075b97fd
Binary file not shown.
|
@ -228,9 +228,14 @@ void isoBuffer::serialDecode(double baudRate)
|
||||||
qDebug() << bitPeriod_seconds;
|
qDebug() << bitPeriod_seconds;
|
||||||
qDebug() << dist_seconds;
|
qDebug() << dist_seconds;
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
while(dist_seconds > (bitPeriod_seconds + SERIAL_DELAY)){
|
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;
|
return back_bit - serialPtr_bit;
|
||||||
}else return bufferEnd_bit - serialPtr_bit + back_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;
|
||||||
|
}
|
||||||
|
|
|
@ -61,6 +61,7 @@ private:
|
||||||
bool uartTransmitting = false;
|
bool uartTransmitting = false;
|
||||||
isoBufferBuffer *serialBuffer;
|
isoBufferBuffer *serialBuffer;
|
||||||
bool symbolUpdated = false;
|
bool symbolUpdated = false;
|
||||||
|
void updateSerialPtr(double baudRate);
|
||||||
//Generic Functions
|
//Generic Functions
|
||||||
double sampleConvert(short sample, int TOP, bool AC);
|
double sampleConvert(short sample, int TOP, bool AC);
|
||||||
public slots:
|
public slots:
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue