Compare commits
2 Commits
78f7ac0e68
...
62a66f5f6d
Author | SHA1 | Date |
---|---|---|
Matt McWilliams | 62a66f5f6d | |
Matt McWilliams | 3a435933e3 |
|
@ -145,15 +145,15 @@ int Servo_delay (int angleA, int angleB) {
|
|||
void Cap_off (boolean suppress, boolean force) {
|
||||
Endstop_on();
|
||||
current_angle = servo.read();
|
||||
if ((Read_endstop() || force) && (cap_state || current_angle != cap_off_angle)) {
|
||||
if ( (cap_state || current_angle != cap_off_angle)) {
|
||||
Servo_angle(cap_off_angle);
|
||||
cap_state = false;
|
||||
} else {
|
||||
log("Cap already off");
|
||||
}
|
||||
while (Read_endstop()) {
|
||||
/*while (Read_endstop()) {
|
||||
delay(1);
|
||||
}
|
||||
}*/
|
||||
Endstop_off();
|
||||
log("Cap_off()");
|
||||
if (!suppress) {
|
||||
|
@ -164,15 +164,15 @@ void Cap_off (boolean suppress, boolean force) {
|
|||
void Cap_on (boolean suppress, boolean force) {
|
||||
Endstop_on();
|
||||
current_angle = servo.read();
|
||||
if ((!Read_endstop() || force) && (!cap_state || current_angle != cap_on_angle)) {
|
||||
if ( (!cap_state || current_angle != cap_on_angle)) {
|
||||
Servo_angle(cap_on_angle);
|
||||
cap_state = true;
|
||||
} else {
|
||||
log("Cap already on");
|
||||
}
|
||||
while (!Read_endstop()) {
|
||||
/*while (!Read_endstop()) {
|
||||
delay(1);
|
||||
}
|
||||
}*/
|
||||
Endstop_off();
|
||||
log("Cap_on()");
|
||||
if (!suppress) {
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
boolean debug_state = false;
|
||||
|
||||
const int proj_fwd_pin = 12;
|
||||
const int proj_bwd_pin = 11;
|
||||
const int proj_pin = 10;
|
||||
const int proj_fwd_pin = 9;
|
||||
const int proj_bwd_pin = 10;
|
||||
const int proj_micro_pin = 4;
|
||||
const int proj_time = 1200;
|
||||
const int proj_delay = 42;
|
||||
|
||||
boolean proj_dir = true;
|
||||
boolean proj_running = false;
|
||||
volatile int proj_micro_raw;
|
||||
|
||||
const char cmd_projector = 'p';
|
||||
const char cmd_proj_forward = 'g';
|
||||
|
@ -25,6 +26,16 @@ void setup() {
|
|||
Serial.begin(57600);
|
||||
Serial.flush();
|
||||
Serial.setTimeout(serialDelay);
|
||||
pins_init();
|
||||
}
|
||||
|
||||
void pins_init () {
|
||||
pinMode(proj_fwd_pin, OUTPUT);
|
||||
pinMode(proj_bwd_pin, OUTPUT);
|
||||
pinMode(proj_micro_pin, INPUT_PULLUP);
|
||||
|
||||
analogWrite(proj_fwd_pin, 0);
|
||||
analogWrite(proj_bwd_pin, 0);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
@ -36,6 +47,9 @@ void loop() {
|
|||
cmd(cmd_char);
|
||||
cmd_char = 'z';
|
||||
}
|
||||
if (proj_running) {
|
||||
proj_reading();
|
||||
}
|
||||
}
|
||||
|
||||
void cmd (char val) {
|
||||
|
@ -72,11 +86,11 @@ void identify () {
|
|||
|
||||
void proj_start () {
|
||||
if (proj_dir) {
|
||||
digitalWrite(proj_fwd_pin, HIGH);
|
||||
digitalWrite(proj_bwd_pin, LOW);
|
||||
analogWrite(proj_fwd_pin, 255);
|
||||
analogWrite(proj_bwd_pin, 0);
|
||||
} else {
|
||||
digitalWrite(proj_bwd_pin, HIGH);
|
||||
digitalWrite(proj_fwd_pin, LOW);
|
||||
analogWrite(proj_bwd_pin, 255);
|
||||
analogWrite(proj_fwd_pin, 0);
|
||||
}
|
||||
proj_running = true;
|
||||
delay(500); // Let bump pass out of microswitch
|
||||
|
@ -95,8 +109,8 @@ void proj_reading () {
|
|||
}
|
||||
|
||||
void proj_stop () {
|
||||
digitalWrite(proj_bwd_pin, LOW);
|
||||
digitalWrite(proj_fwd_pin, LOW);
|
||||
analogWrite(proj_bwd_pin, 0);
|
||||
analogWrite(proj_fwd_pin, 0);
|
||||
|
||||
proj_running = false;
|
||||
|
||||
|
|
|
@ -25,7 +25,27 @@ RailSlotsD = 6;
|
|||
|
||||
MountBoltSpacingY=40;
|
||||
|
||||
OptoEndstopAdjustZ=0.25;
|
||||
OptoEndstopAdjustZ=2-9;
|
||||
|
||||
module OptoEndstop () {
|
||||
$fn=30;
|
||||
Y=5;
|
||||
Z2=3.64-1.75;
|
||||
difference () {
|
||||
union() {
|
||||
cube([11.15, 28.25, 1.75], center=true);
|
||||
translate([0,14,0]) cylinder(r=R(6), h=1.75, center=true);
|
||||
translate([0,-14,0]) cylinder(r=R(6), h=1.75, center=true);
|
||||
}
|
||||
translate([0,14,0]) cylinder(r=R(2.85), h=1.75+1, center=true);
|
||||
translate([0,-14,0]) cylinder(r=R(2.85), h=1.75+1, center=true);
|
||||
}
|
||||
translate([-R(6.1)+1.2, R(28.25)-R(Y+4.15+4.15)-3.65, 0]) {
|
||||
translate([0,R(Y)+R(4.15),-R(1.75)-R(10.15)]) cube([6.1, 4.15, 10.15], center=true);
|
||||
translate([0,-R(Y)-R(4.15),-R(1.75)-R(10.15)]) cube([6.1, 4.15, 10.15], center=true);
|
||||
}
|
||||
translate([3,4, -R(1.75)-R(.75)]) cube([3.6, 15.7, .75], center=true);
|
||||
}
|
||||
|
||||
module BoltVoid () {
|
||||
cylinder(r=R(BoltD), h=20, center=true);
|
||||
|
@ -66,9 +86,12 @@ module Mount () {
|
|||
translate([80, R(MountBoltSpacingY), 0]) RailSlots();
|
||||
translate([80, -R(MountBoltSpacingY), 0]) RailSlots();
|
||||
//endstop
|
||||
translate([0, -34, 25-2-2]) {
|
||||
cube([14, 20, 50], center=true);
|
||||
translate([0, 11, -12.5]) cylinder(r=R(22), h=4, center=true);
|
||||
translate([0, -34, 25-2-2-10]) {
|
||||
difference () {
|
||||
cube([14, 20, 50], center=true);
|
||||
translate([0, R(LensVoidDiameter)+10+4.01, 0]) cylinder(r=R(LensVoidDiameter)+5, h=LensY + 29, center=true, $fn=200);
|
||||
}
|
||||
translate([0, 11, -14+9]) cylinder(r=R(22), h=4, center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,29 +181,37 @@ module RailMount () {
|
|||
}
|
||||
|
||||
module OptoEndstopMount () {
|
||||
translate([-5,9.5,20]) {
|
||||
difference() {
|
||||
cube([14-0.3, 14, 24], center=true);
|
||||
translate([0, R(LensVoidDiameter)+15+4, 0]) cylinder(r=R(LensVoidDiameter)+15, h=LensY, center=true, $fn=200);
|
||||
translate([0,-8.3,0]) cube([7.25, 8, 24+1], center=true);
|
||||
translate([0,-5,-9+OptoEndstopAdjustZ]) rotate([90, 0, 0]) cylinder(r=R(2.9),h=10,center=true, $fn=40);
|
||||
translate([0,-5,10+OptoEndstopAdjustZ]) rotate([90, 0, 0]) cylinder(r=R(2.9),h=10,center=true, $fn=40);
|
||||
translate([0,1,1+OptoEndstopAdjustZ]) cube([8,14,11.5],center=true);
|
||||
translate([0,6,.75+OptoEndstopAdjustZ]) cylinder(r=R(22), h=4, center=true);
|
||||
}
|
||||
|
||||
translate([-5,9.5,20]) {
|
||||
difference() {
|
||||
translate([0, 0, 1-7.25]) cube([14-0.3-0.3, 14, 32+4], center=true);
|
||||
//lens void
|
||||
translate([0, R(LensVoidDiameter)+5+4, 0]) cylinder(r=R(LensVoidDiameter)+5, h=LensY + 29, center=true, $fn=200);
|
||||
//connector void
|
||||
translate([0,-8.3, -14.5]) cube([9, 8, 5], center=true);
|
||||
//bolts
|
||||
translate([2,-5,-13.25+OptoEndstopAdjustZ]) rotate([90, 0, 0]) cylinder(r=R(2.9),h=20,center=true, $fn=40);
|
||||
translate([2,-5,15+OptoEndstopAdjustZ]) rotate([90, 0, 0]) cylinder(r=R(2.9),h=20,center=true, $fn=40);
|
||||
//main void
|
||||
translate([1,1,-3]) cube([8,20,15],center=true);
|
||||
//pathway void
|
||||
translate([0,6,-2]) cylinder(r=R(22), h=4, center=true);
|
||||
//smd voids
|
||||
translate([-5, -6.5, -3]) cube([3.6, 1, 18], center=true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module Debug () {
|
||||
Mount();
|
||||
translate([-CapOffsetX,-CapOffsetY,5.71]) rotate([0,0,currentAngle]) Cap();
|
||||
//translate([-CapOffsetX,-CapOffsetY,5.71]) rotate([0,0,currentAngle]) Cap();
|
||||
//color("green") RailMount();
|
||||
translate([5, -38, -11.8+OptoEndstopAdjustZ]) rotate([0, -90, 0]) opto_endstop();
|
||||
//translate([5, -38, -11.8]) OptoEndstopMount();
|
||||
//translate([5, -38, -11.8+OptoEndstopAdjustZ]) rotate([0, -90, 0]) opto_endstop();
|
||||
//color("green") translate([5, -38, -11.8]) OptoEndstopMount();
|
||||
//translate([2, -38 + 2, -11.8 + 11 + 2 +.75]) rotate([90, 0, 0]) OptoEndstop();
|
||||
}
|
||||
|
||||
Render="MountFront";
|
||||
Render="Debug";
|
||||
|
||||
if (Render=="Debug") {
|
||||
Debug();
|
||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue