mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
SCRIPT: wpiformat
This commit is contained in:
committed by
Peter Johnson
parent
ae6bdc9d25
commit
2109161534
@@ -193,7 +193,8 @@ void IterativeRobotBase::LoopFunc() {
|
||||
}
|
||||
|
||||
void IterativeRobotBase::PrintLoopOverrunMessage() {
|
||||
WPILIB_ReportError(err::Error, "Loop time of {:.6f}s overrun", m_period.value());
|
||||
WPILIB_ReportError(err::Error, "Loop time of {:.6f}s overrun",
|
||||
m_period.value());
|
||||
}
|
||||
|
||||
void IterativeRobotBase::PrintWatchdogEpochs() {
|
||||
|
||||
@@ -75,7 +75,8 @@ void TimedRobot::EndCompetition() {
|
||||
HAL_StopNotifier(m_notifier, &status);
|
||||
}
|
||||
|
||||
TimedRobot::TimedRobot(wpi::units::second_t period) : IterativeRobotBase(period) {
|
||||
TimedRobot::TimedRobot(wpi::units::second_t period)
|
||||
: IterativeRobotBase(period) {
|
||||
m_startTime = std::chrono::microseconds{RobotController::GetFPGATime()};
|
||||
AddPeriodic([=, this] { LoopFunc(); }, period);
|
||||
|
||||
@@ -87,7 +88,8 @@ TimedRobot::TimedRobot(wpi::units::second_t period) : IterativeRobotBase(period)
|
||||
HAL_ReportUsage("Framework", "TimedRobot");
|
||||
}
|
||||
|
||||
TimedRobot::TimedRobot(wpi::units::hertz_t frequency) : TimedRobot{1 / frequency} {}
|
||||
TimedRobot::TimedRobot(wpi::units::hertz_t frequency)
|
||||
: TimedRobot{1 / frequency} {}
|
||||
|
||||
TimedRobot::~TimedRobot() {
|
||||
if (m_notifier != HAL_kInvalidHandle) {
|
||||
@@ -102,7 +104,8 @@ uint64_t TimedRobot::GetLoopStartTime() {
|
||||
}
|
||||
|
||||
void TimedRobot::AddPeriodic(std::function<void()> callback,
|
||||
wpi::units::second_t period, wpi::units::second_t offset) {
|
||||
wpi::units::second_t period,
|
||||
wpi::units::second_t offset) {
|
||||
m_callbacks.emplace(
|
||||
callback, m_startTime,
|
||||
std::chrono::microseconds{static_cast<int64_t>(period.value() * 1e6)},
|
||||
|
||||
@@ -17,9 +17,9 @@ void TimesliceRobot::Schedule(std::function<void()> func,
|
||||
wpi::units::second_t allocation) {
|
||||
if (m_nextOffset + allocation > m_controllerPeriod) {
|
||||
throw WPILIB_MakeError(err::Error,
|
||||
"Function scheduled at offset {} with allocation {} "
|
||||
"exceeded controller period of {}\n",
|
||||
m_nextOffset, allocation, m_controllerPeriod);
|
||||
"Function scheduled at offset {} with allocation {} "
|
||||
"exceeded controller period of {}\n",
|
||||
m_nextOffset, allocation, m_controllerPeriod);
|
||||
}
|
||||
|
||||
AddPeriodic(func, m_controllerPeriod, m_nextOffset);
|
||||
|
||||
Reference in New Issue
Block a user