Compare commits
2 Commits
93ac73f69e
...
1d2a65867b
Author | SHA1 | Date |
---|---|---|
Matt McWilliams | 1d2a65867b | |
Matt McWilliams | 498b585b67 |
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -2501,6 +2501,7 @@ const timing = require('./lib/ui/timing.js');
|
||||||
const Mscript = require('./lib/mscript');
|
const Mscript = require('./lib/mscript');
|
||||||
const { delay } = require('./lib/delay');
|
const { delay } = require('./lib/delay');
|
||||||
const alertObj = require('./lib/ui/alert.js');
|
const alertObj = require('./lib/ui/alert.js');
|
||||||
|
const gamecontroller = require('./lib/ui/gamecontroller.js');
|
||||||
const { Log } = require('./lib/log');
|
const { Log } = require('./lib/log');
|
||||||
|
|
||||||
let log;
|
let log;
|
||||||
|
@ -2533,4 +2534,5 @@ async function init () {
|
||||||
capper.init();
|
capper.init();
|
||||||
alertObj.init();
|
alertObj.init();
|
||||||
timing.init();
|
timing.init();
|
||||||
|
gamecontroller.init(seq, cmd, cam, proj);
|
||||||
};
|
};
|
|
@ -29,6 +29,15 @@ cam.set = function (dir, callback) {
|
||||||
cam.lock = true;
|
cam.lock = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cam.setAsync = async function (dir) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
return cam.set(dir, function (ms) {
|
||||||
|
setTimeout(reject, 10000);
|
||||||
|
return resolve(ms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
cam.setValue = function (val) {
|
cam.setValue = function (val) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var obj = {
|
var obj = {
|
||||||
|
@ -55,6 +64,16 @@ cam.move = function (callback) {
|
||||||
cam.queue[obj.id] = obj;
|
cam.queue[obj.id] = obj;
|
||||||
cam.lock = true;
|
cam.lock = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
cam.moveAsync = async function () {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
return cam.move(function (ms) {
|
||||||
|
setTimeout(reject, 10000);
|
||||||
|
return resolve(ms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
cam.end = function (c, id, ms) {
|
cam.end = function (c, id, ms) {
|
||||||
'use strict';
|
'use strict';
|
||||||
if (c === cfg.arduino.cmd.camera_forward) {
|
if (c === cfg.arduino.cmd.camera_forward) {
|
||||||
|
@ -85,6 +104,8 @@ cam.end = function (c, id, ms) {
|
||||||
if (typeof cam.queue[id] !== 'undefined') {
|
if (typeof cam.queue[id] !== 'undefined') {
|
||||||
if (typeof cam.queue[id].callback !== 'undefined') {
|
if (typeof cam.queue[id].callback !== 'undefined') {
|
||||||
cam.queue[id].callback(ms);
|
cam.queue[id].callback(ms);
|
||||||
|
} else {
|
||||||
|
log.info('NO CAM CALLBACK')
|
||||||
}
|
}
|
||||||
delete cam.queue[id];
|
delete cam.queue[id];
|
||||||
cam.lock = false;
|
cam.lock = false;
|
||||||
|
|
|
@ -15,14 +15,14 @@ cmd.projector_forward = function (callback) {
|
||||||
$('#cmd_proj_forward').addClass('active');
|
$('#cmd_proj_forward').addClass('active');
|
||||||
if (!proj.dir) {
|
if (!proj.dir) {
|
||||||
proj.set(true, function (ms) {
|
proj.set(true, function (ms) {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.move(res);
|
proj.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.move(res);
|
proj.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -40,14 +40,14 @@ cmd.projector_backward = function (callback) {
|
||||||
$('#cmd_proj_backward').addClass('active');
|
$('#cmd_proj_backward').addClass('active');
|
||||||
if (proj.dir) {
|
if (proj.dir) {
|
||||||
proj.set(false, function (ms) {
|
proj.set(false, function (ms) {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.move(res);
|
proj.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.move(res);
|
proj.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,14 +61,14 @@ cmd.projector_second_forward = function (callback) {
|
||||||
$('#cmd_proj2_forward').addClass('active');
|
$('#cmd_proj2_forward').addClass('active');
|
||||||
if (!proj.second.dir) {
|
if (!proj.second.dir) {
|
||||||
proj.second.set(true, function (ms) {
|
proj.second.set(true, function (ms) {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.second.move(res);
|
proj.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.second.move(res);
|
proj.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
cmd.projector_second_backward = function (callback) {
|
cmd.projector_second_backward = function (callback) {
|
||||||
|
@ -81,14 +81,14 @@ cmd.projector_second_backward = function (callback) {
|
||||||
$('#cmd_proj2_backward').addClass('active');
|
$('#cmd_proj2_backward').addClass('active');
|
||||||
if (proj.second.dir) {
|
if (proj.second.dir) {
|
||||||
proj.second.set(false, function (ms) {
|
proj.second.set(false, function (ms) {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.second.move(res);
|
proj.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
proj.second.move(res);
|
proj.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -112,32 +112,32 @@ cmd.camera_forward = function (rgb, callback) {
|
||||||
var off = [0, 0, 0];
|
var off = [0, 0, 0];
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
gui.updateState();
|
gui.updateState();
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
$('#cmd_cam_forward').removeClass('active');
|
$('#cmd_cam_forward').removeClass('active');
|
||||||
if (callback) { callback(ms); }
|
if (callback) { callback(ms); }
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
};
|
};
|
||||||
$('#cmd_cam_forward').addClass('active');
|
$('#cmd_cam_forward').addClass('active');
|
||||||
if (!cam.dir) {
|
if (!cam.dir) {
|
||||||
cam.set(true, function () {
|
cam.set(true, function () {
|
||||||
setTimeout( function () {
|
//setTimeout( function () {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
setTimeout( function () {
|
//setTimeout( function () {
|
||||||
cam.move(res);
|
cam.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
cam.move(res);
|
cam.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -234,20 +234,20 @@ cmd.camera_backward = function (rgb, callback) {
|
||||||
$('#cmd_cam_backward').addClass('active');
|
$('#cmd_cam_backward').addClass('active');
|
||||||
if (cam.dir) {
|
if (cam.dir) {
|
||||||
cam.set(false, function () {
|
cam.set(false, function () {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
cam.move(res);
|
cam.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
cam.move(res);
|
cam.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -284,12 +284,12 @@ cmd.black_backward = function (callback) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
cam.set(false, function () {
|
cam.set(false, function () {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
cam.move(res);
|
cam.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -309,12 +309,12 @@ cmd.black_backward = function (callback) {
|
||||||
}, cfg.arduino.serialDelay);
|
}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
cam.move(res);
|
cam.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -339,32 +339,32 @@ cmd.camera_second_forward = function (callback) {
|
||||||
var off = [0, 0, 0];
|
var off = [0, 0, 0];
|
||||||
var res = function (ms) {
|
var res = function (ms) {
|
||||||
gui.updateState();
|
gui.updateState();
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
$('#cmd_cam2_forward').removeClass('active');
|
$('#cmd_cam2_forward').removeClass('active');
|
||||||
if (callback) { callback(ms); }
|
if (callback) { callback(ms); }
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
};
|
};
|
||||||
$('#cmd_cam2_forward').addClass('active');
|
$('#cmd_cam2_forward').addClass('active');
|
||||||
if (!cam.second.dir) {
|
if (!cam.second.dir) {
|
||||||
cam.second.set(true, function () {
|
cam.second.set(true, function () {
|
||||||
setTimeout( function () {
|
//setTimeout( function () {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
setTimeout( function () {
|
setTimeout( function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -382,20 +382,20 @@ cmd.camera_second_backward = function (callback) {
|
||||||
$('#cmd_cam_backward').addClass('active');
|
$('#cmd_cam_backward').addClass('active');
|
||||||
if (cam.second.dir) {
|
if (cam.second.dir) {
|
||||||
cam.second.set(false, function () {
|
cam.second.set(false, function () {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(rgb);
|
light.display(rgb);
|
||||||
light.set(rgb, function () {
|
light.set(rgb, function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -410,21 +410,21 @@ cmd.black_second_forward = function (callback) {
|
||||||
$('#cmd_black2_forward').addClass('active');
|
$('#cmd_black2_forward').addClass('active');
|
||||||
if (!cam.second.dir) {
|
if (!cam.second.dir) {
|
||||||
cam.second.set(true, function () {
|
cam.second.set(true, function () {
|
||||||
setTimeout( function () {
|
//setTimeout( function () {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
setTimeout( function () {
|
//setTimeout( function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -440,20 +440,20 @@ cmd.black2_backward = function (callback) {
|
||||||
$('#cmd_black2_backward').addClass('active');
|
$('#cmd_black2_backward').addClass('active');
|
||||||
if (cam.second.dir) {
|
if (cam.second.dir) {
|
||||||
cam.second.set(false, function () {
|
cam.second.set(false, function () {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setTimeout(function () {
|
//setTimeout(function () {
|
||||||
light.display(off);
|
light.display(off);
|
||||||
light.set(off, function () {
|
light.set(off, function () {
|
||||||
cam.second.move(res);
|
cam.second.move(res);
|
||||||
});
|
});
|
||||||
}, cfg.arduino.serialDelay);
|
//}, cfg.arduino.serialDelay);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,159 @@
|
||||||
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
|
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||||
|
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||||
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
let gamecontroller;
|
||||||
|
class GameController {
|
||||||
|
constructor() {
|
||||||
|
this.cameraMoving = false;
|
||||||
|
this.projectorMoving = false;
|
||||||
|
}
|
||||||
|
init(seq, cmd, cam, proj) {
|
||||||
|
this.seq = seq;
|
||||||
|
this.cmd = cmd;
|
||||||
|
this.cam = cam;
|
||||||
|
this.proj = proj;
|
||||||
|
window.addEventListener('gamepadconnected', (e) => {
|
||||||
|
const gamepads = navigator.getGamepads();
|
||||||
|
if (gamepads.length > 0) {
|
||||||
|
console.dir(gamepads[0]);
|
||||||
|
this.pressed = gamepads[0].buttons.map((button) => { return button.pressed; });
|
||||||
|
if (gamepads[0].id.indexOf("USB Gamepad") !== -1 && gamepads[0].buttons.length === 10) {
|
||||||
|
gui.notify('GAMEPAD CONNECTED', 'NES Controller');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gui.notify('GAMEPAD CONNECTED', 'Unknown');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.handleController();
|
||||||
|
});
|
||||||
|
window.addEventListener('gamepaddisconnected', (e) => {
|
||||||
|
gui.notify('GAMEPAD DISCONNECTED', '');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
handleController() {
|
||||||
|
const gamepads = navigator.getGamepads();
|
||||||
|
if (gamepads.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const gamepad = gamepads[0];
|
||||||
|
if (gamepad.id.indexOf("USB Gamepad") !== -1 && gamepad.buttons.length === 10) {
|
||||||
|
this.handleNESController(gamepad);
|
||||||
|
}
|
||||||
|
requestAnimationFrame(this.handleController.bind(this));
|
||||||
|
}
|
||||||
|
handleNESController(gamepad) {
|
||||||
|
const leftStickX = gamepad.axes[0];
|
||||||
|
const leftStickY = gamepad.axes[1];
|
||||||
|
//log.info(leftStickX + ',' + leftStickY)
|
||||||
|
//select == 8
|
||||||
|
//start == 9
|
||||||
|
//A == 2
|
||||||
|
//B == 1
|
||||||
|
for (let i = 0; i < gamepad.buttons.length; i++) {
|
||||||
|
if (gamepad.buttons[i].pressed && !this.pressed[i]) {
|
||||||
|
log.info(`Button[${i}] pressed`);
|
||||||
|
if (i === 2) {
|
||||||
|
if (!this.cameraMoving)
|
||||||
|
this.camera();
|
||||||
|
}
|
||||||
|
else if (i === 1) {
|
||||||
|
if (!this.projectorMoving)
|
||||||
|
this.projector();
|
||||||
|
}
|
||||||
|
else if (i == 9) {
|
||||||
|
this.sequence();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.pressed = gamepad.buttons.map((button) => { return button.pressed; });
|
||||||
|
this.cameraDirection(leftStickX);
|
||||||
|
this.projectorDirection(leftStickY);
|
||||||
|
}
|
||||||
|
camera(silent = false) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const dir = this.cam.dir ? 'camera_forward' : 'camera_backward';
|
||||||
|
if (!silent)
|
||||||
|
log.info(`Gamepad A ${dir}`);
|
||||||
|
this.cameraMoving = true;
|
||||||
|
yield this.cam.moveAsync();
|
||||||
|
this.cameraMoving = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
projector(silent = false) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const dir = this.cam.dir ? 'projector_forward' : 'projector_backward';
|
||||||
|
if (!silent)
|
||||||
|
log.info(`Gamepad B ${dir}`);
|
||||||
|
this.projectorMoving = true;
|
||||||
|
yield this.proj.moveAsync();
|
||||||
|
this.projectorMoving = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
cameraDirection(dir) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (dir !== 0 && this.cameraMoving) {
|
||||||
|
log.info('Camera D-PAD blocked');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dir === 1) {
|
||||||
|
log.info('Gamepad D-pad camera_forward');
|
||||||
|
if (!this.cam.dir) {
|
||||||
|
this.cameraMoving = true;
|
||||||
|
yield this.proj.setAsync(true);
|
||||||
|
}
|
||||||
|
yield this.camera(true);
|
||||||
|
}
|
||||||
|
else if (dir === -1) {
|
||||||
|
log.info('Gamepad D-pad camera_backward');
|
||||||
|
if (this.cam.dir) {
|
||||||
|
this.cameraMoving = true;
|
||||||
|
yield this.cam.setAsync(true);
|
||||||
|
}
|
||||||
|
yield this.camera(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
projectorDirection(dir) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (dir !== 0 && this.projectorMoving) {
|
||||||
|
log.info('Projector D-PAD blocked');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dir === -1) {
|
||||||
|
log.info('Gamepad D-pad projector_forward');
|
||||||
|
if (!this.proj.dir) {
|
||||||
|
this.projectorMoving = true;
|
||||||
|
yield this.proj.setAsync(true);
|
||||||
|
}
|
||||||
|
yield this.projector(true);
|
||||||
|
}
|
||||||
|
else if (dir === 1) {
|
||||||
|
log.info('Gamepad D-pad projector_backward');
|
||||||
|
if (this.proj.dir) {
|
||||||
|
this.projectorMoving = true;
|
||||||
|
yield this.proj.setAsync(false);
|
||||||
|
}
|
||||||
|
yield this.projector(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
sequence() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
if (!this.seq.isRunning()) {
|
||||||
|
this.seq.start();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.seq.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gamecontroller = new GameController();
|
||||||
|
module.exports = gam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,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;oBAClB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;iBAChC;gBACD,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;aAC5B;iBAAM,IAAI,GAAG,KAAK,CAAC,EAAE;gBACpB,GAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;gBAC7C,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;oBACjB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;oBAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;iBACjC;gBACD,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;aAC5B;QACH,CAAC;KAAA;IAEK,QAAQ;;YACZ,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE;gBACzB,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;aAClB;iBAAM;gBACL,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;aACnB;QACH,CAAC;KAAA;CACF;AAGD,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC;AACtC,MAAM,CAAC,OAAO,GAAG,cAAc,CAAC"}
|
|
@ -28,6 +28,16 @@ proj.set = function (dir, callback) {
|
||||||
proj.queue[obj.id] = obj;
|
proj.queue[obj.id] = obj;
|
||||||
proj.lock = true;
|
proj.lock = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
proj.setAsync = async function (dir) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
return proj.set(dir, function (ms) {
|
||||||
|
setTimeout(reject, 10000);
|
||||||
|
return resolve(ms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
proj.move = function (callback) {
|
proj.move = function (callback) {
|
||||||
'use strict';
|
'use strict';
|
||||||
var obj;
|
var obj;
|
||||||
|
@ -46,6 +56,16 @@ proj.move = function (callback) {
|
||||||
proj.queue[obj.id] = obj;
|
proj.queue[obj.id] = obj;
|
||||||
proj.lock = true;
|
proj.lock = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
proj.moveAsync = async function () {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
return proj.move(function (ms) {
|
||||||
|
setTimeout(reject, 10000);
|
||||||
|
return resolve(ms);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
proj.end = function (c, id, ms) {
|
proj.end = function (c, id, ms) {
|
||||||
'use strict';
|
'use strict';
|
||||||
if (c === cfg.arduino.cmd.projector_forward) {
|
if (c === cfg.arduino.cmd.projector_forward) {
|
||||||
|
@ -75,6 +95,8 @@ proj.end = function (c, id, ms) {
|
||||||
if (typeof proj.queue[id] !== 'undefined') {
|
if (typeof proj.queue[id] !== 'undefined') {
|
||||||
if (typeof proj.queue[id].callback !== 'undefined') {
|
if (typeof proj.queue[id].callback !== 'undefined') {
|
||||||
proj.queue[id].callback(ms);
|
proj.queue[id].callback(ms);
|
||||||
|
} else {
|
||||||
|
log.info('NO PROJ CALLBACK')
|
||||||
}
|
}
|
||||||
delete proj.queue[id];
|
delete proj.queue[id];
|
||||||
proj.lock = false;
|
proj.lock = false;
|
||||||
|
|
|
@ -21,6 +21,7 @@ class Sequence {
|
||||||
let timeStr;
|
let timeStr;
|
||||||
//console.log(JSON.stringify(arg))
|
//console.log(JSON.stringify(arg))
|
||||||
if (arg.start) {
|
if (arg.start) {
|
||||||
|
this.running = true;
|
||||||
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
||||||
this.activeStep(arg.step);
|
this.activeStep(arg.step);
|
||||||
log.info(`Step ${arg.step + 1}/${this.arr.length}, Loop ${arg.loop + 1}/${this.loops}`, 'SERIAL', true);
|
log.info(`Step ${arg.step + 1}/${this.arr.length}, Loop ${arg.loop + 1}/${this.loops}`, 'SERIAL', true);
|
||||||
|
@ -33,6 +34,7 @@ class Sequence {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (arg.stop) {
|
else if (arg.stop) {
|
||||||
|
this.running = false;
|
||||||
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
||||||
//console.log(JSON.stringify(arg))
|
//console.log(JSON.stringify(arg))
|
||||||
this.progress(arg.step + 1, arg.loop);
|
this.progress(arg.step + 1, arg.loop);
|
||||||
|
@ -218,9 +220,11 @@ class Sequence {
|
||||||
}
|
}
|
||||||
cancel() {
|
cancel() {
|
||||||
gui.spinner(true, `Cancelling sequence...`);
|
gui.spinner(true, `Cancelling sequence...`);
|
||||||
this.running = false;
|
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
isRunning() {
|
||||||
|
return this.running;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
seq = new Sequence();
|
seq = new Sequence();
|
||||||
module.exports = seq;
|
module.exports = seq;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.109",
|
"version": "1.8.150",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"description": "GUI for the mcopy small gauge film optical printer platform",
|
"description": "GUI for the mcopy small gauge film optical printer platform",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -27,6 +27,7 @@ const timing = require('./lib/ui/timing.js');
|
||||||
const Mscript = require('./lib/mscript');
|
const Mscript = require('./lib/mscript');
|
||||||
const { delay } = require('./lib/delay');
|
const { delay } = require('./lib/delay');
|
||||||
const alertObj = require('./lib/ui/alert.js');
|
const alertObj = require('./lib/ui/alert.js');
|
||||||
|
const gamecontroller = require('./lib/ui/gamecontroller.js');
|
||||||
const { Log } = require('./lib/log');
|
const { Log } = require('./lib/log');
|
||||||
|
|
||||||
let log;
|
let log;
|
||||||
|
@ -59,4 +60,5 @@ async function init () {
|
||||||
capper.init();
|
capper.init();
|
||||||
alertObj.init();
|
alertObj.init();
|
||||||
timing.init();
|
timing.init();
|
||||||
|
gamecontroller.init(seq, cmd, cam, proj);
|
||||||
};
|
};
|
|
@ -0,0 +1,155 @@
|
||||||
|
let gamecontroller : GameController;
|
||||||
|
|
||||||
|
class GameController {
|
||||||
|
private seq : Sequence;
|
||||||
|
private cmd : any;
|
||||||
|
private cam : any;
|
||||||
|
private proj : any;
|
||||||
|
private pressed : boolean[];
|
||||||
|
|
||||||
|
private cameraMoving : boolean = false;
|
||||||
|
private projectorMoving : boolean = false;
|
||||||
|
|
||||||
|
constructor () {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public init (seq : Sequence, cmd : any, cam : any, proj : any) {
|
||||||
|
this.seq = seq;
|
||||||
|
this.cmd = cmd;
|
||||||
|
this.cam = cam;
|
||||||
|
this.proj = proj;
|
||||||
|
|
||||||
|
window.addEventListener('gamepadconnected', (e) => {
|
||||||
|
const gamepads = navigator.getGamepads();
|
||||||
|
if (gamepads.length > 0) {
|
||||||
|
console.dir(gamepads[0]);
|
||||||
|
this.pressed = gamepads[0].buttons.map((button: GamepadButton) => { return button.pressed; });
|
||||||
|
if (gamepads[0].id.indexOf("USB Gamepad") !== -1 && gamepads[0].buttons.length === 10) {
|
||||||
|
gui.notify('GAMEPAD CONNECTED', 'NES Controller');
|
||||||
|
} else {
|
||||||
|
gui.notify('GAMEPAD CONNECTED', 'Unknown');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.handleController();
|
||||||
|
});
|
||||||
|
|
||||||
|
window.addEventListener('gamepaddisconnected', (e) => {
|
||||||
|
gui.notify('GAMEPAD DISCONNECTED', '');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
handleController () {
|
||||||
|
const gamepads = navigator.getGamepads();
|
||||||
|
|
||||||
|
if (gamepads.length === 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const gamepad : Gamepad = gamepads[0];
|
||||||
|
if (gamepad.id.indexOf("USB Gamepad") !== -1 && gamepad.buttons.length === 10) {
|
||||||
|
this.handleNESController(gamepad);
|
||||||
|
}
|
||||||
|
|
||||||
|
requestAnimationFrame(this.handleController.bind(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleNESController (gamepad : Gamepad) {
|
||||||
|
const leftStickX : number = gamepad.axes[0];
|
||||||
|
const leftStickY : number = gamepad.axes[1];
|
||||||
|
//log.info(leftStickX + ',' + leftStickY)
|
||||||
|
//select == 8
|
||||||
|
//start == 9
|
||||||
|
//A == 2
|
||||||
|
//B == 1
|
||||||
|
for (let i = 0; i < gamepad.buttons.length; i++) {
|
||||||
|
if (gamepad.buttons[i].pressed && !this.pressed[i]) {
|
||||||
|
log.info(`Button[${i}] pressed`);
|
||||||
|
if (i === 2) {
|
||||||
|
if (!this.cameraMoving) this.camera();
|
||||||
|
} else if (i === 1) {
|
||||||
|
if (!this.projectorMoving) this.projector();
|
||||||
|
} else if (i == 9) {
|
||||||
|
this.sequence();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pressed = gamepad.buttons.map((button: GamepadButton) => { return button.pressed; });
|
||||||
|
|
||||||
|
this.cameraDirection(leftStickX);
|
||||||
|
this.projectorDirection(leftStickY);
|
||||||
|
}
|
||||||
|
|
||||||
|
async camera (silent : boolean = false) {
|
||||||
|
const dir : string = this.cam.dir ? 'camera_forward' : 'camera_backward';
|
||||||
|
if (!silent) log.info(`Gamepad A ${dir}`);
|
||||||
|
this.cameraMoving = true;
|
||||||
|
await this.cam.moveAsync();
|
||||||
|
this.cameraMoving = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async projector (silent : boolean = false) {
|
||||||
|
const dir : string = this.cam.dir ? 'projector_forward' : 'projector_backward';
|
||||||
|
if (!silent) log.info(`Gamepad B ${dir}`);
|
||||||
|
this.projectorMoving = true;
|
||||||
|
await this.proj.moveAsync();
|
||||||
|
this.projectorMoving = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
async cameraDirection (dir: number) {
|
||||||
|
if (dir !== 0 && this.cameraMoving) {
|
||||||
|
log.info('Camera D-PAD blocked')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dir === 1) {
|
||||||
|
log.info('Gamepad D-pad camera_forward');
|
||||||
|
if (!this.cam.dir) {
|
||||||
|
this.cameraMoving = true;
|
||||||
|
await this.proj.setAsync(true);
|
||||||
|
}
|
||||||
|
await this.camera(true);
|
||||||
|
} else if (dir === -1) {
|
||||||
|
log.info('Gamepad D-pad camera_backward');
|
||||||
|
if (this.cam.dir) {
|
||||||
|
this.cameraMoving = true;
|
||||||
|
await this.cam.setAsync(true);
|
||||||
|
}
|
||||||
|
await this.camera(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async projectorDirection (dir : number) {
|
||||||
|
if (dir !== 0 && this.projectorMoving) {
|
||||||
|
log.info('Projector D-PAD blocked')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dir === -1) {
|
||||||
|
log.info('Gamepad D-pad projector_forward');
|
||||||
|
if (!this.proj.dir) {
|
||||||
|
this.projectorMoving = true;
|
||||||
|
await this.proj.setAsync(true);
|
||||||
|
}
|
||||||
|
await this.projector(true);
|
||||||
|
} else if (dir === 1) {
|
||||||
|
log.info('Gamepad D-pad projector_backward');
|
||||||
|
if (this.proj.dir) {
|
||||||
|
this.projectorMoving = true;
|
||||||
|
await this.proj.setAsync(false);
|
||||||
|
}
|
||||||
|
await this.projector(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async sequence () {
|
||||||
|
if (!this.seq.isRunning()) {
|
||||||
|
this.seq.start();
|
||||||
|
} else {
|
||||||
|
this.seq.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
gamecontroller = new GameController();
|
||||||
|
module.exports = gamecontroller;
|
|
@ -49,6 +49,7 @@ class Sequence {
|
||||||
let timeStr;
|
let timeStr;
|
||||||
//console.log(JSON.stringify(arg))
|
//console.log(JSON.stringify(arg))
|
||||||
if (arg.start) {
|
if (arg.start) {
|
||||||
|
this.running = true;
|
||||||
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
||||||
this.activeStep(arg.step);
|
this.activeStep(arg.step);
|
||||||
log.info(`Step ${arg.step + 1}/${this.arr.length}, Loop ${arg.loop + 1}/${this.loops}`, 'SERIAL', true);
|
log.info(`Step ${arg.step + 1}/${this.arr.length}, Loop ${arg.loop + 1}/${this.loops}`, 'SERIAL', true);
|
||||||
|
@ -58,6 +59,7 @@ class Sequence {
|
||||||
this.progress(0, 0);
|
this.progress(0, 0);
|
||||||
}
|
}
|
||||||
} else if (arg.stop) {
|
} else if (arg.stop) {
|
||||||
|
this.running = false;
|
||||||
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
if (typeof arg.loop !== 'undefined' && typeof arg.step !== 'undefined') {
|
||||||
//console.log(JSON.stringify(arg))
|
//console.log(JSON.stringify(arg))
|
||||||
this.progress(arg.step + 1, arg.loop);
|
this.progress(arg.step + 1, arg.loop);
|
||||||
|
@ -257,9 +259,12 @@ class Sequence {
|
||||||
|
|
||||||
public cancel () {
|
public cancel () {
|
||||||
gui.spinner(true, `Cancelling sequence...`);
|
gui.spinner(true, `Cancelling sequence...`);
|
||||||
this.running = false;
|
|
||||||
this.stop();
|
this.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isRunning () : boolean {
|
||||||
|
return this.running;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
seq = new Sequence();
|
seq = new Sequence();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
var HID = require('node-hid');
|
||||||
|
console.log(HID.devices());
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alert": "file:app/lib/alert",
|
"alert": "file:app/lib/alert",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"description": "Small gauge film optical printer platform",
|
"description": "Small gauge film optical printer platform",
|
||||||
"main": "build.js",
|
"main": "build.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.150",
|
"version": "1.8.152",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -231,7 +231,7 @@ module debug () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PART = "9pin_plug";
|
PART = "9pin_socket";
|
||||||
|
|
||||||
if (PART == "9pin_plug") {
|
if (PART == "9pin_plug") {
|
||||||
rotate([180, 0, 0]) cpc_9pin_plug();
|
rotate([180, 0, 0]) cpc_9pin_plug();
|
||||||
|
|
|
@ -41,7 +41,7 @@ BodyX = 18.44;
|
||||||
|
|
||||||
FrontBodyVoid = 12;
|
FrontBodyVoid = 12;
|
||||||
|
|
||||||
KeySpacingY = 57.4 - .2;
|
KeySpacingY = 57.2;
|
||||||
KeyZ = -13.25;
|
KeyZ = -13.25;
|
||||||
|
|
||||||
BearingOuterDiameter = 21.6;
|
BearingOuterDiameter = 21.6;
|
||||||
|
@ -61,6 +61,7 @@ FilmZ = -3.5;
|
||||||
GateBoltX = 21.2;
|
GateBoltX = 21.2;
|
||||||
GateBoltSpacingY = 105;
|
GateBoltSpacingY = 105;
|
||||||
|
|
||||||
|
SlideRailBoltSpacingY = 26;
|
||||||
SlideRailBoltSpacingZ = 24;
|
SlideRailBoltSpacingZ = 24;
|
||||||
|
|
||||||
module m5_nut_bolt (pos = [0, 0, 0], rot = [0, 0, 0], bolt = 20, nut = 4, nutOffset = 0) {
|
module m5_nut_bolt (pos = [0, 0, 0], rot = [0, 0, 0], bolt = 20, nut = 4, nutOffset = 0) {
|
||||||
|
@ -179,10 +180,11 @@ module gate_mask_text_void (string = "example", pos = [0, 0, 0], rot = [0, 0, 0]
|
||||||
}
|
}
|
||||||
|
|
||||||
module gate_mask_text (format = "") {
|
module gate_mask_text (format = "") {
|
||||||
|
Z = -3;
|
||||||
if (format == "standard16") {
|
if (format == "standard16") {
|
||||||
gate_mask_text_void("16mm", pos = [11, 0, -2.5], rot = [90, 0, 90]);
|
gate_mask_text_void("16mm", pos = [11, 0, Z], rot = [90, 0, 90]);
|
||||||
} else if (format == "super16") {
|
} else if (format == "super16") {
|
||||||
gate_mask_text_void("super16", pos = [11, 0, -2.5], rot = [90, 0, 90]);
|
gate_mask_text_void("super16", pos = [11, 0, Z], rot = [90, 0, 90]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,12 +378,17 @@ module sprocketed_roller_text (pos = [0, 0, 0], rot = [0, 0, 0], font_size = 3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module sprocketed_roller_16mm (pos = [0, 0, 0], rot = [0, 0, 0], side = "TOP") {
|
module sprocketed_roller_16mm (pos = [0, 0, 0], rot = [0, 0, 0], side = "TAKEUP") {
|
||||||
$fn = 160;
|
$fn = 160;
|
||||||
TaperD = 19.05;
|
TaperD = 19.05;
|
||||||
TaperH = 5;
|
TaperH = 5;
|
||||||
RotateSprocketZ = side == "TOP" ? 7 : -16;
|
AdjustRollers = 0.25;
|
||||||
TopChars = side == "TOP" ? "TAKEUP" : "FEED";
|
//θ = (arc length / radius) * (360° / 2π)
|
||||||
|
AdjustRollersAngle = (AdjustRollers / (TaperD / 2)) * (360 / (2 * PI));
|
||||||
|
echo("Adjust Rollers Angle", AdjustRollersAngle);
|
||||||
|
FeedSprocketAngle = -16 + AdjustRollersAngle;
|
||||||
|
TakeupSprocketAngle = 7 + AdjustRollersAngle;
|
||||||
|
RotateSprocketZ = side == "TAKEUP" ? TakeupSprocketAngle : FeedSprocketAngle;
|
||||||
translate(pos) rotate(rot) {
|
translate(pos) rotate(rot) {
|
||||||
difference() {
|
difference() {
|
||||||
union () {
|
union () {
|
||||||
|
@ -396,14 +403,14 @@ module sprocketed_roller_16mm (pos = [0, 0, 0], rot = [0, 0, 0], side = "TOP") {
|
||||||
translate([-20, 0, 16.15]) rotate([45, 0, 0]) cube([40, 1, 1], center = true);
|
translate([-20, 0, 16.15]) rotate([45, 0, 0]) cube([40, 1, 1], center = true);
|
||||||
translate([0, 0, 15.9]) cylinder(r = R(2.5), h = 1, center = true, $fn = 30);
|
translate([0, 0, 15.9]) cylinder(r = R(2.5), h = 1, center = true, $fn = 30);
|
||||||
//pressure relief hole
|
//pressure relief hole
|
||||||
cylinder(r = R(1.5), h = 50, center = true, $fn = 30);
|
//cylinder(r = R(2), h = 50, center = true, $fn = 30);
|
||||||
//void for key
|
//void for key
|
||||||
translate([0, 0, -21.15 - 5]) cube([7.95 + 1, 2.37, 10], center = true);
|
translate([0, 0, -21.15 - 5]) cube([7.95 + 1, 2.37, 10], center = true);
|
||||||
translate([(-15 / 2) - (6 / 2) + 0.2, 0, -31]) cube([15, 15, 40], center = true);
|
translate([(-15 / 2) - (6 / 2) + 0.2, 0, -31]) cube([15, 15, 40], center = true);
|
||||||
//m2.5 bolt
|
//m2.5 bolt
|
||||||
translate([0, 0, -15.85]) rotate([0, 90, 0]) cylinder(r = R(2.75), h = 30, center = true, $fn = 30);
|
translate([0, 0, -15.85]) rotate([0, 90, 0]) cylinder(r = R(2.75), h = 30, center = true, $fn = 30);
|
||||||
//
|
//
|
||||||
sprocketed_roller_text([0, 0, 16], chars = TopChars);
|
sprocketed_roller_text([0, 0, 16], chars = side);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -413,10 +420,12 @@ module sprocketed_roller_16mm (pos = [0, 0, 0], rot = [0, 0, 0], side = "TOP") {
|
||||||
//BOM: 2, M2.5 hex nut, ISO 4032, Attaches the bolt to the nut
|
//BOM: 2, M2.5 hex nut, ISO 4032, Attaches the bolt to the nut
|
||||||
module sprocketed_roller_nut_16mm (pos = [0, 0, 0], rot = [0, 0, 0]) {
|
module sprocketed_roller_nut_16mm (pos = [0, 0, 0], rot = [0, 0, 0]) {
|
||||||
$fn = 80;
|
$fn = 80;
|
||||||
translate(pos) rotate(rot) difference() {
|
NutOuterD = 18;
|
||||||
|
translate(pos) rotate(rot) {
|
||||||
|
difference() {
|
||||||
union () {
|
union () {
|
||||||
translate([0, 0, -5]) cylinder(r = R(11), h = 7, center = true);
|
translate([0, 0, -5]) cylinder(r = R(11), h = 7, center = true);
|
||||||
translate([0, 0, -6.5]) cylinder(r = R(18), h = 8, center = true);
|
translate([0, 0, -6.5]) cylinder(r = R(NutOuterD), h = 8, center = true);
|
||||||
}
|
}
|
||||||
translate([0, 0, 11.6]) difference () {
|
translate([0, 0, 11.6]) difference () {
|
||||||
union () {
|
union () {
|
||||||
|
@ -430,6 +439,9 @@ module sprocketed_roller_nut_16mm (pos = [0, 0, 0], rot = [0, 0, 0]) {
|
||||||
translate([0, 0, -21]) cylinder(r = R(4.75), h = 30, center = true, $fn = 30);
|
translate([0, 0, -21]) cylinder(r = R(4.75), h = 30, center = true, $fn = 30);
|
||||||
translate([0, 0, 22]) m2_5_nut(30);
|
translate([0, 0, 22]) m2_5_nut(30);
|
||||||
}
|
}
|
||||||
|
//taper
|
||||||
|
translate([0, 0, -10]) cylinder(r1 = R(8), r2 = R(5.5), h = 2, center = true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,14 +478,14 @@ module body (pos = [0, 0, 0], gauge = "16mm") {
|
||||||
translate([-BodyX + 7.5, 0, 0]) cube([BodyX, PlateY + 2, BodyZ + 1], center = true);
|
translate([-BodyX + 7.5, 0, 0]) cube([BodyX, PlateY + 2, BodyZ + 1], center = true);
|
||||||
|
|
||||||
//slide rails bolts
|
//slide rails bolts
|
||||||
m2_5_nut_bolt([6, 13.2, (SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ ], [0, 90, 0], nut = 10, pad = 0.1);
|
m2_5_nut_bolt([6, SlideRailBoltSpacingY / 2, (SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ ], [0, 90, 0], nut = 10, pad = 0.1);
|
||||||
m2_5_nut_bolt([6, -13.2, (SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ], [0, 90, 0], nut = 10, pad = 0.1);
|
m2_5_nut_bolt([6, -SlideRailBoltSpacingY / 2, (SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ], [0, 90, 0], nut = 10, pad = 0.1);
|
||||||
m2_5_nut_bolt([6, 13.2, (-SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ], [0, 90, 0], nut = 10, pad = 0.1);
|
m2_5_nut_bolt([6, SlideRailBoltSpacingY / 2, (-SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ], [0, 90, 0], nut = 10, pad = 0.1);
|
||||||
m2_5_nut_bolt([6, -13.2, (-SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ], [0, 90, 0], nut = 10, pad = 0.1);
|
m2_5_nut_bolt([6, -SlideRailBoltSpacingY / 2, (-SlideRailBoltSpacingZ / 2) + SlideRailsOffsetZ], [0, 90, 0], nut = 10, pad = 0.1);
|
||||||
|
|
||||||
//filter holder bolts
|
//filter holder bolts
|
||||||
m2_5_nut_bolt([0, 13.2, -5], [0, 90, 0], nut = 12, pad = 0.1);
|
m2_5_nut_bolt([0, SlideRailBoltSpacingY / 2, -5], [0, 90, 0], nut = 12, pad = 0.1);
|
||||||
m2_5_nut_bolt([0, -13.2, -5], [0, 90, 0], nut = 12, pad = 0.1);
|
m2_5_nut_bolt([0, -SlideRailBoltSpacingY / 2, -5], [0, 90, 0], nut = 12, pad = 0.1);
|
||||||
|
|
||||||
//idle rollers
|
//idle rollers
|
||||||
m2_5_nut_bolt([-2, IdleRollerSpacingAY / 2, (BodyZ / 2) - IdleRollerAZ], [0, 90, 0], nut = BodyX, bolt = BodyX + 40, pad = 0.1);
|
m2_5_nut_bolt([-2, IdleRollerSpacingAY / 2, (BodyZ / 2) - IdleRollerAZ], [0, 90, 0], nut = BodyX, bolt = BodyX + 40, pad = 0.1);
|
||||||
|
@ -565,6 +577,7 @@ module slide_rail (pos = [0, 0, 0], side = "A") {
|
||||||
BoltSlotY = 1.5;
|
BoltSlotY = 1.5;
|
||||||
BoltSlotOffsetY = side == "A" ? BoltSlotY : -BoltSlotY;
|
BoltSlotOffsetY = side == "A" ? BoltSlotY : -BoltSlotY;
|
||||||
BoltsOffsetY = side == "A" ? -1 / 2 : 1 / 2;
|
BoltsOffsetY = side == "A" ? -1 / 2 : 1 / 2;
|
||||||
|
NutVoidY = side == "A" ? -4.5 : 4.5;
|
||||||
translate(pos) {
|
translate(pos) {
|
||||||
difference() {
|
difference() {
|
||||||
cube([7, 9, BodyZ - 16], center = true);
|
cube([7, 9, BodyZ - 16], center = true);
|
||||||
|
@ -574,6 +587,7 @@ module slide_rail (pos = [0, 0, 0], side = "A") {
|
||||||
slide_rail_bolt_slot([0, BoltsOffsetY, SlideRailBoltSpacingZ / 2], [0, 90, 0], BoltSlotY, BoltSlotOffsetY);
|
slide_rail_bolt_slot([0, BoltsOffsetY, SlideRailBoltSpacingZ / 2], [0, 90, 0], BoltSlotY, BoltSlotOffsetY);
|
||||||
slide_rail_bolt_slot([0, BoltsOffsetY, -SlideRailBoltSpacingZ / 2], [0, 90, 0], BoltSlotY, BoltSlotOffsetY);
|
slide_rail_bolt_slot([0, BoltsOffsetY, -SlideRailBoltSpacingZ / 2], [0, 90, 0], BoltSlotY, BoltSlotOffsetY);
|
||||||
}
|
}
|
||||||
|
translate([0, NutVoidY, ((BodyZ - 16) / 2) - (3 / 2) + 0.01]) cube([7 + 1, 7 , 3], center = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -724,12 +738,12 @@ module front_block (pos = [0, 0, 0], rot = [0, 0, 0]) {
|
||||||
|
|
||||||
//for pegs
|
//for pegs
|
||||||
translate([12.25, 0, -1.75]) {
|
translate([12.25, 0, -1.75]) {
|
||||||
translate([3.5, 0, 0]) rounded_cube([33.4, 31.4, 4], d = 3, center = true, $fn = 30);
|
translate([3.5, 0, 0]) rounded_cube([33.6, 31.6, 4], d = 3, center = true, $fn = 30);
|
||||||
translate([-3, 12, -2]) {
|
translate([-5, 12, -2]) {
|
||||||
cylinder(r = R(2.75), h = 20, center = true, $fn = 40);
|
cylinder(r = R(2.75), h = 20, center = true, $fn = 40);
|
||||||
translate([0, 0, 7]) m2_5_nut(4);
|
translate([0, 0, 7]) m2_5_nut(4);
|
||||||
}
|
}
|
||||||
translate([-3, -12, -2]) {
|
translate([-5, -12, -2]) {
|
||||||
cylinder(r = R(2.75), h = 20, center = true, $fn = 40);
|
cylinder(r = R(2.75), h = 20, center = true, $fn = 40);
|
||||||
translate([0, 0, 7]) m2_5_nut(4);
|
translate([0, 0, 7]) m2_5_nut(4);
|
||||||
}
|
}
|
||||||
|
@ -814,7 +828,7 @@ module debug () {
|
||||||
//color("blue") translate([8, 4.6, FilmZ]) 16mm_film(18, true, true);
|
//color("blue") translate([8, 4.6, FilmZ]) 16mm_film(18, true, true);
|
||||||
union () {
|
union () {
|
||||||
FilmZ = - 7.2; //retraction distance
|
FilmZ = - 7.2; //retraction distance
|
||||||
//translate([(-BodyX / 2) - 1, 0, -BodyZ / 2]) body(gauge = "16mm");
|
translate([(-BodyX / 2) - 1, 0, -BodyZ / 2]) body(gauge = "16mm");
|
||||||
|
|
||||||
translate([0, 0, FilmZ + 1.4]) front_plate();
|
translate([0, 0, FilmZ + 1.4]) front_plate();
|
||||||
translate([0, 0, FilmZ - 1.4]) back_plate();
|
translate([0, 0, FilmZ - 1.4]) back_plate();
|
||||||
|
@ -823,8 +837,8 @@ module debug () {
|
||||||
//front_plate_void([(PlateX / 2) - (FrontPlateVoidX / 2) - 2.41, 0, 0]);
|
//front_plate_void([(PlateX / 2) - (FrontPlateVoidX / 2) - 2.41, 0, 0]);
|
||||||
//film_clearance_void([0, 0, 15]);
|
//film_clearance_void([0, 0, 15]);
|
||||||
|
|
||||||
sprocketed_roller_16mm([1.5, KeySpacingY / 2, KeyZ], [0, 90, 0], side = "TOP");
|
sprocketed_roller_16mm([1.5, KeySpacingY / 2, KeyZ], [0, 90, 0], side = "TAKEUP");
|
||||||
sprocketed_roller_16mm([1.5, -KeySpacingY / 2, KeyZ], [0, 90, 0], side = "BOTTOM");
|
sprocketed_roller_16mm([1.5, -KeySpacingY / 2, KeyZ], [0, 90, 0], side = "FEED");
|
||||||
|
|
||||||
//bearing_debug([-6.8, KeySpacingY / 2, KeyZ], [0, 90, 0]);
|
//bearing_debug([-6.8, KeySpacingY / 2, KeyZ], [0, 90, 0]);
|
||||||
//bearing_debug([-6.8, -KeySpacingY / 2, KeyZ], [0, 90, 0]);
|
//bearing_debug([-6.8, -KeySpacingY / 2, KeyZ], [0, 90, 0]);
|
||||||
|
@ -840,14 +854,14 @@ module debug () {
|
||||||
idle_roller_16mm([9, IdleRollerSpacingBY / 2, (BodyZ / 2) - IdleRollerBZ - (BodyZ / 2)], [0, 90, 0]);
|
idle_roller_16mm([9, IdleRollerSpacingBY / 2, (BodyZ / 2) - IdleRollerBZ - (BodyZ / 2)], [0, 90, 0]);
|
||||||
idle_roller_16mm([9, -IdleRollerSpacingBY / 2, (BodyZ / 2) - IdleRollerBZ - (BodyZ / 2)], [0, 90, 0]);*/
|
idle_roller_16mm([9, -IdleRollerSpacingBY / 2, (BodyZ / 2) - IdleRollerBZ - (BodyZ / 2)], [0, 90, 0]);*/
|
||||||
|
|
||||||
slide_rail([-BodyX + (7 / 2) - 0.6, 11.5, (-BodyZ / 2) - 7], "A");
|
//slide_rail([-BodyX + (7 / 2) - 0.6, 11.5, (-BodyZ / 2) - 7], "A");
|
||||||
slide_rail([-BodyX + (7 / 2) - 0.6, -11.5, (-BodyZ / 2) - 7], "B");
|
slide_rail([-BodyX + (7 / 2) - 0.6, -11.5, (-BodyZ / 2) - 7], "B");
|
||||||
|
|
||||||
slide([-BodyX + (7 / 2) - 0.4, 0, FilmZ + (-BodyZ / 2) + 1]);
|
slide([-BodyX + (7 / 2) - 0.4, 0, FilmZ + (-BodyZ / 2) + 1]);
|
||||||
|
|
||||||
slide_catch([-13, 36, -51.5]);
|
slide_catch([-13, 36, -51.5]);
|
||||||
translate([0, 0, 0]) {
|
translate([0, 0, 0]) {
|
||||||
front_block([(-BodyX / 2) - 1, 0, (6.5 / 2)]);
|
//front_block([(-BodyX / 2) - 1, 0, (6.5 / 2)]);
|
||||||
color("yellow") front_block_pegs([0, 0, 2]);
|
color("yellow") front_block_pegs([0, 0, 2]);
|
||||||
front_block_film_path([(16.75 / 2) - 1, (58.5 / 2) + (13 / 2), -2.25]);
|
front_block_film_path([(16.75 / 2) - 1, (58.5 / 2) + (13 / 2), -2.25]);
|
||||||
front_block_film_path([(16.75 / 2) - 1, (-58.5 / 2) - (13 / 2), -2.25], [0, 0, 180]);
|
front_block_film_path([(16.75 / 2) - 1, (-58.5 / 2) - (13 / 2), -2.25], [0, 0, 180]);
|
||||||
|
@ -860,7 +874,7 @@ module debug () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PART="front_block_16mm";
|
PART="front_block_16mmx";
|
||||||
|
|
||||||
if (PART == "front_plate") {
|
if (PART == "front_plate") {
|
||||||
//1
|
//1
|
||||||
|
@ -874,12 +888,12 @@ if (PART == "front_plate") {
|
||||||
} else if (PART == "mask_slide_super16") {
|
} else if (PART == "mask_slide_super16") {
|
||||||
//1
|
//1
|
||||||
rotate([180, 0, 0]) gate_mask_slide_super16();
|
rotate([180, 0, 0]) gate_mask_slide_super16();
|
||||||
} else if (PART == "sprocketed_roller_top_16mm") {
|
} else if (PART == "sprocketed_roller_takeup_16mm") {
|
||||||
//1
|
//1
|
||||||
rotate([180, 0, 0]) sprocketed_roller_16mm(side = "TOP");
|
rotate([180, 0, 0]) sprocketed_roller_16mm(side = "TAKEUP");
|
||||||
} else if (PART == "sprocketed_roller_bottom_16mm") {
|
} else if (PART == "sprocketed_roller_feed_16mm") {
|
||||||
//1
|
//1
|
||||||
rotate([180, 0, 0]) sprocketed_roller_16mm(side = "BOTTOM");
|
rotate([180, 0, 0]) sprocketed_roller_16mm(side = "FEED");
|
||||||
} else if (PART == "sprocketed_roller_nut_16mm") {
|
} else if (PART == "sprocketed_roller_nut_16mm") {
|
||||||
//2
|
//2
|
||||||
sprocketed_roller_nut_16mm();
|
sprocketed_roller_nut_16mm();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue