Disallow tile=0

This commit is contained in:
Jeff Epler 2021-01-26 15:05:24 -06:00
parent 1c10ec99a7
commit 189ec2fc60
2 changed files with 3 additions and 3 deletions

View File

@ -3711,7 +3711,7 @@ msgid "threshold must be in the range 0-65536"
msgstr "" msgstr ""
#: shared-bindings/rgbmatrix/RGBMatrix.c #: shared-bindings/rgbmatrix/RGBMatrix.c
msgid "tile must be greater than or equal to zero" msgid "tile must be greater than zero"
msgstr "" msgstr ""
#: shared-bindings/time/__init__.c #: shared-bindings/time/__init__.c

View File

@ -214,9 +214,9 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n
int tile = args[ARG_tile].u_int; int tile = args[ARG_tile].u_int;
if (tile < 0) { if (tile <= 0) {
mp_raise_ValueError_varg( mp_raise_ValueError_varg(
translate("tile must be greater than or equal to zero")); translate("tile must be greater than zero"));
} }
int computed_height = (rgb_count / 3) * (1 << (addr_count)) * tile; int computed_height = (rgb_count / 3) * (1 << (addr_count)) * tile;