Aarhus-University-MPE / Lake-Profiler

1 stars 0 forks source link

Move to bottom position when in Run mode #6

Closed MadsR closed 1 year ago

MadsR commented 2 years ago

Instead of having to wait 15+ mins for it to move down in service, before flicking over to run.

System should move to bottom position when in Run mode, waiting for alarm.

MadsR commented 1 year ago

Motor Position Check 1_AutonomyProcess.h Added Motor Position check to case 0: of AutonomyState(), should now move system to bottom position before starting, when autonomy process is initialized.

void AutonomyState() {
...
    case 0:
      // Check if at bottom position before starting autonomy
      if (!MotorPositionReached(MOTOR_DIR_DOWN)) {
        autonomyState = 30;
      }
      // System at bottom position wait for alarm
      else if (AlarmStatus(RTCC_ALM0)) {
        autonomyState++;
        DEBUG_PRINTLN(F("Alarm case 0"));
      }
      break;
      ...
      // Move to bottom position
    case 30:
      DEBUG_PRINTLINE();
      DEBUG_PRINTLN(F("Moving to Bottom Position"));
      DEBUG_PRINTLINE();
      MotorMove(MOTOR_DIR_DOWN);
      autonomyState++;
      break;
    // Wait until bottom position is reached
    case 31:
      if (MotorPositionReached()) {
        MotorMove(MOTOR_DIR_HALT);
        autonomyState = 0;
      }
      break;
  }
}