-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fixes for issues in #3648 #3652
Conversation
With the switch to use the IDF's stdin for feeding the Lua VM, we unintentionally lost the ability to use uart.on('data') on the console uart. This is since we no longer install the nodemcu uart driver on said uart. In order to resolve this shortcoming, this commit refactors the uart.on('data') delimiter handling and moves it away from platform.c into uart.c where it really belongs. A new function, uart_feed_data(), is introduced, which is used both by the nodemcu uart driver task as well as the nodemcu console driver task (assuming the console is in fact a uart). The linebuffer allocation/freeing is still in response to uart.start()/uart.stop(), but it is now in uart.c rather than platform.c. The whole uart integration is still too tightly coupled between the platform component and the module component's uart.c, but this makes it slightly better at least.
With the change to use the IDF's stdin to feed the Lua VM, the default IDF CR/LF translation appears to cause issues with some IDEs.
Updated and removed incorrect node module documentation.
Thanks for the PR! a uart.on() callback handler works now. But uart.start()/uart.stop() are mandatory.
ESPlorer is not working. I guess, because it doesn't send uart.start|stop. I will try to figure out the CR/LF handling. |
I fixed nodemcu-tools (VSCode extension). Now it works with this PR. However, the issue of determining the architecture of the esp chip remained unresolved when launching the nodemcu-tool and nodemcu-tools applications. This is required for further correct operation of applications. The following functions can be used to determine:
From the table above, it can be seen that none of the functions currently allows you to determine all possible types of chips at once with one command. If What's wrong with returning such a string?
The new |
I suggest revert commit to default
because some log messages will be displayed more correctly in IDEs. All IDEs works fine with these CRLF/CR settings. |
@serg3295 Is there something wrong with using e.g. As for the CR+LF to LF issue, that is (part of) what this PR is intended to fix. As I just mentioned over on the issue itself, you may not have gotten the fix activated as I only updated Having the output direction also configured to |
Also, |
I have tried both cr lf/cr and lf/lf. In any case, 10 is returned. I run the test code in the terminal:
then type 111 I ran the program in debugger. In uart_feed_data function
another test case:
There is no problem. It's just that the message is displayed more correctly. |
Huh. That's odd. I'll see if I can get some more time to do a deep-dive into the IDF internals then and figure out what's going on... |
You are absolutely right. I don't even understand why this obvious option didn't occur to me :-/ |
I've made small changes.
Now the applications are working fine. |
@serg3295 Oh gosh, those should be using the correct macros from Kconfig, not be hard-coded! Cut-n-paste fail on my behalf, good catch, will fix! |
@jmattsson I fixed nodemcu-tool and nodemcu-tools and tested them with settings: I also tested ESPlorer a bit. Everything works. EDIT. I will try to fix nodemcu-tool(s) to get only LF and not expect CRLF, if it needs to be done for any reason. |
@serg3295 Okay, I've made the necessary changes to actually honour the Kconfig settings. Let me know if that looks good on your end, please? |
I have corrected the code of nodemcu-tool/nodemcu-tools so that they also work with the LF/LF settings. |
@marcelstoer since it looks like Philip is busy, and there's been external review and feedback and fixing, any objections to me merging this? |
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.
Thanks Jade and @serg3295 for fixing this!
Fixes #3648.
dev-esp32
branch rather than for therelease
branch.docs/*
.It was pointed out that the switch to use the IDF's
stdin
inadvertently broke some IDE's due to different CR/LF handling, as well as breakinguart.on('data')
handling on the console uart. This PR addresses both. The first by changing the default IDF CR/LF handling to do no translation which should match what we used to do, and the second by refactoring theuart.on('data')
handling and hooking it into the new console task in addition to the uart task. In the future, we should probably consider adding aconsole.on('data')
module/function to allow this sort of functionality also on models which use CDC or USB-Serial-JTAG consoles (at which point the uart.on('data') should just be a forward to that, for the console uart).Additionally I've added
node.chipmodel()
to allow querying the model of ESP32 that NodeMCU is running on.I've tested this on ESP32-C3 as that was what I had on my desk at the moment, and as far as I can tell it now works correctly. CR/LF handling is madly confusing with local terminal line discipline, ttyUSB line discipline, and ESP internal CR/LF translation all acting together and causing confusion.
@serg3295 could you please take this for a spin? I do not have VS Code to test with, and I can't find an ESPlorer version that supports
io.open()
instead of the oldfile.open()
to test file uploads there.