Skip to content

Commit 1abc66d

Browse files
committed
please build i need this
1 parent 64382bb commit 1abc66d

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
#include "py/mpconfig.h"
2+
#include "py/obj.h"
3+
#include "py/runtime.h"
4+
#include "py/builtin.h"
25

36
#if PYBRICKS_PY_EXPERIMENTAL
47

5-
#include "py/obj.h"
6-
#include "py/runtime.h"
78
#include "pybricks/experimental/odometry.h"
89

10+
// Define STATIC if not already defined (usually it is in mpconfig.h)
11+
#ifndef STATIC
12+
#define STATIC static
13+
#endif
14+
915
// This is the function that Python calls
1016
STATIC mp_obj_t experimental_odometry_benchmark(size_t n_args, const mp_obj_t *args) {
1117
int num_iters = mp_obj_get_int(args[0]);
@@ -16,22 +22,19 @@ STATIC mp_obj_t experimental_odometry_benchmark(size_t n_args, const mp_obj_t *a
1622

1723
return calculate_odometry(num_iters, wheel_circ, axle_track, right_func, left_func);
1824
}
19-
// We define it as a MicroPython function object
25+
// Define as a MicroPython function object
2026
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(experimental_odometry_benchmark_obj, 5, 5, experimental_odometry_benchmark);
2127

22-
// We map the C function to the Python name "odometry_benchmark"
28+
// Map the C function to the Python name "odometry_benchmark"
2329
STATIC const mp_rom_map_elem_t experimental_globals_table[] = {
2430
{ MP_ROM_QSTR(MP_QSTR_odometry_benchmark), MP_ROM_PTR(&experimental_odometry_benchmark_obj) },
2531
};
2632
STATIC MP_DEFINE_CONST_DICT(pb_module_experimental_globals, experimental_globals_table);
2733

28-
// This is the structure MicroPython looks for to register the module
34+
// Structure for MicroPython to register the module
2935
const mp_obj_module_t pb_module_experimental = {
3036
.base = { &mp_type_module },
3137
.globals = (mp_obj_dict_t *)&pb_module_experimental_globals,
3238
};
3339

34-
// CRITICAL: We do NOT need a MP_REGISTER_MODULE tag here because
35-
// the Pybricks build system handles registration via the Makefile/QSTR process.
36-
3740
#endif // PYBRICKS_PY_EXPERIMENTAL

0 commit comments

Comments
 (0)