IEP-1447 Focus shift to terminated console after auto-starting serial monitor post-flash#1152
Conversation
WalkthroughThe change refactors the process execution in the Changes
Sequence Diagram(s)sequenceDiagram
participant Delegate as SerialFlashLaunchConfigDelegate
participant Proc as Process
participant CF as CompletableFuture
participant Monitor as Serial Monitor
Delegate->>Proc: Start process execution
Proc->>Delegate: onExit() callback upon termination
Delegate->>CF: Schedule callback after 1-second delay
CF->>Delegate: Execute delayed callback
Delegate->>Monitor: Open serial monitor if exit status is 0
Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/internal/SerialFlashLaunchConfigDelegate.java (1)
197-212: Implementation aligns well with requirements.The asynchronous implementation with a 1-second delay successfully addresses the PR objective. The code properly checks the process exit status before opening the serial monitor and includes appropriate error handling.
Consider these improvements:
- Enhance error logging to include more context:
- Logger.log(e); + Logger.log("Failed to open serial monitor after successful flash: " + e.getMessage(), e);
- Make the delay duration configurable:
+ private static final int SERIAL_MONITOR_DELAY_SECONDS = 1; + protected void launchInternal(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { // ... existing code ... - }, CompletableFuture.delayedExecutor(1, TimeUnit.SECONDS)); + }, CompletableFuture.delayedExecutor(SERIAL_MONITOR_DELAY_SECONDS, TimeUnit.SECONDS));
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/internal/SerialFlashLaunchConfigDelegate.java(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build_macos
🔇 Additional comments (1)
bundles/com.espressif.idf.launch.serial.core/src/com/espressif/idf/launch/serial/internal/SerialFlashLaunchConfigDelegate.java (1)
26-27: LGTM!The added imports for
CompletableFutureandTimeUnitare appropriate for implementing the asynchronous execution and delay functionality.
|
@sigmaaa hi ! Tested under: after the flash the focus is on serial monitor tab ✅ |
Description
Added 1-second delay after flashing to open the serial monitor to avoid this behavior:
Also, put the open serial monitor in the condition so that, in case of an error during the flash, the serial monitor will not be opened.
Fixes # (IEP-1447)
Type of change
Please delete options that are not relevant.
How has this been tested?
Test Configuration:
Dependent components impacted by this PR:
Checklist
Summary by CodeRabbit