Fix a pile of yellow in the bootloader

Change-Id: Ia89a33bbb13683566e421ac2a002baa20cdb07de
This commit is contained in:
Solomon Peachy 2020-10-13 13:06:18 -04:00
parent b4865b05b0
commit 4a3d046545
9 changed files with 87 additions and 58 deletions

View file

@ -49,12 +49,16 @@ bool remote_button_hold(void)
int button_read_device(void)
{
int btn = BUTTON_NONE;
#ifndef BOOTLOADER
bool hold_button_old;
bool remote_hold_button_old;
#endif
int data;
/* normal buttons */
#ifndef BOOTLOADER
hold_button_old = hold_button;
#endif
hold_button = button_hold();
if (!hold_button)
@ -87,7 +91,9 @@ int button_read_device(void)
/* remote buttons */
data = remote_detect() ? adc_read(ADC_REMOTE) : 0xff;
#ifndef BOOTLOADER
remote_hold_button_old = remote_hold_button;
#endif
remote_hold_button = data < 0x14;
#ifndef BOOTLOADER

View file

@ -60,14 +60,18 @@ bool remote_button_hold(void)
int button_read_device(void)
{
int btn = BUTTON_NONE;
#ifndef BOOTLOADER
bool hold_button_old;
bool remote_hold_button_old;
#endif
static int prev_data = 0xff;
static int last_valid = 0xff;
int data;
/* normal buttons */
#ifndef BOOTLOADER
hold_button_old = hold_button;
#endif
hold_button = button_hold();
#ifndef BOOTLOADER
@ -86,7 +90,7 @@ int button_read_device(void)
last_valid = data;
prev_data = data;
data = last_valid;
if (data < 0xf0)
{
if(data < 0x7c)
@ -114,7 +118,9 @@ int button_read_device(void)
/* remote buttons */
data = remote_detect() ? adc_scan(ADC_REMOTE) : 0xff;
#ifndef BOOTLOADER
remote_hold_button_old = remote_hold_button;
#endif
remote_hold_button = data < 0x17;
#ifndef BOOTLOADER