mirror of
https://github.com/lindbergh-loader/lindbergh-loader.git
synced 2026-10-14 01:49:12 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3e3f51003 |
@@ -160,6 +160,10 @@ void *readJVSFrameThread(void * arg)
|
|||||||
waitForEnd = 0;
|
waitForEnd = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
while(jvsFrameBuffer.ready == 1) {
|
||||||
|
usleep(10);
|
||||||
|
}
|
||||||
|
|
||||||
// printf("SERIAL thread debug: trying to read byte.\n");
|
// printf("SERIAL thread debug: trying to read byte.\n");
|
||||||
// Try to read a byte from serial, this call will be blocking if VMIN > 0 and VTIME = 0
|
// Try to read a byte from serial, this call will be blocking if VMIN > 0 and VTIME = 0
|
||||||
bytesRead = read(fd, &localBuffer[byteCount], 1);
|
bytesRead = read(fd, &localBuffer[byteCount], 1);
|
||||||
@@ -237,14 +241,13 @@ int startJVSFrameThread(int * fd) {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
JVSFrame readJVSFrameFromThread() {
|
JVSFrame readJVSFrameFromThread() {
|
||||||
|
|
||||||
JVSFrame frame;
|
JVSFrame frame;
|
||||||
// Lock while reading/writing to shared frame
|
// Lock while reading/writing to shared frame
|
||||||
pthread_mutex_lock(&jvsBuffer_lock);
|
pthread_mutex_lock(&jvsBuffer_lock);
|
||||||
|
|
||||||
// Check if we have a valid frame
|
// Check if we have a valid frame
|
||||||
if (jvsFrameBuffer.ready == 1) {
|
if (jvsFrameBuffer.ready == 1) {
|
||||||
frame = jvsFrameBuffer;
|
memcpy(&frame, &jvsFrameBuffer, sizeof(JVSFrame));
|
||||||
// It has been red, we disable this frame
|
// It has been red, we disable this frame
|
||||||
jvsFrameBuffer.ready = 0;
|
jvsFrameBuffer.ready = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user