Skip to content

Commit fb32251

Browse files
committed
please build i need this
1 parent 547d1d8 commit fb32251

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

pybricks/experimental/pb_module_experimental.c

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66

77
#include "pybricks/experimental/odometry.h"
88

9-
#ifndef STATIC
10-
#define STATIC static
11-
#endif
12-
13-
// 1. The actual function logic
14-
STATIC mp_obj_t experimental_odometry_benchmark(size_t n_args, const mp_obj_t *args) {
9+
// 1. The actual benchmark logic
10+
// Keep this STATIC as it is used by the function object below
11+
static mp_obj_t experimental_odometry_benchmark(size_t n_args, const mp_obj_t *args) {
1512
int num_iters = mp_obj_get_int(args[0]);
1613
float wheel_circ = mp_obj_get_float(args[1]);
1714
float axle_track = mp_obj_get_float(args[2]);
@@ -20,14 +17,24 @@ STATIC mp_obj_t experimental_odometry_benchmark(size_t n_args, const mp_obj_t *a
2017

2118
return calculate_odometry(num_iters, wheel_circ, axle_track, right_func, left_func);
2219
}
23-
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(experimental_odometry_benchmark_obj, 5, 5, experimental_odometry_benchmark);
20+
// Define the function object
21+
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(experimental_odometry_benchmark_obj, 5, 5, experimental_odometry_benchmark);
2422

25-
// 2. The Globals Table - the system looks for the name "<filename>_globals"
26-
// Since your file is pb_module_experimental.c, it looks for pb_module_experimental_globals
27-
STATIC const mp_rom_map_elem_t pb_module_experimental_globals_table[] = {
23+
// 2. The Globals Table
24+
// REMOVED 'STATIC' to prevent 'defined but not used' error
25+
const mp_rom_map_elem_t pb_module_experimental_globals_table[] = {
2826
{ MP_ROM_QSTR(MP_QSTR_odometry_benchmark), MP_ROM_PTR(&experimental_odometry_benchmark_obj) },
2927
};
30-
// This is the specific symbol the linker is clashing on - we keep it STATIC here.
31-
STATIC MP_DEFINE_CONST_DICT(pb_module_experimental_globals, pb_module_experimental_globals_table);
28+
29+
// 3. Define the dict WITHOUT 'STATIC'
30+
// This makes it visible to the auto-registration system without triggering the warning
31+
MP_DEFINE_CONST_DICT(pb_module_experimental_globals, pb_module_experimental_globals_table);
32+
33+
// 4. Define the module structure WITHOUT 'STATIC'
34+
// This matches the 'extern' declaration the build system generates
35+
const mp_obj_module_t pb_module_experimental = {
36+
.base = { &mp_type_module },
37+
.globals = (mp_obj_dict_t *)&pb_module_experimental_globals,
38+
};
3239

3340
#endif // PYBRICKS_PY_EXPERIMENTAL

0 commit comments

Comments
 (0)