Skip to content

Commit

Permalink
pybricks.parameters.Color: fix hsv print
Browse files Browse the repository at this point in the history
mp_printf uses fixed, platform-independent specifiers.

This fixes statements like print(Color.RED) not working
correctly on some platforms.
  • Loading branch information
laurensvalk committed Sep 21, 2020
1 parent c5c74ce commit f45333e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pybricks/parameters/pb_type_color.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

#if PYBRICKS_PY_PARAMETERS

#include <inttypes.h>

#include <pbio/color.h>

#include "py/objstr.h"
Expand Down Expand Up @@ -160,7 +158,7 @@ STATIC mp_obj_t pb_type_Color_make_new(const mp_obj_type_t *type, size_t n_args,

void pb_type_Color_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
pb_type_Color_obj_t *self = MP_OBJ_TO_PTR(self_in);
mp_printf(print, "Color(%" PRIu16 ", %" PRIu8 ", %" PRIu8, self->hsv.h, self->hsv.s, self->hsv.v);
mp_printf(print, "Color(%u, %u, %u", self->hsv.h, self->hsv.s, self->hsv.v);
if (self->name != mp_const_none) {
mp_printf(print, ", '%s'", mp_obj_str_get_str(self->name));
}
Expand Down

0 comments on commit f45333e

Please sign in to comment.