FS13257: Fix inconsistent defaults in the USB mode selection

Change-Id: I44894d13f070313ad326ce68018556573e35aad9
This commit is contained in:
Solomon Peachy 2020-11-16 11:32:12 -05:00
parent 5252523937
commit 9c68c69cf0
4 changed files with 16 additions and 4 deletions

View file

@ -1025,6 +1025,10 @@ void settings_apply(bool read_disk)
usb_charging_enable(global_settings.usb_charging);
#endif
#ifdef HAVE_USB_POWER
usb_set_mode(global_settings.usb_mode);
#endif
#ifdef HAVE_TOUCHSCREEN
touchscreen_set_mode(global_settings.touch_mode);
memcpy(&calibration_parameters, &global_settings.ts_calibration_data, sizeof(struct touchscreen_parameter));

View file

@ -2161,7 +2161,7 @@ const struct settings_list settings[] = {
CHOICE_SETTING(0,
usb_mode,
LANG_USB_MODE,
USB_MODE_MASS_STORAGE,
USBMODE_DEFAULT,
"usb mode",
"ask,mass storage,charge"
#if defined(DX50) || defined(DX90)

View file

@ -145,6 +145,13 @@ enum
#if !defined(USBPOWER_BTN_IGNORE)
#define USBPOWER_BTN_IGNORE 0
#endif
#if defined(BOOTLOADER)
#define USBMODE_DEFAULT USB_MODE_MASS_STORAGE
#else
#define USBMODE_DEFAULT USB_MODE_MASS_STORAGE
#endif
#endif
#ifdef HAVE_USBSTACK

View file

@ -95,8 +95,8 @@ static bool usb_host_present = false;
static int usb_num_acks_to_expect = 0;
static long usb_last_broadcast_tick = 0;
#ifdef HAVE_USB_POWER
static int usb_mode = USB_MODE_ASK;
static int new_usbmode = USB_MODE_ASK;
static int usb_mode = USBMODE_DEFAULT;
static int new_usbmode = USBMODE_DEFAULT;
#endif
static int usb_release_exclusive_storage(void);
@ -476,6 +476,7 @@ static void NORETURN_ATTR usb_thread(void)
/* Power (charging-only) button */
#ifdef HAVE_USB_POWER
new_usbmode = usb_mode;
switch (usb_mode) {
case USB_MODE_CHARGE:
case USB_MODE_ADB:
@ -491,7 +492,7 @@ static void NORETURN_ATTR usb_thread(void)
case USB_MODE_MASS_STORAGE:
if (button_status() & ~USBPOWER_BTN_IGNORE)
new_usbmode = USB_MODE_CHARGE;
break;
break;
}
#ifndef BOOTLOADER