Skip to content

ESP32: Check the ESP-IDF error code #6573

Closed
@IhorNehrutsa

Description

@IhorNehrutsa

1) Is it correct to represent the ESP-IDF error code as OSError code?
For example, for the code

from esp32 import RMT  
from machine import Pin  
rmt = RMT(1000, pin=Pin(10)) # 1000 is wrong  

we get an output

OSError: (-258, 'ESP_ERR_INVALID_ARG')

But I expect to see

EspError: (258, '0x102 ESP_ERR_INVALID_ARG')

(or something similar) according to errors

#define ESP_ERR_INVALID_ARG         0x102   /*!< Invalid argument */

from the
esp_err.h#L31

2) Is this line of code correct? Do you need a '-' here?

uint32_t pcode = -code;

from the
mphalport.c#61

3) Is it possible to develop a C module with esp_err.py functionality?
esp_err.zip

I try but it doesn't work completely.
mod_esp_err.zip
I get TypeError when executing esp_err_test.py

  File "<stdin>", line 9, in <module>
TypeError: can't create 'EspError' instances

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions