Skip to content

Commit

Permalink
Deprecate ESP (commaai#592)
Browse files Browse the repository at this point in the history
* remove unused wifi tests

* remove that one too

* no bootmode from ESP

* clean that up

* remove two more wifi tests

* remove boardesp and esptool

* esp_gps -> gps

* missed those

* remove esptool refs

* remove esp certs

* no more wifi

* that was old

* cleanup jenkins dockerfile

* fix linter

* remove more wifi refs

* clone panda jungle from github

* no copy

* always default esp to off
  • Loading branch information
adeebshihadeh authored Aug 26, 2020
1 parent 6ae6221 commit 8b41ed3
Show file tree
Hide file tree
Showing 54 changed files with 76 additions and 5,256 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.git
.DS_Store
boardesp/esp-open-sdk
20 changes: 0 additions & 20 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,26 +45,6 @@ jobs:
- name: Build pedal STM bootstub image
run: $RUN "cd /tmp/openpilot/panda/board/pedal && make obj/bootstub.bin"

build_esp:
name: build esp
runs-on: ubuntu-16.04
timeout-minutes: 45
steps:
- uses: actions/checkout@v2
- name: Build docker image
run: |
docker pull $(grep -ioP '(?<=^from)\s+\S+' tests/build/Dockerfile.panda_esp) || true
docker pull docker.io/commaai/panda_esp:latest || true
docker build --cache-from docker.io/commaai/panda_esp:latest -t panda_esp -f tests/build/Dockerfile.panda_esp .
- name: Build ESP image
run: docker run --rm panda_esp /bin/sh -c "cd /panda/boardesp && make user1.bin"
- name: Push image
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/panda'
run: |
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN }}
docker tag panda_esp docker.io/commaai/panda_esp:latest
docker push docker.io/commaai/panda_esp:latest
safety:
name: safety
runs-on: ubuntu-16.04
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
exclude: '^(tests/automated)/'
args:
- --select=F,E112,E113,E304,E501,E502,E701,E702,E703,E71,E72,E731,W191,W6
- --exclude=python/esptool.py,tests/gmbitbang/*
- --exclude=tests/gmbitbang/*
- --max-line-length=160
- --statistics
- repo: local
Expand Down
13 changes: 1 addition & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-instal

ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"
RUN pyenv install 3.7.3
RUN pyenv install 2.7.12
RUN pyenv global 3.7.3
RUN pyenv rehash

Expand All @@ -68,16 +67,6 @@ ENV HOME /home/batman

ENV PYTHONPATH /tmp:$PYTHONPATH

COPY ./boardesp/get_sdk_ci.sh /tmp/panda/boardesp/
COPY ./boardesp/python2_make.py /tmp/panda/boardesp/

COPY ./panda_jungle /tmp/panda_jungle

RUN useradd --system -s /sbin/nologin pandauser
RUN mkdir -p /tmp/panda/boardesp/esp-open-sdk
RUN chown pandauser /tmp/panda/boardesp/esp-open-sdk
USER pandauser
RUN cd /tmp/panda/boardesp && ./get_sdk_ci.sh
USER root
RUN cd /tmp && git clone https://github.com/commaai/panda_jungle.git

ADD ./panda.tar.gz /tmp/panda
26 changes: 3 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,19 @@ pipeline {
steps {
timeout(time: 60, unit: 'MINUTES') {
script {
try {
sh 'cp -R /home/batman/panda_jungle .'
} catch (err) {
echo "Folder already exists"
}
sh 'git archive -v -o panda.tar.gz --format=tar.gz HEAD'
dockerImage = docker.build("${env.DOCKER_IMAGE_TAG}")
}
}
}
}
stage('Test Dev Build (no WIFI)') {
stage('Test Dev Build') {
steps {
lock(resource: "Pandas", inversePrecedence: true, quantity: 1){
timeout(time: 60, unit: 'MINUTES') {
script {
sh "docker run --name ${env.DOCKER_NAME} --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'cd /tmp/panda; SKIPWIFI=1 ./run_automated_tests.sh'"
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_dev_nowifi.xml"
sh "docker run --name ${env.DOCKER_NAME} --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'cd /tmp/panda; ./run_automated_tests.sh'"
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_dev.xml"
sh "docker rm ${env.DOCKER_NAME}"
}
}
Expand All @@ -51,21 +46,6 @@ pipeline {
}
}
}
/*
stage('Test Dev Build (WIFI)') {
steps {
lock(resource: "Pandas", inversePrecedence: true, quantity: 1){
timeout(time: 60, unit: 'MINUTES') {
script {
sh "docker run --name ${env.DOCKER_NAME} --privileged --volume /dev/bus/usb:/dev/bus/usb --volume /var/run/dbus:/var/run/dbus --net host ${env.DOCKER_IMAGE_TAG} bash -c 'cd /tmp/panda; ./run_automated_tests.sh'"
sh "docker cp ${env.DOCKER_NAME}:/tmp/panda/nosetests.xml test_results_dev.xml"
sh "docker rm ${env.DOCKER_NAME}"
}
}
}
}
}
*/
}
post {
failure {
Expand Down
19 changes: 6 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

<img src="https://github.com/commaai/panda/blob/master/buy.png"></a>

It supports 3x CAN, 2x LIN, and 1x GMLAN. It also charges a phone. On the computer side, it has both USB and Wi-Fi.
It supports 3x CAN, 2x LIN, and 1x GMLAN. It also charges a phone. On the computer side, it has USB.

It uses an [STM32F413](http://www.st.com/en/microcontrollers/stm32f413-423.html?querycriteria=productId=LN2004) for low level stuff and an [ESP8266](https://en.wikipedia.org/wiki/ESP8266) for Wi-Fi. They are connected over high speed SPI, so the panda is actually capable of dumping the full contents of the busses over Wi-Fi, unlike every other dongle on amazon. ELM327 is weak, panda is strong.
It uses an [STM32F413](http://www.st.com/en/microcontrollers/stm32f413-423.html?querycriteria=productId=LN2004).

It is 2nd gen hardware, reusing code and parts from the [NEO](https://github.com/commaai/neo) interface board.

Expand Down Expand Up @@ -56,30 +56,23 @@ As a universal car interface, it should support every reasonable software interf

- [User space](https://github.com/commaai/panda/tree/master/python)
- [socketcan in kernel](https://github.com/commaai/panda/tree/master/drivers/linux) (alpha)
- [ELM327](https://github.com/commaai/panda/blob/master/boardesp/elm327.c)
- [Windows J2534](https://github.com/commaai/panda/tree/master/drivers/windows)

## Directory structure

- board -- Code that runs on the STM32
- boardesp -- Code that runs on the ESP8266
- drivers -- Drivers (not needed for use with python)
- python   -- Python userspace library for interfacing with the panda
- tests -- Tests and helper programs for panda

## Programming over USB

[Programming the Board (STM32)](board/README.md)

[Programming the ESP](boardesp/README.md)
## Programming

See `board/README.md`

## Debugging

To print out the serial console from the STM32, run `tests/debug_console.py`

To print out the serial console from the ESP8266, run `PORT=1 tests/debug_console.py`

## Safety Model

When a panda powers up, by default it's in `SAFETY_SILENT` mode. While in `SAFETY_SILENT` mode, the buses are also forced to be silent. In order to send messages, you have to select a safety mode. Currently, setting safety modes is only supported over USB. Some of safety modes (for example `SAFETY_ALLOUTPUT`) are disabled in release firmwares. In order to use them, compile and flash your own build.
Expand All @@ -100,8 +93,8 @@ These are the [CI regression tests](https://github.com/commaai/panda/actions) we
* A recorded drive for each supported car variant is [replayed through the safety logic](https://github.com/commaai/panda/tree/master/tests/safety_replay)
to ensure that the behavior remains unchanged.
* An internal Hardware-in-the-loop test, which currently only runs on pull requests opened by comma.ai's organization members, verifies the following functionalities:
* compiling the code in various configuration and flashing it both through USB and WiFi.
* Receiving, sending and forwarding CAN messages on all buses, over USB and WiFi.
* compiling the code in various configuration and flashing it both through USB.
* Receiving, sending and forwarding CAN messages on all buses, over USB.

In addition, we run the [pylint](https://www.pylint.org/) and [flake8](https://github.com/PyCQA/flake8) linters on all python files within the panda repo.

Expand Down
31 changes: 0 additions & 31 deletions TODO

This file was deleted.

2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# flake8: noqa
# pylint: skip-file
from .python import Panda, PandaWifiStreaming, PandaDFU, ESPROM, CesantaFlasher, flash_release, BASEDIR, ensure_st_up_to_date, build_st, PandaSerial
from .python import Panda, PandaWifiStreaming, PandaDFU, flash_release, BASEDIR, ensure_st_up_to_date, build_st, PandaSerial
12 changes: 0 additions & 12 deletions board/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,10 @@ void detect_board_type(void) {

// ///// Configuration detection ///// //
bool has_external_debug_serial = 0;
bool is_entering_bootmode = 0;

void detect_configuration(void) {
// detect if external serial debugging is present
has_external_debug_serial = detect_with_pull(GPIOA, 3, PULL_DOWN);

#ifdef PANDA
if(hw_type == HW_TYPE_WHITE_PANDA) {
// check if the ESP is trying to put me in boot mode
is_entering_bootmode = !detect_with_pull(GPIOB, 0, PULL_UP);
} else {
is_entering_bootmode = 0;
}
#else
is_entering_bootmode = 0;
#endif
}

// ///// Board functions ///// //
Expand Down
14 changes: 7 additions & 7 deletions board/board_declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ typedef void (*board_enable_can_transciever)(uint8_t transciever, bool enabled);
typedef void (*board_enable_can_transcievers)(bool enabled);
typedef void (*board_set_led)(uint8_t color, bool enabled);
typedef void (*board_set_usb_power_mode)(uint8_t mode);
typedef void (*board_set_esp_gps_mode)(uint8_t mode);
typedef void (*board_set_gps_mode)(uint8_t mode);
typedef void (*board_set_can_mode)(uint8_t mode);
typedef void (*board_usb_power_mode_tick)(uint32_t uptime);
typedef bool (*board_check_ignition)(void);
Expand All @@ -23,7 +23,7 @@ struct board {
board_enable_can_transcievers enable_can_transcievers;
board_set_led set_led;
board_set_usb_power_mode set_usb_power_mode;
board_set_esp_gps_mode set_esp_gps_mode;
board_set_gps_mode set_gps_mode;
board_set_can_mode set_can_mode;
board_usb_power_mode_tick usb_power_mode_tick;
board_check_ignition check_ignition;
Expand Down Expand Up @@ -56,10 +56,10 @@ struct board {
#define USB_POWER_CDP 2U
#define USB_POWER_DCP 3U

// ESP modes
#define ESP_GPS_DISABLED 0U
#define ESP_GPS_ENABLED 1U
#define ESP_GPS_BOOTMODE 2U
// GPS modes
#define GPS_DISABLED 0U
#define GPS_ENABLED 1U
#define GPS_BOOTMODE 2U

// CAN modes
#define CAN_MODE_NORMAL 0U
Expand All @@ -76,4 +76,4 @@ bool board_has_gmlan(void);
bool board_has_obd(void);
bool board_has_lin(void);
bool board_has_rtc(void);
bool board_has_relay(void);
bool board_has_relay(void);
14 changes: 7 additions & 7 deletions board/boards/black.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ void black_set_usb_power_mode(uint8_t mode) {
}
}

void black_set_esp_gps_mode(uint8_t mode) {
void black_set_gps_mode(uint8_t mode) {
switch (mode) {
case ESP_GPS_DISABLED:
case GPS_DISABLED:
// GPS OFF
set_gpio_output(GPIOC, 14, 0);
set_gpio_output(GPIOC, 5, 0);
break;
case ESP_GPS_ENABLED:
case GPS_ENABLED:
// GPS ON
set_gpio_output(GPIOC, 14, 1);
set_gpio_output(GPIOC, 5, 1);
break;
case ESP_GPS_BOOTMODE:
case GPS_BOOTMODE:
set_gpio_output(GPIOC, 14, 1);
set_gpio_output(GPIOC, 5, 0);
break;
default:
puts("Invalid ESP/GPS mode\n");
puts("Invalid GPS mode\n");
break;
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ void black_init(void) {
set_gpio_mode(GPIOC, 3, MODE_ANALOG);

// Set default state of GPS
current_board->set_esp_gps_mode(ESP_GPS_ENABLED);
current_board->set_gps_mode(GPS_ENABLED);

// C10: OBD_SBU1_RELAY (harness relay driving output)
// C11: OBD_SBU2_RELAY (harness relay driving output)
Expand Down Expand Up @@ -240,7 +240,7 @@ const board board_black = {
.enable_can_transcievers = black_enable_can_transcievers,
.set_led = black_set_led,
.set_usb_power_mode = black_set_usb_power_mode,
.set_esp_gps_mode = black_set_esp_gps_mode,
.set_gps_mode = black_set_gps_mode,
.set_can_mode = black_set_can_mode,
.usb_power_mode_tick = black_usb_power_mode_tick,
.check_ignition = black_check_ignition,
Expand Down
4 changes: 2 additions & 2 deletions board/boards/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void common_init_gpio(void){
set_gpio_alternate(GPIOA, 12, GPIO_AF10_OTG_FS);
GPIOA->OSPEEDR = GPIO_OSPEEDER_OSPEEDR11 | GPIO_OSPEEDER_OSPEEDR12;

// A9,A10: USART 1 for talking to the ESP / GPS
// A9,A10: USART 1 for talking to the GPS
set_gpio_alternate(GPIOA, 9, GPIO_AF7_USART1);
set_gpio_alternate(GPIOA, 10, GPIO_AF7_USART1);

Expand Down Expand Up @@ -81,4 +81,4 @@ bool detect_with_pull(GPIO_TypeDef *GPIO, int pin, int mode) {
bool ret = get_gpio_input(GPIO, pin);
set_gpio_pullup(GPIO, pin, PULL_NONE);
return ret;
}
}
4 changes: 2 additions & 2 deletions board/boards/dos.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void dos_set_usb_power_mode(uint8_t mode) {
dos_set_bootkick(mode == USB_POWER_CDP);
}

void dos_set_esp_gps_mode(uint8_t mode) {
void dos_set_gps_mode(uint8_t mode) {
UNUSED(mode);
}

Expand Down Expand Up @@ -217,7 +217,7 @@ const board board_dos = {
.enable_can_transcievers = dos_enable_can_transcievers,
.set_led = dos_set_led,
.set_usb_power_mode = dos_set_usb_power_mode,
.set_esp_gps_mode = dos_set_esp_gps_mode,
.set_gps_mode = dos_set_gps_mode,
.set_can_mode = dos_set_can_mode,
.usb_power_mode_tick = dos_usb_power_mode_tick,
.check_ignition = dos_check_ignition,
Expand Down
12 changes: 6 additions & 6 deletions board/boards/grey.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ void grey_init(void) {
white_grey_common_init();

// Set default state of GPS
current_board->set_esp_gps_mode(ESP_GPS_ENABLED);
current_board->set_gps_mode(GPS_ENABLED);
}

void grey_set_esp_gps_mode(uint8_t mode) {
void grey_set_gps_mode(uint8_t mode) {
switch (mode) {
case ESP_GPS_DISABLED:
case GPS_DISABLED:
// GPS OFF
set_gpio_output(GPIOC, 14, 0);
set_gpio_output(GPIOC, 5, 0);
break;
case ESP_GPS_ENABLED:
case GPS_ENABLED:
// GPS ON
set_gpio_output(GPIOC, 14, 1);
set_gpio_output(GPIOC, 5, 1);
break;
case ESP_GPS_BOOTMODE:
case GPS_BOOTMODE:
set_gpio_output(GPIOC, 14, 1);
set_gpio_output(GPIOC, 5, 0);
break;
Expand All @@ -41,7 +41,7 @@ const board board_grey = {
.enable_can_transcievers = white_enable_can_transcievers,
.set_led = white_set_led,
.set_usb_power_mode = white_set_usb_power_mode,
.set_esp_gps_mode = grey_set_esp_gps_mode,
.set_gps_mode = grey_set_gps_mode,
.set_can_mode = white_set_can_mode,
.usb_power_mode_tick = white_usb_power_mode_tick,
.check_ignition = white_check_ignition,
Expand Down
Loading

0 comments on commit 8b41ed3

Please sign in to comment.