Fixed screen brightness problems (tested on 1.0.0 and 2.0.0). Some refactoring.

This commit is contained in:
nwert
2018-06-15 23:28:27 +12:00
parent b2dd070d10
commit 694a8b5395
11 changed files with 157 additions and 107 deletions

View File

@@ -37,22 +37,21 @@ u32 btn_wait()
u32 res = 0, btn = btn_read();
int pwr = 0;
// Power button down, raise a filter.
//Power button down, raise a filter.
if (btn & BTN_POWER)
{
pwr = 1;
btn &= 0xFFFFFFFE;
btn &= ~BTN_POWER;
}
do
{
res = btn_read();
// Power button up, remove filter.
//Power button up, remove filter.
if (!(res & BTN_POWER) && pwr)
pwr = 0;
// Power button still down.
else if (pwr)
res &= 0xFFFFFFFE;
else if (pwr) //Power button still down.
res &= ~BTN_POWER;
} while (btn == res);
return res;