summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-10-12 13:26:58 -0500
committerJeff Epler <jepler@gmail.com>2020-10-12 13:28:20 -0500
commit9696dbfd388aa4c21b686d4566832964c31f8035 (patch)
tree555a00737732dfb1a0ded88b1174fd2f9a861d68 /shared-module
parent40a3d11d643c2a0da9d401a0c2853065ad64142c (diff)
rgbmatrix: Don't crash when setting brightness=0
If the display is paused, `_PM_swapbuffer_maybe` will never return. So, when brightness is 0, refresh does nothing. This makes it necessary to update the display when unpausing. Closes: #3524
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/rgbmatrix/RGBMatrix.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/shared-module/rgbmatrix/RGBMatrix.c b/shared-module/rgbmatrix/RGBMatrix.c
index 3007ca4db..abd6d500f 100644
--- a/shared-module/rgbmatrix/RGBMatrix.c
+++ b/shared-module/rgbmatrix/RGBMatrix.c
@@ -190,6 +190,8 @@ void common_hal_rgbmatrix_rgbmatrix_set_paused(rgbmatrix_rgbmatrix_obj_t* self,
_PM_stop(&self->protomatter);
} else if (!paused && self->paused) {
_PM_resume(&self->protomatter);
+ _PM_convert_565(&self->protomatter, self->bufinfo.buf, self->width);
+ _PM_swapbuffer_maybe(&self->protomatter);
}
self->paused = paused;
}
@@ -199,8 +201,10 @@ bool common_hal_rgbmatrix_rgbmatrix_get_paused(rgbmatrix_rgbmatrix_obj_t* self)
}
void common_hal_rgbmatrix_rgbmatrix_refresh(rgbmatrix_rgbmatrix_obj_t* self) {
- _PM_convert_565(&self->protomatter, self->bufinfo.buf, self->width);
- _PM_swapbuffer_maybe(&self->protomatter);
+ if (!self->paused) {
+ _PM_convert_565(&self->protomatter, self->bufinfo.buf, self->width);
+ _PM_swapbuffer_maybe(&self->protomatter);
+ }
}
int common_hal_rgbmatrix_rgbmatrix_get_width(rgbmatrix_rgbmatrix_obj_t* self) {