Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forgotten iBuf++ in File NMEA0183.cpp ? #21

Open
BerndCirotzki opened this issue Mar 5, 2021 · 1 comment
Open

forgotten iBuf++ in File NMEA0183.cpp ? #21

BerndCirotzki opened this issue Mar 5, 2021 · 1 comment

Comments

@BerndCirotzki
Copy link

I think there is an Issue in your Code.
in File "NMEA0183.cpp" in Function "SendBuf"

181 // Could not send immediately, so buffer message
182 if ( strlen(buf)-iBuf >= MsgOutBufFreeSize() ) return false; // No room for message
183
184 size_t wp=MsgOutWritePos;
185
186 for (size_t temp = (MsgOutWritePos + 1) % MsgOutBufSize;
187 buf[iBuf]!=0 && temp!=MsgOutReadPos;
188 temp = (MsgOutWritePos + 1) % MsgOutBufSize ) {
189 MsgOutBuf[MsgOutWritePos]=buf[iBuf];
190 MsgOutWritePos=temp;
191 iBuf++; // <------ Please add this here !!****
192 }
193
194 if ( buf[iBuf]!=0 ) {
......

Am I right ?

greetings from Hamburg

@ttlappalainen
Copy link
Owner

Something strange. I have:

  for (size_t temp = (MsgOutWritePos + 1) % MsgOutBufSize;
       buf[iBuf]!=0 && temp!=MsgOutReadPos;
       temp = (MsgOutWritePos + 1) % MsgOutBufSize, iBuf++ ) {
    MsgOutBuf[MsgOutWritePos]=buf[iBuf];
    MsgOutWritePos=temp;
  }

But yes - same effect and seem to be missing on git.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants