Skip to content

Commit

Permalink
fixed intake manual auto, has not been tested on robot
Browse files Browse the repository at this point in the history
  • Loading branch information
prawny-boy committed Jan 28, 2024
1 parent 2df1f03 commit 7551c81
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/cpp/IntakeBehaviour.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ IntakeManualControl::IntakeManualControl(Intake* intake, frc::XboxController& co
}

void IntakeManualControl::OnTick(units::second_t dt) {
if (_codriver.GetBButtonPressed()) {
if (_codriver.GetBButtonReleased()) {
if (_rawControl) {
_rawControl = false;
_intaking = false;
_ejecting = false;
_intake->setState(IntakeState::kIdle);
} else {
_rawControl = true;
Expand Down Expand Up @@ -46,19 +48,20 @@ void IntakeManualControl::OnTick(units::second_t dt) {
_ejecting = false;
} else {
_ejecting = true;
_intaking = false;
}
}

if (_intaking) {
if (_intake->getState() == IntakeState::kHold || _intake->getState() == IntakeState::kPass) {
if (_intake->GetConfig().intakeSensor->Get() == 1) {
if (_intake->GetConfig().intakeSensor->Get() == 0) {
_intake->setState(IntakeState::kIdle);
_intaking = false;
} else {
_intake->setState(IntakeState::kPass);
}
} else {
if (_intake->GetConfig().intakeSensor->Get() == 0) {
if (_intake->GetConfig().intakeSensor->Get() == 1) {
_intake->setState(IntakeState::kHold);
_intaking = false;
} else {
Expand All @@ -68,7 +71,7 @@ void IntakeManualControl::OnTick(units::second_t dt) {
}

if (_ejecting) {
if (_intake->GetConfig().intakeSensor->Get() == 1) {
if (_intake->GetConfig().intakeSensor->Get() == 0) {
_intake->setState(IntakeState::kIdle);
_ejecting = false;
} else {
Expand Down

0 comments on commit 7551c81

Please sign in to comment.