blue led is used for can receiving now

This commit is contained in:
Firmware Batman 2017-08-22 13:36:20 -07:00
parent 0400267cd9
commit ea4e92944c
3 changed files with 13 additions and 16 deletions

View File

@ -361,7 +361,7 @@ void can_rx(uint8_t can_number) {
safety_rx_hook(&to_push); safety_rx_hook(&to_push);
#ifdef PANDA #ifdef PANDA
set_led(LED_GREEN, 1); set_led(LED_BLUE, 1);
#endif #endif
can_push(&can_rx_q, &to_push); can_push(&can_rx_q, &to_push);

View File

@ -582,12 +582,8 @@ int main() {
puth(can_tx2_q.r_ptr); puts(" "); puth(can_tx2_q.w_ptr); puts("\n"); puth(can_tx2_q.r_ptr); puts(" "); puth(can_tx2_q.w_ptr); puts("\n");
#endif #endif
// set LED to be controls allowed, blue on panda, green on legacy // set green LED to be controls allowed
#ifdef PANDA
set_led(LED_BLUE, controls_allowed);
#else
set_led(LED_GREEN, controls_allowed); set_led(LED_GREEN, controls_allowed);
#endif
// blink the red LED // blink the red LED
for (int fade = 0; fade < 1024; fade += 8) { for (int fade = 0; fade < 1024; fade += 8) {
@ -601,7 +597,7 @@ int main() {
// turn off the green LED, turned on by CAN // turn off the green LED, turned on by CAN
#ifdef PANDA #ifdef PANDA
set_led(LED_GREEN, 0); set_led(LED_BLUE, 0);
#endif #endif
} }

View File

@ -126,7 +126,7 @@ class Panda(object):
#print(device) #print(device)
if device.getVendorID() == 0xbbaa and device.getProductID() in [0xddcc, 0xddee]: if device.getVendorID() == 0xbbaa and device.getProductID() in [0xddcc, 0xddee]:
if self._serial is None or device.getSerialNumber() == self._serial: if self._serial is None or device.getSerialNumber() == self._serial:
print("opening device", device.getSerialNumber()) print("opening device", device.getSerialNumber(), hex(device.getProductID()))
self.bootstub = device.getProductID() == 0xddee self.bootstub = device.getProductID() == 0xddee
self.legacy = (device.getbcdDevice() != 0x2300) self.legacy = (device.getbcdDevice() != 0x2300)
self._handle = device.open() self._handle = device.open()
@ -166,19 +166,20 @@ class Panda(object):
self.connect() self.connect()
def flash(self, fn=None): def flash(self, fn=None, code=None):
if not self.bootstub: if not self.bootstub:
self.reset(enter_bootstub=True) self.reset(enter_bootstub=True)
assert(self.bootstub) assert(self.bootstub)
if fn is None: if fn is None and code is None:
ret = os.system("cd %s && make clean && make -f %s %s" % (os.path.join(BASEDIR, "board"), ret = os.system("cd %s && make clean && make -f %s %s" % (os.path.join(BASEDIR, "board"),
"Makefile.legacy" if self.legacy else "Makefile", "Makefile.legacy" if self.legacy else "Makefile",
"obj/comma.bin" if self.legacy else "obj/panda.bin")) "obj/comma.bin" if self.legacy else "obj/panda.bin"))
fn = os.path.join(BASEDIR, "board", "obj", "comma.bin" if self.legacy else "panda.bin") fn = os.path.join(BASEDIR, "board", "obj", "comma.bin" if self.legacy else "panda.bin")
if code is None:
with open(fn) as f: with open(fn) as f:
dat = f.read() code = f.read()
# get version # get version
print("flash: version is "+self.get_version()) print("flash: version is "+self.get_version())
@ -199,8 +200,8 @@ class Panda(object):
# flash over EP2 # flash over EP2
STEP = 0x10 STEP = 0x10
print("flash: flashing") print("flash: flashing")
for i in range(0, len(dat), STEP): for i in range(0, len(code), STEP):
self._handle.bulkWrite(2, dat[i:i+STEP]) self._handle.bulkWrite(2, code[i:i+STEP])
# reset # reset
print("flash: resetting") print("flash: resetting")
@ -229,7 +230,7 @@ class Panda(object):
context = usb1.USBContext() context = usb1.USBContext()
ret = [] ret = []
for device in context.getDeviceList(skip_on_error=True): for device in context.getDeviceList(skip_on_error=True):
if device.getVendorID() == 0xbbaa and device.getProductID() == 0xddcc: if device.getVendorID() == 0xbbaa and device.getProductID() in [0xddcc, 0xddee]:
ret.append(device.getSerialNumber()) ret.append(device.getSerialNumber())
# TODO: detect if this is real # TODO: detect if this is real
#ret += ["WIFI"] #ret += ["WIFI"]