Inkplate6: Fix crash with initial set of greyscale (#6038)

This commit is contained in:
Clyde Stubbs 2024-01-17 10:23:36 +11:00 committed by Jesse Hills
parent 86c9546362
commit 95292dbba1
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 5 additions and 1 deletions

View file

@ -55,6 +55,9 @@ void Inkplate6::setup() {
this->wakeup_pin_->digital_write(false);
}
/**
* Allocate buffers. May be called after setup to re-initialise if e.g. greyscale is changed.
*/
void Inkplate6::initialize_() {
ExternalRAMAllocator<uint8_t> allocator(ExternalRAMAllocator<uint8_t>::ALLOW_FAILURE);
ExternalRAMAllocator<uint32_t> allocator32(ExternalRAMAllocator<uint32_t>::ALLOW_FAILURE);

View file

@ -68,8 +68,9 @@ class Inkplate6 : public display::DisplayBuffer, public i2c::I2CDevice {
void set_greyscale(bool greyscale) {
this->greyscale_ = greyscale;
this->initialize_();
this->block_partial_ = true;
if (this->is_ready())
this->initialize_();
}
void set_partial_updating(bool partial_updating) { this->partial_updating_ = partial_updating; }
void set_full_update_every(uint32_t full_update_every) { this->full_update_every_ = full_update_every; }