Search found 6 matches

by kkimdev
Sun Jan 06, 2019 2:50 am
Forum: General Discussion and Questions
Topic: print(1, 2) prints "1_space_2"
Replies: 6
Views: 370

Re: print(1, 2) prints "1_space_2"

OK so the issue was that, for _space_ we actually need the following two lines and must be ordered in that way.

Code: Select all

Q( )
Q(_space_)
by kkimdev
Sat Jan 05, 2019 11:58 pm
Forum: General Discussion and Questions
Topic: print(1, 2) prints "1_space_2"
Replies: 6
Views: 370

Re: print(1, 2) prints "1_space_2"

Oh I see. Numworks port has the same makeqstrdata.py https://github.com/numworks/epsilon/blo ... strdata.py but somehow it was generating

Code: Select all

QDEF(MP_QSTR__space_, (const byte*)"\xe1\x07" "_space_")
But I think it should be straightforward to debug at this point. Thanks a lot!!
by kkimdev
Sat Jan 05, 2019 11:54 am
Forum: General Discussion and Questions
Topic: print(1, 2) prints "1_space_2"
Replies: 6
Views: 370

Re: print(1, 2) prints "1_space_2"

Thanks! I've found it.. I don't understand why it prints differently then lol.... shouldn't normal micropython also print _space_ ? https://github.com/micropython/micropyt ... ins.c#L384
by kkimdev
Fri Jan 04, 2019 9:57 am
Forum: General Discussion and Questions
Topic: print(1, 2) prints "1_space_2"
Replies: 6
Views: 370

print(1, 2) prints "1_space_2"

Hi, I'm using Numworks port of Micropython https://github.com/numworks/epsilon/ and just noticed print(1, 2) prints "1_space_2" which should be "1 2" instead., mp_builtin_print uses `MP_QSTR__space_` for the separator, which Numeoworks port defines as `Q(_space_)` . I guess original Micropython defi...
by kkimdev
Thu Feb 08, 2018 10:30 pm
Forum: General Discussion and Questions
Topic: Calling uPython function from C?
Replies: 2
Views: 2144

Re: Calling uPython function from C?

Thanks! The following worked.

mp_obj_t step_function = mp_load_global(qstr_from_str("step"));
result = mp_call_function_1(step_function, mp_obj_new_float(duration));

if (result == mp_const_true) {

} else if (result == mp_const_false) {

} else {

}
by kkimdev
Thu Feb 08, 2018 5:28 am
Forum: General Discussion and Questions
Topic: Calling uPython function from C?
Replies: 2
Views: 2144

Calling uPython function from C?

For embedded uPython, let's say the there is a function defined like this: def step(time_ms): . ... . ... . return True if .... else False then I would like to call the function, step(), from C. How can I do this? I think it should be something like this but I couldn't figure out the ? part. mp_obj_...