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

peek() returns second char in buffer - after update to MKRNB v1.6 #126

Open
andersop91 opened this issue Mar 17, 2024 · 0 comments
Open
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@andersop91
Copy link

Currently working with the board MKR NB 1500.

After ugrading to MKRNB v1.6.0 i'm experiencing a problem with the message disposal functionality from example RecieveSMS.ino
I believe it's connected with the change in #100.
I acknowledge the bug presented - the first character is clipped if using peek in <v1.6.0, and was not according to the given documentation . Nevertheless, according to my experience this fix is breaking other functionality, as it now consequently reads the second character in the buffer, and not the first as I would expect.

Am I doing anything wrong?

Output;
image
Where 83 corresponds to 'S' in ascii.

Current code;

// If there are any SMSs available()
  if (sms.available()) {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    Serial.print("Message starts with: ");
    int peek = sms.peek();
    Serial.println(peek);

    // Read message bytes and print them
    while ((c = sms.read()) != -1) {
      Serial.print((char)c);
    }

    Serial.println("\nEND OF MESSAGE");

    // Delete message from modem memory
    sms.flush();
    Serial.println("MESSAGE DELETED");
    }
  }
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants