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

Improvements of Examples #7659

Closed
3 of 5 tasks
VojtechBartoska opened this issue Jan 4, 2023 · 11 comments
Closed
3 of 5 tasks

Improvements of Examples #7659

VojtechBartoska opened this issue Jan 4, 2023 · 11 comments
Assignees
Labels
Type: Example Issue is related to specific example.

Comments

@VojtechBartoska
Copy link
Contributor

VojtechBartoska commented Jan 4, 2023

This issue tracks improvements of all examples in this repository.

Purpose

We've been actively collecting feedback from the Community to figure out how to improve Arduino ESP32 Core framework and make it more accessible and easy to developed with. Main outcome includes improvements of Examples which serve as a solid starting point for most of the applications. Up to that, we sorted our examples and we will be continuously updating them to increase their quality.

Overview

Example improvements includes adding Readmes, headers, inline comments and so on.

Overview is available in this Google Spreadsheet. (Anyone can comment)

To-Do list

Contribution

We are looking for your feedback about the examples. Also contribution to current examples is very welcomed (please wait for our example template/guideline)

@VojtechBartoska VojtechBartoska converted this from a draft issue Jan 4, 2023
@VojtechBartoska VojtechBartoska added the Type: Example Issue is related to specific example. label Jan 4, 2023
@VojtechBartoska VojtechBartoska moved this from Todo to Under investigation in Arduino ESP32 Core Project Roadmap Jan 4, 2023
@VojtechBartoska VojtechBartoska pinned this issue Jan 4, 2023
@PilnyTomas PilnyTomas self-assigned this Jan 4, 2023
@dsyleixa
Copy link

dsyleixa commented Jan 8, 2023

just out of interest: what are the hard-to-understand MT examples good for?
Finally we have std::thread
std::thread thread_0 (myfunction);

and std::mutex
std::mutex my_mutex;

and so on, which are absolutely common providing an absolutely catchy syntax, plus even vTaskPrioritySet() (which admittedly is not quite POSIX-like though)...?
https://github.com/dsyleixa/Arduino/blob/master/ESP32_Test/std_thread_000/std_thread_000.ino
https://github.com/dsyleixa/Arduino/blob/master/ESP32_Test/std_thread_007/std_thread_007.ino
https://github.com/dsyleixa/Arduino/blob/master/ESP32_Test/esp32_stdmutex_003/esp32_stdmutex_003.ino
https://github.com/dsyleixa/Arduino/blob/master/ESP32_Test/esp32_stdthread_008/esp32_stdthread_008.ino

@PilnyTomas
Copy link
Contributor

@dsyleixa
My examples illustrate how FreeRTOS (on which all ESP32s run) does the multithreading natively.
Why use the existing and well-tested solution? I'll let that answer for you.

@dsyleixa
Copy link

dsyleixa commented Jan 9, 2023

aren't std::thread and std::mutex well-tested as well?
And finally this is the arduino-ESP32 section IIUC (please CMIIW)

(but BTW, some more std:: lib and POSIX-like pthread examples and extensions to thread prios, joinable() vs. detached(), queuing, semaphores, atomic, and core assignment would be highly appreciated, too!)

@Xylopyrographer
Copy link
Contributor

What does the green and orange shading in the spreadsheet represent?

@VojtechBartoska
Copy link
Contributor Author

VojtechBartoska commented Jan 10, 2023

@Xylopyrographer Green - examples are okay. Orange - examples need some action with higher priority. (known issue, request from community etc.)

@PilnyTomas
Copy link
Contributor

@dsyleixa

aren't std::thread and std::mutex well-tested as well?

Sure they are, but they are not supported by FreeRTOS. If you believe that implementing std::thread and std::mutex to work on FreeRTOS is an easy job we will welcome your PR!

And finally this is the arduino-ESP32 section IIUC (please CMIIW)

Yes, you "UC" - what is your point? As it was pointed out elsewhere - Arduino ESP32 runs on ESP-IDF which runs on FreeRTOS - they are inseparable.

@dsyleixa
Copy link

@PilnyTomas
re: "but they are not supported by FreeRTOS"
I have to disagree, std::thread is already powered by RTOS underneath, and they are already working like a charm as has been demonstrated here (no PR needed at all!):
#7659 (comment)
So my point was that I wouldn't expect RTOS MT code in the arduino-esp32 section when std::thread etc are available, because of simplicity, convenience, and user-friendlyness.
(So probably your RTOS-MT code will better fit to the low-level esp32-IDF section instead.)

@PilnyTomas
Copy link
Contributor

@dsyleixa If it is supported we will be happy to review your PR with examples.
You can follow the example of my pseudo library and create a new one named for example "pthread" and include your examples there.

@dsyleixa
Copy link

dsyleixa commented Jan 13, 2023

@PilnyTomas
I don't issue PRs, I do not even know how that works, but my examples work as shown above, and if you want you may use them.

@PilnyTomas PilnyTomas unpinned this issue Jan 25, 2023
@VojtechBartoska VojtechBartoska pinned this issue Jan 25, 2023
@PilnyTomas PilnyTomas modified the milestone: 2.0.7 Feb 13, 2023
@mathertel
Copy link
Contributor

Please don't forget:

There is another example in #7687

  • improving static files responses using a http eTag header
  • extensive documentation

@VojtechBartoska
Copy link
Contributor Author

a lot of examples have been improved and we are continuously working on this.

This ticket fulfil it purpose to do the investigation and start the improvements so I am closing it as done.

@github-project-automation github-project-automation bot moved this from Under investigation to Done in Arduino ESP32 Core Project Roadmap May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Example Issue is related to specific example.
Projects
Development

No branches or pull requests

5 participants