Skip to content

Commit 1aa149b

Browse files
committed
pbio/sys/status: Drop duplicate size constant.
This is a protocol constant, so we don't need to hardcode something of the same value elsewhere and then statically assert equality.
1 parent 8b2e3f5 commit 1aa149b

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

lib/pbio/drv/usb/usb_stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ PROCESS(pbdrv_usb_process, "USB");
3636
// to/from FIFOs in 32-bit chunks.
3737
static uint8_t usb_in_buf[USBD_PYBRICKS_MAX_PACKET_SIZE] __aligned(4);
3838
static uint8_t usb_response_buf[PBIO_PYBRICKS_USB_MESSAGE_SIZE(sizeof(uint32_t))] __aligned(4);
39-
static uint8_t usb_status_buf[PBIO_PYBRICKS_USB_MESSAGE_SIZE(PBSYS_STATUS_REPORT_SIZE)] __aligned(4);
39+
static uint8_t usb_status_buf[PBIO_PYBRICKS_USB_MESSAGE_SIZE(PBIO_PYBRICKS_EVENT_STATUS_REPORT_SIZE)] __aligned(4);
4040
static uint8_t usb_stdout_buf[USBD_PYBRICKS_MAX_PACKET_SIZE] __aligned(4);
4141
static volatile uint32_t usb_in_sz;
4242
static volatile uint32_t usb_response_sz;

lib/pbio/include/pbsys/status.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
#include <pbio/protocol.h>
1616

17-
#define PBSYS_STATUS_REPORT_SIZE 7
18-
1917
void pbsys_status_set_program_id(pbio_pybricks_user_program_id_t program_id);
2018
void pbsys_status_set(pbio_pybricks_status_flags_t status);
2119
void pbsys_status_clear(pbio_pybricks_status_flags_t status);

lib/pbio/sys/status.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,12 @@ static void pbsys_status_update_flag(pbio_pybricks_status_flags_t status, bool s
5656
/**
5757
* Gets the Pybricks status report and writes it to @p buf.
5858
*
59-
* The buffer must be at least ::PBSYS_STATUS_REPORT_SIZE bytes.
59+
* The buffer must be at least ::PBIO_PYBRICKS_EVENT_STATUS_REPORT_SIZE bytes.
6060
*
6161
* @param [in] buf The buffer to hold the binary data.
6262
* @return The number of bytes written to @p buf.
6363
*/
6464
uint32_t pbsys_status_get_status_report(uint8_t *buf) {
65-
66-
_Static_assert(PBSYS_STATUS_REPORT_SIZE == PBIO_PYBRICKS_EVENT_STATUS_REPORT_SIZE,
67-
"size of status report does not match size of event");
68-
6965
return pbio_pybricks_event_status_report(buf, pbsys_status.flags, pbsys_status.program_id, pbsys_status.slot);
7066
}
7167

0 commit comments

Comments
 (0)