Add getDirection() to EndstopCameraShield and fix sloppy bugs in code that were not disabling emitters after actions. Could have caused false positives in behavior so check on the machine
This commit is contained in:
parent
35d832f965
commit
7cecef3de5
|
@ -112,7 +112,6 @@ uint32_t EndstopCameraShield::frame() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableCloseEmitter();
|
||||
_enableOpenEmitter();
|
||||
//_enableCloseInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -124,8 +123,8 @@ uint32_t EndstopCameraShield::frame() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
//_disableCloseInterrupt();
|
||||
_disableCloseEmitter();
|
||||
//_disableCloseInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,6 @@ uint32_t EndstopCameraShield::toOpen() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableOpenEmitter();
|
||||
_enableCloseEmitter();
|
||||
//_enableOpenInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -150,8 +148,8 @@ uint32_t EndstopCameraShield::toOpen() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
//_disableOpenInterrupt();
|
||||
_disableOpenEmitter();
|
||||
//_disableOpenInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -164,7 +162,6 @@ uint32_t EndstopCameraShield::toClose() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableCloseEmitter();
|
||||
_enableOpenEmitter();
|
||||
//_enableCloseInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -176,8 +173,8 @@ uint32_t EndstopCameraShield::toClose() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
_disableCloseInterrupt();
|
||||
//_disableCloseEmitter();
|
||||
_disableCloseEmitter();
|
||||
//_disableCloseInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -188,6 +185,10 @@ void EndstopCameraShield::setDirection(bool direction) {
|
|||
}
|
||||
}
|
||||
|
||||
bool EndstopCameraShield::getDirection() {
|
||||
return _direction;
|
||||
}
|
||||
|
||||
bool EndstopCameraShield::isOpened() {
|
||||
return _isOpened;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ class EndstopCameraShield {
|
|||
uint32_t toOpen();
|
||||
uint32_t toClose();
|
||||
void setDirection(bool direction);
|
||||
bool getDirection();
|
||||
bool isOpened();
|
||||
bool isClosed();
|
||||
void test();
|
||||
|
|
|
@ -112,7 +112,6 @@ uint32_t EndstopCameraShield::frame() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableCloseEmitter();
|
||||
_enableOpenEmitter();
|
||||
//_enableCloseInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -124,8 +123,8 @@ uint32_t EndstopCameraShield::frame() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
//_disableCloseInterrupt();
|
||||
_disableCloseEmitter();
|
||||
//_disableCloseInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,6 @@ uint32_t EndstopCameraShield::toOpen() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableOpenEmitter();
|
||||
_enableCloseEmitter();
|
||||
//_enableOpenInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -150,8 +148,8 @@ uint32_t EndstopCameraShield::toOpen() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
//_disableOpenInterrupt();
|
||||
_disableOpenEmitter();
|
||||
//_disableOpenInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -164,7 +162,6 @@ uint32_t EndstopCameraShield::toClose() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableCloseEmitter();
|
||||
_enableOpenEmitter();
|
||||
//_enableCloseInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -176,8 +173,8 @@ uint32_t EndstopCameraShield::toClose() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
_disableCloseInterrupt();
|
||||
//_disableCloseEmitter();
|
||||
_disableCloseEmitter();
|
||||
//_disableCloseInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -188,6 +185,10 @@ void EndstopCameraShield::setDirection(bool direction) {
|
|||
}
|
||||
}
|
||||
|
||||
bool EndstopCameraShield::getDirection() {
|
||||
return _direction;
|
||||
}
|
||||
|
||||
bool EndstopCameraShield::isOpened() {
|
||||
return _isOpened;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ class EndstopCameraShield {
|
|||
uint32_t toOpen();
|
||||
uint32_t toClose();
|
||||
void setDirection(bool direction);
|
||||
bool getDirection();
|
||||
bool isOpened();
|
||||
bool isClosed();
|
||||
void test();
|
||||
|
|
|
@ -112,7 +112,6 @@ uint32_t EndstopCameraShield::frame() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableCloseEmitter();
|
||||
_enableOpenEmitter();
|
||||
//_enableCloseInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -124,8 +123,8 @@ uint32_t EndstopCameraShield::frame() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
//_disableCloseInterrupt();
|
||||
_disableCloseEmitter();
|
||||
//_disableCloseInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,6 @@ uint32_t EndstopCameraShield::toOpen() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableOpenEmitter();
|
||||
_enableCloseEmitter();
|
||||
//_enableOpenInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -150,8 +148,8 @@ uint32_t EndstopCameraShield::toOpen() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
//_disableOpenInterrupt();
|
||||
_disableOpenEmitter();
|
||||
//_disableOpenInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -164,7 +162,6 @@ uint32_t EndstopCameraShield::toClose() {
|
|||
while (running) {
|
||||
if (!primed && i > _minSteps) {
|
||||
_enableCloseEmitter();
|
||||
_enableOpenEmitter();
|
||||
//_enableCloseInterrupt();
|
||||
primed = true;
|
||||
}
|
||||
|
@ -176,8 +173,8 @@ uint32_t EndstopCameraShield::toClose() {
|
|||
_motor.step();
|
||||
i++;
|
||||
}
|
||||
_disableCloseInterrupt();
|
||||
//_disableCloseEmitter();
|
||||
_disableCloseEmitter();
|
||||
//_disableCloseInterrupt();
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -188,6 +185,10 @@ void EndstopCameraShield::setDirection(bool direction) {
|
|||
}
|
||||
}
|
||||
|
||||
bool EndstopCameraShield::getDirection() {
|
||||
return _direction;
|
||||
}
|
||||
|
||||
bool EndstopCameraShield::isOpened() {
|
||||
return _isOpened;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ class EndstopCameraShield {
|
|||
uint32_t toOpen();
|
||||
uint32_t toClose();
|
||||
void setDirection(bool direction);
|
||||
bool getDirection();
|
||||
bool isOpened();
|
||||
bool isClosed();
|
||||
void test();
|
||||
|
|
Loading…
Reference in New Issue