Add XIAO DFPlayer sketch and print gcode; switch grille to Inkscape-edited skull-2.svg

This commit is contained in:
zyphlar
2026-09-10 00:18:22 -07:00
parent de047b813b
commit 16dee110af
5 changed files with 92970 additions and 7 deletions
+92783
View File
File diff suppressed because it is too large Load Diff
+38
View File
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Skull: "death-skull" by sbed, from game-icons.net - CC BY 3.0 (https://creativecommons.org/licenses/by/3.0/). Background rect removed. -->
<svg
viewBox="0 0 512 512"
version="1.1"
id="svg1"
sodipodi:docname="skull.svg"
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<sodipodi:namedview
id="namedview1"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:zoom="1.6020388"
inkscape:cx="297.4335"
inkscape:cy="331.45265"
inkscape:window-width="2560"
inkscape:window-height="1371"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg1" />
<path
id="path1"
style="fill:#000000;fill-opacity:1;stroke-width:1.01621"
d="m 255.99591,1.0231377 c -121.94463,0 -243.885118,60.9712323 -243.885117,152.4276823 0,60.97232 45.729732,91.4574 45.729732,152.42973 0,45.72923 -25.011663,58.10413 -25.011663,88.59028 0,15.24104 58.556067,20.14566 101.224488,33.35228 v 84.09291 h 29.64149 v -84.73481 l 12.06975,-9.93213 12.02695,9.93213 v 84.73481 h 29.73931 v -84.73481 l 12.07178,-9.93213 12.02492,9.93213 v 84.73481 h 29.74134 v -84.73481 l 12.06975,-9.93213 12.02695,9.93213 v 84.73481 h 29.74134 v -84.73481 l 12.06975,-9.93213 12.02695,9.93213 v 84.73481 h 28.63687 v -84.09291 c 0,0 102.4548,-17.98937 101.87862,-35.30854 -0.94813,-28.3999 -25.66375,-40.90683 -25.66375,-86.63402 0,-30.48615 46.38212,-92.90246 45.72769,-152.42973 C 499.88306,61.99234 377.9385,1.0231377 255.99591,1.0231377 Z M 148.51748,124.86693 c 39.57283,0 71.65228,32.0827 71.65228,71.65434 0,39.57164 -32.07945,71.65228 -71.65228,71.65228 -39.56925,-10e-4 -71.650239,-32.08268 -71.650239,-71.65434 0,-39.57163 32.078599,-71.65228 71.650239,-71.65228 z m 214.95686,0 c 39.57164,0 71.65228,32.0827 71.65228,71.65434 0,39.57164 -32.08064,71.65228 -71.65228,71.65228 -39.57163,0 -71.65433,-32.08064 -71.65433,-71.65228 0,-39.57164 32.0827,-71.65434 71.65433,-71.65434 z M 255.99591,250.26149 c 17.91329,0 53.74023,71.65309 53.74023,89.56637 0,35.82419 0.001,35.8241 -17.91205,35.8241 h -71.65433 c -17.91328,0 -17.91205,-0.002 -17.91205,-35.82817 0,-17.91328 35.82492,-89.5623 53.7382,-89.5623 z" />
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+11 -7
View File
@@ -53,8 +53,12 @@ cutoutsFront = [
];
cutoutsLid = [
[7, 14, 0, 0, 0.25*25.4, yappCircle],
[25, 35, 0, 0, 0.125*25.4, yappCircle],
[22, 10, 0, 0, 0.5*25.4/2, yappCircle],
[2, 35, 0, 0, 0.5*25.4/2, yappCircle],
];
snapJoins = [
[10,5,yappFront,yappBack,yappSymmetric]
];
//---------------------------------------------------------------
@@ -114,8 +118,8 @@ module hookBaseInside()
// https://game-icons.net/1x1/sbed/death-skull.html
//---------------------------------------------------------------
plateDia = 50; // faceplate diameter (> 45mm opening -> fused rim)
plateRaise = 2.6; // mm proud of the front face
plateEmbed = 1.5; // mm the plate sinks into the front wall (weld)
plateRaise = 1; // mm proud of the front face
plateEmbed = 5; // mm the plate sinks into the front wall (weld)
skullFaceW = 46; // skull width across the plate
skullMaskD = 44; // opened-up disc around the skull -> the grille voids
frontOuterX = shellInsideLength + 2*wallThickness; // X of the outer front face
@@ -125,7 +129,7 @@ speakerZc = 28.6; // speaker opening centre (Z)
// skull.svg imports at ~180.6mm wide (512-unit viewBox at 72dpi)
skullImportW = 180.6;
module skullArt() { import("skull.svg", center = true); }
module skullArt() { import("skull-2.svg", center = true); }
// The faceplate is a solid disc. The grille is the skull's negative
// space: inside a centre disc, everything that is NOT skull bone is
@@ -143,8 +147,8 @@ module grille2D()
scale(skullFaceW / skullImportW) skullArt();
}
// teeth: a row of slots cut into the jaw for extra grille area
for (i = [-2 : 2])
translate([i * 4.4, -15.5]) square([2.2, 7], center = true);
//for (i = [-2 : 2])
//translate([i * 4.4, -15.5]) square([2.2, 7], center = true);
}
}
BIN
View File
Binary file not shown.
@@ -0,0 +1,138 @@
/***************************************************
DFPlayer - A Mini MP3 Player For Arduino
<https://www.dfrobot.com/product-1121.html>
***************************************************
This example shows the basic function of library for DFPlayer.
Created 2016-12-07
By [Angelo qiao](Angelo.qiao@dfrobot.com)
GNU Lesser General Public License.
See <http://www.gnu.org/licenses/> for details.
All above must be included in any redistribution
****************************************************/
/***********Notice and Trouble shooting***************
1.Connection and Diagram can be found here
<https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299#Connection_Diagram>
2.This code is tested on Arduino Uno, Leonardo, Mega boards.
****************************************************/
#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"
//#if (defined(ARDUINO_Seeed_XIAO_nRF52840_Sense))
#include <Adafruit_TinyUSB.h> // for Serial
#define FPSerial Serial1 // D7 <- DFPlayer TX, D6 -> DFPlayer RX
// #elif (defined(ARDUINO_AVR_UNO) || defined(ESP8266)) // Using a soft serial port
// #include <SoftwareSerial.h>
// SoftwareSerial softSerial(/*rx =*/4, /*tx =*/5);
// #define FPSerial softSerial
// #else
// #define FPSerial Serial1
// #endif
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
uint32_t t0 = millis();
while (!Serial && millis() - t0 < 3000) {
delay(10); // for nrf52840 with native usb
Serial.println(F("Initializing serial..."));
}
FPSerial.begin(9600);
delay(1500); // let the DFPlayer boot
if (!myDFPlayer.begin(FPSerial, /*isACK=*/true, /*doReset=*/true)) {
Serial.println(F("DFPlayer not responding - check wiring / power / SD"));
delay(5000);
Serial.println(F("DFPlayer not responding - check wiring / power / SD"));
// fall through instead of hanging, so you can still debug
}
myDFPlayer.volume(20);
delay(50);
myDFPlayer.play(1);
}
void loop()
{
static unsigned long timer = millis();
if (millis() - timer > 3000) {
timer = millis();
myDFPlayer.next(); //Play next mp3 every 3 second.
}
if (myDFPlayer.available()) {
printDetail(myDFPlayer.readType(), myDFPlayer.read()); //Print the detail message from DFPlayer to handle different errors and states.
}
}
void printDetail(uint8_t type, int value){
switch (type) {
case TimeOut:
Serial.println(F("Time Out!"));
break;
case WrongStack:
Serial.println(F("Stack Wrong!"));
break;
case DFPlayerCardInserted:
Serial.println(F("Card Inserted!"));
break;
case DFPlayerCardRemoved:
Serial.println(F("Card Removed!"));
break;
case DFPlayerCardOnline:
Serial.println(F("Card Online!"));
break;
case DFPlayerUSBInserted:
Serial.println("USB Inserted!");
break;
case DFPlayerUSBRemoved:
Serial.println("USB Removed!");
break;
case DFPlayerPlayFinished:
Serial.print(F("Number:"));
Serial.print(value);
Serial.println(F(" Play Finished!"));
break;
case DFPlayerError:
Serial.print(F("DFPlayerError:"));
switch (value) {
case Busy:
Serial.println(F("Card not found"));
break;
case Sleeping:
Serial.println(F("Sleeping"));
break;
case SerialWrongStack:
Serial.println(F("Get Wrong Stack"));
break;
case CheckSumNotMatch:
Serial.println(F("Check Sum Not Match"));
break;
case FileIndexOut:
Serial.println(F("File Index Out of Bound"));
break;
case FileMismatch:
Serial.println(F("Cannot Find File"));
break;
case Advertise:
Serial.println(F("In Advertise"));
break;
default:
break;
}
break;
default:
break;
}
}