diff --git a/Desktop_Interface/bin/Labrador.exe b/Desktop_Interface/bin/Labrador.exe index 73b4e378..3cd286d0 100644 Binary files a/Desktop_Interface/bin/Labrador.exe and b/Desktop_Interface/bin/Labrador.exe differ diff --git a/Desktop_Interface/isobuffer.cpp b/Desktop_Interface/isobuffer.cpp index 7e87469e..c6bf652d 100644 --- a/Desktop_Interface/isobuffer.cpp +++ b/Desktop_Interface/isobuffer.cpp @@ -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; +} diff --git a/Desktop_Interface/isobuffer.h b/Desktop_Interface/isobuffer.h index a98c5342..7c93e4e1 100644 --- a/Desktop_Interface/isobuffer.h +++ b/Desktop_Interface/isobuffer.h @@ -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: diff --git a/Desktop_Interface/release/isobuffer.obj b/Desktop_Interface/release/isobuffer.obj index a8135d30..8d0b565b 100644 Binary files a/Desktop_Interface/release/isobuffer.obj and b/Desktop_Interface/release/isobuffer.obj differ diff --git a/Desktop_Interface/release/isodriver.obj b/Desktop_Interface/release/isodriver.obj index 2cfce2f6..9048794b 100644 Binary files a/Desktop_Interface/release/isodriver.obj and b/Desktop_Interface/release/isodriver.obj differ diff --git a/Desktop_Interface/release/main.obj b/Desktop_Interface/release/main.obj index 36f9135a..c0b06c59 100644 Binary files a/Desktop_Interface/release/main.obj and b/Desktop_Interface/release/main.obj differ diff --git a/Desktop_Interface/release/mainwindow.obj b/Desktop_Interface/release/mainwindow.obj index 352a7b04..15ee1b02 100644 Binary files a/Desktop_Interface/release/mainwindow.obj and b/Desktop_Interface/release/mainwindow.obj differ diff --git a/Desktop_Interface/release/moc_isobuffer.obj b/Desktop_Interface/release/moc_isobuffer.obj index 5b87de92..95b1b9d2 100644 Binary files a/Desktop_Interface/release/moc_isobuffer.obj and b/Desktop_Interface/release/moc_isobuffer.obj differ diff --git a/Desktop_Interface/release/moc_mainwindow.obj b/Desktop_Interface/release/moc_mainwindow.obj index 5bd1e9ba..801be6d0 100644 Binary files a/Desktop_Interface/release/moc_mainwindow.obj and b/Desktop_Interface/release/moc_mainwindow.obj differ