Refactor to clean up and fix console handling #3666
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.
Fixes #3657.
dev-esp32
branch rather than for therelease
branch.docs/*
.In the interest of backwards compatibility I/we have in the past shoehorned the USB-Serial-JTAG and CDC-ACM console types into the
uart
module via the platform layer. That has kept adding complications and differences in behaviour depending on what the underlying hardware interface is, plus it has been fighting against the IDF's own abstractions in regard to the console.This PR finally "bites the bullet" and moves the system console handling into its own module (
console
), and tidies up the platform layer to no longer attempt to special-case things. It also sets the stage for possibly also including a fancier interactive console based onlinenoise
, though that requires further investigation and work if so.The downside of course is that various IDEs are accustomed to manipulating the
uart
module in order to implement file uploads and downloads, and this refactoring obviously breaks that. That said, @serg3295 has already implemented support in the nodemcu-tools VS Code extension and NodeMCU-Tool CLI utility. I've also provided both an example of how to implement a framed transmission in the module documentation, as well as a helper utility (scripts/upload-file.py
) which can be used to upload files usingconsole
module interactions, using said framing scheme.I'm not happy about breaking backwards compatibility, but I'm even less happy about the number of issues that have cropped up due to trying to avoid it when it's clearly time for it. We don't have the person-power here to fight against the direction the IDF is pulling, so imho it's time to follow its lead in the console area.
Testing has been performed on each of UART, USB-Serial-JTAG and CDC-ACM, and additional testing by @serg3295 over in the #3657 thread.