Merge pull request #3485 from jepler/framebuffer-zero-size
Framebuffer zero size
This commit is contained in:
commit
92d15096d2
@ -1666,6 +1666,10 @@ msgid ""
|
||||
"exit safe mode.\n"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/rgbmatrix/RGBMatrix.c
|
||||
msgid "The length of rgb_pins must be 6, 12, 18, 24, or 30"
|
||||
msgstr ""
|
||||
|
||||
#: supervisor/shared/safe_mode.c
|
||||
msgid ""
|
||||
"The microcontroller's power dipped. Make sure your power supply provides\n"
|
||||
@ -3520,6 +3524,10 @@ msgstr ""
|
||||
msgid "watchdog timeout must be greater than 0"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/rgbmatrix/RGBMatrix.c
|
||||
msgid "width must be greater than zero"
|
||||
msgstr ""
|
||||
|
||||
#: shared-bindings/_bleio/Adapter.c
|
||||
msgid "window must be <= interval"
|
||||
msgstr ""
|
||||
|
@ -73,6 +73,10 @@ STATIC void preflight_pins_or_throw(uint8_t clock_pin, uint8_t *rgb_pins, uint8_
|
||||
uint32_t port = clock_pin / 32;
|
||||
uint32_t bit_mask = 1 << (clock_pin % 32);
|
||||
|
||||
if (rgb_pin_count <= 0 || rgb_pin_count % 6 != 0 || rgb_pin_count > 30) {
|
||||
mp_raise_ValueError_varg(translate("The length of rgb_pins must be 6, 12, 18, 24, or 30"));
|
||||
}
|
||||
|
||||
for (uint8_t i = 0; i < rgb_pin_count; i++) {
|
||||
uint32_t pin_port = rgb_pins[i] / 32;
|
||||
|
||||
@ -210,6 +214,10 @@ STATIC mp_obj_t rgbmatrix_rgbmatrix_make_new(const mp_obj_type_t *type, size_t n
|
||||
}
|
||||
}
|
||||
|
||||
if (args[ARG_width].u_int <= 0) {
|
||||
mp_raise_ValueError(translate("width must be greater than zero"));
|
||||
}
|
||||
|
||||
preflight_pins_or_throw(clock_pin, rgb_pins, rgb_count, true);
|
||||
|
||||
mp_obj_t framebuffer = args[ARG_framebuffer].u_obj;
|
||||
|
Loading…
Reference in New Issue
Block a user