kopia lustrzana https://github.com/pimoroni/pimoroni-pico
Possible fix for display glitch after first program run
rodzic
9fafa3edb1
commit
e4afa6b6f2
|
@ -20,9 +20,16 @@ mp_obj_t picodisplay_init(mp_obj_t buf_obj) {
|
||||||
mp_buffer_info_t bufinfo;
|
mp_buffer_info_t bufinfo;
|
||||||
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
|
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
|
||||||
picodisplay_buf_obj = buf_obj;
|
picodisplay_buf_obj = buf_obj;
|
||||||
if(display == nullptr)
|
|
||||||
display = new PicoDisplay((uint16_t *)bufinfo.buf);
|
// If a display already exists, delete it
|
||||||
|
if(display != nullptr) {
|
||||||
|
delete display;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new display pointing to the newly provided buffer
|
||||||
|
display = new PicoDisplay((uint16_t *)bufinfo.buf);
|
||||||
display->init();
|
display->init();
|
||||||
|
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,16 @@ mp_obj_t picodisplay2_init(mp_obj_t buf_obj) {
|
||||||
mp_buffer_info_t bufinfo;
|
mp_buffer_info_t bufinfo;
|
||||||
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
|
mp_get_buffer_raise(buf_obj, &bufinfo, MP_BUFFER_RW);
|
||||||
picodisplay2_buf_obj = buf_obj;
|
picodisplay2_buf_obj = buf_obj;
|
||||||
if(display2 == nullptr)
|
|
||||||
display2 = new PicoDisplay2((uint16_t *)bufinfo.buf);
|
// If a display already exists, delete it
|
||||||
|
if(display2 != nullptr) {
|
||||||
|
delete display2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a new display pointing to the newly provided buffer
|
||||||
|
display2 = new PicoDisplay2((uint16_t *)bufinfo.buf);
|
||||||
display2->init();
|
display2->init();
|
||||||
|
|
||||||
return mp_const_none;
|
return mp_const_none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue