Skip to content

Commit b5f40d8

Browse files
committed
pybricks.common.System: Fix hub button guard.
The button parameter is enabled everywhere since the remote has more than one button. Instead, we can use a define for the number of buttons on the hub to check this. This saves code size on hubs with one button, like the Move Hub.
1 parent 6dd2afa commit b5f40d8

File tree

11 files changed

+13
-4
lines changed

11 files changed

+13
-4
lines changed

bricks/cityhub/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define PYBRICKS_PY_COMMON_CONTROL (1)
1818
#define PYBRICKS_PY_COMMON_IMU (0)
1919
#define PYBRICKS_PY_COMMON_KEYPAD (1)
20+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (1)
2021
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (1)
2122
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2223
#define PYBRICKS_PY_COMMON_LOGGER (1)

bricks/debug/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define PYBRICKS_PY_COMMON_CONTROL (0)
1717
#define PYBRICKS_PY_COMMON_IMU (0)
1818
#define PYBRICKS_PY_COMMON_KEYPAD (1)
19+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (1)
1920
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (0)
2021
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2122
#define PYBRICKS_PY_COMMON_MOTORS (0)

bricks/essentialhub/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#define PYBRICKS_PY_COMMON_CONTROL (1)
1919
#define PYBRICKS_PY_COMMON_IMU (1)
2020
#define PYBRICKS_PY_COMMON_KEYPAD (1)
21+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (1)
2122
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (1)
2223
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2324
#define PYBRICKS_PY_COMMON_LOGGER (1)

bricks/ev3dev/brickconfig.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define PYBRICKS_PY_COMMON_CONTROL (1)
2222
#define PYBRICKS_PY_COMMON_IMU (0)
2323
#define PYBRICKS_PY_COMMON_KEYPAD (1)
24+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (6)
2425
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (0)
2526
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2627
#define PYBRICKS_PY_COMMON_LOGGER (1)

bricks/ev3rt/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define PYBRICKS_PY_COMMON_CONTROL (0)
2222
#define PYBRICKS_PY_COMMON_IMU (0)
2323
#define PYBRICKS_PY_COMMON_KEYPAD (0)
24+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (6)
2425
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (0)
2526
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2627
#define PYBRICKS_PY_COMMON_LOGGER (0)

bricks/movehub/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define PYBRICKS_PY_COMMON_CONTROL (0)
1818
#define PYBRICKS_PY_COMMON_IMU (0)
1919
#define PYBRICKS_PY_COMMON_KEYPAD (1)
20+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (1)
2021
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (1)
2122
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2223
#define PYBRICKS_PY_COMMON_LOGGER (0)

bricks/nxt/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define PYBRICKS_PY_COMMON_CONTROL (1)
2020
#define PYBRICKS_PY_COMMON_IMU (0)
2121
#define PYBRICKS_PY_COMMON_KEYPAD (1)
22+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (4)
2223
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (0)
2324
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2425
#define PYBRICKS_PY_COMMON_LOGGER (1)

bricks/primehub/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define PYBRICKS_PY_COMMON_CONTROL (1)
2020
#define PYBRICKS_PY_COMMON_IMU (1)
2121
#define PYBRICKS_PY_COMMON_KEYPAD (1)
22+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (4)
2223
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (1)
2324
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (1)
2425
#define PYBRICKS_PY_COMMON_LOGGER (1)

bricks/technichub/mpconfigport.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define PYBRICKS_PY_COMMON_CONTROL (1)
1818
#define PYBRICKS_PY_COMMON_IMU (1)
1919
#define PYBRICKS_PY_COMMON_KEYPAD (1)
20+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (1)
2021
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (1)
2122
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
2223
#define PYBRICKS_PY_COMMON_LOGGER (1)

bricks/virtualhub/mpconfigvariant.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#define PYBRICKS_PY_COMMON_CONTROL (1)
1414
#define PYBRICKS_PY_COMMON_IMU (0)
1515
#define PYBRICKS_PY_COMMON_KEYPAD (1)
16+
#define PYBRICKS_PY_COMMON_KEYPAD_HUB_BUTTONS (1)
1617
#define PYBRICKS_PY_COMMON_LIGHT_ARRAY (1)
1718
#define PYBRICKS_PY_COMMON_LIGHT_MATRIX (0)
1819
#define PYBRICKS_PY_COMMON_LOGGER (1)

0 commit comments

Comments
 (0)