mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -533,7 +533,12 @@ public abstract class Command implements Sendable {
|
||||
});
|
||||
}
|
||||
|
||||
/** Schedules this command. */
|
||||
/**
|
||||
* Schedules this command.
|
||||
*
|
||||
* @deprecated Use CommandScheduler.getInstance().schedule(Command...) instead
|
||||
*/
|
||||
@Deprecated(since = "2025", forRemoval = true)
|
||||
public void schedule() {
|
||||
CommandScheduler.getInstance().schedule(this);
|
||||
}
|
||||
@@ -610,7 +615,7 @@ public abstract class Command implements Sendable {
|
||||
value -> {
|
||||
if (value) {
|
||||
if (!isScheduled()) {
|
||||
schedule();
|
||||
CommandScheduler.getInstance().schedule(this);
|
||||
}
|
||||
} else {
|
||||
if (isScheduled()) {
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ProxyCommand extends Command {
|
||||
@Override
|
||||
public void initialize() {
|
||||
m_command = m_supplier.get();
|
||||
m_command.schedule();
|
||||
CommandScheduler.getInstance().schedule(m_command);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ScheduleCommand extends Command {
|
||||
@Override
|
||||
public void initialize() {
|
||||
for (Command command : m_toSchedule) {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ public class Trigger implements BooleanSupplier {
|
||||
addBinding(
|
||||
(previous, current) -> {
|
||||
if (previous != current) {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
@@ -110,7 +110,7 @@ public class Trigger implements BooleanSupplier {
|
||||
addBinding(
|
||||
(previous, current) -> {
|
||||
if (!previous && current) {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
@@ -127,7 +127,7 @@ public class Trigger implements BooleanSupplier {
|
||||
addBinding(
|
||||
(previous, current) -> {
|
||||
if (previous && !current) {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
@@ -148,7 +148,7 @@ public class Trigger implements BooleanSupplier {
|
||||
addBinding(
|
||||
(previous, current) -> {
|
||||
if (!previous && current) {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
} else if (previous && !current) {
|
||||
command.cancel();
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class Trigger implements BooleanSupplier {
|
||||
addBinding(
|
||||
(previous, current) -> {
|
||||
if (previous && !current) {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
} else if (!previous && current) {
|
||||
command.cancel();
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public class Trigger implements BooleanSupplier {
|
||||
if (command.isScheduled()) {
|
||||
command.cancel();
|
||||
} else {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -214,7 +214,7 @@ public class Trigger implements BooleanSupplier {
|
||||
if (command.isScheduled()) {
|
||||
command.cancel();
|
||||
} else {
|
||||
command.schedule();
|
||||
CommandScheduler.getInstance().schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -197,7 +197,7 @@ void Command::InitSendable(wpi::SendableBuilder& builder) {
|
||||
[this](bool value) {
|
||||
bool isScheduled = IsScheduled();
|
||||
if (value && !isScheduled) {
|
||||
Schedule();
|
||||
CommandScheduler::GetInstance().Schedule(this);
|
||||
} else if (!value && isScheduled) {
|
||||
Cancel();
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ ProxyCommand::ProxyCommand(std::unique_ptr<Command> command) {
|
||||
|
||||
void ProxyCommand::Initialize() {
|
||||
m_command = m_supplier();
|
||||
m_command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(m_command);
|
||||
}
|
||||
|
||||
void ProxyCommand::End(bool interrupted) {
|
||||
|
||||
@@ -18,7 +18,7 @@ ScheduleCommand::ScheduleCommand(Command* toSchedule) {
|
||||
|
||||
void ScheduleCommand::Initialize() {
|
||||
for (auto command : m_toSchedule) {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void Trigger::AddBinding(wpi::unique_function<void(bool, bool)>&& body) {
|
||||
Trigger Trigger::OnChange(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (previous != current) {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -38,7 +38,7 @@ Trigger Trigger::OnChange(Command* command) {
|
||||
Trigger Trigger::OnChange(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (previous != current) {
|
||||
command.Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -47,7 +47,7 @@ Trigger Trigger::OnChange(CommandPtr&& command) {
|
||||
Trigger Trigger::OnTrue(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -56,7 +56,7 @@ Trigger Trigger::OnTrue(Command* command) {
|
||||
Trigger Trigger::OnTrue(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
command.Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -65,7 +65,7 @@ Trigger Trigger::OnTrue(CommandPtr&& command) {
|
||||
Trigger Trigger::OnFalse(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (previous && !current) {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -74,7 +74,7 @@ Trigger Trigger::OnFalse(Command* command) {
|
||||
Trigger Trigger::OnFalse(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (previous && !current) {
|
||||
command.Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
});
|
||||
return *this;
|
||||
@@ -83,7 +83,7 @@ Trigger Trigger::OnFalse(CommandPtr&& command) {
|
||||
Trigger Trigger::WhileTrue(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (previous && !current) {
|
||||
command->Cancel();
|
||||
}
|
||||
@@ -94,7 +94,7 @@ Trigger Trigger::WhileTrue(Command* command) {
|
||||
Trigger Trigger::WhileTrue(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
command.Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (previous && !current) {
|
||||
command.Cancel();
|
||||
}
|
||||
@@ -105,7 +105,7 @@ Trigger Trigger::WhileTrue(CommandPtr&& command) {
|
||||
Trigger Trigger::WhileFalse(Command* command) {
|
||||
AddBinding([command](bool previous, bool current) {
|
||||
if (previous && !current) {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (!previous && current) {
|
||||
command->Cancel();
|
||||
}
|
||||
@@ -116,7 +116,7 @@ Trigger Trigger::WhileFalse(Command* command) {
|
||||
Trigger Trigger::WhileFalse(CommandPtr&& command) {
|
||||
AddBinding([command = std::move(command)](bool previous, bool current) {
|
||||
if (!previous && current) {
|
||||
command.Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
} else if (previous && !current) {
|
||||
command.Cancel();
|
||||
}
|
||||
@@ -130,7 +130,7 @@ Trigger Trigger::ToggleOnTrue(Command* command) {
|
||||
if (command->IsScheduled()) {
|
||||
command->Cancel();
|
||||
} else {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -143,7 +143,7 @@ Trigger Trigger::ToggleOnTrue(CommandPtr&& command) {
|
||||
if (command.IsScheduled()) {
|
||||
command.Cancel();
|
||||
} else {
|
||||
command.Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -156,7 +156,7 @@ Trigger Trigger::ToggleOnFalse(Command* command) {
|
||||
if (command->IsScheduled()) {
|
||||
command->Cancel();
|
||||
} else {
|
||||
command->Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -169,7 +169,7 @@ Trigger Trigger::ToggleOnFalse(CommandPtr&& command) {
|
||||
if (command.IsScheduled()) {
|
||||
command.Cancel();
|
||||
} else {
|
||||
command.Schedule();
|
||||
frc2::CommandScheduler::GetInstance().Schedule(command);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -398,7 +398,10 @@ class Command : public wpi::Sendable, public wpi::SendableHelper<Command> {
|
||||
|
||||
/**
|
||||
* Schedules this command.
|
||||
*
|
||||
* @deprecated Use CommandScheduler::GetInstance().Schedule() instead
|
||||
*/
|
||||
[[deprecated("Use CommandScheduler::GetInstance().Schedule() instead.")]]
|
||||
void Schedule();
|
||||
|
||||
/**
|
||||
|
||||
@@ -277,7 +277,10 @@ CommandPtr final {
|
||||
|
||||
/**
|
||||
* Schedules this command.
|
||||
*
|
||||
* @deprecated Use CommandScheduler::GetInstance().Schedule() instead
|
||||
*/
|
||||
[[deprecated("Use CommandScheduler::GetInstance().Schedule() instead.")]]
|
||||
void Schedule() const&;
|
||||
|
||||
// Prevent calls on a temporary, as the returned pointer would be invalid
|
||||
|
||||
Reference in New Issue
Block a user