Skip to content

Commit

Permalink
Dcp remove (#168)
Browse files Browse the repository at this point in the history
* No DCP charge mode when building from EON
  • Loading branch information
rbiasini authored Mar 12, 2019
1 parent e437b9b commit a6193a8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
8 changes: 8 additions & 0 deletions board/build.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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");
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions common/version.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def flash(self, fn=None, code=None, reconnect=True):
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)
Expand Down
4 changes: 3 additions & 1 deletion python/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit a6193a8

Please sign in to comment.