Restore the home method. Now it compiles.
This commit is contained in:
parent
66b18dd351
commit
6f68081dc5
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.40",
|
"version": "1.8.41",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.40",
|
"version": "1.8.41",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy-app",
|
"name": "mcopy-app",
|
||||||
"version": "1.8.40",
|
"version": "1.8.41",
|
||||||
"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": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "1.8.40",
|
"version": "1.8.41",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
|
@ -157,56 +157,110 @@ void McopyProjector::setStepperMode (uint8_t mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void McopyProjector::home () {
|
void McopyProjector::home () {
|
||||||
/*
|
|
||||||
uint16_t steps = _motorSteps * _mode;
|
uint16_t steps = _motorSteps * _mode;
|
||||||
long reading;
|
uint16_t quarter = steps / 4;
|
||||||
//
|
uint16_t eighth = quarter / 2;
|
||||||
|
uint16_t takeupPeak = 0;
|
||||||
|
uint16_t feedPeak = 0;
|
||||||
|
uint16_t takeupOffset = 0;
|
||||||
|
uint16_t feedOffset = 0;
|
||||||
|
long takeupReading = 0.0;
|
||||||
|
long feedReading = 0.0;
|
||||||
|
|
||||||
|
emitters(true);
|
||||||
|
delay(10);
|
||||||
|
|
||||||
for (uint16_t i = 0; i < steps; i++) {
|
for (uint16_t i = 0; i < steps; i++) {
|
||||||
reading = analogReadAccurateAverage(_takeupReceiver);
|
takeupReading = analogReadAccurateAverage(_takeupReceiver);
|
||||||
_takeupSamples[i] = reading;
|
feedReading = analogReadAccurateAverage(_feedReceiver);
|
||||||
|
_takeupSamples[i] = takeupReading;
|
||||||
|
_feedSamples[i] = feedReading;
|
||||||
if (i < steps - 1) {
|
if (i < steps - 1) {
|
||||||
_takeup.move(1);
|
_takeup.move(1);
|
||||||
|
_feed.move(1);
|
||||||
_takeup.runToPosition();
|
_takeup.runToPosition();
|
||||||
|
_feed.runToPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
|
||||||
for (uint16_t i = 0; i < steps; i++) {
|
for (uint16_t i = 0; i < steps; i++) {
|
||||||
Serial.print(i);
|
Serial.print(i);
|
||||||
Serial.print(", ");
|
Serial.print(", ");
|
||||||
Serial.println(_takeupSamples[i]);
|
Serial.print(_takeupSamples[i]);
|
||||||
|
Serial.print(", ");
|
||||||
|
Serial.println(_feedSamples[i]);
|
||||||
}
|
}
|
||||||
uint16_t peak = findPeak(_takeupSamples, steps);
|
|
||||||
Serial.print("peak: ");
|
takeupPeak = findPeak(_takeupSamples, steps);
|
||||||
Serial.println(peak);
|
feedPeak = findPeak(_feedSamples, steps);
|
||||||
uint16_t offset = abs(200 - peak);
|
Serial.print(" takeup peak: ");
|
||||||
Serial.print("offset: ");
|
Serial.println(takeupPeak);
|
||||||
Serial.println(offset);
|
Serial.print(" feed peak: ");
|
||||||
if (offset != 0) {
|
Serial.println(feedPeak);
|
||||||
for (uint16_t i = 0; i < offset; i++) {
|
|
||||||
_takeup.move(-1);
|
takeupOffset = abs(steps - takeupPeak);
|
||||||
_takeup.runToPosition();
|
feedOffset = abs(steps - takeupPeak);
|
||||||
}
|
|
||||||
for (uint16_t i = 0; i < 25; i++) {
|
Serial.print("takeup offset: ");
|
||||||
|
Serial.println(takeupOffset);
|
||||||
|
Serial.print(" feed offset: ");
|
||||||
|
Serial.println(feedOffset);
|
||||||
|
|
||||||
|
if (takeupOffset > 0) {
|
||||||
|
for (uint16_t i = 0; i < takeupOffset; i++) {
|
||||||
_takeup.move(-1);
|
_takeup.move(-1);
|
||||||
_takeup.runToPosition();
|
_takeup.runToPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (uint16_t i = 0; i < 50; i++) {
|
if (feedOffset > 0) {
|
||||||
reading = analogReadAccurateAverage(_takeupReceiver);
|
for (uint16_t i = 0; i < feedOffset; i++) {
|
||||||
_takeupSamples[i] = reading;
|
_feed.move(-1);
|
||||||
|
_feed.runToPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < eighth; i++) {
|
||||||
|
_takeup.move(-1);
|
||||||
|
_feed.move(-1);
|
||||||
|
_takeup.runToPosition();
|
||||||
|
_feed.runToPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < quarter; i++) {
|
||||||
|
takeupReading = analogReadAccurateAverage(_takeupReceiver);
|
||||||
|
feedReading = analogReadAccurateAverage(_feedReceiver);
|
||||||
|
_takeupSamples[i] = takeupReading;
|
||||||
|
_feedSamples[i] = feedReading;
|
||||||
if (i < steps - 1) {
|
if (i < steps - 1) {
|
||||||
_takeup.move(1);
|
_takeup.move(1);
|
||||||
|
_feed.move(1);
|
||||||
_takeup.runToPosition();
|
_takeup.runToPosition();
|
||||||
|
_feed.runToPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uint16_t peak2 = findPeak(_takeupSamples, 50);
|
|
||||||
uint16_t offset2 = abs(50 - peak2);
|
emitters(false);
|
||||||
if (offset2 != 0) {
|
|
||||||
for (uint16_t i = 0; i < offset2; i++) {
|
takeupPeak = findPeak(_takeupSamples, quarter);
|
||||||
|
feedPeak = findPeak(_feedSamples, quarter);
|
||||||
|
takeupOffset = abs(quarter - takeupPeak);
|
||||||
|
feedOffset = abs(quarter - feedPeak);
|
||||||
|
|
||||||
|
if (takeupOffset > 0) {
|
||||||
|
for (uint16_t i = 0; i < takeupOffset; i++) {
|
||||||
_takeup.move(-1);
|
_takeup.move(-1);
|
||||||
_takeup.runToPosition();
|
_takeup.runToPosition();
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
if (feedOffset > 0) {
|
||||||
|
for (uint16_t i = 0; i < feedOffset; i++) {
|
||||||
|
_feed.move(-1);
|
||||||
|
_feed.runToPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_posTakeup = 0;
|
||||||
|
_posFeed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
long McopyProjector::readVcc() {
|
long McopyProjector::readVcc() {
|
||||||
|
@ -249,3 +303,8 @@ uint16_t McopyProjector::findPeak(long (&arr)[200], uint16_t &steps) {
|
||||||
}
|
}
|
||||||
return maxI;
|
return maxI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void McopyProjector::emitters (bool enabled) {
|
||||||
|
digitalWrite(_takeupEmitter, enabled ? HIGH : LOW);
|
||||||
|
digitalWrite(_feedEmitter, enabled ? HIGH : LOW);
|
||||||
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ class McopyProjector {
|
||||||
long analogReadAccurate (uint8_t &pin);
|
long analogReadAccurate (uint8_t &pin);
|
||||||
long analogReadAccurateAverage (uint8_t &pin);
|
long analogReadAccurateAverage (uint8_t &pin);
|
||||||
uint16_t findPeak(long (&arr)[200], uint16_t &steps);
|
uint16_t findPeak(long (&arr)[200], uint16_t &steps);
|
||||||
|
void emitters(bool enabled);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.40",
|
"version": "1.8.41",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.40",
|
"version": "1.8.41",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"arduino": "file:app/lib/arduino",
|
"arduino": "file:app/lib/arduino",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "mcopy",
|
"name": "mcopy",
|
||||||
"version": "1.8.40",
|
"version": "1.8.41",
|
||||||
"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.40",
|
"version": "1.8.41",
|
||||||
"ext_port": 1111,
|
"ext_port": 1111,
|
||||||
"profiles": {
|
"profiles": {
|
||||||
"mcopy": {
|
"mcopy": {
|
||||||
|
|
Loading…
Reference in New Issue