From bac4d854349a794f0db53a7bc24974c8edf15824 Mon Sep 17 00:00:00 2001 From: Comma Device Date: Wed, 6 Nov 2019 21:42:07 +0000 Subject: [PATCH] dos and python3 --- board/board.h | 11 +++++++++-- board/build.mk | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/board/board.h b/board/board.h index 5629a841..0181ae5a 100644 --- a/board/board.h +++ b/board/board.h @@ -21,8 +21,15 @@ void detect_board_type(void) { #ifdef PANDA // SPI lines floating: white (TODO: is this reliable?) if((detect_with_pull(GPIOA, 4, PULL_DOWN)) || (detect_with_pull(GPIOA, 5, PULL_DOWN)) || (detect_with_pull(GPIOA, 6, PULL_DOWN)) || (detect_with_pull(GPIOA, 7, PULL_DOWN))){ - hw_type = HW_TYPE_WHITE_PANDA; - current_board = &board_white; + // white panda has serial lines, if floating, it's a dos + if (!detect_with_pull(GPIOA, 2, PULL_DOWN) && !detect_with_pull(GPIOA, 3, PULL_DOWN)) { + // TODO: replace with DOS + hw_type = HW_TYPE_UNO; + current_board = &board_uno; + } else { + hw_type = HW_TYPE_WHITE_PANDA; + current_board = &board_white; + } } else if(detect_with_pull(GPIOA, 13, PULL_DOWN)) { // Rev AB deprecated, so no pullup means black. In REV C, A13 is pulled up to 5V with a 10K hw_type = HW_TYPE_GREY_PANDA; current_board = &board_grey; diff --git a/board/build.mk b/board/build.mk index acac0309..21daf53a 100644 --- a/board/build.mk +++ b/board/build.mk @@ -33,7 +33,7 @@ POSTCOMPILE = @mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d && touch $@ # this no longer pushes the bootstub flash: obj/$(PROJ_NAME).bin - PYTHONPATH=../ python -c "from python import Panda; Panda().flash('obj/$(PROJ_NAME).bin')" + PYTHONPATH=../ python3 -c "from python import Panda; Panda().flash('obj/$(PROJ_NAME).bin')" ota: obj/$(PROJ_NAME).bin curl http://192.168.0.10/stupdate --upload-file $< @@ -42,7 +42,7 @@ bin: obj/$(PROJ_NAME).bin # this flashes everything recover: obj/bootstub.$(PROJ_NAME).bin obj/$(PROJ_NAME).bin - -PYTHONPATH=../ python -c "from python import Panda; Panda().reset(enter_bootloader=True)" + -PYTHONPATH=../ python3 -c "from python import Panda; Panda().reset(enter_bootloader=True)" sleep 1.0 $(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08004000 -D obj/$(PROJ_NAME).bin $(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08000000:leave -D obj/bootstub.$(PROJ_NAME).bin