Addressing the issue with the JKMM99 projector functionality where frames stop prematurely. Conceivably, the proj_microswitch() function is the only place that calls proj_stop() so the issue is with the logic there. It makes little sense that this function allows for 15ms frames because of the test that requires a 450ms elapsed time before it is stopped.

This commit is contained in:
sixteenmillimeter 2020-09-29 14:00:54 -04:00
parent 7c9543239e
commit 5e481e77b0
1 changed files with 12 additions and 6 deletions

View File

@ -241,6 +241,8 @@ void proj_stop () {
digitalWrite(PROJECTOR_FWD, LOW); digitalWrite(PROJECTOR_FWD, LOW);
digitalWrite(PROJECTOR_BWD, LOW); digitalWrite(PROJECTOR_BWD, LOW);
//evaluate total time
Serial.println(cmd_projector); Serial.println(cmd_projector);
log("projector()"); log("projector()");
proj_running = false; proj_running = false;
@ -266,17 +268,21 @@ void proj_direction (boolean state) {
void proj_microswitch () { void proj_microswitch () {
int val = digitalRead(PROJECTOR_MICROSWITCH); int val = digitalRead(PROJECTOR_MICROSWITCH);
long now = millis(); long now = millis();
if (!proj_primed && val != proj_micro_state && val == PROJECTOR_MICROSWITCH_OPENED) { if (!proj_primed // if not primed
&& val != proj_micro_state // AND if state changes
&& val == PROJECTOR_MICROSWITCH_OPENED // AND state changes to open
&& now - proj_time > PROJECTOR_HALF_TIME) {
//prime //prime
log("proj_primed => true"); log("proj_primed => true");
proj_micro_state = val; proj_micro_state = val;
proj_primed = true; proj_primed = true;
} else if (proj_primed && val != proj_micro_state } else if (proj_primed //if primed
&& val == PROJECTOR_MICROSWITCH_CLOSED && val != proj_micro_state //AND if state changes
&& now - proj_time > PROJECTOR_HALF_TIME) { && val == PROJECTOR_MICROSWITCH_CLOSED //AND state changes to open
//turn off && now - proj_time > PROJECTOR_HALF_TIME) { //AND total elapsed time is greater than half frame time
//stop
proj_primed = false; proj_primed = false;
proj_micro_state = val; proj_micro_state = val; //unneeded?
proj_stop(); proj_stop();
} else { } else {
//delay(1); //some smothing value //delay(1); //some smothing value