From a5e68f0f8bde45792606022c73526f3d24db0c8d Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 11:46:50 -0400 Subject: [PATCH 1/8] add fix for tinyusb enumeration bug --- .github/workflows/build-clang-doxy.yml | 5 +++++ library.properties | 4 ++-- platformio.ini | 2 +- src/Wippersnapper.h | 2 +- src/provisioning/tinyusb/Wippersnapper_FS.cpp | 10 ++++++++-- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 672198375..5dbf7a89f 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -51,6 +51,7 @@ jobs: git clone --quiet https://github.com/adafruit/Adafruit_STMPE610.git /home/runner/Arduino/libraries/Adafruit_STMPE610 git clone --quiet https://github.com/adafruit/Adafruit-ST7735-Library.git /home/runner/Arduino/libraries/Adafruit-ST7735-Library git clone --quiet https://github.com/adafruit/Adafruit_TouchScreen.git /home/runner/Arduino/libraries/Adafruit_TouchScreen + git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino git clone --depth 1 --branch wippersnapper https://github.com/brentru/lvgl.git /home/runner/Arduino/libraries/lvgl git clone --depth 1 --branch development https://github.com/brentru/Adafruit_LvGL_Glue.git /home/runner/Arduino/libraries/Adafruit_LittlevGL_Glue_Library - name: Download and install stable Nanopb @@ -188,6 +189,7 @@ jobs: git clone --quiet https://github.com/adafruit/Adafruit_STMPE610.git /home/runner/Arduino/libraries/Adafruit_STMPE610 git clone --quiet https://github.com/adafruit/Adafruit-ST7735-Library.git /home/runner/Arduino/libraries/Adafruit-ST7735-Library git clone --quiet https://github.com/adafruit/Adafruit_TouchScreen.git /home/runner/Arduino/libraries/Adafruit_TouchScreen + git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino git clone --depth 1 --branch wippersnapper https://github.com/brentru/lvgl.git /home/runner/Arduino/libraries/lvgl git clone --depth 1 --branch development https://github.com/brentru/Adafruit_LvGL_Glue.git /home/runner/Arduino/libraries/Adafruit_LittlevGL_Glue_Library - name: Download and install stable Nanopb @@ -373,6 +375,7 @@ jobs: git clone --quiet https://github.com/adafruit/WiFiNINA.git /home/runner/Arduino/libraries/WiFiNINA git clone --quiet https://github.com/milesburton/Arduino-Temperature-Control-Library.git /home/runner/Arduino/libraries/Arduino-Temperature-Control-Library git clone --quiet https://github.com/PaulStoffregen/OneWire.git /home/runner/Arduino/libraries/OneWire + git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino - name: Download and install stable Nanopb run: | # Download and extract nanopb @@ -423,6 +426,7 @@ jobs: run: | git clone --quiet https://github.com/pstolarz/OneWireNg.git /home/runner/Arduino/libraries/OneWireNg git clone --quiet https://github.com/pstolarz/Arduino-Temperature-Control-Library.git /home/runner/Arduino/libraries/Arduino-Temperature-Control-Library + git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino - name: Download and install stable Nanopb run: | # Download and extract nanopb @@ -579,6 +583,7 @@ jobs: git clone --quiet https://github.com/adafruit/Adafruit_STMPE610.git /home/runner/Arduino/libraries/Adafruit_STMPE610 git clone --quiet https://github.com/adafruit/Adafruit-ST7735-Library.git /home/runner/Arduino/libraries/Adafruit-ST7735-Library git clone --quiet https://github.com/adafruit/Adafruit_TouchScreen.git /home/runner/Arduino/libraries/Adafruit_TouchScreen + git clone --quiet https://github.com/adafruit/Adafruit_TinyUSB_Arduino /home/runner/Arduino/libraries/Adafruit_TinyUSB_Arduino git clone --depth 1 --branch wippersnapper https://github.com/brentru/lvgl.git /home/runner/Arduino/libraries/lvgl git clone --depth 1 --branch development https://github.com/brentru/Adafruit_LvGL_Glue.git /home/runner/Arduino/libraries/Adafruit_LittlevGL_Glue_Library - name: Download and install stable Nanopb diff --git a/library.properties b/library.properties index 1aa7a2725..b9b3197d5 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Adafruit WipperSnapper -version=1.0.0-alpha.89 +version=1.0.0-alpha.90 author=Adafruit maintainer=Adafruit sentence=Arduino application for Adafruit.io WipperSnapper @@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper category=Communication url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino architectures=* -depends=Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit INA219, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit TinyUSB Library, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork +depends=Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit INA219, Adafruit LTR329 and LTR303, Adafruit LTR390 Library, Adafruit MCP3421, Adafruit NAU7802 Library, Adafruit SleepyDog Library, Adafruit TMP117, Adafruit AHTX0, Adafruit BME280 Library, Adafruit BMP280 Library, Adafruit BMP3XX Library, Adafruit DPS310, Adafruit DS248x, Adafruit SCD30, Adafruit SGP30 Sensor, Adafruit SGP40 Sensor, Sensirion I2C SCD4x, Sensirion I2C SEN5X, arduino-sht, Adafruit Si7021 Library, Adafruit MQTT Library, Adafruit MS8607, Adafruit MCP9808 Library, Adafruit MCP9600 Library, Adafruit MPL115A2, Adafruit MPRLS Library, Adafruit TSL2591 Library, Adafruit_VL53L0X, Adafruit VL53L1X, STM32duino VL53L4CD, STM32duino VL53L4CX, Adafruit_VL6180X, Adafruit PM25 AQI Sensor, Adafruit VCNL4020 Library, Adafruit VCNL4040, Adafruit VEML7700 Library, Adafruit LC709203F, Adafruit LPS2X, Adafruit LPS35HW, Adafruit seesaw Library, Adafruit BME680 Library, Adafruit MAX1704X, Adafruit ADT7410 Library, Adafruit HTS221, Adafruit HTU21DF Library, Adafruit HTU31D Library, Adafruit PCT2075, hp_BH1750, ENS160 - Adafruit Fork diff --git a/platformio.ini b/platformio.ini index 87ff73c73..05ac613fd 100644 --- a/platformio.ini +++ b/platformio.ini @@ -17,7 +17,7 @@ monitor_speed = 115200 lib_compat_mode = strict lib_deps = adafruit/Adafruit Zero DMA Library - adafruit/Adafruit TinyUSB Library + https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git adafruit/Adafruit NeoPixel adafruit/Adafruit SPIFlash adafruit/Adafruit DotStar diff --git a/src/Wippersnapper.h b/src/Wippersnapper.h index fc4d41928..bdc18fa54 100644 --- a/src/Wippersnapper.h +++ b/src/Wippersnapper.h @@ -142,7 +142,7 @@ #endif #define WS_VERSION \ - "1.0.0-alpha.89" ///< WipperSnapper app. version (semver-formatted) + "1.0.0-alpha.90" ///< WipperSnapper app. version (semver-formatted) // Reserved Adafruit IO MQTT topics #define TOPIC_IO_THROTTLE "/throttle" ///< Adafruit IO Throttle MQTT Topic diff --git a/src/provisioning/tinyusb/Wippersnapper_FS.cpp b/src/provisioning/tinyusb/Wippersnapper_FS.cpp index 3dbbcf4bc..99b7e6604 100644 --- a/src/provisioning/tinyusb/Wippersnapper_FS.cpp +++ b/src/provisioning/tinyusb/Wippersnapper_FS.cpp @@ -209,8 +209,14 @@ void Wippersnapper_FS::initUSBMSC() { // init MSC usb_msc.begin(); - // re-attach the usb device - TinyUSBDevice.attach(); + // If already enumerated, additional class driver begin() e.g msc, hid, midi won't take effect until re-enumeration + if (TinyUSBDevice.mounted()) { + TinyUSBDevice.detach(); + delay(10); + TinyUSBDevice.attach(); + } + + // wait for enumeration delay(500); } From 4e698782eabf442f19a1ff4111890e4239de4afa Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 12:19:19 -0400 Subject: [PATCH 2/8] checkout ref --- .github/workflows/build-clang-doxy.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 5dbf7a89f..7f8f32123 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -156,12 +156,12 @@ jobs: "feather_esp32s2", "feather_esp32s2_tft", "feather_esp32s2_reverse_tft", - "feather_esp32s3", - "feather_esp32s3_4mbflash_2mbpsram", - "feather_esp32s3_tft", + "wippersnapper_feather_esp32s3", + "wippersnapper_feather_esp32s3_4mbflash_2mbpsram", + "wippersnapper_feather_esp32s3_tft", "qtpy_esp32s3", "qtpy_esp32s2", - "feather_esp32s3_reverse_tft", + "wippersnapper_feather_esp32s3_reverse_tft", "qtpy_esp32s3_n4r2", ] steps: @@ -176,8 +176,9 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: brentru/ci-arduino path: ci + ref: fix-fs-enumeration-bug - name: Install CI-Arduino run: bash ci/actions_install.sh - name: Install extra Arduino libraries From b59f126dd07a0f791ae2abe5dd8b719e545a85e9 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 12:23:33 -0400 Subject: [PATCH 3/8] wrong ref! --- .github/workflows/build-clang-doxy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 7f8f32123..9122fb2f3 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -178,7 +178,7 @@ jobs: with: repository: brentru/ci-arduino path: ci - ref: fix-fs-enumeration-bug + ref: add-ws-partition-scheme-targets - name: Install CI-Arduino run: bash ci/actions_install.sh - name: Install extra Arduino libraries From 1236bd025b8c5b60aced83a184e50fa9d5ebcf2b Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 12:49:13 -0400 Subject: [PATCH 4/8] point dev to new ref --- .github/workflows/build-clang-doxy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 9122fb2f3..9a4007cd8 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -258,8 +258,9 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: brentru/ci-arduino path: ci + ref: add-ws-partition-scheme-targets - name: Checkout Board Definitions uses: actions/checkout@v4 with: From bde9d2f5fdbf7471f14c4a2b22bbed08f8fbe925 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 12:58:53 -0400 Subject: [PATCH 5/8] point to new ref --- .github/workflows/build-clang-doxy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index 9a4007cd8..a73dba345 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -572,8 +572,9 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: adafruit/ci-arduino + repository: brentru/ci-arduino path: ci + ref: add-ws-partition-scheme-targets - name: Install CI-Arduino run: bash ci/actions_install.sh - name: Install extra Arduino libraries From ccb12e1e0263ce1080629b52fd1d555991b0bd9d Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 12:59:26 -0400 Subject: [PATCH 6/8] dont point esp32 there! --- .github/workflows/build-clang-doxy.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index a73dba345..eacff38ae 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -258,9 +258,8 @@ jobs: echo >>$GITHUB_ENV WS_VERSION=$(git describe --dirty --tags) - uses: actions/checkout@v4 with: - repository: brentru/ci-arduino + repository: adafruit/ci-arduino path: ci - ref: add-ws-partition-scheme-targets - name: Checkout Board Definitions uses: actions/checkout@v4 with: From 76f3f6aa637e15e42210ecfe3820da6c419a603d Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 13:50:20 -0400 Subject: [PATCH 7/8] rm ws_ --- .github/workflows/build-clang-doxy.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-clang-doxy.yml b/.github/workflows/build-clang-doxy.yml index eacff38ae..67cc35328 100644 --- a/.github/workflows/build-clang-doxy.yml +++ b/.github/workflows/build-clang-doxy.yml @@ -156,12 +156,12 @@ jobs: "feather_esp32s2", "feather_esp32s2_tft", "feather_esp32s2_reverse_tft", - "wippersnapper_feather_esp32s3", - "wippersnapper_feather_esp32s3_4mbflash_2mbpsram", - "wippersnapper_feather_esp32s3_tft", + "feather_esp32s3", + "feather_esp32s3_4mbflash_2mbpsram", + "feather_esp32s3_tft", "qtpy_esp32s3", "qtpy_esp32s2", - "wippersnapper_feather_esp32s3_reverse_tft", + "feather_esp32s3_reverse_tft", "qtpy_esp32s3_n4r2", ] steps: From 420793d1d498483e38ec3a0b2b657b7e7ed771a6 Mon Sep 17 00:00:00 2001 From: brentru Date: Thu, 5 Sep 2024 13:51:34 -0400 Subject: [PATCH 8/8] put back fs --- src/provisioning/tinyusb/Wippersnapper_FS.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/provisioning/tinyusb/Wippersnapper_FS.cpp b/src/provisioning/tinyusb/Wippersnapper_FS.cpp index 99b7e6604..f0ffe23d4 100644 --- a/src/provisioning/tinyusb/Wippersnapper_FS.cpp +++ b/src/provisioning/tinyusb/Wippersnapper_FS.cpp @@ -208,16 +208,8 @@ void Wippersnapper_FS::initUSBMSC() { // init MSC usb_msc.begin(); - - // If already enumerated, additional class driver begin() e.g msc, hid, midi won't take effect until re-enumeration - if (TinyUSBDevice.mounted()) { - TinyUSBDevice.detach(); - delay(10); - TinyUSBDevice.attach(); - } - - - // wait for enumeration + // Attach MSC and wait for enumeration + TinyUSBDevice.attach(); delay(500); }