Clean up uniform brightness setting

This commit is contained in:
fruchti 2020-07-15 22:29:34 +02:00
parent fc5f7caa14
commit ccfdd7aeab
2 changed files with 6 additions and 10 deletions

View file

@ -1 +1 @@
263 264

View file

@ -13,7 +13,6 @@ int main(void)
LED_Init(); LED_Init();
int ct = 0;
uint8_t *data = (uint8_t*)LED_PixelData; uint8_t *data = (uint8_t*)LED_PixelData;
while(1) while(1)
{ {
@ -22,16 +21,13 @@ int main(void)
uint8_t brightness = LightSensor_RelativeBrightness * 255; uint8_t brightness = LightSensor_RelativeBrightness * 255;
if(LED_FrameFlag) if(LED_FrameFlag)
{ {
LED_FrameFlag = false; for(int i = 0; i < LED_COLUMNS * LED_ROWS; i++)
data[ct] = brightness;
LED_Commit();
ct += 3;
if(ct >= LED_COLUMNS * LED_ROWS)
{ {
ct -= LED_COLUMNS * LED_ROWS; data[i] = brightness;
ct += 1;
} }
LED_FrameFlag = false;
LED_Commit();
} }
} }