diff --git a/baby-mobile-v5.kicad_sch b/baby-mobile-v5.kicad_sch index bfd7c32..ca91100 100644 --- a/baby-mobile-v5.kicad_sch +++ b/baby-mobile-v5.kicad_sch @@ -9,7 +9,7 @@ (date "2026-03-11") (rev "5.0") (comment 1 "XIAO nRF52840 + IS25LP128F + TPS61220") - (comment 2 "Key-shaped panel with breakaway SOP adapters") + (comment 2 "Intended for Baby Trend Smart Steps Activity Center AC01E21B/WK03F23A/WK03E69A") ) (lib_symbols (symbol "Connector:Conn_01x16_Pin" @@ -2614,6 +2614,211 @@ ) (embedded_fonts no) ) + (symbol "Transistor_BJT:2N3904" + (pin_names + (offset 0) + (hide yes) + ) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (property "Reference" "Q" + (at 5.08 1.905 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "2N3904" + (at 5.08 0 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "Package_TO_SOT_THT:TO-92_Inline" + (at 5.08 -1.905 0) + (effects + (font + (size 1.27 1.27) + (italic yes) + ) + (justify left) + (hide yes) + ) + ) + (property "Datasheet" "https://www.onsemi.com/pub/Collateral/2N3903-D.PDF" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Description" "0.2A Ic, 40V Vce, Small Signal NPN Transistor, TO-92" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_keywords" "NPN Transistor" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "ki_fp_filters" "TO?92*" + (at 0 0 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (symbol "2N3904_0_1" + (polyline + (pts + (xy -2.54 0) (xy 0.635 0) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0.635 1.905) (xy 0.635 -1.905) + ) + (stroke + (width 0.508) + (type default) + ) + (fill + (type none) + ) + ) + (circle + (center 1.27 0) + (radius 2.8194) + (stroke + (width 0.254) + (type default) + ) + (fill + (type none) + ) + ) + ) + (symbol "2N3904_1_1" + (polyline + (pts + (xy 0.635 0.635) (xy 2.54 2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 0.635 -0.635) (xy 2.54 -2.54) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type none) + ) + ) + (polyline + (pts + (xy 1.27 -1.778) (xy 1.778 -1.27) (xy 2.286 -2.286) (xy 1.27 -1.778) + ) + (stroke + (width 0) + (type default) + ) + (fill + (type outline) + ) + ) + (pin input line + (at -5.08 0 0) + (length 2.54) + (name "B" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "2" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 2.54 5.08 270) + (length 2.54) + (name "C" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "3" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + (pin passive line + (at 2.54 -5.08 90) + (length 2.54) + (name "E" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (number "1" + (effects + (font + (size 1.27 1.27) + ) + ) + ) + ) + ) + (embedded_fonts no) + ) (symbol "bm:C" (exclude_from_sim no) (in_bom yes) @@ -2815,7 +3020,7 @@ (embedded_fonts no) ) ) - (text "Memory" + (text "Flash" (exclude_from_sim no) (at 65.278 137.16 0) (effects @@ -2883,6 +3088,18 @@ (color 0 0 0 0) (uuid "27e5f52e-0ae1-42be-b638-2ba1b684ea4c") ) + (junction + (at 193.04 190.5) + (diameter 0) + (color 0 0 0 0) + (uuid "281a8c8b-2ff7-4095-8e2d-8ddcc13614cb") + ) + (junction + (at 182.88 212.09) + (diameter 0) + (color 0 0 0 0) + (uuid "3b899a39-f615-4d23-b630-6340da2cd105") + ) (junction (at 302.26 162.56) (diameter 0) @@ -2913,6 +3130,18 @@ (color 0 0 0 0) (uuid "b4ef88db-519f-48de-b199-16343987ba1f") ) + (junction + (at 339.09 72.37) + (diameter 0) + (color 0 0 0 0) + (uuid "d64e64fd-ae8d-403f-b573-c89f48488950") + ) + (junction + (at 193.04 204.47) + (diameter 0) + (color 0 0 0 0) + (uuid "de6acd04-2d44-4863-af09-9ac961e84433") + ) (junction (at 67.31 166.37) (diameter 0) @@ -2977,6 +3206,16 @@ ) (uuid "0a315227-f5b7-4de4-9dc2-5a9da0d1e499") ) + (wire + (pts + (xy 339.09 66.04) (xy 339.09 72.37) + ) + (stroke + (width 0) + (type default) + ) + (uuid "0b329cbc-c71c-45f7-a879-bc62a772c618") + ) (wire (pts (xy 304.8 91.44) (xy 304.72 91.44) @@ -3047,6 +3286,16 @@ ) (uuid "1e67db82-9086-4cc6-acee-2e0c4028091c") ) + (wire + (pts + (xy 196.85 204.47) (xy 193.04 204.47) + ) + (stroke + (width 0) + (type default) + ) + (uuid "1f1150a6-7548-4e6b-bfc3-a7f7f53b9b0a") + ) (wire (pts (xy 62.23 166.37) (xy 67.31 166.37) @@ -3167,6 +3416,16 @@ ) (uuid "45f62031-bc9a-4aad-90bf-c329fa26f5c3") ) + (wire + (pts + (xy 193.04 198.12) (xy 193.04 204.47) + ) + (stroke + (width 0) + (type default) + ) + (uuid "47a3b6e6-8d57-4824-9829-b36c7d2dbb78") + ) (wire (pts (xy 318.53 157.48) (xy 320.04 157.48) @@ -3197,6 +3456,16 @@ ) (uuid "50e91b58-4065-4b70-80ff-b78479a4cb8d") ) + (wire + (pts + (xy 182.88 214.63) (xy 182.88 212.09) + ) + (stroke + (width 0) + (type default) + ) + (uuid "51b0fd54-20fb-4560-a45c-5e275f2e98b5") + ) (wire (pts (xy 332.74 135.97) (xy 332.74 135.89) @@ -3307,6 +3576,16 @@ ) (uuid "7b09f59c-2799-44c6-bf90-c378030ea9b1") ) + (wire + (pts + (xy 204.47 204.47) (xy 207.01 204.47) + ) + (stroke + (width 0) + (type default) + ) + (uuid "81e450a3-df15-4558-bdb5-f91882a84b93") + ) (wire (pts (xy 62.23 153.67) (xy 71.12 153.67) @@ -3317,6 +3596,16 @@ ) (uuid "83ec5324-e898-46e6-9fe2-31d9a05b3da0") ) + (wire + (pts + (xy 190.5 204.47) (xy 193.04 204.47) + ) + (stroke + (width 0) + (type default) + ) + (uuid "840e995a-8b8c-42cf-8a88-910ca01bb54c") + ) (wire (pts (xy 334.01 90.15) (xy 334.01 90.17) @@ -3397,6 +3686,16 @@ ) (uuid "93b77e73-d20f-4fe2-bf42-a7c0d0018958") ) + (wire + (pts + (xy 175.26 212.09) (xy 182.88 212.09) + ) + (stroke + (width 0) + (type default) + ) + (uuid "961d8b8e-6570-42db-b709-c17e817cd824") + ) (wire (pts (xy 330.2 135.89) (xy 330.2 135.97) @@ -3457,6 +3756,16 @@ ) (uuid "a80cbefa-0f08-40b2-9854-090a0f94a904") ) + (wire + (pts + (xy 339.09 72.37) (xy 339.09 76.18) + ) + (stroke + (width 0) + (type default) + ) + (uuid "a82654c0-5a9a-435d-998d-0a8f02737d66") + ) (wire (pts (xy 207.01 204.47) (xy 223.52 204.47) @@ -3507,6 +3816,16 @@ ) (uuid "b4e0a463-68c6-49f4-96e9-2451c3680296") ) + (wire + (pts + (xy 182.88 212.09) (xy 182.88 209.55) + ) + (stroke + (width 0) + (type default) + ) + (uuid "b7fd5478-666a-43da-b7e4-0d4cb0cc1e03") + ) (wire (pts (xy 223.52 217.17) (xy 207.01 217.17) @@ -3557,6 +3876,26 @@ ) (uuid "c4d05913-3458-4acf-8f0c-0127e44f1453") ) + (wire + (pts + (xy 182.88 199.39) (xy 182.88 190.5) + ) + (stroke + (width 0) + (type default) + ) + (uuid "c857e726-87a2-4846-bfd3-1b6b8021a588") + ) + (wire + (pts + (xy 193.04 190.5) (xy 182.88 190.5) + ) + (stroke + (width 0) + (type default) + ) + (uuid "c8a9dfcf-ad38-4a03-96b8-1606a9f841a2") + ) (wire (pts (xy 332.74 135.89) (xy 332.74 133.35) @@ -3657,16 +3996,6 @@ ) (uuid "d9f11ff0-1664-4fd8-8e91-e57082669da3") ) - (wire - (pts - (xy 339.09 76.18) (xy 339.09 72.37) - ) - (stroke - (width 0) - (type default) - ) - (uuid "dc56447b-2913-4073-a3e6-ae9a14e1130a") - ) (wire (pts (xy 71.12 153.67) (xy 78.74 153.67) @@ -3697,6 +4026,16 @@ ) (uuid "e9a38bc1-2ddc-4f6e-a7cc-a9e64d98c7ff") ) + (wire + (pts + (xy 193.04 190.5) (xy 193.04 186.69) + ) + (stroke + (width 0) + (type default) + ) + (uuid "f13c8c4d-ab0e-48f1-84b6-a1ce528d6ec0") + ) (wire (pts (xy 231.14 212.09) (xy 243.84 212.09) @@ -3766,6 +4105,16 @@ (justify left bottom) ) (uuid "17fde927-5808-496f-a1ca-d4605d856967") + (property "Note" "FB to GND = 3.3v out" + (at 339.598 80.518 0) + (effects + (font + (size 1.27 1.27) + (italic yes) + ) + (justify left) + ) + ) ) (label "C_BTN2" (at 223.52 204.47 180) @@ -3856,6 +4205,16 @@ (justify right bottom) ) (uuid "39dfef0c-d7a2-4482-bca9-5affd0a9afcc") + (property "Note" "(Actual ~3-4v battery, not C_3V3)" + (at 368.554 149.86 0) + (effects + (font + (size 1.27 1.27) + (italic yes) + ) + (justify right) + ) + ) ) (label "LED1" (at 85.09 95.25 180) @@ -3887,16 +4246,6 @@ ) (uuid "438c3312-c149-454f-b4ff-6772bede766a") ) - (label "C_3V3" - (at 339.09 72.37 180) - (effects - (font - (size 1.27 1.27) - ) - (justify right bottom) - ) - (uuid "48166a40-8d9a-4748-a3d2-5c0155819d36") - ) (label "C_3V3" (at 78.74 151.13 180) (effects @@ -3967,6 +4316,16 @@ ) (uuid "77d53298-9c1a-40ea-8c83-67797873ba0f") ) + (label "BTN_IN" + (at 175.26 212.09 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left bottom) + ) + (uuid "79592a17-39cf-4b05-a85f-21c3df67578f") + ) (label "SPI_MISO" (at 125.73 91.44 0) (effects @@ -3977,7 +4336,17 @@ ) (uuid "7e061299-bff5-40d1-8f87-e3efcbd5b5b0") ) - (label "C_BTN1" + (label "C_3V3" + (at 182.88 222.25 270) + (effects + (font + (size 1.27 1.27) + ) + (justify right bottom) + ) + (uuid "80f022bc-44f7-48ad-9299-5dad45c55891") + ) + (label "BTN_IN" (at 85.09 80.01 180) (effects (font @@ -4047,6 +4416,26 @@ ) (uuid "968fcbdf-0690-43cd-87a6-f65d215b6d57") ) + (label "C_3V3" + (at 339.09 66.04 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left bottom) + ) + (uuid "9cb5e98c-f75c-4851-bbcf-fcc6ed6fd931") + ) + (label "GND" + (at 193.04 186.69 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left bottom) + ) + (uuid "9d75788f-95f8-44d8-8d26-3358cf4ac82b") + ) (label "VO+" (at 340.36 160.02 0) (effects @@ -4441,6 +4830,74 @@ ) ) ) + (symbol + (lib_id "Device:R") + (at 200.66 204.47 90) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "1413b3fe-94a4-4524-a2c4-fb5472fd3c58") + (property "Reference" "R7" + (at 200.66 198.12 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Value" "100K" + (at 200.66 200.66 90) + (effects + (font + (size 1.27 1.27) + ) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P1.90mm_Vertical" + (at 200.66 206.248 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 200.66 204.47 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 200.66 204.47 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "528ae99d-66c3-4cba-90e4-f8c9c83a4a59") + ) + (pin "2" + (uuid "c79cc031-4917-40c4-b104-82ddb754db7e") + ) + (instances + (project "baby-mobile-v5" + (path "/3033f063-d051-4b2e-89f5-f1cfe4577b32" + (reference "R7") + (unit 1) + ) + ) + ) + ) (symbol (lib_id "bm:C") (at 309.88 162.56 270) @@ -4590,7 +5047,7 @@ ) ) ) - (property "Value" "1nF" + (property "Value" "20nF" (at 298.196 171.116 0) (effects (font @@ -5902,6 +6359,152 @@ ) ) ) + (symbol + (lib_id "Device:R") + (at 182.88 218.44 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "9b14d705-e0a4-4af9-88aa-c1341fb5ccf4") + (property "Reference" "R8" + (at 185.42 217.1699 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "470K" + (at 185.42 219.7099 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P1.90mm_Vertical" + (at 181.102 218.44 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 182.88 218.44 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 182.88 218.44 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "0a220a46-0a33-4667-91ae-503c386e41c9") + ) + (pin "2" + (uuid "fb0d31a7-90ef-4de3-881a-7ae2f20c8699") + ) + (instances + (project "baby-mobile-v5" + (path "/3033f063-d051-4b2e-89f5-f1cfe4577b32" + (reference "R8") + (unit 1) + ) + ) + ) + ) + (symbol + (lib_id "Transistor_BJT:2N3904") + (at 185.42 204.47 180) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "a084e525-c37b-4d70-9877-91e81d08aa4f") + (property "Reference" "Q1" + (at 180.34 203.1999 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "2N3904" + (at 180.34 205.7399 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "Package_TO_SOT_THT:TO-92_Inline" + (at 180.34 202.565 0) + (effects + (font + (size 1.27 1.27) + (italic yes) + ) + (justify left) + (hide yes) + ) + ) + (property "Datasheet" "https://www.onsemi.com/pub/Collateral/2N3903-D.PDF" + (at 185.42 204.47 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + (hide yes) + ) + ) + (property "Description" "0.2A Ic, 40V Vce, Small Signal NPN Transistor, TO-92" + (at 185.42 204.47 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "7f9fd381-05b7-4d2b-ac20-94427f8e62e1") + ) + (pin "3" + (uuid "cff7bea6-19f9-40d7-a972-ac8cf6dfad14") + ) + (pin "2" + (uuid "0af396b5-4483-4ff1-af5c-8a8183d14f57") + ) + (instances + (project "" + (path "/3033f063-d051-4b2e-89f5-f1cfe4577b32" + (reference "Q1") + (unit 1) + ) + ) + ) + ) (symbol (lib_id "bm:C") (at 342.9 87.61 0) @@ -6036,6 +6639,76 @@ ) ) ) + (symbol + (lib_id "Device:R") + (at 193.04 194.31 0) + (unit 1) + (exclude_from_sim no) + (in_bom yes) + (on_board yes) + (dnp no) + (fields_autoplaced yes) + (uuid "b54e60f2-827e-4365-b528-af504d173765") + (property "Reference" "R6" + (at 195.58 193.0399 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Value" "470K" + (at 195.58 195.5799 0) + (effects + (font + (size 1.27 1.27) + ) + (justify left) + ) + ) + (property "Footprint" "Resistor_THT:R_Axial_DIN0204_L3.6mm_D1.6mm_P1.90mm_Vertical" + (at 191.262 194.31 90) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Datasheet" "~" + (at 193.04 194.31 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (property "Description" "Resistor" + (at 193.04 194.31 0) + (effects + (font + (size 1.27 1.27) + ) + (hide yes) + ) + ) + (pin "1" + (uuid "6f9f0b6b-5a88-4bb9-9f21-6253efd1bc15") + ) + (pin "2" + (uuid "5762cfc4-fd1c-46bf-b4d0-0226bbde2e21") + ) + (instances + (project "baby-mobile-v5" + (path "/3033f063-d051-4b2e-89f5-f1cfe4577b32" + (reference "R6") + (unit 1) + ) + ) + ) + ) (symbol (lib_id "bm:C") (at 344.17 76.18 90) diff --git a/baby_mobile_v2/baby_mobile_v2.ino b/baby_mobile_v2/baby_mobile_v2.ino index 404eedd..da0daee 100644 --- a/baby_mobile_v2/baby_mobile_v2.ino +++ b/baby_mobile_v2/baby_mobile_v2.ino @@ -52,7 +52,15 @@ // ============================================================ // When defined, a wake from deep sleep (button press) plays a random track // immediately instead of waiting for user input. -//#define WAKE_PLAY_RANDOM +#define WAKE_PLAY_RANDOM + +// ============================================================ +// Button playback mode: +// Undefined — short press toggles play/stop (press again to stop). +// Defined — every press always starts a track; never stops mid-play. +// If WAKE_PLAY_RANDOM is also defined, picks a random track; +// otherwise advances to the next track (wrapping around). +#define BTN_ALWAYS_START // ============================================================ // POC MODE: stream audio from internal LittleFS instead of SPI flash. @@ -89,10 +97,10 @@ using namespace Adafruit_LittleFS_Namespace; // Buttons (directly to GPIO, active LOW with internal pull-up) #define PIN_BTN1 1 +/* #define PIN_BTN2 1 #define PIN_BTN3 1 #define PIN_BTN4 1 -/* #define PIN_BTN5 4 #define PIN_BTN6 5 #define PIN_BTN7 3 @@ -104,10 +112,10 @@ using namespace Adafruit_LittleFS_Namespace; // LED_G is 12/13 const uint8_t BTN_PINS[] = { - PIN_BTN1, PIN_BTN2, PIN_BTN3, PIN_BTN4, + PIN_BTN1 /*, PIN_BTN2, PIN_BTN3, PIN_BTN4,*/ /*PIN_BTN5, PIN_BTN6, PIN_BTN7, PIN_BTN8*/ }; -#define NUM_BUTTONS 4 +#define NUM_BUTTONS 1 // ============================================================ // FLASH CONSTANTS @@ -253,8 +261,9 @@ unsigned long g_lastActivity = 0; volatile bool g_usbConnected = false; // Wake-from-sleep detection. Read before SoftDevice starts (setupBLE), stored here. -static bool g_wakeFromSleep = false; -static uint8_t g_wakeTrack = 0; +static bool g_wakeFromSleep = false; +static uint8_t g_wakeTrack = 0; +static uint32_t g_debugResetreas = 0; // printed 10 s after boot for post-sleep diagnosis #ifdef POC_INTERNAL_FLASH static void pocFilename(uint8_t n, char *buf) { // buf must be >=16 bytes @@ -1456,13 +1465,17 @@ void setup() { // Read RESETREAS and collect a random byte BEFORE starting the SoftDevice. // Once Bluefruit.begin() enables S140, the SoftDevice owns NRF_RNG and // NRF_POWER — direct register access after that point causes a hard fault. - g_wakeFromSleep = (NRF_POWER->RESETREAS & POWER_RESETREAS_OFF_Msk) != 0; + uint32_t resetreas = NRF_POWER->RESETREAS; NRF_POWER->RESETREAS = 0xFFFFFFFFUL; // write-1-to-clear - if (g_wakeFromSleep) Serial.println("Woke from deep sleep."); + g_wakeFromSleep = (resetreas & POWER_RESETREAS_OFF_Msk) != 0; + g_debugResetreas = resetreas; // printed 10 s after boot once serial reconnects + // Seed Arduino random() from hardware RNG now, before Bluefruit.begin(). + // After the SoftDevice starts it owns NRF_RNG — hwRandom() must not be + // called again after that point. Use random() everywhere in loop(). + randomSeed(hwRandom()); #ifdef WAKE_PLAY_RANDOM if (g_wakeFromSleep && g_numTracks > 0) { - // hwRandom() is safe here — SoftDevice not yet started. - g_wakeTrack = hwRandom() % g_numTracks; + g_wakeTrack = (uint8_t)random(g_numTracks); } #endif @@ -1752,6 +1765,16 @@ static void serUploadTick() { void loop() { if (g_playing || g_bleUploading) g_lastActivity = millis(); + // Print RESETREAS once, 10 s after boot, so serial has time to reconnect + // after a wake-from-sleep reset. + static bool resetreasLogged = false; + if (!resetreasLogged && millis() > 10000) { + resetreasLogged = true; + Serial.print("RESETREAS: 0x"); Serial.println(g_debugResetreas, HEX); + Serial.print("g_wakeFromSleep: "); Serial.println(g_wakeFromSleep); + Serial.print("g_numTracks: "); Serial.println(g_numTracks); + } + // ---- Serial upload ---- serUploadTick(); @@ -1799,14 +1822,27 @@ void loop() { if (g_trackDoneMs != 0 && millis() >= g_trackDoneMs) { g_trackDoneMs = 0; audioStop(); } + } else { + delay(1); // yield to RTOS idle task so the watchdog gets fed } } if (longPress) { startBLEAdvertising(); waitButtonRelease(1); } else { +#ifdef BTN_ALWAYS_START + if (g_numTracks > 0) { + if (g_playing) audioStop(); +#ifdef WAKE_PLAY_RANDOM + audioStart((uint8_t)random(g_numTracks)); +#else + audioStart((g_currentTrack + 1) % g_numTracks); +#endif + } +#else if (g_playing) { audioStop(); } else if (g_numTracks > 0) { audioStart(g_currentTrack); } +#endif } break; } @@ -1814,11 +1850,22 @@ void loop() { case 3: case 4: case 5: +#ifdef BTN_ALWAYS_START + if (g_numTracks > 0) { + if (g_playing) audioStop(); +#ifdef WAKE_PLAY_RANDOM + audioStart((uint8_t)random(g_numTracks)); +#else + audioStart((g_currentTrack + 1) % g_numTracks); +#endif + } +#else if (g_playing) { audioStop(); } else if (g_numTracks > 0) { audioStart(g_currentTrack); } +#endif break; /* case 4: // Next track diff --git a/sounds/audiopapkin-sound-design-elements-robot-mechanism-020-344708.mp3 b/sounds/audiopapkin-sound-design-elements-robot-mechanism-020-344708.mp3 new file mode 100644 index 0000000..e9a3e27 Binary files /dev/null and b/sounds/audiopapkin-sound-design-elements-robot-mechanism-020-344708.mp3 differ diff --git a/sounds/dragon-studio-free-dog-bark-419014.mp3 b/sounds/dragon-studio-free-dog-bark-419014.mp3 new file mode 100644 index 0000000..e60a777 Binary files /dev/null and b/sounds/dragon-studio-free-dog-bark-419014.mp3 differ diff --git a/sounds/dragon-studio-gentle-horse-whinny-499650.mp3 b/sounds/dragon-studio-gentle-horse-whinny-499650.mp3 new file mode 100644 index 0000000..29c9b67 Binary files /dev/null and b/sounds/dragon-studio-gentle-horse-whinny-499650.mp3 differ diff --git a/sounds/dragon-studio-helicopter-flying-by-515262.mp3 b/sounds/dragon-studio-helicopter-flying-by-515262.mp3 new file mode 100644 index 0000000..38e594b Binary files /dev/null and b/sounds/dragon-studio-helicopter-flying-by-515262.mp3 differ diff --git a/sounds/dragon-studio-waves-crashing-397977.mp3 b/sounds/dragon-studio-waves-crashing-397977.mp3 new file mode 100644 index 0000000..3823d9e Binary files /dev/null and b/sounds/dragon-studio-waves-crashing-397977.mp3 differ diff --git a/sounds/freesound_community-054883_bounce-38937.mp3 b/sounds/freesound_community-054883_bounce-38937.mp3 new file mode 100644 index 0000000..46b73f0 Binary files /dev/null and b/sounds/freesound_community-054883_bounce-38937.mp3 differ diff --git a/sounds/freesound_community-084229_pinkie-pie-39whee39wav-86646.mp3 b/sounds/freesound_community-084229_pinkie-pie-39whee39wav-86646.mp3 new file mode 100644 index 0000000..11f275d Binary files /dev/null and b/sounds/freesound_community-084229_pinkie-pie-39whee39wav-86646.mp3 differ diff --git a/sounds/freesound_community-cricket-chirp-101026.mp3 b/sounds/freesound_community-cricket-chirp-101026.mp3 new file mode 100644 index 0000000..c840ed4 Binary files /dev/null and b/sounds/freesound_community-cricket-chirp-101026.mp3 differ diff --git a/sounds/freesound_community-drop-bounce-plastic-bottle-69626.mp3 b/sounds/freesound_community-drop-bounce-plastic-bottle-69626.mp3 new file mode 100644 index 0000000..0873927 Binary files /dev/null and b/sounds/freesound_community-drop-bounce-plastic-bottle-69626.mp3 differ diff --git a/sounds/freesound_community-f-phrase-on-native-american-flute-95062.mp3 b/sounds/freesound_community-f-phrase-on-native-american-flute-95062.mp3 new file mode 100644 index 0000000..8c7d449 Binary files /dev/null and b/sounds/freesound_community-f-phrase-on-native-american-flute-95062.mp3 differ diff --git a/sounds/freesound_community-large-ball-bounce-104128.mp3 b/sounds/freesound_community-large-ball-bounce-104128.mp3 new file mode 100644 index 0000000..0216b60 Binary files /dev/null and b/sounds/freesound_community-large-ball-bounce-104128.mp3 differ diff --git a/sounds/fronbondi_skegs-sfx-odd-whooping-or-squelching-comedic-sound-effect-453119.mp3 b/sounds/fronbondi_skegs-sfx-odd-whooping-or-squelching-comedic-sound-effect-453119.mp3 new file mode 100644 index 0000000..548eb13 Binary files /dev/null and b/sounds/fronbondi_skegs-sfx-odd-whooping-or-squelching-comedic-sound-effect-453119.mp3 differ diff --git a/sounds/humordome-boing-boing-bounce-454474.mp3 b/sounds/humordome-boing-boing-bounce-454474.mp3 new file mode 100644 index 0000000..0c8f04f Binary files /dev/null and b/sounds/humordome-boing-boing-bounce-454474.mp3 differ diff --git a/sounds/kalsstockmedia-robotic-bass-drop-machinery-futuristic-reverse-279795.mp3 b/sounds/kalsstockmedia-robotic-bass-drop-machinery-futuristic-reverse-279795.mp3 new file mode 100644 index 0000000..7561ca3 Binary files /dev/null and b/sounds/kalsstockmedia-robotic-bass-drop-machinery-futuristic-reverse-279795.mp3 differ diff --git a/sounds/koiroylers-awesome-rewind-351984.mp3 b/sounds/koiroylers-awesome-rewind-351984.mp3 new file mode 100644 index 0000000..b541f7b Binary files /dev/null and b/sounds/koiroylers-awesome-rewind-351984.mp3 differ diff --git a/sounds/loswin23-bird-chirp-485390.mp3 b/sounds/loswin23-bird-chirp-485390.mp3 new file mode 100644 index 0000000..73e7d22 Binary files /dev/null and b/sounds/loswin23-bird-chirp-485390.mp3 differ diff --git a/sounds/nematoki-rooster-cry-chicken-rooster-305576.mp3 b/sounds/nematoki-rooster-cry-chicken-rooster-305576.mp3 new file mode 100644 index 0000000..e62f41f Binary files /dev/null and b/sounds/nematoki-rooster-cry-chicken-rooster-305576.mp3 differ diff --git a/sounds/ribhavagrawal-chicken-cluking-type-3-293320.mp3 b/sounds/ribhavagrawal-chicken-cluking-type-3-293320.mp3 new file mode 100644 index 0000000..d9dd53a Binary files /dev/null and b/sounds/ribhavagrawal-chicken-cluking-type-3-293320.mp3 differ diff --git a/sounds/ribhavagrawal-lion-roaring-sfx-293295.mp3 b/sounds/ribhavagrawal-lion-roaring-sfx-293295.mp3 new file mode 100644 index 0000000..8e862a3 Binary files /dev/null and b/sounds/ribhavagrawal-lion-roaring-sfx-293295.mp3 differ diff --git a/sounds/sondangsirait419-gajah-220044.mp3 b/sounds/sondangsirait419-gajah-220044.mp3 new file mode 100644 index 0000000..41cc62e Binary files /dev/null and b/sounds/sondangsirait419-gajah-220044.mp3 differ diff --git a/sounds/sound_garage-cat-meow-8-fx-306184.mp3 b/sounds/sound_garage-cat-meow-8-fx-306184.mp3 new file mode 100644 index 0000000..ed49d94 Binary files /dev/null and b/sounds/sound_garage-cat-meow-8-fx-306184.mp3 differ diff --git a/sounds/stu9-plasma-bounce-357127 (1).mp3 b/sounds/stu9-plasma-bounce-357127 (1).mp3 new file mode 100644 index 0000000..dc1312e Binary files /dev/null and b/sounds/stu9-plasma-bounce-357127 (1).mp3 differ diff --git a/sounds/stu9-plasma-bounce-357127.mp3 b/sounds/stu9-plasma-bounce-357127.mp3 new file mode 100644 index 0000000..dc1312e Binary files /dev/null and b/sounds/stu9-plasma-bounce-357127.mp3 differ diff --git a/sounds/u_jd81cxyq22-cow-mooing-343423.mp3 b/sounds/u_jd81cxyq22-cow-mooing-343423.mp3 new file mode 100644 index 0000000..66b9aa6 Binary files /dev/null and b/sounds/u_jd81cxyq22-cow-mooing-343423.mp3 differ diff --git a/sounds/universfield-funny-boing-flexatone-wobble-352710.mp3 b/sounds/universfield-funny-boing-flexatone-wobble-352710.mp3 new file mode 100644 index 0000000..426b68a Binary files /dev/null and b/sounds/universfield-funny-boing-flexatone-wobble-352710.mp3 differ diff --git a/sounds/universfield-whistle-slide-down-323778.mp3 b/sounds/universfield-whistle-slide-down-323778.mp3 new file mode 100644 index 0000000..86c0dec Binary files /dev/null and b/sounds/universfield-whistle-slide-down-323778.mp3 differ diff --git a/sounds/wefgf-whoopsies-447694.mp3 b/sounds/wefgf-whoopsies-447694.mp3 new file mode 100644 index 0000000..c12d38f Binary files /dev/null and b/sounds/wefgf-whoopsies-447694.mp3 differ