made it so that the new LiveWindow mess doesn't do anything
Calls to LiveWindow (which is a kind of front end for smart dashboard) got added
to all of the low-level classes (aka the ones that we use). We decided against
creating a fork of WPILib for all of the parts that we care about and instead
just made it so that all of the function calls don't do anything.
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4179 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.cpp b/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.cpp
index e4113a4..956b651 100644
--- a/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.cpp
+++ b/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.cpp
@@ -4,6 +4,7 @@
#include <sstream>
LiveWindow* LiveWindow::m_instance = NULL;
+ReentrantSemaphore LiveWindow::m_instanceLock;
/**
* Get an instance of the LiveWindow main class
@@ -12,6 +13,7 @@
*/
LiveWindow * LiveWindow::GetInstance()
{
+ Synchronized sync(m_instanceLock);
if (m_instance == NULL)
{
m_instance = new LiveWindow();
@@ -25,10 +27,12 @@
*/
LiveWindow::LiveWindow()
{
+#if 0
m_enabled = false;
m_liveWindowTable = NetworkTable::GetTable("LiveWindow");
m_statusTable = m_liveWindowTable->GetSubTable("~STATUS~");
m_scheduler = Scheduler::GetInstance();
+#endif
}
/**
@@ -37,6 +41,7 @@
*/
void LiveWindow::SetEnabled(bool enabled)
{
+#if 0
if (m_enabled == enabled)
return;
if (enabled)
@@ -67,6 +72,7 @@
}
m_enabled = enabled;
m_statusTable->PutBoolean("LW Enabled", m_enabled);
+#endif
}
LiveWindow::~LiveWindow()
@@ -82,9 +88,11 @@
void LiveWindow::AddSensor(char *subsystem, char *name,
LiveWindowSendable *component)
{
+#if 0
m_components[component].subsystem = subsystem;
m_components[component].name = name;
m_components[component].isSensor = true;
+#endif
}
/**
@@ -96,9 +104,11 @@
void LiveWindow::AddActuator(char *subsystem, char *name,
LiveWindowSendable *component)
{
+#if 0
m_components[component].subsystem = subsystem;
m_components[component].name = name;
m_components[component].isSensor = false;
+#endif
}
/**
@@ -106,6 +116,7 @@
*/
void LiveWindow::AddSensor(std::string type, int module, int channel, LiveWindowSendable *component)
{
+#if 0
std::ostringstream oss;
oss << type << "[" << module << "," << channel << "]";
std::string types(oss.str());
@@ -115,6 +126,7 @@
AddSensor("Ungrouped", cc, component);
if (std::find(m_sensors.begin(), m_sensors.end(), component) == m_sensors.end())
m_sensors.push_back(component);
+#endif
}
/**
@@ -122,6 +134,7 @@
*/
void LiveWindow::AddActuator(std::string type, int module, int channel, LiveWindowSendable *component)
{
+#if 0
std::ostringstream oss;
oss << type << "[" << module << "," << channel << "]";
std::string types(oss.str());
@@ -129,6 +142,7 @@
types.copy(cc, types.size());
cc[types.size()]='\0';
AddActuator("Ungrouped", cc, component);
+#endif
}
/**
@@ -138,10 +152,12 @@
*/
void LiveWindow::UpdateValues()
{
+#if 0
for (unsigned int i = 0; i < m_sensors.size(); i++)
{
m_sensors[i]->UpdateTable();
}
+#endif
}
/**
@@ -150,10 +166,12 @@
*/
void LiveWindow::Run()
{
+#if 0
if (m_enabled)
{
UpdateValues();
}
+#endif
}
/**
@@ -165,6 +183,7 @@
*/
void LiveWindow::InitializeLiveWindowComponents()
{
+#if 0
for (std::map<LiveWindowSendable *, LiveWindowComponent>::iterator it =
m_components.begin(); it != m_components.end(); ++it)
{
@@ -185,5 +204,6 @@
m_sensors.push_back(component);
}
}
+#endif
}
diff --git a/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.h b/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.h
index 7583c85..7237afa 100644
--- a/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.h
+++ b/aos/externals/WPILib/WPILib/LiveWindow/LiveWindow.h
@@ -4,22 +4,27 @@
#include "LiveWindow/LiveWindowSendable.h"
#include "tables/ITable.h"
#include "Commands/Scheduler.h"
+#include "Synchronized.h"
#include <vector>
#include <map>
struct LiveWindowComponent
{
+#if 0
std::string subsystem;
std::string name;
bool isSensor;
+#endif
LiveWindowComponent()
{}//WTF?
LiveWindowComponent(std::string subsystem, std::string name, bool isSensor)
{
+#if 0
this->subsystem = subsystem;
this->name = name;
this->isSensor = isSensor;
+#endif
}
};
@@ -38,7 +43,7 @@
void AddSensor(std::string type, int module, int channel, LiveWindowSendable *component);
void AddActuator(std::string type, int module, int channel, LiveWindowSendable *component);
- bool IsEnabled() { return m_enabled; }
+ bool IsEnabled() { return false; }
void SetEnabled(bool enabled);
protected:
@@ -50,10 +55,14 @@
void Initialize();
void InitializeLiveWindowComponents();
+#if 0
std::vector<LiveWindowSendable *> m_sensors;
std::map<LiveWindowSendable *, LiveWindowComponent> m_components;
+#endif
static LiveWindow *m_instance;
+ static ReentrantSemaphore m_instanceLock;
+#if 0
ITable *m_liveWindowTable;
ITable *m_statusTable;
@@ -61,6 +70,7 @@
bool m_enabled;
bool m_firstTime;
+#endif
};
#endif
diff --git a/frc971/crio/crio.gyp b/frc971/crio/crio.gyp
index 3622161..e2cd6ae 100644
--- a/frc971/crio/crio.gyp
+++ b/frc971/crio/crio.gyp
@@ -5,6 +5,7 @@
'target_name': 'WPILib_changes',
'type': 'static_library',
'sources': [
+ '<(AOS)/externals/WPILib/WPILib/LiveWindow/LiveWindow.cpp',
],
'dependencies': [
'<(EXTERNALS):WPILib',