Click here to Skip to main content
14,032,277 members

C / C++ / MFC

 
GeneralRe: What are the best mocking frameworks available on Linux? Pin
IlanGreen13-May-18 1:15
memberIlanGreen13-May-18 1:15 
GeneralRe: What are the best mocking frameworks available on Linux? Pin
Hila Berger14-May-18 20:38
memberHila Berger14-May-18 20:38 
QuestionInvalid operands to binary expression Pin
Member 1380291228-Apr-18 7:03
memberMember 1380291228-Apr-18 7:03 
AnswerRe: Invalid operands to binary expression Pin
Richard MacCutchan28-Apr-18 22:18
protectorRichard MacCutchan28-Apr-18 22:18 
GeneralRe: Invalid operands to binary expression Pin
Member 1380291229-Apr-18 10:21
memberMember 1380291229-Apr-18 10:21 
GeneralRe: Invalid operands to binary expression Pin
Richard MacCutchan29-Apr-18 21:02
protectorRichard MacCutchan29-Apr-18 21:02 
QuestionData packet was cut when sending from Arduino Uno to Raspberry Pi 3 in C++ Pin
Ahmad ZULKIPLEE24-Apr-18 23:26
memberAhmad ZULKIPLEE24-Apr-18 23:26 
AnswerRe: Data packet was cut when sending from Arduino Uno to Raspberry Pi 3 in C++ Pin
Jochen Arndt25-Apr-18 0:17
mveJochen Arndt25-Apr-18 0:17 
The answer is obvious:
You have to rewrite your code to be able to handle incomplete packages.

You got incomplete packets because you stop receiving if any number of data has been received (even a single byte/character). That would be the normal behaviour. The only reason why that happens not very often is that the system has to service also other tasks. And that is not done while waiting (see end of my post)!

Because you are sending only a single kind of data, you can change the data being send using a fixed length format by using leading zeroes:
sprintf(dataToSend, "R%03dE T%03dE", valpotRoulis, valpotTangage);
That makes parsing much simpler (e.g. using scanf()) and you can wait for the known number of characters (11 + line feed):
const int CMD_LENGTH = 12; // Or whatever applies
while(n < CMD_LENGTH && i < 1000000);
By the way: what is the purpose of the undefined variable i here?

But when doing so you will run more into the already existing performance problem of using a polling loop. Waiting for the data wastes a lot of time (10 ms) that is not available for other tasks.

The solution is to put the receiving into an own thread and use the fine Qt signaling features. Because there are only two event data values, there is even no need to use shared variables.
GeneralRe: Data packet was cut when sending from Arduino Uno to Raspberry Pi 3 in C++ Pin
Ahmad ZULKIPLEE25-Apr-18 2:15
memberAhmad ZULKIPLEE25-Apr-18 2:15 
GeneralRe: Data packet was cut when sending from Arduino Uno to Raspberry Pi 3 in C++ Pin
Jochen Arndt25-Apr-18 3:06
mveJochen Arndt25-Apr-18 3:06 
AnswerRe: Data packet was cut when sending from Arduino Uno to Raspberry Pi 3 in C++ Pin
Richard MacCutchan25-Apr-18 0:19
protectorRichard MacCutchan25-Apr-18 0:19 
AnswerRe: Data packet was cut when sending from Arduino Uno to Raspberry Pi 3 in C++ Pin
leon de boer25-Apr-18 15:05
memberleon de boer25-Apr-18 15:05 
QuestionFrom framebuffer to SPI via ioctl in Linux Pin
Vaclav_23-Apr-18 3:16
memberVaclav_23-Apr-18 3:16 
AnswerRe: From framebuffer to SPI via ioctl in Linux Pin
Jochen Arndt23-Apr-18 3:59
mveJochen Arndt23-Apr-18 3:59 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Vaclav_23-Apr-18 4:17
memberVaclav_23-Apr-18 4:17 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Jochen Arndt23-Apr-18 4:24
mveJochen Arndt23-Apr-18 4:24 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Vaclav_23-Apr-18 8:08
memberVaclav_23-Apr-18 8:08 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Jochen Arndt23-Apr-18 10:28
mveJochen Arndt23-Apr-18 10:28 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Vaclav_23-Apr-18 13:39
memberVaclav_23-Apr-18 13:39 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Jochen Arndt23-Apr-18 21:21
mveJochen Arndt23-Apr-18 21:21 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Vaclav_24-Apr-18 12:16
memberVaclav_24-Apr-18 12:16 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Jochen Arndt24-Apr-18 21:07
mveJochen Arndt24-Apr-18 21:07 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Vaclav_25-Apr-18 3:36
memberVaclav_25-Apr-18 3:36 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Jochen Arndt25-Apr-18 4:20
mveJochen Arndt25-Apr-18 4:20 
GeneralRe: From framebuffer to SPI via ioctl in Linux Pin
Vaclav_25-Apr-18 9:11
memberVaclav_25-Apr-18 9:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190419.4 | Last Updated 23 Apr 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid