Skip to content
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

keep terminal open after run command #11

Closed
blezek opened this issue May 27, 2016 · 6 comments
Closed

keep terminal open after run command #11

blezek opened this issue May 27, 2016 · 6 comments

Comments

@blezek
Copy link

blezek commented May 27, 2016

Would like an option to keep the terminal open after a run command. Because the ESP8266 is event driven, often my scripts produce output long after NodeMCU-Tool closes the serial terminal after running a lua file. A flag to the command would be most helpful.

@AndiDittrich
Copy link
Owner

hi blezek,

currently, the run command only waits for a incommming "new line" from the ESP8266 - sequence \n\r>. it is may possible to redirect every incomming message to stdout, but it requires some deeper modifications of the application structure.

As a result of such modification, NodeMCU would keep the connection open for a infinite time and has to be killed by an external process...

are you using NodeMCU-Tool within an external application ?

@blezek
Copy link
Author

blezek commented May 28, 2016

@AndiDittrich Appreciate you getting back to me.

Here's my typical use case.

  1. write Lua code, with print statements for debugging
  2. run nodemcu-tool --port /dev/tty.w* --baud 74880 upload src/blynk.lua to upload to the ESP8266
  3. run nodemcu-tool --port /dev/tty.w* --baud 74880 terminal
  4. type dofile ( 'blynk.lua' )
  5. watch output to see what happens
  6. repeat

If I could have the terminal command execute the dofile, or have the run command keep the terminal open, then my debugging cycle would be a bit shorter. The run is nice, but my debugging statements sometimes take a few seconds to appear (like connecting to a WiFi network) that I couldn't see them.

This make more sense?

@AndiDittrich
Copy link
Owner

Hi Daniel,

my suggestion is to add a --run flag to the terminal action, which transmits a dofile command initially and continues as terminal session - it only requires a few new lines of code - what do you think ?

with this enhancement you could create a simple shell script like this to speed up the development process

debug.sh

#!/bin/bash

# upload the file
nodemcu-tool upload src/blynk.lua

# run the file "blynk.lua" within a new nodemcu terminal session
nodemcu-tool terminal --run "blynk.lua"

this shall reduce your workload to a single cli statement like ./debug.sh

btw. you should consider to create a project based configuration to store the tty settings

@blezek
Copy link
Author

blezek commented May 28, 2016

Hi @AndiDittrich

Your suggestion would be fantastic! I really like your tool, between it and esptool.py to flash the firmware, and emacs, I have a great development setup for the ESP chip.

Let me know when it's ready, and I'll test it out.

Thanks,
-dan

@AndiDittrich
Copy link
Owner

ready!

Example 1

$ nodemcu-tool terminal --run helloworld.lua
[SerialTerminal] Starting Terminal Mode - press ctrl+c to exit
dofile("helloworld.lua")
Hello World!
|---|
| H |
| E |
| L |
| L |
| O |
| | |
| W |
| O |
| R |
| L |
| D |
|---|
YEAH!!! HELLO WORLD!!!
String: Lorem ipsum dolor sit amet, consetetur sadipscing elitr

@AndiDittrich AndiDittrich added this to the v1.6 milestone May 28, 2016
@blezek
Copy link
Author

blezek commented May 29, 2016

Perfect, looking forward to trying it out soon.

@blezek blezek closed this as completed May 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants