Skip to content

Commit a6193a8

Browse files
authoredMar 12, 2019
Dcp remove (#168)
* No DCP charge mode when building from EON
1 parent e437b9b commit a6193a8

File tree

5 files changed

+19
-9
lines changed

5 files changed

+19
-9
lines changed
 

‎board/build.mk

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ CFLAGS += -I inc -I ../ -nostdlib -fno-builtin -std=gnu11 -Os
22

33
CFLAGS += -Tstm32_flash.ld
44

5+
# Compile fast charge (DCP) only not on EON
6+
ifeq (,$(wildcard /EON))
7+
BUILDER = DEV
8+
else
9+
CFLAGS += "-DEON"
10+
BUILDER = EON
11+
endif
12+
513
CC = arm-none-eabi-gcc
614
OBJCOPY = arm-none-eabi-objcopy
715
OBJDUMP = arm-none-eabi-objdump

‎board/main.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,6 @@ int main() {
590590
uint64_t marker = 0;
591591
#define CURRENT_THRESHOLD 0xF00
592592
#define CLICKS 8
593-
// Enough clicks to ensure that enumeration happened. Should be longer than bootup time of the device connected to EON
594-
#define CLICKS_BOOTUP 30
595593
#endif
596594

597595
for (cnt=0;;cnt++) {
@@ -618,8 +616,9 @@ int main() {
618616
}
619617
break;
620618
case USB_POWER_CDP:
621-
// been CLICKS_BOOTUP clicks since we switched to CDP
622-
if ((cnt-marker) >= CLICKS_BOOTUP ) {
619+
#ifndef EON
620+
// been CLICKS clicks since we switched to CDP
621+
if ((cnt-marker) >= CLICKS) {
623622
// measure current draw, if positive and no enumeration, switch to DCP
624623
if (!is_enumerated && current < CURRENT_THRESHOLD) {
625624
puts("USBP: no enumeration with current draw, switching to DCP mode\n");
@@ -631,6 +630,7 @@ int main() {
631630
if (current >= CURRENT_THRESHOLD) {
632631
marker = cnt;
633632
}
633+
#endif
634634
break;
635635
case USB_POWER_DCP:
636636
// been at least CLICKS clicks since we switched to DCP

‎common/version.mk

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ endif
66

77
ifneq ($(wildcard ../.git/HEAD),)
88
obj/gitversion.h: ../VERSION ../.git/HEAD ../.git/index
9-
echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@
9+
echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(BUILDER)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@
1010
else
1111
ifneq ($(wildcard ../../.git/modules/panda/HEAD),)
1212
obj/gitversion.h: ../VERSION ../../.git/modules/panda/HEAD ../../.git/modules/panda/index
13-
echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@
13+
echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(BUILDER)-$(shell git rev-parse --short=8 HEAD)-$(BUILD_TYPE)\";" > $@
1414
else
1515
obj/gitversion.h: ../VERSION
16-
echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-unknown-$(BUILD_TYPE)\";" > $@
16+
echo "const uint8_t gitversion[] = \"$(shell cat ../VERSION)-$(BUILDER)-unknown-$(BUILD_TYPE)\";" > $@
1717
endif
1818
endif

‎python/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def flash(self, fn=None, code=None, reconnect=True):
270270
code = f.read()
271271

272272
# get version
273-
print("flash: version is "+self.get_version())
273+
print("flash: version is " + self.get_version())
274274

275275
# do flash
276276
Panda.flash_static(self._handle, code)

‎python/update.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ def ensure_st_up_to_date():
88
with open(os.path.join(BASEDIR, "VERSION")) as f:
99
repo_version = f.read()
1010

11+
repo_version += "-EON" if os.path.isfile('/EON') else "-DEV"
12+
1113
panda = None
1214
panda_dfu = None
1315
should_flash_recover = False
@@ -24,7 +26,7 @@ def ensure_st_up_to_date():
2426
if len(panda_dfu) > 0:
2527
panda_dfu = PandaDFU(panda_dfu[0])
2628
panda_dfu.recover()
27-
29+
2830
print "waiting for board..."
2931
time.sleep(1)
3032

0 commit comments

Comments
 (0)