Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uart pm25 wip #547

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 46 additions & 6 deletions .github/workflows/build-clang-doxy.yml
Expand Up @@ -52,6 +52,11 @@ jobs:
git clone --quiet https://github.com/adafruit/Adafruit_TouchScreen.git /home/runner/Arduino/libraries/Adafruit_TouchScreen
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: Enable Debug flag for libraries
run: |
# BusIO
git clone --quiet https://github.com/adafruit/Adafruit_BusIO.git /home/runner/Arduino/libraries/Adafruit_BusIO
sed -i 's/\/\/#define DEBUG_SERIAL Serial/#define DEBUG_SERIAL Serial/g' /home/runner/Arduino/libraries/Adafruit_BusIO/*.cpp
- name: Download and install stable Nanopb
run: |
# Download and extract nanopb
Expand All @@ -70,7 +75,7 @@ jobs:
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000
- name: list
run: |
ls
ls -R
ls examples/*/build/
- name: Rename build artifacts to reflect the platform name
run: |
Expand Down Expand Up @@ -120,6 +125,11 @@ jobs:
run: |
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/pstolarz/OneWireNg.git /home/runner/Arduino/libraries/OneWireNg
- name: Enable Debug flag for libraries
run: |
# BusIO
git clone --quiet https://github.com/adafruit/Adafruit_BusIO.git /home/runner/Arduino/libraries/Adafruit_BusIO
sed -i 's/\/\/#define DEBUG_SERIAL Serial/#define DEBUG_SERIAL Serial/g' /home/runner/Arduino/libraries/Adafruit_BusIO/*.cpp
- name: Download and install stable Nanopb
run: |
# Download and extract nanopb
Expand All @@ -135,6 +145,7 @@ jobs:
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000
- name: Check artifacts
run: |
ls -R
ls examples/Wippersnapper_demo/build/*
- name: Rename build artifacts to reflect the platform name
run: |
Expand Down Expand Up @@ -216,6 +227,11 @@ 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
- name: Enable Debug flag for libraries
run: |
# BusIO
git clone --quiet https://github.com/adafruit/Adafruit_BusIO.git /home/runner/Arduino/libraries/Adafruit_BusIO
sed -i 's/\/\/#define DEBUG_SERIAL Serial/#define DEBUG_SERIAL Serial/g' /home/runner/Arduino/libraries/Adafruit_BusIO/*.cpp
- name: Download and install stable Nanopb
run: |
# Download and extract nanopb
Expand Down Expand Up @@ -266,6 +282,11 @@ 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
- name: Enable Debug flag for libraries
run: |
# BusIO
git clone --quiet https://github.com/adafruit/Adafruit_BusIO.git /home/runner/Arduino/libraries/Adafruit_BusIO
sed -i 's/\/\/#define DEBUG_SERIAL Serial/#define DEBUG_SERIAL Serial/g' /home/runner/Arduino/libraries/Adafruit_BusIO/*.cpp
- name: Download and install stable Nanopb
run: |
# Download and extract nanopb
Expand Down Expand Up @@ -317,6 +338,11 @@ jobs:
git clone --quiet https://github.com/arduino-libraries/Servo.git /home/runner/Arduino/libraries/Servo
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
- name: Enable Debug flag for libraries
run: |
# BusIO
git clone --quiet https://github.com/adafruit/Adafruit_BusIO.git /home/runner/Arduino/libraries/Adafruit_BusIO
sed -i 's/\/\/#define DEBUG_SERIAL Serial/#define DEBUG_SERIAL Serial/g' /home/runner/Arduino/libraries/Adafruit_BusIO/*.cpp
- name: Download and install stable Nanopb
run: |
# Download and extract nanopb
Expand Down Expand Up @@ -355,6 +381,11 @@ jobs:
run: |
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
- name: Enable Debug flag for libraries
run: |
# BusIO
git clone --quiet https://github.com/adafruit/Adafruit_BusIO.git /home/runner/Arduino/libraries/Adafruit_BusIO
sed -i 's/\/\/#define DEBUG_SERIAL Serial/#define DEBUG_SERIAL Serial/g' /home/runner/Arduino/libraries/Adafruit_BusIO/*.cpp
- name: Download and install stable Nanopb
run: |
# Download and extract nanopb
Expand All @@ -367,7 +398,7 @@ jobs:
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000
- name: list build artifacts
run: |
ls
ls -R
ls examples/*
- name: Rename build artifacts to reflect the platform name
run: |
Expand All @@ -390,7 +421,7 @@ jobs:
strategy:
fail-fast: false
matrix:
arduino-platform: ["feather_esp32s2_debug", "feather_esp32s2_tft_debug",
arduino-platform: ["feather_esp32s2_debug", "feather_esp32s2_tft_debug", "feather_esp32s3_reverse_tft_debug",
"feather_esp32s3_debug", "feather_esp32s3_4mbflash_2mbpsram_debug", "feather_esp32s3_tft_debug"]
steps:
- uses: actions/setup-python@v4
Expand All @@ -405,6 +436,7 @@ jobs:
- uses: actions/checkout@v4
with:
repository: adafruit/ci-arduino
ref: add-itsybitsy-rp2040
path: ci
- name: Install CI-Arduino
run: bash ci/actions_install.sh
Expand All @@ -413,12 +445,18 @@ jobs:
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/pstolarz/OneWireNg.git /home/runner/Arduino/libraries/OneWireNg
git clone --quiet https://github.com/adafruit/Adafruit_HX8357_Library.git /home/runner/Arduino/libraries/Adafruit_HX8357_Library
git clone --quiet https://github.com/adafruit/Adafruit_VCNL4020.git /home/runner/Arduino/libraries/Adafruit_VCNL4020
git clone --quiet https://github.com/adafruit/Adafruit_ILI9341.git /home/runner/Arduino/libraries/Adafruit_ILI9341
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 --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: Enable Debug flag for libraries
run: |
# BusIO
git clone --quiet https://github.com/adafruit/Adafruit_BusIO.git /home/runner/Arduino/libraries/Adafruit_BusIO
sed -i 's/\/\/#define DEBUG_SERIAL Serial/#define DEBUG_SERIAL Serial/g' /home/runner/Arduino/libraries/Adafruit_BusIO/*.cpp
- name: Download and install stable Nanopb
run: |
# Download and extract nanopb
Expand All @@ -437,21 +475,23 @@ jobs:
run: python3 ci/build_platform.py ${{ matrix.arduino-platform }} --build_timeout 48000
- name: list
run: |
ls
ls -R
ls examples/*/build/
- name: Rename build artifacts to reflect the platform name
run: |
mv examples/*/build/*/wippersnapper_debug.ino.uf2 wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.uf2
mv examples/*/build/*/wippersnapper_debug.ino.bin wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.bin
mv examples/*/build/*/wippersnapper_debug.ino.elf wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.elf
mv examples/*/build/*/wippersnapper_debug.ino.map wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.map
- name: upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build-files-dev
path: |
wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.uf2
wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.bin


wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.elf
wippersnapper.${{ matrix.arduino-platform }}.${{ env.WS_VERSION }}.map

clang_and_doxy:
runs-on: ubuntu-latest
Expand Down
@@ -0,0 +1 @@

21 changes: 5 additions & 16 deletions examples/Wippersnapper_demo/Wippersnapper_demo.ino
@@ -1,17 +1,5 @@
// Adafruit IO WipperSnapper Beta
//
//
// NOTE: This software is a BETA release and in active development.
// Please report bugs or errors to https://github.com/adafruit/Adafruit_Wippersnapper_Arduino/issues
//
//
// Adafruit invests time and resources providing this open source code.
// Please support Adafruit and open source hardware by purchasing
// products from Adafruit!
//
// Brent Rubell for Adafruit Industries, 2021-2022
//
// All text above must be included in any redistribution.
// Adafruit IO WipperSnapper Beta (DEBUG BUILD ONLY!)
// Brent Rubell for Adafruit Industries, 2021 - 2023

#include "Wippersnapper_Networking.h"
Wippersnapper_WiFi wipper;
Expand All @@ -23,11 +11,12 @@ void setup() {
// Provisioning must occur prior to serial init.
wipper.provision();

Serial.begin(115200);
Serial.begin(115200); // wippersnapper serial
// Serial1.begin(115200); // ESP-IDF messages serial
// Serial1.setDebugOutput(true); // Enable ESP-IDF messages over Serial1
//while (!Serial) delay(10);

wipper.connect();

}

void loop() {
Expand Down
@@ -0,0 +1 @@

33 changes: 32 additions & 1 deletion src/components/uart/drivers/ws_uart_drv_pm25aqi.h
Expand Up @@ -106,7 +106,38 @@ class ws_uart_drv_pm25aqi : public ws_uart_drv {
// Attempt to read the PM2.5 Sensor
if (!_aqi->read(&_data)) {
Serial.println("[UART, PM25] Data not available.");
delay(500);
#ifdef USE_SW_UART
if (_swSerial->available()) {
WS_DEBUG_PRINTLN("[UART, PM25] Flushing Software Serial..");
_swSerial->flush();
WS_DEBUG_PRINTLN("[UART, PM25] Uart Available. Attempting to clear write errors");
_swSerial->clearWriteError();
} else {
WS_DEBUG_PRINTLN("[UART, PM25] Uart Unavailable. Attempting to clear write errors");
_swSerial->clearWriteError();
if (!_swSerial->isListening()) {
WS_DEBUG_PRINTLN("[UART, PM25] Re-listening on Software Serial..");
_swSerial->listen();
}
// delay(500);
}
#else
WS_DEBUG_PRINTLN("[UART, PM25] Setting Hardware Serial to debug mode..");
_hwSerial->setDebugOutput(true);
if (_hwSerial->available()) {
WS_DEBUG_PRINTLN("[UART, PM25] Uart available, flushing Hardware Serial..");
_hwSerial->flush();
WS_DEBUG_PRINTLN("[UART, PM25] Uart available, clearing write errors..");
_hwSerial->clearWriteError();
WS_DEBUG_PRINTLN("[UART, PM25] Uart available, resetting event queue..");
_hwSerial->eventQueueReset();
} else {
WS_DEBUG_PRINTLN("[UART, PM25] Uart Unavailable. Attempting to reset event queue...");
_hwSerial->eventQueueReset();
WS_DEBUG_PRINTLN("[UART, PM25] Uart Unavailable. Attempting to clear write errors");
_hwSerial->clearWriteError();
}
#endif
return false;
}
Serial.println("[UART, PM25] Read data OK");
Expand Down