Dcp remove (#168)

* No DCP charge mode when building from EON
This commit is contained in:
rbiasini
2019-03-11 23:41:40 -07:00
committed by GitHub
parent e437b9b4b1
commit a6193a8285
5 changed files with 19 additions and 9 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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)

View File

@@ -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)