From a6193a82850fccf5f3d4dfcab46ac9e745fee94f Mon Sep 17 00:00:00 2001 From: rbiasini Date: Mon, 11 Mar 2019 23:41:40 -0700 Subject: [PATCH] Dcp remove (#168) * No DCP charge mode when building from EON --- board/build.mk | 8 ++++++++ board/main.c | 8 ++++---- common/version.mk | 6 +++--- python/__init__.py | 2 +- python/update.py | 4 +++- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/board/build.mk b/board/build.mk index 9f2c4250..a84ed3fd 100644 --- a/board/build.mk +++ b/board/build.mk @@ -2,6 +2,14 @@ CFLAGS += -I inc -I ../ -nostdlib -fno-builtin -std=gnu11 -Os CFLAGS += -Tstm32_flash.ld +# Compile fast charge (DCP) only not on EON +ifeq (,$(wildcard /EON)) + BUILDER = DEV +else + CFLAGS += "-DEON" + BUILDER = EON +endif + CC = arm-none-eabi-gcc OBJCOPY = arm-none-eabi-objcopy OBJDUMP = arm-none-eabi-objdump diff --git a/board/main.c b/board/main.c index 16d64916..a8a0674c 100644 --- a/board/main.c +++ b/board/main.c @@ -590,8 +590,6 @@ int main() { uint64_t marker = 0; #define CURRENT_THRESHOLD 0xF00 #define CLICKS 8 - // Enough clicks to ensure that enumeration happened. Should be longer than bootup time of the device connected to EON - #define CLICKS_BOOTUP 30 #endif for (cnt=0;;cnt++) { @@ -618,8 +616,9 @@ int main() { } break; case USB_POWER_CDP: - // been CLICKS_BOOTUP clicks since we switched to CDP - if ((cnt-marker) >= CLICKS_BOOTUP ) { +#ifndef EON + // been CLICKS clicks since we switched to CDP + if ((cnt-marker) >= CLICKS) { // measure current draw, if positive and no enumeration, switch to DCP if (!is_enumerated && current < CURRENT_THRESHOLD) { puts("USBP: no enumeration with current draw, switching to DCP mode\n"); @@ -631,6 +630,7 @@ int main() { if (current >= CURRENT_THRESHOLD) { marker = cnt; } +#endif break; case USB_POWER_DCP: // been at least CLICKS clicks since we switched to DCP diff --git a/common/version.mk b/common/version.mk index cc42223d..2569834c 100644 --- a/common/version.mk +++ b/common/version.mk @@ -6,13 +6,13 @@ endif ifneq ($(wildcard ../.git/HEAD),) obj/gitversion.h: ../VERSION ../.git/HEAD ../.git/index - echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ + echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(BUILDER)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ else ifneq ($(wildcard ../../.git/modules/panda/HEAD),) obj/gitversion.h: ../VERSION ../../.git/modules/panda/HEAD ../../.git/modules/panda/index - echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ + echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(BUILDER)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@ else obj/gitversion.h: ../VERSION - echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-unknown-$(BUILD_TYPE)\";" > $@ + echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(BUILDER)-unknown-$(BUILD_TYPE)\";" > $@ endif endif diff --git a/python/__init__.py b/python/__init__.py index 51db7a7a..b0364c20 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -270,7 +270,7 @@ class Panda(object): code = f.read() # get version - print("flash: version is "+self.get_version()) + print("flash: version is " + self.get_version()) # do flash Panda.flash_static(self._handle, code) diff --git a/python/update.py b/python/update.py index d393df9f..ce730e49 100755 --- a/python/update.py +++ b/python/update.py @@ -8,6 +8,8 @@ def ensure_st_up_to_date(): with open(os.path.join(BASEDIR, "VERSION")) as f: repo_version = f.read() + repo_version += "-EON" if os.path.isfile('/EON') else "-DEV" + panda = None panda_dfu = None should_flash_recover = False @@ -24,7 +26,7 @@ def ensure_st_up_to_date(): if len(panda_dfu) > 0: panda_dfu = PandaDFU(panda_dfu[0]) panda_dfu.recover() - + print "waiting for board..." time.sleep(1)