microbit: Ensure LED matrix display is cleared when brightness is set to '0' (#281)

- Fixed optimsation case for when brightness is set to zero in render() method.
- Introduce equivalent optimsation case for renderGreyscale(), to
  promote consistent behaviour.
master
Joe Finney 6 years ago
parent fe3a3dd1f4
commit 2f32db3e14

@ -136,7 +136,10 @@ void MicroBitDisplay::render()
// Simple optimisation.
// If display is at zero brightness, there's nothing to do.
if(brightness == 0)
{
renderFinish();
return;
}
// Calculate the bitpattern to write.
uint32_t row_data = 0x01 << (matrixMap.rowStart + strobeRow);
@ -208,6 +211,14 @@ void MicroBitDisplay::renderWithLightSense()
void MicroBitDisplay::renderGreyscale()
{
// Simple optimisation.
// If display is at zero brightness, there's nothing to do.
if(brightness == 0)
{
renderFinish();
return;
}
uint32_t row_data = 0x01 << (matrixMap.rowStart + strobeRow);
uint32_t col_data = 0;

Loading…
Cancel
Save