Search found 5956 matches

by pythoncoder
Sun Jan 13, 2019 5:58 pm
Forum: ESP8266 boards
Topic: ESP8266 Code crashes after ~30 hours
Replies: 6
Views: 4187

Re: ESP8266 Code crashes after ~30 hours

Your senddata routine instantiates a socket. If an exception occurs after that point the socket is not closed. This can occur if you get a WiFi outage. It is worth ensuring that sockets are always closed as they use RAM. The reliability of ESP8266 devices depends also on the quality of the device an...
by pythoncoder
Fri Jan 11, 2019 8:19 am
Forum: General Discussion and Questions
Topic: namedtuple to JSON possible?
Replies: 2
Views: 2171

Re: namedtuple to JSON possible?

Is this any use?

Code: Select all

settings_dict = {"param": 1, "bar":99}  # loaded from JSON

class Foo:
    def __init__(self):
        for k in settings_dict.keys():
            setattr(self, k, settings_dict[k])

foo = Foo()
foo.param
foo.bar
by pythoncoder
Thu Jan 10, 2019 9:20 am
Forum: MicroPython pyboard
Topic: Save data on power down
Replies: 14
Views: 8498

Re: Save data on power down

The battery backed RAM is 4KiB of contiguous space. You'll find some tips on accessing it here.
by pythoncoder
Mon Dec 31, 2018 8:18 am
Forum: General Discussion and Questions
Topic: "Function takes 0 positional arguments" - but it should take self
Replies: 5
Views: 4723

Re: "Function takes 0 positional arguments" - but it should take self

I can't see anything obviously wrong with your code. It would help if you could post the details of your REPL session from a soft reboot to your error so we can see exactly how it occurs. In general MicroPython handles args and self exactly as per CPython.
by pythoncoder
Sat Dec 29, 2018 6:25 am
Forum: ESP32 boards
Topic: optimizing uasyncio performance
Replies: 26
Views: 18768

Re: optimizing uasyncio performance

Re GC in my experience (mainly on Pyboard and ESP8266) GC time is radically reduced if you issue

Code: Select all

gc.collect()
explicitly at regular intervals. Ideally you do this at times when your code can tolerate a pause of a few ms.

Good to hear of a successful application for the fast_io fork :D
by pythoncoder
Fri Dec 28, 2018 8:11 am
Forum: ESP8266 boards
Topic: [SOLVED] Crashing/freezing every few hours
Replies: 29
Views: 29660

Cheap hardware

There is no question that hardware quality is very variable, both ESP8266 modules and USB power supplies. I have a USB PSU which works fine for charging phones. It even works for a couple of days running an ESP8266. Then it generates a burst of about 1000 power spikes before resuming normal operatio...
by pythoncoder
Fri Dec 28, 2018 8:01 am
Forum: ESP32 boards
Topic: wifi interupt
Replies: 4
Views: 2844

Re: wifi interupt

The standard way to deal with real time events in Python is to use asyncio, Python's cooperative scheduler. The MicroPython version is uasyncio. There is a tutorial on its use here.
by pythoncoder
Fri Dec 28, 2018 7:52 am
Forum: Drivers for External Components
Topic: ssd1331 Multi-Language Font
Replies: 1
Views: 3189

Re: ssd1331 Multi-Language Font

You might like to look at nano-gui which supports these displays. Fonts are created as Python source files uding font-to-py . This supports multi-lingual fonts and converts industry standard font files to Python source. The Python files are designed so that, if they are frozen as bytecode, their RAM...
by pythoncoder
Thu Dec 27, 2018 9:43 am
Forum: ESP8266 boards
Topic: [SOLVED] Crashing/freezing every few hours
Replies: 29
Views: 29660

They should never crash.

I'm running a test with three ESP8266 devices connected to a server. Each communicates in both directions every five seconds. Code is designed according to the principles in this doc . This test runs 24/7. I have accumulated some 1500 device hours of running with only one crash. This may have had an...
by pythoncoder
Mon Dec 24, 2018 6:59 am
Forum: General Discussion and Questions
Topic: Memmory Allocation Error although plenty of RAM left...
Replies: 21
Views: 11470

Re: Memmory Allocation Error although plenty of RAM left...

@Johnny010 There are optimisations you can make. I suggest you read this doc.