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

espnow doesn't give correct error messages #1611

Open
floitsch opened this issue May 9, 2023 · 0 comments
Open

espnow doesn't give correct error messages #1611

floitsch opened this issue May 9, 2023 · 0 comments

Comments

@floitsch
Copy link
Member

floitsch commented May 9, 2023

I got the following error message.

******************************************************************************
Decoding by `jag`, device has version <2.0.0-alpha.81.18+floitsch-espnow-rate.f71e3e98>
******************************************************************************
EXCEPTION error. 
UNKNOWN ERROR 0x5(5)
  0: espnow_send_              <sdk>/esp32/espnow.toit:138:3
  1: Service.send              <sdk>/esp32/espnow.toit:119:5
  2: espnow_tx_task            espnow1.toit:24:13
  3: main.<lambda>             espnow1.toit:17:10
******************************************************************************

That error comes from (where EIO is set to 0x05):

return Primitive::os_error(EIO, process);
full function
PRIMITIVE(send) {
  ARGS(Blob, mac, Blob, data, bool, wait);

  // Reset the value of semaphore(max value is 1) to 0, so no need to check the result.
  xSemaphoreTake(tx_sem, 0);

  esp_err_t err = esp_now_send(mac.address(), data.address(), data.length());
  if (err != ESP_OK) return Primitive::os_error(err, process);

  if (wait) {
    portBASE_TYPE ret = xSemaphoreTake(tx_sem, pdMS_TO_TICKS(ESPNOW_TX_WAIT_US));
    if (ret != pdTRUE) {
      return Primitive::os_error(ETIMEDOUT, process);
    } else {
      if (tx_status != ESP_NOW_SEND_SUCCESS) {
        return Primitive::os_error(EIO, process);
      }
    }
  }

  return Smi::from(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant