add flash and monitor command #216
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #194
Description
This pull request adds a new "Flash & Monitor" feature to the TypeScript example application, allowing users to flash a device and immediately start monitoring its console output. The changes include updates to the UI, integration of new button logic, and enhancements to the
ESPLoaderclass to support this workflow.Flash & Monitor feature integration:
Added a new "Flash & Monitor" button to the UI (
index.html) and connected it in the TypeScript code, including logic to show/hide the button based on device connection state. [1] [2] [3] [4] [5]Implemented the handler for the "Flash & Monitor" button, which validates inputs, flashes selected files to the device, and then starts console monitoring at the specified baud rate. Progress bars and UI states are updated accordingly.
Console monitoring enhancements:
Added new methods to the
ESPLoaderclass:flashAndMonitor,startConsoleMonitoring, andstopConsoleMonitoring, enabling the ability to flash and then monitor the device console in one workflow, with error handling and support for custom baud rates.Updated console start/stop logic to use the new monitoring methods, display device info, and handle errors more robustly, including proper cleanup and UI state management after stopping the console. [1] [2] [3]
General improvements and cleanup:
Ensured device and loader objects are properly reset in the cleanup logic to prevent stale references after disconnecting.
Minor UI and error handling improvements throughout the program and flash workflows. [1] [2]
Testing
Click Connect device and then
Flash & Monitorusingexamples/typescriptproject.Checklist
Before submitting a Pull Request, please ensure the following: