diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 14d305c..1bfe224 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,10 +6,21 @@ on: tags: ['*'] jobs: - build-and-release: + build: runs-on: ubuntu-latest - permissions: - contents: write + strategy: + matrix: + include: + - name: esp32 + target: esp32 + led_builtin: 2 + bsp_config_gpio: 9 + board_specific_init: boards/default.h + - name: xiao-esp32c6 + target: esp32c6 + led_builtin: 8 + bsp_config_gpio: 0 + board_specific_init: boards/xiao_esp32c6.h steps: - name: Checkout @@ -17,11 +28,35 @@ jobs: with: fetch-depth: 1 - - name: Build firmware - run: docker build -t esp-scope-firmware . + - name: Build firmware (${{ matrix.name }}) + run: | + docker build \ + --build-arg TARGET=${{ matrix.target }} \ + --build-arg LED_BUILTIN=${{ matrix.led_builtin }} \ + --build-arg BSP_CONFIG_GPIO=${{ matrix.bsp_config_gpio }} \ + --build-arg BOARD_SPECIFIC_INIT=${{ matrix.board_specific_init }} \ + -t esp-scope-${{ matrix.name }} . - - name: Extract binary - run: docker run --rm esp-scope-firmware cat /workspace/build/esp-scope.bin > esp-scope.bin + - name: Extract binary (${{ matrix.name }}) + run: | + docker run --rm esp-scope-${{ matrix.name }} \ + cat /workspace/build/esp-scope.bin > esp-scope-${{ matrix.name }}.bin + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: esp-scope-${{ matrix.name }} + path: esp-scope-${{ matrix.name }}.bin + + release: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Download all artifacts + uses: actions/download-artifact@v4 - name: Set release tag id: tag @@ -39,4 +74,31 @@ jobs: with: tag_name: ${{ steps.tag.outputs.tag }} prerelease: ${{ steps.tag.outputs.prerelease }} - files: esp-scope.bin + body: | + ## Firmware binaries + + | File | Board | Target | LED GPIO | AP-Mode button GPIO | + |------|-------|--------|----------|---------------------| + | `esp-scope-esp32.bin` | Generic ESP32 | esp32 | 2 | 9 | + | `esp-scope-xiao-esp32c6.bin` | Seeed XIAO ESP32C6 | esp32c6 | 8 (built-in yellow LED) | 0 (Boot button) | + + ## Flashing + + ### Browser (easiest) + + Download the `.bin` for your board above, then flash it in your browser — no drivers or tools needed: + + 👉 **[https://www.espboards.dev/tools/program/](https://www.espboards.dev/tools/program/)** + + Works with Chrome, Edge, or Opera. Connect your ESP via USB, click **Connect to ESP**, select the `.bin` file, and flash. + + ### Command line + + ```bash + esptool.py -p write_flash 0x0 esp-scope-.bin + ``` + + Replace `` with your serial port (e.g. `/dev/ttyUSB0` or `COM3`). + files: | + esp-scope-esp32/esp-scope-esp32.bin + esp-scope-xiao-esp32c6/esp-scope-xiao-esp32c6.bin diff --git a/Dockerfile b/Dockerfile index 9caa84d..80ea53b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM espressif/idf:v5.5 AS firmware-builder SHELL ["/bin/bash", "-c"] +ARG TARGET=esp32 ARG LED_BUILTIN=2 ARG BSP_CONFIG_GPIO=9 ARG BOARD_SPECIFIC_INIT="boards/default.h" @@ -12,4 +13,4 @@ WORKDIR /workspace RUN sed -i "s/^CONFIG_LED_BUILTIN=.*/CONFIG_LED_BUILTIN=${LED_BUILTIN}/" sdkconfig.defaults && \ sed -i "s/^CONFIG_BSP_CONFIG_GPIO=.*/CONFIG_BSP_CONFIG_GPIO=${BSP_CONFIG_GPIO}/" sdkconfig.defaults && \ sed -i "s|^CONFIG_BOARD_SPECIFIC_INIT=.*|CONFIG_BOARD_SPECIFIC_INIT=\"${BOARD_SPECIFIC_INIT}\"|" sdkconfig.defaults -RUN source /opt/esp/idf/export.sh > /dev/null 2>&1 && idf.py set-target esp32 && idf.py build +RUN source /opt/esp/idf/export.sh > /dev/null 2>&1 && idf.py set-target ${TARGET} && idf.py build diff --git a/README.md b/README.md index a9555c6..2f4e93d 100644 --- a/README.md +++ b/README.md @@ -71,9 +71,10 @@ If you don't have ESP-IDF installed locally, you can build the firmware using th Optionally override board-specific config values: ```bash docker build \ + --build-arg TARGET=esp32c6 \ --build-arg LED_BUILTIN=8 \ --build-arg BSP_CONFIG_GPIO=0 \ - --build-arg BOARD_SPECIFIC_INIT="boards/xiao-esp32c6.h" \ + --build-arg BOARD_SPECIFIC_INIT="boards/xiao_esp32c6.h" \ -t esp-scope-firmware . ``` diff --git a/main/main.c b/main/main.c index 86ce728..421d464 100644 --- a/main/main.c +++ b/main/main.c @@ -40,11 +40,14 @@ static void start_webserver(void); #define ADC_ATTEN ADC_ATTEN_DB_11 #define ADC_BIT_WIDTH ADC_BITWIDTH_12 -// TYPE2 is only available on newer chips (S3, C6, etc.). ESP32 (WROOM-32) requires TYPE1. -// #define ADC_OUTPUT_TYPE ADC_DIGI_OUTPUT_FORMAT_TYPE2 -// #define ADC_GET_DATA(p_data) ((p_data)->type2.data) +// TYPE1 is used on original ESP32. Newer chips (S3, C6, etc.) use TYPE2. +#if defined(CONFIG_IDF_TARGET_ESP32) #define ADC_OUTPUT_TYPE ADC_DIGI_OUTPUT_FORMAT_TYPE1 #define ADC_GET_DATA(p_data) ((p_data)->type1.data) +#else +#define ADC_OUTPUT_TYPE ADC_DIGI_OUTPUT_FORMAT_TYPE2 +#define ADC_GET_DATA(p_data) ((p_data)->type2.data) +#endif /* * Web Server Configuration