Giter Club home page Giter Club logo

Comments (6)

markserrano915 avatar markserrano915 commented on June 3, 2024

Yes, I can just use my Raspberry directly and interface my GPS module with it, but I have my reasons why I want the NodeMcu as the point of data capture (for example it's smaller and cheaper).

from micropygps.

inmcm avatar inmcm commented on June 3, 2024

I did some experiments with the mem_info within the Unix version of micro python to see just how much memory was being consumed on import:

>>> from micropython import mem_info
>>> mem_info()
mem: total=6681, current=2911, peak=4486
stack: 928 out of 80000
GC: total: 2072832, used: 4096, free: 2068736
 No. of 1-blocks: 41, 2-blocks: 21, max blk sz: 41, max free sz: 64640
>>> from micropyGPS import MicropyGPS
>>> mem_info()
mem: total=107812, current=29518, peak=92472
stack: 928 out of 80000
GC: total: 2072832, used: 33824, free: 2039008
 No. of 1-blocks: 300, 2-blocks: 45, max blk sz: 80, max free sz: 61718

As a quick test, I deleted all the "test" at in the __main__ section and re-ran the import test. Surprisingly, the usage was much lower

>>> from micropython import mem_info
>>> mem_info()
mem: total=8610, current=2980, peak=4555
stack: 928 out of 80000
GC: total: 2072832, used: 4000, free: 2068832
 No. of 1-blocks: 46, 2-blocks: 17, max blk sz: 41, max free sz: 64643
>>> from micropyGPS import MicropyGPS
>>> mem_info()
mem: total=87457, current=22271, peak=70409
stack: 928 out of 80000
GC: total: 2072832, used: 25280, free: 2047552
 No. of 1-blocks: 196, 2-blocks: 30, max blk sz: 80, max free sz: 62461

I re-ran the test several times and got similar numbers. I went ahead and stripped the the code from __main__ and pushed it into a separate tests.py. It's very interesting that just importing the class brings in all that other code from the main module. Maybe a bug in Micropython?

from micropygps.

ckuethe avatar ckuethe commented on June 3, 2024

I can reproduce this. I need to think about how to reduce memory use even more (possibly precompiling to frozen bytecode) because I'm also running a bunch of other i2c devices on the same nodemcu.

from micropygps.

ckuethe avatar ckuethe commented on June 3, 2024

Also, the nodemcu board might have 128kB RAM, but less than 50kB are available once the underlying RTOS and micropython are load.

from micropygps.

capedra avatar capedra commented on June 3, 2024

@markserrano915 @inmcm @ckuethe
I've been trying to use this library on Wemos D1 Mini Lite 1.0.0.
Here it is the output:

>>> from micropython import mem_info
>>> mem_info()
stack: 2096 out of 8192
GC: total: 35968, used: 10240, free: **25728**
 No. of 1-blocks: 26, 2-blocks: 4, max blk sz: 264, max free sz: 554
>from micropyGPS import MicropyGPS
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError: memory allocation failed, allocating 832 bytes

from micropygps.

tcinbis avatar tcinbis commented on June 3, 2024

I could use the library on an ESP32 after precompiling it as a frozen module.

from micropygps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.