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

Invalid assignment to rmt_encode_state_t for RMT led strip encoder example (IDFGH-9881) (IDFGH-9882) #11200

Closed
3 tasks done
fschuetz opened this issue Apr 15, 2023 · 1 comment
Assignees
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@fschuetz
Copy link

fschuetz commented Apr 15, 2023

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

v5.1-dev

Operating System used.

macOS

How did you build your project?

VS Code IDE

If you are using Windows, please specify command line type.

None

What is the expected behavior?

Example should compile.

What is the actual behavior?

Example does not compile.

Steps to reproduce.

Try to compile using strict compiler settings. I embedded it in a c++ project and adapted the example, removing the "extern C". This will not allow the assignment due to strict type checking.

In the examples/peripherals/rmt/led_strip/main/led_strip_encoder.c on line 25 and 26 the following assignment is done:

    rmt_encode_state_t session_state = 0;
    rmt_encode_state_t state = 0;

However, the rmt_encode_state_t is defined in components/driver/rmt/include/driver/rmt_encoder.h as

typedef enum {
    RMT_ENCODING_COMPLETE = (1 << 0), /*!< The encoding session is finished, the caller can continue with subsequent encoding */
    RMT_ENCODING_MEM_FULL = (1 << 1), /*!< The encoding artifact memory is full, the caller should return from current encoding session */
} rmt_encode_state_t;

This means it cannot be assigned 0 and thus the example does not work, as the fields of rmt_encode_state_t are 1 and 2. It might be useful to adapt rmt_encode_state_t to include a field RMT_ENCODING_OK = 0 (which I think would be the right thing to do as this type serves to hold the return code from the rmt encoders) or the example needs to be adapted.

Build or installation Logs.

examples/peripherals/rmt/led_strip/main/led_strip_encoder.c:26:40: error: invalid conversion from 'int' to 'rmt_encode_state_t' [-fpermissive]
 25   |     rmt_encode_state_t session_state = 0;
      |                                        ^
      |                                        |
      |                                        int
examples/peripherals/rmt/led_strip/main/led_strip_encoder.c:27:32: error: invalid conversion from 'int' to 'rmt_encode_state_t' [-fpermissive]
 26   |     rmt_encode_state_t state = 0;
      |                                ^
      |                                |
      |                                int

More Information.

No response

@fschuetz fschuetz added the Type: Bug bugs in IDF label Apr 15, 2023
@github-actions github-actions bot changed the title Invalid assignment to rmt_encode_state_t for RMT led strip encoder example Invalid assignment to rmt_encode_state_t for RMT led strip encoder example (IDFGH-9881) Apr 15, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Apr 15, 2023
@github-actions github-actions bot changed the title Invalid assignment to rmt_encode_state_t for RMT led strip encoder example (IDFGH-9881) Invalid assignment to rmt_encode_state_t for RMT led strip encoder example (IDFGH-9881) (IDFGH-9882) Apr 15, 2023
@espressif-bot espressif-bot added Resolution: Done Issue is done internally Status: Done Issue is done internally and removed Status: Opened Issue is new labels Apr 16, 2023
@Alvin1Zhang Alvin1Zhang removed Status: Done Issue is done internally Resolution: Done Issue is done internally labels Apr 16, 2023
@espressif-bot espressif-bot added Status: Opened Issue is new Status: Selected for Development Issue is selected for development Status: In Progress Work is in progress and removed Status: Opened Issue is new Status: Selected for Development Issue is selected for development labels Apr 17, 2023
@suda-morris
Copy link
Collaborator

Thanks for reporting. Yes, this is something we can do better in the esp-idf side. We will introduce a new enum variant RMT_ENCODING_INIT = 0 in the rmt_encode_state_t

@espressif-bot espressif-bot added Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Resolution: Done Issue is done internally and removed Status: In Progress Work is in progress Resolution: NA Issue resolution is unavailable labels Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Done Issue is done internally Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests

4 participants