MicroPython_ESP32_psRAM_LoBo icon indicating copy to clipboard operation
MicroPython_ESP32_psRAM_LoBo copied to clipboard

Restore original prototype of `mp_sched_schedule`

Open amirgon opened this issue 7 years ago • 2 comments

This is important for compatability with libraries that call mp_sched_schedule and need to compile on both the original Microptython and lobo's Micropython. New prototype name changed to mp_sched_schedule_ex

amirgon avatar Dec 16 '18 22:12 amirgon

There are reasons why the mp_sched_schedule was changed. If writing the C-module wich uses mp_sched_schedule for both original MicroPython and this port, it should be easy to conditionally compile for one or the other, something like this

#if MICROPY_PY_SYS_PLATFORM_LOBO
#define mymp_sched_schedule(x) mp_sched_schedule(x, NULL);
#else
#define mymp_sched_schedule(x) mp_sched_schedule(x);
#endif

then use mymp_sched_schedule() instead of mp_sched_schedule in your module. It is simple and should work.

loboris avatar Dec 17 '18 12:12 loboris

@loboris I understand there are reasons for the change, that is why I kept your version as mp_sched_schedule_ex. However, in my opinion it's cleaner to keep the same API, instead of adding #ifs and changing all calls to mp_sched_schedule.

With my PR, when you have a Micropython library that uses mp_sched_schedule it would work without a change on your branch. With your suggestion, such library would have to be adapted by changing each mp_sched_schedule call to mymp_sched_schedule.

amirgon avatar Dec 17 '18 13:12 amirgon