diff --git a/Jenkinsfile b/Jenkinsfile index d9b1c4647f1..6b9e1d7459c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -110,7 +110,24 @@ pipeline { ["build", "scons -j4"], ["flash", "cd scripts/ && ./reflash_internal_panda.py"], ["flash jungle", "cd board/jungle && ./flash.py --all"], - ["test", "cd tests/hitl && pytest --durations=0 2*.py [5-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], ]) } } @@ -122,7 +139,24 @@ pipeline { ["build", "scons -j4"], ["flash", "cd scripts/ && ./reflash_internal_panda.py"], ["flash jungle", "cd board/jungle && ./flash.py --all"], - ["test", "cd tests/hitl && pytest --durations=0 2*.py [5-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], + ["test", "cd tests/hitl && pytest --durations=0 2*.py [8-9]*.py"], ]) } } diff --git a/board/drivers/harness.h b/board/drivers/harness.h index 3ebf109fe83..dee0dd6a999 100644 --- a/board/drivers/harness.h +++ b/board/drivers/harness.h @@ -15,7 +15,7 @@ void set_intercept_relay(bool intercept, bool ignition_relay) { } // wait until we're not reading the analog voltages anymore - while (harness.sbu_adc_lock) {} + //while (harness.sbu_adc_lock) {} if (harness.status == HARNESS_STATUS_NORMAL) { set_gpio_output(current_board->harness_config->GPIO_relay_SBU1, current_board->harness_config->pin_relay_SBU1, !ignition_relay); @@ -34,7 +34,7 @@ bool harness_check_ignition(void) { bool ret = false; // wait until we're not reading the analog voltages anymore - while (harness.sbu_adc_lock) {} + //while (harness.sbu_adc_lock) {} switch(harness.status){ case HARNESS_STATUS_NORMAL: @@ -51,6 +51,7 @@ bool harness_check_ignition(void) { static uint8_t harness_detect_orientation(void) { uint8_t ret = harness.status; + return ret; #ifndef BOOTSTUB // We can't detect orientation if the relay is being driven diff --git a/board/main.c b/board/main.c index dcc40922bd0..e45c8483ecb 100644 --- a/board/main.c +++ b/board/main.c @@ -329,6 +329,8 @@ int main(void) { print("**** INTERRUPTS ON ****\n"); enable_interrupts(); + print("boot time: "); puth(microsecond_timer_get()); print("us\n"); + // LED should keep on blinking all the time while (true) { if (power_save_status == POWER_SAVE_STATUS_DISABLED) { diff --git a/python/__init__.py b/python/__init__.py index aa5f49dd6fb..b67e52c0060 100644 --- a/python/__init__.py +++ b/python/__init__.py @@ -147,9 +147,9 @@ def __init__(self, serial: str | None = None, claim: bool = True, disable_checks self._can_speed_kbps = can_speed_kbps if cli and serial is None: - self._connect_serial = self._cli_select_panda() + self._connect_serial = self._cli_select_panda() else: - self._connect_serial = serial + self._connect_serial = serial # connect and set mcu type self.connect(claim) diff --git a/python/spi.py b/python/spi.py index 8ee5aecb9e2..51711ffe2f6 100644 --- a/python/spi.py +++ b/python/spi.py @@ -263,8 +263,8 @@ def _transfer(self, endpoint: int, data, timeout: int, max_rx_len: int = 1000, e raise exc def get_protocol_version(self) -> bytes: - vers_str = b"VERSION" def _get_version(spi) -> bytes: + vers_str = b"VERSION" spi.writebytes(vers_str) logger.debug("- waiting for echo") @@ -274,7 +274,7 @@ def _get_version(spi) -> bytes: if bytes(version_bytes).startswith(vers_str): break if (time.monotonic() - start) > 0.001: - raise PandaSpiMissingAck + raise PandaSpiMissingAck(f"got {version_bytes}") rlen = struct.unpack(" 1000: @@ -296,6 +296,9 @@ def _get_version(spi) -> bytes: except PandaSpiException as e: exc = e logger.debug("SPI get protocol version failed, retrying", exc_info=True) + + # ensure slave is in a good state and not stuck TXing a massive buffer + spi.readbytes(SPI_BUF_SIZE) raise exc # libusb1 functions diff --git a/tests/hitl/9_harness.py b/tests/hitl/9_harness.py index ddd3516e4da..99e0fc48501 100644 --- a/tests/hitl/9_harness.py +++ b/tests/hitl/9_harness.py @@ -9,6 +9,8 @@ @pytest.mark.panda_expect_can_error def test_harness_status(p, panda_jungle): + # here good + # map from jungle orientations to panda orientations orientation_map = { Panda.HARNESS_STATUS_NC: Panda.HARNESS_STATUS_NC, @@ -19,12 +21,17 @@ def test_harness_status(p, panda_jungle): for ignition, orientation in itertools.product([True, False], [Panda.HARNESS_STATUS_NC, Panda.HARNESS_STATUS_NORMAL, Panda.HARNESS_STATUS_FLIPPED]): print() p.set_safety_mode(CarParams.SafetyModel.elm327) + # here good panda_jungle.set_harness_orientation(orientation) + # here bad + continue panda_jungle.set_ignition(ignition) # wait for orientation detection time.sleep(0.25) + # here **** bad *** + health = p.health() detected_orientation = health['car_harness_status'] print(f"orientation set: {orientation} detected: {detected_orientation}") diff --git a/tests/hitl/conftest.py b/tests/hitl/conftest.py index ecc3a455c8d..802a62e4d3d 100644 --- a/tests/hitl/conftest.py +++ b/tests/hitl/conftest.py @@ -126,9 +126,9 @@ def func_fixture_panda(request, module_panda): # Check health of each CAN core after test, normal to fail for test_gen2_loopback on OBD bus, so skipping mark = request.node.get_closest_marker('panda_expect_can_error') expect_can_error = mark is not None - if not expect_can_error: - for i in range(3): - can_health = p.can_health(i) + for i in range(3): + can_health = p.can_health(i) + if not expect_can_error: assert can_health['bus_off_cnt'] == 0 assert can_health['receive_error_cnt'] < 127 assert can_health['transmit_error_cnt'] < 255 @@ -152,7 +152,6 @@ def fixture_panda_setup(request): p.reset(reconnect=True) p.set_can_loopback(False) - p.set_power_save(False) for bus, speed in BUS_SPEEDS: p.set_can_speed_kbps(bus, speed) clear_can_buffers(p)