Skip to content

Commit

Permalink
Revert "Remove CONFIG_SCAN_SPEED_BRIGHTNESS"
Browse files Browse the repository at this point in the history
This reverts commit b206498.
  • Loading branch information
Song Muchun committed Apr 11, 2019
1 parent aa0cb74 commit c456e9f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#define CONFIG_MAX_BRIGHTNESS 80
#define CONFIG_NIGHT_MODE_BRIGHTNESS 1
#define CONFIG_NIGHT_MODE_FAIR_FACTOR 55
#define CONFIG_SCAN_SPEED_BRIGHTNESS 55
#define CONFIG_SEETING_TIME_SCAN_SPEED 15
#define CONFIG_SETTING_SCAN_SPEED 2
#define CONFIG_CHIME_START_HOUR 8
Expand Down
15 changes: 15 additions & 0 deletions user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ static void show_times(void xdata *priv)
half_low = sec_old & 0x0f;
if (half_low > 2 && half_low < 5 && should_show_temperature(user)) {
if (!is_temp) {
unsigned char brightness;

/**
* fb_info->brightness maybe alter in irq.
* So we should disable irq to protect shared
Expand All @@ -272,19 +274,32 @@ static void show_times(void xdata *priv)
local_irq_enable();
return;
}
brightness = fb_info->brightness;
fb_info->brightness = CONFIG_SCAN_SPEED_BRIGHTNESS;
fb_load_temperature(offset);
fb_info->offset = fb_scan(fb_info, 64, 1);
fb_info->brightness = brightness;
local_irq_enable();
is_temp = true;
}
} else if (is_temp) {
unsigned char brightness;

/**
* fb_info->brightness maybe alter in irq.
* So we should disable irq to protect shared
* variable.
*/
local_irq_disable();
brightness = fb_info->brightness;
/**
* If we are in night mode, we should not increase
* the brightness.
*/
if (!user->night_mode)
fb_info->brightness = CONFIG_SCAN_SPEED_BRIGHTNESS;
fb_info->offset = fb_scan_reverse(fb_info, 64, 1);
fb_info->brightness = brightness;
local_irq_enable();
is_temp = false;
}
Expand Down

0 comments on commit c456e9f

Please sign in to comment.