Skip to content

Commit

Permalink
pybricks.hubs: Rename SystemHub alias to ThisHub.
Browse files Browse the repository at this point in the history
We use it as a convenient way to share code between hubs, but the name gets a bit confusing if we introduce hub.system later, so rename it.
  • Loading branch information
laurensvalk committed May 26, 2021
1 parent 510419c commit 6ea10b9
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pybricks/hubs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
MP_DECLARE_CONST_FUN_OBJ_2(pb_hubs_Hub_reset_obj);
MP_DECLARE_CONST_FUN_OBJ_1(pb_hubs_Hub_reset_reason_obj);

extern const mp_obj_type_t pb_type_SystemHub;
extern const mp_obj_type_t pb_type_ThisHub;

extern const mp_obj_module_t pb_module_hubs;

Expand Down
6 changes: 3 additions & 3 deletions pybricks/hubs/pb_module_hubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ MP_DEFINE_CONST_FUN_OBJ_1(pb_hubs_Hub_reset_reason_obj, pb_hubs_Hub_reset_reason
#endif // PBDRV_CONFIG_RESET

STATIC const mp_rom_map_elem_t hubs_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hubs) },
{ MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME), MP_ROM_PTR(&pb_type_SystemHub) },
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_hubs) },
{ MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME), MP_ROM_PTR(&pb_type_ThisHub) },
#ifdef PYBRICKS_HUB_CLASS_NAME_ALIAS
{ MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME_ALIAS), MP_ROM_PTR(&pb_type_SystemHub) },
{ MP_ROM_QSTR(PYBRICKS_HUB_CLASS_NAME_ALIAS), MP_ROM_PTR(&pb_type_ThisHub) },
#endif
};
STATIC MP_DEFINE_CONST_DICT(pb_module_hubs_globals, hubs_globals_table);
Expand Down
2 changes: 1 addition & 1 deletion pybricks/hubs/pb_type_cityhub.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ STATIC const mp_rom_map_elem_t hubs_CityHub_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(hubs_CityHub_locals_dict, hubs_CityHub_locals_dict_table);

const mp_obj_type_t pb_type_SystemHub = {
const mp_obj_type_t pb_type_ThisHub = {
{ &mp_type_type },
.name = MP_QSTR_CityHub,
.make_new = hubs_CityHub_make_new,
Expand Down
2 changes: 1 addition & 1 deletion pybricks/hubs/pb_type_ev3brick.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ STATIC const mp_rom_map_elem_t hubs_EV3Brick_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(hubs_EV3Brick_locals_dict, hubs_EV3Brick_locals_dict_table);

const mp_obj_type_t pb_type_SystemHub = {
const mp_obj_type_t pb_type_ThisHub = {
{ &mp_type_type },
.name = PYBRICKS_HUB_CLASS_NAME,
.make_new = hubs_EV3Brick_make_new,
Expand Down
2 changes: 1 addition & 1 deletion pybricks/hubs/pb_type_movehub.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ STATIC const mp_rom_map_elem_t hubs_MoveHub_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(hubs_MoveHub_locals_dict, hubs_MoveHub_locals_dict_table);

const mp_obj_type_t pb_type_SystemHub = {
const mp_obj_type_t pb_type_ThisHub = {
{ &mp_type_type },
.name = PYBRICKS_HUB_CLASS_NAME,
.make_new = hubs_MoveHub_make_new,
Expand Down
2 changes: 1 addition & 1 deletion pybricks/hubs/pb_type_nxtbrick.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ STATIC const mp_rom_map_elem_t hubs_NXTBrick_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(hubs_NXTBrick_locals_dict, hubs_NXTBrick_locals_dict_table);

const mp_obj_type_t pb_type_SystemHub = {
const mp_obj_type_t pb_type_ThisHub = {
{ &mp_type_type },
.name = PYBRICKS_HUB_CLASS_NAME,
.make_new = hubs_NXTBrick_make_new,
Expand Down
2 changes: 1 addition & 1 deletion pybricks/hubs/pb_type_primehub.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ STATIC const mp_rom_map_elem_t hubs_PrimeHub_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(hubs_PrimeHub_locals_dict, hubs_PrimeHub_locals_dict_table);

const mp_obj_type_t pb_type_SystemHub = {
const mp_obj_type_t pb_type_ThisHub = {
{ &mp_type_type },
.name = PYBRICKS_HUB_CLASS_NAME,
.make_new = hubs_PrimeHub_make_new,
Expand Down
2 changes: 1 addition & 1 deletion pybricks/hubs/pb_type_technichub.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ STATIC const mp_rom_map_elem_t hubs_TechnicHub_locals_dict_table[] = {
};
STATIC MP_DEFINE_CONST_DICT(hubs_TechnicHub_locals_dict, hubs_TechnicHub_locals_dict_table);

const mp_obj_type_t pb_type_SystemHub = {
const mp_obj_type_t pb_type_ThisHub = {
{ &mp_type_type },
.name = PYBRICKS_HUB_CLASS_NAME,
.make_new = hubs_TechnicHub_make_new,
Expand Down
2 changes: 1 addition & 1 deletion pybricks/pybricks.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ void pb_package_import_all(void) {
#if PYBRICKS_PY_HUBS
// Initialize hub instance
const mp_obj_t args;
mp_store_name(MP_QSTR_hub, pb_type_SystemHub.make_new(&pb_type_SystemHub, 0, 0, &args));
mp_store_name(MP_QSTR_hub, pb_type_ThisHub.make_new(&pb_type_ThisHub, 0, 0, &args));
#endif
}

0 comments on commit 6ea10b9

Please sign in to comment.