Redirecting terminal/WebRepl to OLED 1306
-
- Posts: 16
- Joined: Sun Jun 12, 2016 4:51 pm
Redirecting terminal/WebRepl to OLED 1306
Any idea how can I easily redirect terminal output to OLED screen while typing over webrepl ?
I would really like to make "stand alone" python terminal
I would really like to make "stand alone" python terminal
Re: Redirecting terminal/WebRepl to OLED 1306
I would look at how WebREPL does it (https://github.com/micropython/micropyt ... dwebrepl.c). I think it involves the os.dupterm call.
Re: Redirecting terminal/WebRepl to OLED 1306
Seems to be doable (I could read after Google translate Chinese->English):
https://blog.boochow.com/article/oled-c ... pterm.html
Gist reply-to-oled.py can be found here:
https://gist.github.com/boochow
I did copy FBConsole.py from there to ESP32 module with Oled:
My ESP32 module boots up with "oled" already:
https://www.esp32.com/viewtopic.php?f=2 ... 240#p31240
"oled" is created as the oled in Gist in my boot.py.
Unfortunately the next line from Gist does not work:
What am I missing? Or is the Gist just for Python and not for MicroPython?
https://blog.boochow.com/article/oled-c ... pterm.html
Gist reply-to-oled.py can be found here:
https://gist.github.com/boochow
Code: Select all
from machine import I2C
i2c=I2C(1)
i2c.init(freq=1000000)
oled = SSD1306_I2C(128, 64, i2c)
console = FBConsole(oled)
os.dupterm(console)
I did copy FBConsole.py from there to ESP32 module with Oled:
Code: Select all
$ ~/webrepl/webrepl_cli.py FBConsole.py 192.168.4.1:
Password:
op:put, host:192.168.4.1, port:8266, passwd:abcd.
FBConsole.py -> /FBConsole.py
Remote WebREPL version: (1, 9, 4)
Sent 2294 of 2294 bytes
$
https://www.esp32.com/viewtopic.php?f=2 ... 240#p31240
"oled" is created as the oled in Gist in my boot.py.
Unfortunately the next line from Gist does not work:
Code: Select all
>>> from FBConsole import FBConsole
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "FBConsole.py", line 3, in <module>
AttributeError: 'module' object has no attribute 'IOBase'
>>>
>>> import FBConsole
>>> console = FBConsole(oled)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'module' object is not callable
>>>
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
Re: Redirecting terminal/WebRepl to OLED 1306
Hi HermanSW,
That looks like legitimate MicroPython code (the 'u' prefixing . And uio.IOBase exists, at least on my recent-ish 1.9.4 build:
Which version of MicroPython are you running?
Googling the issue does identify a possible hint. Do you have an 'io' directory on the filesystem that could be confusing the import?
That looks like legitimate MicroPython code (the 'u' prefixing . And uio.IOBase exists, at least on my recent-ish 1.9.4 build:
Code: Select all
MicroPython v1.9.4-564-gcb3c66e79 on 2018-09-21; ESP32 module with ESP32
Type "help()" for more information.
>>> import uio
>>> uio.
__class__ __name__ BufferedWriter BytesIO
FileIO IOBase StringIO TextIOWrapper
open
Googling the issue does identify a possible hint. Do you have an 'io' directory on the filesystem that could be confusing the import?
Re: Redirecting terminal/WebRepl to OLED 1306
> Which version of MicroPython are you running?
>
1.9.4 from May, see below.
> Do you have an 'io' directory on the filesystem that could be confusing the import?
>
No, I flashed MicroPython and had just single boot.py file then.
Never created directories, see below for which files are in filesystem:
P.S:
>
1.9.4 from May, see below.
> Do you have an 'io' directory on the filesystem that could be confusing the import?
>
No, I flashed MicroPython and had just single boot.py file then.
Never created directories, see below for which files are in filesystem:
Code: Select all
$ webrepl_client.py 192.168.4.1
Password:
WebREPL connected
>>>
>>>
MicroPython v1.9.4 on 2018-05-11; ESP32 module with ESP32
Type "help()" for more information.
>>> uos.listdir()
['boot.py', 'webrepl_cfg.py', 'ssd1306.py', 'pye.py', 'FBConsole.py']
>>>
Code: Select all
>>> import uio
>>> help(uio)
object <module 'uio'> is of type module
__name__ -- uio
open -- <function>
FileIO -- <class 'FileIO'>
TextIOWrapper -- <class 'TextIOWrapper'>
StringIO -- <class 'StringIO'>
BytesIO -- <class 'BytesIO'>
BufferedWriter -- <class 'BufferedWriter'>
>>>
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
Re: Redirecting terminal/WebRepl to OLED 1306
Hi,
IOBase had been added on 4 June.
https://github.com/micropython/micropyt ... 69700b0bee
An older version of FBClass.py is here, which I had written before IOBase was added.
https://gist.github.com/boochow/4163e00 ... 4c359527aa
hope this helps!
IOBase had been added on 4 June.
https://github.com/micropython/micropyt ... 69700b0bee
An older version of FBClass.py is here, which I had written before IOBase was added.
https://gist.github.com/boochow/4163e00 ... 4c359527aa
hope this helps!
Re: Redirecting terminal/WebRepl to OLED 1306
Thank you! -- my fault.
I just installed latest 1.9.4
after copying off all files with webrepl_cli.py, then I did screen session into ESP32, activated AP, enabled WebREPL and copied in all files via webrepl_cli.py again.
After reboot my Oled screen did show up nicely.
Then only 3 commands later REPL did show up on Oled!!
P.S:
Ooops, seems I don't have matching ssd1306.py ... which ssd1306.py do you use?
I just installed latest 1.9.4
Code: Select all
MicroPython v1.9.4-623-g34af10d2e on 2018-10-03; ESP32 module with ESP32
After reboot my Oled screen did show up nicely.
Then only 3 commands later REPL did show up on Oled!!
Code: Select all
>>> from FBConsole import FBConsole
>>> console = FBConsole(oled)
>>> os.dupterm(console)
<_webrepl>
>>>
P.S:
Ooops, seems I don't have matching ssd1306.py ... which ssd1306.py do you use?
Code: Select all
>>> os.listdir()
['boot.py', 'webrepl_cfg.py', 'FBConsole.py', 'pdupterm: Exception in write() method, deactivating: Traceback (most recent call last):
File "FBConsole.py", line 62, in write
File "FBConsole.py", line 50, in _putc
File "FBConsole.py", line 77, in _newline
AttributeError: 'SSD1306_I2C' object has no attribute 'fill_rect'
ye.py', 'ssd1306.py']
>>>
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
Re: Redirecting terminal/WebRepl to OLED 1306
Wow!
I did google for "ssd1306.py fille_rect" and found this:
https://git.zgyarmati.de/zgyarmati/micr ... ssd1306.py
Then I did download it and copied it over to ESP32.
Adter doing soft reboot in screen session my initial Oled screen showed nicely.
Then doing the three commands from previous posting and REPL started on Oled.
This time without issues, with line scrolling, ...
I did google for "ssd1306.py fille_rect" and found this:
https://git.zgyarmati.de/zgyarmati/micr ... ssd1306.py
Then I did download it and copied it over to ESP32.
Adter doing soft reboot in screen session my initial Oled screen showed nicely.
Then doing the three commands from previous posting and REPL started on Oled.
This time without issues, with line scrolling, ...
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Redirecting terminal/WebRepl to OLED 1306
Is there a problem with the official version? It definitely supports fill_rect().
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Redirecting terminal/WebRepl to OLED 1306
Thanks for asking, I looked at it but found no "fill_rect" in that file.pythoncoder wrote: ↑Thu Oct 04, 2018 5:01 amIs there a problem with the official version? It definitely supports fill_rect().
Anyway I tried it and copied over to ESP32 module.
My normal boot.py Oled comands worked,
as well os.dupterm with FBConsole. I will keep using the official ssd1306.py from now on.
While 16x8 character display might not be that useful to interact with MicroPython REPL, bigger displays definitely are.
I really would like to see FBConsole from Boochow
https://gist.github.com/boochow/4163e00 ... 17cfc0297c
being part of official MicroPython.
If possible his repl-to-oled.py (as sample) somehow as well:
https://gist.github.com/boochow/f3bbd6a ... 20cbd9f9e0
Working with REPL is cool, accessing history commands with arrow up/down is fine. Moving cursor left seems to erase the character on display, but "END" key makes all visible again. I found a little bug sofar, if getting a history command, doing some arrow left, and then change something, is correct for first change action, but display gets scrambled for 2nd (like delete character, then insert new). Only display is scrambled, command is still correct as can be seen by pressing Return.
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell
https://github.com/Hermann-SW/pico-w
Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454
webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell