Compare commits

...

3 Commits

Author SHA1 Message Date
Neale Pickett bcce75feac Default to keyboard mode 2022-06-26 12:24:00 -06:00
Neale Pickett e9584169d1 Case work, bugfixes 2022-06-26 10:55:28 -06:00
Neale Pickett 2f8eab0b3b possibly-working pig 2022-06-25 16:45:38 -06:00
10 changed files with 66713 additions and 335626 deletions

View File

@ -10,6 +10,7 @@
#define SECOND (1000 * MILLISECOND)
VailAdapter::VailAdapter(unsigned int PiezoPin) {
this->keyboardMode = true;
this->buzzer = new PolyBuzzer(PiezoPin);
this->txToneFrequency = 440;
}
@ -108,6 +109,7 @@ void VailAdapter::HandleMIDI(midiEventPacket_t event) {
this->keyer->Release();
}
this->keyer = GetKeyerByNumber(event.byte2, this);
this->keyer->SetDitDuration(this->ditDuration);
break;
case 0x80: // Note off
this->buzzer->NoTone(1);

386762
case/body.stl

File diff suppressed because it is too large Load Diff

15502
case/cap.stl

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Make circles lovely and round
$fa = 1; $fs = 0.1;
outer_dimensions = [24.2, 21, 27];
outer_dimensions = [24.2, 21, 25];
outer_radius = 3.7;
wall_width = [1.3, 1.3, 1.3];
inner_dimensions = outer_dimensions - (wall_width * 2);
@ -14,28 +14,21 @@ channel = [16, 1, 1]; // Difensions of cap channel
channel_height = 2; // How far into the case the clips need to go
cap_thickness = 1.3;
// More information: https://danielupshaw.com/openscad-rounded-corners/
module roundedcube_simple(size=[1, 1, 1], center=false, r=0.5) {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
module roundedcube(size=[1, 1, 1], center=false, r=0.5) {
size = (size[0]==undef) ? [size, size, size] : size;
cubeSize = [size[0] - 2*r, size[1] - 2*r, size[2]];
translate = (center == false) ?
[r, r, r] :
[
r - (size[0] / 2),
r - (size[1] / 2),
r - (size[2] / 2)
];
translate(v = translate)
minkowski() {
cube(size = [
size[0] - (r * 2),
size[1] - (r * 2),
size[2] - (r * 2)
]);
sphere(r = r);
}
translate(center ? [0,0,0] : size/2) {
union() {
cube([size[0], cubeSize[1], size[2]], center=true);
cube([cubeSize[0], size[1], size[2]], center=true);
for (ymul = [-0.5, 0.5]) {
for (xmul = [-0.5, 0.5]) {
translate([cubeSize[0]*xmul, cubeSize[1]*ymul, 0]) cylinder(h=size[2], r=r, center=true);
}
}
}
}
}
module trs_support() {
@ -54,10 +47,12 @@ module usb_c() {
module case() {
difference() {
translate((outer_dimensions * z_elevate) + ([0, 0, -1] * outer_radius)) difference() {
roundedcube_simple(outer_dimensions, center=true, r=outer_radius);
roundedcube_simple(inner_dimensions, center=true, r=inner_radius);
translate(-outer_dimensions/2) cube([100, 100, outer_radius]);
translate((outer_dimensions * z_elevate) + ([0, 0, -1] * cap_thickness)) {
difference() {
roundedcube(outer_dimensions, center=true, r=outer_radius);
roundedcube(inner_dimensions, center=true, r=inner_radius);
translate(-outer_dimensions/2) cube([100, 100, cap_thickness]);
}
}
// USB C port
@ -86,7 +81,7 @@ module body() {
translate([-6, 0, xiao_elevation]) rotate(45, [0, 0, 1]) cube(15, center=true);
}
}
translate(outer_dimensions * center) roundedcube_simple(outer_dimensions, r=outer_radius);
translate(outer_dimensions * center) roundedcube(outer_dimensions, r=outer_radius);
}
@ -109,7 +104,7 @@ module body() {
// Channel in the back to make it easier to squeeze in the XIAO
translate([-4.5, 0, xiao_elevation]) intersection() {
cube([13, 100, pcb_thickness], center=true);
roundedcube_simple(inner_dimensions, center=true, r=inner_radius);
roundedcube(inner_dimensions, center=true, r=cap_thickness);
}
// Channels for bottom insertion part thingy
@ -143,11 +138,11 @@ module cap() {
inner = inner_dimensions * 0.97; // leave 5% slop
union() {
intersection() {
roundedcube_simple(outer_dimensions, center=true, r=outer_radius);
roundedcube(outer_dimensions, center=true, r=outer_radius);
translate([0, 0, cap_thickness/2]) cube([100, 100, cap_thickness], center=true);
}
intersection() {
roundedcube_simple(inner, center=true, r=inner_radius);
roundedcube(inner, center=true, r=inner_radius);
translate(center * inner) cube([100, 100, cap_thickness+2.2]);
}
difference() {
@ -175,7 +170,9 @@ if (TARGET == "body") {
body();
} else if (TARGET == "cap") {
cap();
} else {
} else if (true == true) {
color([0, 0.5, 0.5]) body();
color([0.5, 0, 0.5]) translate([0, 0, -cap_thickness]) cap();
} else {
roundedcube(10);
}

View File

@ -66,7 +66,7 @@ public:
this->ditDuration = 100;
}
void SetDitDuration(int duration) {
void SetDitDuration(unsigned int duration) {
this->ditDuration = duration;
}

View File

@ -18,7 +18,7 @@ class Keyer {
public:
virtual void SetOutput(Transmitter *output);
virtual void Reset();
virtual void SetDitDuration(int d);
virtual void SetDitDuration(unsigned int d);
virtual void Release();
virtual bool TxClosed();
virtual bool TxClosed(int relay);

View File

@ -16,8 +16,8 @@ void PolyBuzzer::update() {
if (playing != tones[i]) {
playing = tones[i];
tone(this->pin, tones[i]);
return;
}
return;
}
}
this->playing = 0;

View File

@ -1,11 +1,11 @@
#include "touchbounce.h"
void TouchBounce::attach(int pin) {
this->qt = Adafruit_FreeTouch(pin, OVERSAMPLE_2, RESISTOR_50K, FREQ_MODE_NONE);
this->qt = Adafruit_FreeTouch(pin, OVERSAMPLE_2, RESISTOR_0, FREQ_MODE_SPREAD);
this->qt.begin();
}
bool TouchBounce::readCurrentState() {
int val = this->qt.measure();
return val > QT_THRESHOLD/2;
return val > QT_THRESHOLD;
}

View File

@ -3,7 +3,7 @@
#include <Adafruit_FreeTouch.h>
#include "bounce2.h"
#define QT_THRESHOLD 850
#define QT_THRESHOLD 450
class TouchBounce: public Bounce {
public:

View File

@ -22,7 +22,7 @@
#define DIT_KEYBOARD_KEY KEY_LEFT_CTRL
#define DAH_KEYBOARD_KEY KEY_RIGHT_CTRL
#define TONE 550
#define TONE 3000
#define MILLISECOND 1
#define SECOND (1 * MILLISECOND)