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,
"profiles": {
"mcopy": {

2
app/package-lock.json generated
View File

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

View File

@ -1,6 +1,6 @@
{
"name": "mcopy-app",
"version": "1.8.76",
"version": "1.8.77",
"description": "GUI for the mcopy small gauge film optical printer platform",
"main": "main.js",
"scripts": {

View File

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

View File

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

4
package-lock.json generated
View File

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

View File

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

View File

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