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

Better timing management during reception. #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

EmbeddedDevver
Copy link

Tested with ESP32.

The reason why you needed to include the 15mS timer, is because the while loop executes very fast and the data from the Ikea module will be received slowly. Thus the while loop exits  too early if you do not had the 15mS delay included because there was no data (yet) inside the UART buffer. 

But your 15mS delay causes that for every received character, there will be 15mS delay. So 64 characters received will be 64 times 15mS equals a a long (blocking) code.

It's better to use this code, where I use a timeout for the entire frame and not for every character.
@Mrten
Copy link

Mrten commented Oct 5, 2021

This does not compile

error: base operand of '->' has non-pointer type 'SoftwareSerial'
   90 |             if (sensorSerial->available()) {
      |                             ^~
SerialCom.h:93:55: error: base operand of '->' has non-pointer type 'SoftwareSerial'
   93 |                 serialRxBuf[rxBufIdx++] = sensorSerial->read();
      |                                                       ^~

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

Successfully merging this pull request may close these issues.

None yet

2 participants