Skip to content

Commit

Permalink
Added details to readme installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Anforowicz committed Aug 29, 2024
1 parent 6ca0c1e commit 9ca74ba
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 23 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The following lines of boilerplate have to be in your project's
# CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.16)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esp32_socketcand_adapter)
35 changes: 23 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,33 @@ Here's an image of an example setup:
![Example ESP32 Socketcand Translate Setup](socketcand_adapter_labeled.jpg)

## Installation
The *Releases* page contains pre-built `esp32_socketcand_adapter.bin` files.
To flash them onto your ESP32 using
[Esptool](https://docs.espressif.com/projects/esptool/en/latest/esp32/), run this command:

```bash
esptool.py write_flash 0 esp32_socketcand_adapter.bin
```
1. Install [Esptool](https://docs.espressif.com/projects/esptool/en/latest/esp32/)
by running:
```
python -m pip install esptool
```

To monitor log output from the ESP32 on Linux, run: \
(replace "/dev/ttyUSB0" with the port you're using)
2. Download the latest `esp32_socketcand_adapter.bin` file from the
[Releases](https://github.com/wibotic/socketcand_translate/releases) page.

```bash
tail -f /dev/ttyUSB0
```
3. Connect an [Olimex ESP32-EVB](https://www.olimex.com/Products/IoT/ESP32/ESP32-EVB/open-source-hardware)
to your computer with a micro USB cable.

4. Flash your ESP32 by running
```
python -m esptool write_flash 0 esp32_socketcand_adapter.bin
```

5. Optionally, monitor log output on Linux by running:

Note: Flashing will fail if the port is being monitored.
```bash
tail -f /dev/ttyUSB0
```
Replace */dev/ttyUSB0* with the port you're using.
Run `lsusb` to get a list of USB ports.
Note: Flashing will fail if the port is being monitored.
## Build from source
Alternatively, you can build the project yourself.
Expand Down
8 changes: 4 additions & 4 deletions main/persistent_settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ esp_err_t persistent_settings_load() {
err = nvs_get_blob(nvs_handle, "config", &persistent_settings_data,
&config_size);

if (err == ESP_ERR_NVS_NOT_FOUND) {
ESP_LOGW(TAG, "No saved settings detected, so using defaults.");
if (err != ESP_OK) {
ESP_LOGW(TAG, "Couldn't load persistent settings: %s",
esp_err_to_name(err));
ESP_LOGW(TAG, "Using default settings instead.");
persistent_settings_data = persistent_settings_default;
} else {
ESP_RETURN_ON_ERROR(err, TAG, "Couldn't read value from NVS.");
}

nvs_close(nvs_handle);
Expand Down
12 changes: 6 additions & 6 deletions main/status_report.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,22 +308,22 @@ static esp_err_t print_socketcand_status(char *buf_out, size_t buflen,
"{\n"

"\"Total socketcand frames received over TCP\": "
"\"%lld\",\n"
"%lld,\n"

"\"Total invalid socketcand frames received over TCP\": "
"\"%lld\",\n"
"%lld,\n"

"\"Total frames transmitted to CAN bus\": "
"\"%lld\",\n"
"%lld,\n"

"\"Total CAN transmit fails\": "
"\"%lld\",\n"
"%lld,\n"

"\"Total frames received from CAN bus\": "
"\"%lld\",\n"
"%lld,\n"

"\"Total socketcand frames sent over TCP\": "
"\"%lld\"\n"
"%lld\n"

"}",
status.socketcand_frames_received,
Expand Down

0 comments on commit 9ca74ba

Please sign in to comment.