mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick find and replace to do. Basically, there are two primary things that we have done this summer that break existing user code: -Changing GetInstance() calls to return references instead of pointers. This forces users to change from doing something like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor(). -Making PIDGet() and related calls const, forcing users to change the function signatures wherever they override them. The GetInstance() calls don't really matter to me either way, especially since there are no real ownership issues going on there, unlike the rest of the smart pointer-related changes. For the const stuff, it is certainly more correct to mandate that user PIDGet() functions be const and the such, but at the same time, I'm not sure that there is any strong need for it, and the errors generated are not the most helpful. While this wouldn't necessarily be an issue for more experienced teams or completely new teams (who don't have any old code to be reusing), it may cause issues for more average teams who aren't familiar with the intricacies of C++ anything. Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
This commit is contained in:
@@ -31,7 +31,7 @@ void IterativeRobot::StartCompetition() {
|
||||
HALReport(HALUsageReporting::kResourceType_Framework,
|
||||
HALUsageReporting::kFramework_Iterative);
|
||||
|
||||
LiveWindow &lw = LiveWindow::GetInstance();
|
||||
LiveWindow *lw = LiveWindow::GetInstance();
|
||||
// first and one-time initialization
|
||||
SmartDashboard::init();
|
||||
NetworkTable::GetTable("LiveWindow")
|
||||
@@ -46,14 +46,14 @@ void IterativeRobot::StartCompetition() {
|
||||
HALNetworkCommunicationObserveUserProgramStarting();
|
||||
|
||||
// loop forever, calling the appropriate mode-dependent function
|
||||
lw.SetEnabled(false);
|
||||
lw->SetEnabled(false);
|
||||
while (true) {
|
||||
// Call the appropriate function depending upon the current robot mode
|
||||
if (IsDisabled()) {
|
||||
// call DisabledInit() if we are now just entering disabled mode from
|
||||
// either a different mode or from power-on
|
||||
if (!m_disabledInitialized) {
|
||||
lw.SetEnabled(false);
|
||||
lw->SetEnabled(false);
|
||||
DisabledInit();
|
||||
m_disabledInitialized = true;
|
||||
// reset the initialization flags for the other modes
|
||||
@@ -67,7 +67,7 @@ void IterativeRobot::StartCompetition() {
|
||||
// call AutonomousInit() if we are now just entering autonomous mode from
|
||||
// either a different mode or from power-on
|
||||
if (!m_autonomousInitialized) {
|
||||
lw.SetEnabled(false);
|
||||
lw->SetEnabled(false);
|
||||
AutonomousInit();
|
||||
m_autonomousInitialized = true;
|
||||
// reset the initialization flags for the other modes
|
||||
@@ -81,7 +81,7 @@ void IterativeRobot::StartCompetition() {
|
||||
// call TestInit() if we are now just entering test mode from
|
||||
// either a different mode or from power-on
|
||||
if (!m_testInitialized) {
|
||||
lw.SetEnabled(true);
|
||||
lw->SetEnabled(true);
|
||||
TestInit();
|
||||
m_testInitialized = true;
|
||||
// reset the initialization flags for the other modes
|
||||
@@ -95,14 +95,14 @@ void IterativeRobot::StartCompetition() {
|
||||
// call TeleopInit() if we are now just entering teleop mode from
|
||||
// either a different mode or from power-on
|
||||
if (!m_teleopInitialized) {
|
||||
lw.SetEnabled(false);
|
||||
lw->SetEnabled(false);
|
||||
TeleopInit();
|
||||
m_teleopInitialized = true;
|
||||
// reset the initialization flags for the other modes
|
||||
m_disabledInitialized = false;
|
||||
m_autonomousInitialized = false;
|
||||
m_testInitialized = false;
|
||||
Scheduler::GetInstance().SetEnabled(true);
|
||||
Scheduler::GetInstance()->SetEnabled(true);
|
||||
}
|
||||
HALNetworkCommunicationObserveUserProgramTeleop();
|
||||
TeleopPeriodic();
|
||||
|
||||
Reference in New Issue
Block a user