Developed a seemingly working fix with the "correction loop" strategy. Might be putting the motor through hell but it is consistent.

This commit is contained in:
Matt McWilliams 2023-11-25 20:22:44 -05:00
parent fcf24b5539
commit f84e8b741a
8 changed files with 22 additions and 14 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.76", "version": "1.8.77",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

2
app/package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy-app", "name": "mcopy-app",
"version": "1.8.76", "version": "1.8.77",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy-app", "name": "mcopy-app",
"version": "1.8.76", "version": "1.8.77",
"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": {

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.76", "version": "1.8.77",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {

View File

@ -51,7 +51,7 @@ const int PROJECTOR_FRAME = 600;
const int PROJECTOR_MICROSWITCH_CLOSED = 0; const int PROJECTOR_MICROSWITCH_CLOSED = 0;
const int PROJECTOR_MICROSWITCH_OPENED = 1; const int PROJECTOR_MICROSWITCH_OPENED = 1;
const int PROJECTOR_HALF_TIME = 450; const int PROJECTOR_HALF_TIME = 450;
const int PROJECTOR_STOP_DELAY = 15; const int PROJECTOR_STOP_DELAY = 1;
//PROJECTOR VARIABLES //PROJECTOR VARIABLES
boolean proj_dir = true; boolean proj_dir = true;
@ -132,16 +132,24 @@ void proj_stop () {
digitalWrite(PROJECTOR_BWD, LOW); digitalWrite(PROJECTOR_BWD, LOW);
digitalWrite(LED_FWD, LOW); digitalWrite(LED_FWD, LOW);
digitalWrite(LED_BWD, LOW); digitalWrite(LED_BWD, LOW);
int correctionLoops = 0;
if (digitalRead(PROJECTOR_MICROSWITCH) == PROJECTOR_MICROSWITCH_CLOSED) { if (digitalRead(PROJECTOR_MICROSWITCH) == PROJECTOR_MICROSWITCH_CLOSED) {
if (proj_dir) { if (proj_dir) {
digitalWrite(PROJECTOR_BWD, HIGH); while (digitalRead(PROJECTOR_MICROSWITCH) == PROJECTOR_MICROSWITCH_CLOSED) {
delay(PROJECTOR_STOP_DELAY); digitalWrite(PROJECTOR_BWD, HIGH);
delay(PROJECTOR_STOP_DELAY);
correctionLoops++;
}
digitalWrite(PROJECTOR_BWD, LOW); digitalWrite(PROJECTOR_BWD, LOW);
mc.log("correctionLoops: " + String(correctionLoops));
} else { } else {
digitalWrite(PROJECTOR_FWD, HIGH); while (digitalRead(PROJECTOR_MICROSWITCH) == PROJECTOR_MICROSWITCH_CLOSED) {
delay(PROJECTOR_STOP_DELAY); digitalWrite(PROJECTOR_FWD, HIGH);
delay(PROJECTOR_STOP_DELAY);
correctionLoops++;
}
digitalWrite(PROJECTOR_FWD, LOW); digitalWrite(PROJECTOR_FWD, LOW);
mc.log("correctionLoops: " + String(correctionLoops));
} }
} }

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.8.76", "version": "1.8.77",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mcopy", "name": "mcopy",
"version": "1.8.76", "version": "1.8.77",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"arduino": "file:app/lib/arduino", "arduino": "file:app/lib/arduino",

View File

@ -1,6 +1,6 @@
{ {
"name": "mcopy", "name": "mcopy",
"version": "1.8.76", "version": "1.8.77",
"description": "Small gauge film optical printer platform", "description": "Small gauge film optical printer platform",
"main": "build.js", "main": "build.js",
"directories": { "directories": {

View File

@ -1,5 +1,5 @@
{ {
"version": "1.8.76", "version": "1.8.77",
"ext_port": 1111, "ext_port": 1111,
"profiles": { "profiles": {
"mcopy": { "mcopy": {