Search found 735 matches

by stijn
Mon Apr 18, 2022 7:24 am
Forum: Development of MicroPython
Topic: C++ native modules for Micropython?
Replies: 5
Views: 2947

Re: C++ native modules for Micropython?

Yes the firmware in that case contains everything. 'rebuild' is perhaps not the best word for it, IIRC the Makefile is smart enough to figure out that if you only change one source file of the module it's only going to build/link that object file.
by stijn
Sun Apr 17, 2022 6:58 am
Forum: Development of MicroPython
Topic: C++ native modules for Micropython?
Replies: 5
Views: 2947

Re: C++ native modules for Micropython?

I tried converting the features0 example in examples/natmod
Do you really need native modules? 'user modules' are quite a lot easier to work with, plus have C++ examples: examples/usercmodules/cppexample. And micrpython-wrap also works that way.
by stijn
Fri Mar 04, 2022 7:37 pm
Forum: General Discussion and Questions
Topic: TypeError: can't convert __enter__ to float
Replies: 5
Views: 1973

Re: TypeError: can't convert __enter__ to float

Code: Select all

(x, y, z) = self.raw_values
needs to be

Code: Select all

(x, y, z) = self.raw_values()
?
by stijn
Fri Mar 04, 2022 7:33 pm
Forum: Raspberry Pi microcontroller boards
Topic: How to organize code
Replies: 5
Views: 2065

Re: How to organize code

Bit hard to tell, but sounds ok to me to put those arrays in a separate module for clarity; doesn't necessarily mean they should be globals though: you could have functions like def LargeArrayA(): return [......] def LargeArrayB(): return [......] But that's just an idea, I'd probably recommend tryi...
by stijn
Fri Mar 04, 2022 7:47 am
Forum: Raspberry Pi microcontroller boards
Topic: How to organize code
Replies: 5
Views: 2065

Re: How to organize code

You probably should have a look at other small Python projects, and micropython's own python code to see how things are structured. Modules are for grouping functionality i.e. functions and classes, something like 'import my_variables' and 'import my_arrays' is the opposite and looks like a red herr...
by stijn
Sun Feb 27, 2022 8:27 am
Forum: General Discussion and Questions
Topic: Slow returning scalar types in async function
Replies: 7
Views: 2191

Re: Slow returning scalar types in async function

Something is very wrong here. Windows port for test3 (and 10 iterations of that just to make sure): dict 15.809 int 3406.55 float 22.054 Seems worth creating a Github issue for this: while it's not suprirising creating a generator has an overhead, the differences observed here are so large it's eith...
by stijn
Sat Feb 26, 2022 8:19 am
Forum: General Discussion and Questions
Topic: ImportError: no module named 'logging'
Replies: 3
Views: 3328

Re: ImportError: no module named 'logging'

None of micropython-lib is included in firmware by default actually, not for any port.
by stijn
Thu Feb 17, 2022 7:04 am
Forum: Raspberry Pi microcontroller boards
Topic: Micropython String
Replies: 4
Views: 2131

Re: Micropython String

Perhaps you were looking at CPython examples?

MicroPython indeed does not implement those functions: http://docs.micropython.org/en/latest/g ... s.html#str
by stijn
Mon Feb 07, 2022 7:45 pm
Forum: Development of MicroPython
Topic: vstr_t line avoiding a sweep from GC in pyexec
Replies: 1
Views: 3223

Re: vstr_t line avoiding a sweep from GC in pyexec

Didn't check in detail, but the non-eventdriven version is one big loop hence line is on the stack as long as the program runs and as such doesn't get garbage collected because the mark phase will see it being on the stack?