-
Notifications
You must be signed in to change notification settings - Fork 7.6k
feat(core): Add wait time before setup #11367
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
base: master
Are you sure you want to change the base?
Conversation
Added initialization time for UART, etc. Default value is 0.
👋 Hello tanakamasayuki, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 76 files 76 suites 12m 41s ⏱️ Results for commit 756bde2. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a wait time mechanism before continuing with the setup process for the ESP32 core, allowing for additional initialization time (such as for UART) before executing subsequent code.
- Added a weak function getArduinoSetupWaitTick() to provide a configurable delay value.
- Introduced a vTaskDelay call in the loopTask() to pause execution based on the wait tick value.
@@ -44,10 +44,15 @@ __attribute__((weak)) bool shouldPrintChipDebugReport(void) { | |||
return false; | |||
} | |||
|
|||
__attribute__((weak)) uint64_t getArduinoSetupWaitTick(void) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a brief comment above getArduinoSetupWaitTick() to explain its purpose, expected behavior, and the significance of its return value (in ticks) for clarity.
Copilot uses AI. Check for mistakes.
void loopTask(void *pvParameters) { | ||
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL) | ||
// sets UART0 (default console) RX/TX pins as already configured in boot or as defined in variants/pins_arduino.h | ||
Serial0.setPins(gpioNumberToDigitalPin(SOC_RX0), gpioNumberToDigitalPin(SOC_TX0)); | ||
vTaskDelay(getArduinoSetupWaitTick()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be beneficial to clarify (via a comment) that vTaskDelay expects the delay in ticks and that getArduinoSetupWaitTick is expected to provide a meaningful tick value when overridden.
Copilot uses AI. Check for mistakes.
Add function definition and SET_SETUP_WAIT_TICH function
cores/esp32/Arduino.h
Outdated
@@ -228,6 +228,12 @@ bool shouldPrintChipDebugReport(void); | |||
return true; \ | |||
} | |||
|
|||
uint64_t getArduinoSetupWaitTick(void); | |||
#define SET_SETUP_WAIT_TICH(tick) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#define SET_SETUP_WAIT_TICH(tick) \ | |
#define SET_SETUP_WAIT_TICK(tick) \ |
typo
Please do not add weak defines. There are two open issues where weak defines generate weird issues. |
Thank you for your reply. [memo] projects/build_opt.h
main.cpp #if defined(ARDUINO_SETUP_WAIT_TIME)
// set the delay time before running setup in build_opt.h
vTaskDelay(ARDUINO_SETUP_WAIT_TIME);
#endif Restarting the Arduino IDE did not recompile main.cpp. |
Description of Change
Added initialization time for UART, etc.
Default value is 0.
Tests scenarios
Arduino-esp32 core v3.2.0 with M5STACK_STICKC_PLUS2 Board
now or default
output
Output is cut off because UART is not yet initialized.
set wait
output
All output.