Search found 55 matches

by Christian Walther
Thu Mar 07, 2019 6:16 pm
Forum: General Discussion and Questions
Topic: fastest way to fill large bytearrays? (Neopixel, APA102 et al)
Replies: 15
Views: 2835

Re: fastest way to fill large bytearrays? (Neopixel, APA102 et al)

Doh! Thanks, Dave. That’s what I get for trying to solve technical questions with the mushy brain that comes from a cold. With the correct loop bounds, it takes 5.8 ms.
by Christian Walther
Wed Mar 06, 2019 6:59 pm
Forum: General Discussion and Questions
Topic: fastest way to fill large bytearrays? (Neopixel, APA102 et al)
Replies: 15
Views: 2835

Re: fastest way to fill large bytearrays? (Neopixel, APA102 et al)

First, if this code wasn’t in a function, put it in one: local variables are faster than global ones. This takes 9 ms on my ESP8266: def run(): ba = bytearray(120*4) start = utime.ticks_us() for i in range(120): ba[i*4+0] = 255 ba[i*4+1] = 255 ba[i*4+2] = 255 ba[i*4+3] = 255 end = utime.ticks_us() p...
by Christian Walther
Tue Feb 12, 2019 6:09 pm
Forum: General Discussion and Questions
Topic: [SOLVED] PBM file showing /r
Replies: 4
Views: 278

Re: PBM file showing /r

How are you transferring the file to the board? Could it be an FTP connection in text mode or something else that mangles line endings when it thinks a file is text?
by Christian Walther
Tue Feb 12, 2019 11:58 am
Forum: General Discussion and Questions
Topic: [SOLVED] PBM file showing /r
Replies: 4
Views: 278

Re: PBM file showing /r

https://docs.python.org/3/library/io.html#io.IOBase.readline specifies that The line terminator is always b'\n' for binary files so I would say the MicroPython behavior is correct, and your CPython probably isn’t Python 3. The easiest way to resolve this is to replace the CRs in your PBM file by LF...
by Christian Walther
Wed Feb 06, 2019 11:52 am
Forum: ESP32 boards
Topic: How to copy files (e.g. .py, .txt, .dat) to and from the esp32 flash?
Replies: 7
Views: 978

Re: How to copy files (e.g. .py, .txt, .dat) to and from the esp32 flash?

You are confused about how the flash is organized. The MicroPython firmware is not a file, it lives outside of the FAT filesystem in raw flash. The FAT filesystem is located in a different part of flash. Python files that you want to run need to live inside the filesystem, and you don't install them...
by Christian Walther
Fri Feb 01, 2019 7:55 am
Forum: General Discussion and Questions
Topic: How do I terminate a background program/thread/function/method in uPy?
Replies: 5
Views: 348

Re: How do I terminate a background program/thread/function/method in uPy?

Try just ignoring the error messages and typing over them, I expect that even though you can’t see what you type, the REPL should still be functional and you should be able to turn off the WiFi that way.
by Christian Walther
Mon Dec 24, 2018 8:41 am
Forum: ESP8266 boards
Topic: accessing uart0 on nodemcu board
Replies: 23
Views: 1842

Re: accessing uart0 on nodemcu board

This feature is not part of that release yet, you need to use a newer daily build or build your own. I believe the relevant commit is afd0701, which should make any of the daily builds available from the download page suitable.
by Christian Walther
Mon Nov 19, 2018 6:45 pm
Forum: ESP8266 boards
Topic: Trouble flashing the image
Replies: 8
Views: 547

Re: Trouble flashing the image

Is "esptool" a way to get the Firmware from my PC to the ESP8266? Or is it something i need to do after I allready flashed the firmware. esptool runs on your PC, not on the MicroPython board, and yes, it is a tool to flash the firmware onto the board. After connecting with putty however i just saw ...
by Christian Walther
Sun Oct 28, 2018 10:41 am
Forum: General Discussion and Questions
Topic: what "type" is an SHA-256 result, and how do I most easily convert it into a string?
Replies: 3
Views: 375

Re: what "type" is an SHA-256 result, and how do I most easily convert it into a string?

It’s actually a bytes , not a bytearray (former is immutable, latter is mutable). Try type(myHash) and read https://docs.python.org/3/library/stdtypes.html to learn about Python’s built-in types. You didn’t specify what your resulting string should be, but one way of converting your hexHash (a bytes...
by Christian Walther
Sat Oct 27, 2018 9:14 am
Forum: ESP8266 boards
Topic: Pin.IN value always 1
Replies: 2
Views: 392

Re: Pin.IN value always 1

The state of an input pin is undefined when there is nothing connected to it. Have you tried connecting it to GND or 3.3V? (This applies to all digital circuits, not just the ESP8266.)