diff --git a/VERSION b/VERSION index c9b3c01..74a63a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v1.5.1 \ No newline at end of file +v1.5.2 \ No newline at end of file diff --git a/board/boards/black.h b/board/boards/black.h index f56cb1a..c6078e3 100644 --- a/board/boards/black.h +++ b/board/boards/black.h @@ -162,6 +162,9 @@ void black_init(void) { // Turn on USB load switch. black_set_usb_load_switch(true); + // Set right power mode + black_set_usb_power_mode(USB_POWER_CDP); + // Initialize harness harness_init(); diff --git a/board/boards/white.h b/board/boards/white.h index cea15db..241f1b9 100644 --- a/board/boards/white.h +++ b/board/boards/white.h @@ -288,6 +288,16 @@ void white_init(void) { EXTI->RTSR |= (1U << 1); EXTI->FTSR |= (1U << 1); NVIC_EnableIRQ(EXTI1_IRQn); + + // Init usb power mode + uint32_t voltage = adc_get_voltage(); + // Init in CDP mode only if panda is powered by 12V. + // Otherwise a PC would not be able to flash a standalone panda with EON build + if (voltage > 8000U) { // 8V threshold + white_set_usb_power_mode(USB_POWER_CDP); + } else { + white_set_usb_power_mode(USB_POWER_CLIENT); + } } const harness_configuration white_harness_config = { diff --git a/board/bootstub.c b/board/bootstub.c index 3b6b1e8..51ce669 100644 --- a/board/bootstub.c +++ b/board/bootstub.c @@ -32,6 +32,7 @@ const board *current_board; #include "drivers/clock.h" #include "drivers/llgpio.h" +#include "drivers/adc.h" #include "board.h" @@ -68,8 +69,6 @@ int main(void) { detect_configuration(); detect_board_type(); - current_board->set_usb_power_mode(USB_POWER_CLIENT); - if (enter_bootloader_mode == ENTER_SOFTLOADER_MAGIC) { enter_bootloader_mode = 0; soft_flasher_start(); diff --git a/board/main.c b/board/main.c index a6d1d8e..c5324d8 100644 --- a/board/main.c +++ b/board/main.c @@ -652,16 +652,6 @@ int main(void) { // init board current_board->init(); - // init usb power mode - uint32_t voltage = adc_get_voltage(); - // init in CDP mode only if panda is powered by 12V. - // Otherwise a PC would not be able to flash a standalone panda with EON build - if (voltage > 8000U) { // 8V threshold - current_board->set_usb_power_mode(USB_POWER_CDP); - } else { - current_board->set_usb_power_mode(USB_POWER_CLIENT); - } - // panda has an FPU, let's use it! enable_fpu();