Skip to content

Commit 570c166

Browse files
committed
Merge remote-tracking branch 'upstream/uat-xmas2024'
Closes #661 Closes #664 Closes #668 Closes #670 Closes #672 Closes #673
2 parents 9af3867 + 0923b82 commit 570c166

21 files changed

+493
-221
lines changed

.github/workflows/build-clang-doxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ jobs:
498498
strategy:
499499
fail-fast: false
500500
matrix:
501-
arduino-platform: ["picow_rp2040_tinyusb"]
501+
arduino-platform: ["picow_rp2040_tinyusb", "picow_rp2350_tinyusb"]
502502
steps:
503503
- uses: actions/setup-python@v5
504504
with:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ paragraph=Arduino application for Adafruit.io WipperSnapper
77
category=Communication
88
url=https://github.com/adafruit/Adafruit_Wippersnapper_Arduino
99
architectures=*
10-
depends=Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, 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
10+
depends=Adafruit NeoPixel, Adafruit SPIFlash, ArduinoJson, Adafruit DotStar, Adafruit HDC302x, 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 VCNL4200 Library, 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

platformio.ini

Lines changed: 105 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@ framework = arduino
1616
monitor_speed = 115200
1717
lib_compat_mode = strict
1818
lib_deps =
19+
;;;;;;;;;;; FunHouse / LVGL Boards uncomment these ;;;;;;;;;;;;;;
20+
; https://github.com/adafruit/Adafruit_HX8357_Library.git
21+
; https://github.com/adafruit/Adafruit_ILI9341.git
22+
; https://github.com/adafruit/Adafruit_STMPE610.git
23+
; https://github.com/adafruit/Adafruit-ST7735-Library.git
24+
; https://github.com/adafruit/Adafruit_TouchScreen.git
25+
; https://github.com/brentru/lvgl.git#wippersnapper
26+
; https://github.com/brentru/Adafruit_LvGL_Glue.git#development
27+
;;;;;;;;;;; All Boards need these libraries included ;;;;;;;;;;;;;;
1928
adafruit/Adafruit Zero DMA Library
20-
https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git
2129
adafruit/Adafruit NeoPixel
2230
adafruit/Adafruit SPIFlash
2331
adafruit/Adafruit DotStar
@@ -43,6 +51,7 @@ lib_deps =
4351
adafruit/Adafruit Si7021 Library
4452
adafruit/Adafruit VCNL4020 Library
4553
adafruit/Adafruit VCNL4040
54+
adafruit/Adafruit VCNL4200 Library
4655
adafruit/Adafruit MCP3421
4756
adafruit/Adafruit MCP9808 Library
4857
adafruit/Adafruit MCP9600 Library
@@ -78,14 +87,8 @@ lib_deps =
7887
https://github.com/Sensirion/arduino-i2c-sen5x.git
7988
https://github.com/adafruit/WiFiNINA.git
8089
https://github.com/Starmbi/hp_BH1750.git
81-
;;;;;;;;;;; FunHouse / LVGL Boards ;;;;;;;;;;;;;;
82-
https://github.com/adafruit/Adafruit_HX8357_Library.git
83-
https://github.com/adafruit/Adafruit_ILI9341.git
84-
https://github.com/adafruit/Adafruit_STMPE610.git
85-
https://github.com/adafruit/Adafruit-ST7735-Library.git
86-
https://github.com/adafruit/Adafruit_TouchScreen.git
87-
https://github.com/brentru/lvgl.git#wippersnapper
88-
https://github.com/brentru/Adafruit_LvGL_Glue.git#development
90+
https://github.com/adafruit/Adafruit_TinyUSB_Arduino.git
91+
8992

9093

9194
; Common build environment for ESP32 platform
@@ -107,12 +110,13 @@ platform = atmelsam
107110
platform_packages =
108111
platformio/framework-arduino-samd-adafruit@^1.7.13
109112
platformio/tool-jlink@^1.78811.0
110-
lib_ldf_mode = deep
113+
lib_ldf_mode = chain+
114+
lib_compat_mode = strict
111115
lib_archive = no ; debug timer issues see https://community.platformio.org/t/choose-usb-stack-as-tiny-usb/22451/5
112-
lib_ignore = OneWire
116+
lib_ignore = OneWire, USBHost
113117

114118
[common:rp2040]
115-
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
119+
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
116120
; platform_packages =
117121
; framework-arduinopico @ symlink:///Users/tyeth/Projects/arduino-pico
118122
; framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#master
@@ -408,7 +412,23 @@ extra_scripts = pre:rename_usb_config.py
408412
[env:huzzah]
409413
extends=common:esp8266
410414
board = huzzah
411-
build_flags = -DARDUINO_ESP8266_ADAFRUIT_HUZZAH
415+
board_build.f_cpu = 80000000L
416+
; Arduino CLI uses this from adafruit_ci#ci-wippersnapper
417+
; esp8266:esp8266:huzzah:xtal=80,vt=flash,exception=disabled,stacksmash=disabled,ssl=all,mmu=3232,non32xfer=fast,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200
418+
build_flags =
419+
-Wl,--gc-sections
420+
-Wl,-Map=output.map
421+
-DARDUINO_ESP8266_ADAFRUIT_HUZZAH
422+
-DDEBUG_ESP_PORT=Serial
423+
-DVTABLES_IN_FLASH
424+
-DNO_EXCEPTIONS
425+
-DNO_STACK_SMASH_PROTECTION
426+
-DSSL_ALL
427+
-DMMU_3232
428+
-DNON32XFER_FAST
429+
-DDEBUG_DISABLED
430+
-DDEBUG_LEVEL_NONE
431+
board_build.eesz=4M2M
412432
board_build.filesystem = littlefs
413433
upload_port = /dev/cu.SLAB_USBtoUART
414434

@@ -418,8 +438,9 @@ upload_port = /dev/cu.SLAB_USBtoUART
418438
[env:adafruit_pyportal_m4]
419439
extends = common:atsamd
420440
board = adafruit_pyportal_m4
421-
build_flags = -DUSE_TINYUSB=1
441+
build_flags = -DUSE_TINYUSB
422442
-DADAFRUIT_PYPORTAL
443+
extra_scripts = pre:rename_usb_config.py
423444

424445
; Adafruit PyPortal M4 Titano
425446
[env:adafruit_pyportal_m4_titano]
@@ -463,17 +484,24 @@ build_flags = -DUSE_TINYUSB
463484
[env:adafruit_metro_m4_airliftlite]
464485
extends = common:atsamd
465486
board = adafruit_metro_m4_airliftlite
466-
build_flags = -DUSE_TINYUSB=1
487+
build_flags = -DUSE_TINYUSB
467488
-DADAFRUIT_METRO_M4_AIRLIFT_LITE
489+
; extra_scripts = pre:rename_usb_config.py
468490
upload_port = /dev/cu.usbmodem1201
469491

470492

471493
[env:raspberypi_picow]
472494
extends = common:rp2040
473495

496+
[env:raspberypi_picow_debug_port_only]
497+
extends = common:rp2040
498+
build_flags =
499+
-DUSE_TINYUSB
500+
-DDEBUG_RP2040_PORT=Serial
501+
474502
[env:raspberypi_picow_debug]
475503
extends = common:rp2040
476-
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
504+
; platform = https://github.com/maxgerhardt/platform-raspberrypi.git
477505
; platform_packages =
478506
; framework-arduinopico @ symlink:///Users/tyeth/Projects/arduino-pico
479507
; framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git#master
@@ -494,7 +522,7 @@ build_flags =
494522
-DDEBUG_RP2040_CORE
495523
-DDEBUG_RP2040_WIFI
496524
-DNDEBUG
497-
-DLWIP_DEBUG
525+
-DLWIP_DEBUG=1
498526
-DDEBUG_RP2040_PORT=Serial1
499527
-DDEBUG_RP2040_UART_1
500528
-DDEBUG_RP2040_UART=1
@@ -511,3 +539,63 @@ build_flags =
511539
; ; No USB stack
512540
; build_flags = -DPIO_FRAMEWORK_ARDUINO_NO_USB
513541
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6
542+
543+
544+
[env:raspberypi_pico2w]
545+
extends = common:rp2040
546+
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
547+
platform_packages =
548+
framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
549+
board = rpipico2w
550+
build_flags =
551+
-DWIFICC=CYW43_COUNTRY_UK
552+
-DUSE_TINYUSB
553+
; -DARDUINO_ARCH_RP2040
554+
; -DUSBD_MAX_POWER_MA=250
555+
; -DPICO_CYW43_SUPPORTED=1
556+
557+
[env:raspberypi_pico2w_debug]
558+
extends = common:rp2040
559+
platform = https://github.com/maxgerhardt/platform-raspberrypi.git#develop
560+
platform_packages =
561+
framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
562+
; ; framework-arduinopico @ symlink:///Users/tyeth/Projects/arduino-pico
563+
board = rpipico2w
564+
build_type = debug
565+
framework = arduino
566+
debug_tool = cmsis-dap
567+
upload_protocol = cmsis-dap
568+
; board can use both Arduino cores -- we select Arduino-Pico here
569+
board_build.core = earlephilhower
570+
board_build.filesystem_size = 0.5m
571+
debug_init_break = tbreak runNetFSM
572+
build_flags =
573+
; -UARDUINO
574+
; -DPICO_BUILD
575+
-DARDUINO_ARCH_RP2040
576+
-DUSBD_MAX_POWER_MA=250
577+
-DPICO_CYW43_SUPPORTED=1
578+
-DWIFICC=CYW43_COUNTRY_UK
579+
; -DDEBUG
580+
; -DDEBUG_RP2040_WIRE
581+
; -DDEBUG_RP2040_SPI
582+
; -DDEBUG_RP2040_CORE
583+
; -DDEBUG_RP2040_WIFI
584+
; -DNDEBUG
585+
; -DLWIP_DEBUG
586+
; -DDEBUG_RP2040_PORT=Serial1
587+
; -DDEBUG_RP2040_UART_1
588+
; -DDEBUG_RP2040_UART=1
589+
-Og
590+
; Enable debug stack protection
591+
-fstack-protector
592+
; Enable Exceptions
593+
-DPIO_FRAMEWORK_ARDUINO_ENABLE_EXCEPTIONS
594+
; Enable RTTI
595+
-DPIO_FRAMEWORK_ARDUINO_ENABLE_RTTI
596+
; ; Enable default USB Stack of Pico SDK USB Stack with none of below usb options
597+
; Adafruit TinyUSB
598+
-DUSE_TINYUSB
599+
; ; No USB stack
600+
; build_flags = -DPIO_FRAMEWORK_ARDUINO_NO_USB
601+
; -DPIO_FRAMEWORK_ARDUINO_ENABLE_IPV6

src/Wippersnapper.cpp

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,14 +2494,27 @@ void Wippersnapper::runNetFSM() {
24942494
@brief Prints an error to the serial and halts the hardware until
24952495
the WDT bites.
24962496
@param error
2497-
The desired error to print to serial.
2497+
The error to print to serial.
24982498
@param ledStatusColor
2499-
The desired color to blink.
2499+
The color to blink.
2500+
@param seconds_until_reboot
2501+
The amount of time to wait before rebooting.
25002502
*/
25012503
/**************************************************************************/
2502-
void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor) {
2503-
for (;;) {
2504-
WS_DEBUG_PRINT("ERROR [WDT RESET]: ");
2504+
void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor,
2505+
uint8_t seconds_until_reboot) {
2506+
#ifdef ARDUINO_ARCH_ESP8266
2507+
uint8_t wdt_timeout_ms = 3200;
2508+
#else
2509+
uint8_t wdt_timeout_ms = 5000;
2510+
#endif
2511+
int seconds_until_wdt_enable =
2512+
seconds_until_reboot - (int)(wdt_timeout_ms / 1000);
2513+
2514+
for (int i = 0;; i++) {
2515+
WS_DEBUG_PRINT("ERROR [WDT RESET IN ");
2516+
WS_DEBUG_PRINT(seconds_until_reboot - i);
2517+
WS_DEBUG_PRINTLN("]: ");
25052518
WS_DEBUG_PRINTLN(error);
25062519
// let the WDT fail out and reset!
25072520
statusLEDSolid(ledStatusColor);
@@ -2512,6 +2525,12 @@ void Wippersnapper::haltError(String error, ws_led_status_t ledStatusColor) {
25122525
// hardware and software watchdog timers, delayMicroseconds does not.
25132526
delayMicroseconds(1000000);
25142527
#endif
2528+
if (i < seconds_until_wdt_enable) {
2529+
yield();
2530+
WS.feedWDT(); // feed the WDT for the first X-5 seconds
2531+
} else if (i == seconds_until_reboot) {
2532+
WS.enableWDT(wdt_timeout_ms);
2533+
}
25152534
}
25162535
}
25172536

@@ -2748,9 +2767,6 @@ void Wippersnapper::connect() {
27482767
// Dump device info to the serial monitor
27492768
printDeviceInfo();
27502769

2751-
// enable global WDT
2752-
WS.enableWDT(WS_WDT_TIMEOUT);
2753-
27542770
// Generate device identifier
27552771
if (!generateDeviceUID()) {
27562772
haltError("Unable to generate Device UID");
@@ -2772,7 +2788,9 @@ void Wippersnapper::connect() {
27722788
WS_DEBUG_PRINTLN("Running Network FSM...");
27732789
// Run the network fsm
27742790
runNetFSM();
2775-
WS.feedWDT();
2791+
2792+
// Enable WDT after wifi connection as wifiMulti doesnt feed WDT
2793+
WS.enableWDT(WS_WDT_TIMEOUT);
27762794

27772795
#ifdef USE_DISPLAY
27782796
WS._ui_helper->set_load_bar_icon_complete(loadBarIconCloud);

src/Wippersnapper.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,12 @@ typedef enum {
214214
FSM_NET_ESTABLISH_MQTT,
215215
} fsm_net_t;
216216

217-
#define WS_WDT_TIMEOUT 60000 ///< WDT timeout
217+
#ifdef ARDUINO_ARCH_RP2040
218+
#define WS_WDT_TIMEOUT 8388 ///< RP2040 Max WDT timeout
219+
#else
220+
#define WS_WDT_TIMEOUT 60000 ///< WDT timeout
221+
#endif
222+
218223
#define WS_MAX_ALT_WIFI_NETWORKS 3 ///< Maximum number of alternative networks
219224
/* MQTT Configuration */
220225
#define WS_KEEPALIVE_INTERVAL_MS \
@@ -306,7 +311,8 @@ class Wippersnapper {
306311

307312
// Error handling helpers
308313
void haltError(String error,
309-
ws_led_status_t ledStatusColor = WS_LED_STATUS_ERROR_RUNTIME);
314+
ws_led_status_t ledStatusColor = WS_LED_STATUS_ERROR_RUNTIME,
315+
uint8_t seconds_until_reboot = 25);
310316
void errorWriteHang(String error);
311317

312318
// MQTT topic callbacks //

src/Wippersnapper_Boards.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,12 @@
189189
#define BOARD_ID "rpi-pico-w"
190190
#define USE_TINYUSB
191191
#define USE_STATUS_LED
192-
#define STATUS_LED_PIN 32
192+
#define STATUS_LED_PIN LED_BUILTIN
193+
#elif defined(ARDUINO_RASPBERRY_PI_PICO_2W)
194+
#define BOARD_ID "rpi-pico-2w"
195+
#define USE_TINYUSB
196+
#define USE_STATUS_LED
197+
#define STATUS_LED_PIN LED_BUILTIN
193198
#else
194199
#warning "Board type not identified within Wippersnapper_Boards.h!"
195200
#endif

0 commit comments

Comments
 (0)