microbit: fixed an off by 10 bug

Missed a zero in a previous commit, that caused a system lockup due to
a missed timer event.

This commit also changes the minimum display brightness to 4, to also
minimise another feature that needs fixing in the future, where the
timer does not interrupt in the expected time frame.
This commit is contained in:
James Devine 2016-02-02 01:13:39 +00:00
parent e5bc926dcd
commit 3fa9bb09c2
2 changed files with 2 additions and 2 deletions

View File

@ -261,8 +261,8 @@
// Selects the minimum permissable brightness level for the device
// in the region of 0 (off) to 255 (full brightness)
#define MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS 2
#ifndef MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS
#define MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS 4
#endif
// Selects the maximum permissable brightness level for the device

View File

@ -147,7 +147,7 @@ void MicroBitDisplay::render()
//timer does not have enough resolution for brightness of 1. 23.53 us
if(brightness != MICROBIT_DISPLAY_MAXIMUM_BRIGHTNESS && brightness > MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS)
renderTimer.attach_us(this, &MicroBitDisplay::renderFinish, (((brightness * 100) / (MICROBIT_DISPLAY_MAXIMUM_BRIGHTNESS)) * uBit.getTickPeriod()));
renderTimer.attach_us(this, &MicroBitDisplay::renderFinish, (((brightness * 1000) / (MICROBIT_DISPLAY_MAXIMUM_BRIGHTNESS)) * uBit.getTickPeriod()));
//this will take around 23us to execute
if(brightness <= MICROBIT_DISPLAY_MINIMUM_BRIGHTNESS)