Update from firstforge (upstream), where the recent commit msgs are:
------------------------------------------------------------------------
r3615 | bamiller | 2013-02-07 14:27:03 -0800 (Thu, 07 Feb 2013) | 1 line
Make subsystems status only update SmartDashboard on changes.
------------------------------------------------------------------------
r3619 | fbsilberberg | 2013-02-18 19:27:00 -0800 (Mon, 18 Feb 2013) | 1 line
Added Preferences fix from Java to C++.
------------------------------------------------------------------------
r3620 | fbsilberberg | 2013-02-19 13:44:50 -0800 (Tue, 19 Feb 2013) | 1 line
Updated minimum CANJaguar version to 101, as per Rule 61-4.
------------------------------------------------------------------------
r3621 | mwills | 2013-02-19 13:48:39 -0800 (Tue, 19 Feb 2013) | 1 line
Merged NTr380 (fixes introduction of null values)
------------------------------------------------------------------------
r3622 | mwills | 2013-03-02 11:29:17 -0800 (Sat, 02 Mar 2013) | 1 line
Merged NTr381 (removed TCP_NODELAY)
------------------------------------------------------------------------
r3623 | mwills | 2013-03-02 15:40:44 -0800 (Sat, 02 Mar 2013) | 3 lines
Merged some changes from Peter Johnson
- Initialize m_table to NULL in many classes
- Add NULL checks to some live window code
------------------------------------------------------------------------
git-svn-id: https://robotics.mvla.net/svn/frc971/2013/trunk/src@4176 f308d9b7-e957-4cde-b6ac-9a88185e7312
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Accelerometer.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Accelerometer.cpp
index 6a367a8..78df478 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Accelerometer.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Accelerometer.cpp
@@ -15,6 +15,7 @@
*/
void Accelerometer::InitAccelerometer()
{
+ m_table = NULL;
m_voltsPerG = 1.0;
m_zeroGVoltage = 2.5;
nUsageReporting::report(nUsageReporting::kResourceType_Accelerometer, m_analogChannel->GetChannel(), m_analogChannel->GetModuleNumber() - 1);
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/AnalogChannel.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/AnalogChannel.cpp
index beb8688..4bdfb20 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/AnalogChannel.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/AnalogChannel.cpp
@@ -22,6 +22,7 @@
*/
void AnalogChannel::InitChannel(UINT8 moduleNumber, UINT32 channel)
{
+ m_table = NULL;
char buf[64];
Resource::CreateResourceObject(&channels, kAnalogModules * kAnalogChannels);
if (!CheckAnalogModule(moduleNumber))
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/CANJaguar.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/CANJaguar.cpp
index 75d6195..e3196f0 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/CANJaguar.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/CANJaguar.cpp
@@ -31,6 +31,7 @@
*/
void CANJaguar::InitCANJaguar()
{
+ m_table = NULL;
m_transactionSemaphore = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE);
if (m_deviceNumber < 1 || m_deviceNumber > 63)
{
@@ -1248,11 +1249,15 @@
}
void CANJaguar::StartLiveWindowMode() {
- m_table->AddTableListener("Value", this, true);
+ if (m_table != NULL) {
+ m_table->AddTableListener("Value", this, true);
+ }
}
void CANJaguar::StopLiveWindowMode() {
- m_table->RemoveTableListener(this);
+ if (m_table != NULL) {
+ m_table->RemoveTableListener(this);
+ }
}
std::string CANJaguar::GetSmartDashboardType() {
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Compressor.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Compressor.cpp
index 4760c02..d874986 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Compressor.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Compressor.cpp
@@ -47,6 +47,7 @@
UINT8 compresssorRelayModuleNumber,
UINT32 compressorRelayChannel)
{
+ m_table = NULL;
m_enabled = false;
m_pressureSwitch = new DigitalInput(pressureSwitchModuleNumber, pressureSwitchChannel);
m_relay = new Relay(compresssorRelayModuleNumber, compressorRelayChannel, Relay::kForwardOnly);
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Counter.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Counter.cpp
index 98b3ade..8adb719 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Counter.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Counter.cpp
@@ -19,6 +19,7 @@
*/
void Counter::InitCounter(Mode mode)
{
+ m_table = NULL;
Resource::CreateResourceObject(&counters, tCounter::kNumSystems);
UINT32 index = counters->Allocate("Counter");
if (index == ~0ul)
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalInput.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalInput.cpp
index b5c5566..6f3bf1e 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalInput.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalInput.cpp
@@ -20,6 +20,7 @@
*/
void DigitalInput::InitDigitalInput(UINT8 moduleNumber, UINT32 channel)
{
+ m_table = NULL;
char buf[64];
Resource::CreateResourceObject(&interruptsResource, tInterrupt::kNumSystems);
if (!CheckDigitalModule(moduleNumber))
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalOutput.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalOutput.cpp
index 375b264..87f136c 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalOutput.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/DigitalOutput.cpp
@@ -19,6 +19,7 @@
*/
void DigitalOutput::InitDigitalOutput(UINT8 moduleNumber, UINT32 channel)
{
+ m_table = NULL;
char buf[64];
if (!CheckDigitalModule(moduleNumber))
{
@@ -288,11 +289,15 @@
}
void DigitalOutput::StartLiveWindowMode() {
- m_table->AddTableListener("Value", this, true);
+ if (m_table != NULL) {
+ m_table->AddTableListener("Value", this, true);
+ }
}
void DigitalOutput::StopLiveWindowMode() {
- m_table->RemoveTableListener(this);
+ if (m_table != NULL) {
+ m_table->RemoveTableListener(this);
+ }
}
std::string DigitalOutput::GetSmartDashboardType() {
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/DoubleSolenoid.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/DoubleSolenoid.cpp
index f5a48ce..dfcf7e7 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/DoubleSolenoid.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/DoubleSolenoid.cpp
@@ -15,6 +15,7 @@
*/
void DoubleSolenoid::InitSolenoid()
{
+ m_table = NULL;
char buf[64];
if (!CheckSolenoidModule(m_moduleNumber))
{
@@ -158,12 +159,16 @@
void DoubleSolenoid::StartLiveWindowMode() {
Set(kOff);
- m_table->AddTableListener("Value", this, true);
+ if (m_table != NULL) {
+ m_table->AddTableListener("Value", this, true);
+ }
}
void DoubleSolenoid::StopLiveWindowMode() {
Set(kOff);
- m_table->RemoveTableListener(this);
+ if (m_table != NULL) {
+ m_table->RemoveTableListener(this);
+ }
}
std::string DoubleSolenoid::GetSmartDashboardType() {
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Encoder.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Encoder.cpp
index 246df4b..2c44f9d 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Encoder.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Encoder.cpp
@@ -25,6 +25,7 @@
*/
void Encoder::InitEncoder(bool reverseDirection, EncodingType encodingType)
{
+ m_table = NULL;
m_encodingType = encodingType;
tRioStatusCode localStatus = NiFpga_Status_Success;
switch (encodingType)
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Gyro.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Gyro.cpp
index 2f55e58..4ea3588 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Gyro.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Gyro.cpp
@@ -28,6 +28,7 @@
*/
void Gyro::InitGyro()
{
+ m_table = NULL;
if (!m_analog->IsAccumulatorChannel())
{
wpi_setWPIErrorWithContext(ParameterOutOfRange,
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicColorSensor.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicColorSensor.cpp
index d4d70fd..fe6035a 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicColorSensor.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicColorSensor.cpp
@@ -32,6 +32,7 @@
HiTechnicColorSensor::HiTechnicColorSensor(UINT8 moduleNumber)
: m_i2c (NULL)
{
+ m_table = NULL;
DigitalModule *module = DigitalModule::GetInstance(moduleNumber);
m_mode = kActive;
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicCompass.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicCompass.cpp
index 3c353b3..ef9e80c 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicCompass.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/HiTechnicCompass.cpp
@@ -26,6 +26,7 @@
HiTechnicCompass::HiTechnicCompass(UINT8 moduleNumber)
: m_i2c (NULL)
{
+ m_table = NULL;
DigitalModule *module = DigitalModule::GetInstance(moduleNumber);
if (module)
{
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/LiveWindow/LiveWindowStatusListener.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/LiveWindow/LiveWindowStatusListener.cpp
index 5254a7a..a2093a5 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/LiveWindow/LiveWindowStatusListener.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/LiveWindow/LiveWindowStatusListener.cpp
@@ -1,7 +1,7 @@
#include "LiveWindow/LiveWindowStatusListener.h"
#include "Commands/Scheduler.h"
-void ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) {
+void LiveWindowStatusListener::ValueChanged(ITable* source, const std::string& key, EntryValue value, bool isNew) {
}
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/PWM.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/PWM.cpp
index adf5938..8901b74 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/PWM.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/PWM.cpp
@@ -26,6 +26,7 @@
*/
void PWM::InitPWM(UINT8 moduleNumber, UINT32 channel)
{
+ m_table = NULL;
char buf[64];
Resource::CreateResourceObject(&allocated, tDIO::kNumSystems * kPwmChannels);
if (!CheckPWMModule(moduleNumber))
@@ -345,12 +346,16 @@
}
void PWM::StartLiveWindowMode() {
- m_table->AddTableListener("Value", this, true);
+ if (m_table != NULL) {
+ m_table->AddTableListener("Value", this, true);
+ }
}
void PWM::StopLiveWindowMode() {
SetSpeed(0);
- m_table->RemoveTableListener(this);
+ if (m_table != NULL) {
+ m_table->RemoveTableListener(this);
+ }
}
std::string PWM::GetSmartDashboardType() {
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Relay.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Relay.cpp
index e02cd31..eedbd4c 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Relay.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Relay.cpp
@@ -25,6 +25,7 @@
*/
void Relay::InitRelay (UINT8 moduleNumber)
{
+ m_table = NULL;
char buf[64];
Resource::CreateResourceObject(&relayChannels, tDIO::kNumSystems * kRelayChannels * 2);
if (!SensorBase::CheckRelayModule(moduleNumber))
@@ -244,11 +245,15 @@
}
void Relay::StartLiveWindowMode() {
- m_table->AddTableListener("Value", this, true);
+ if(m_table != NULL){
+ m_table->AddTableListener("Value", this, true);
+ }
}
void Relay::StopLiveWindowMode() {
- m_table->RemoveTableListener(this);
+ if(m_table != NULL){
+ m_table->RemoveTableListener(this);
+ }
}
std::string Relay::GetSmartDashboardType() {
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Servo.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Servo.cpp
index 8acb0d7..462e805 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Servo.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Servo.cpp
@@ -20,6 +20,7 @@
*/
void Servo::InitServo()
{
+ m_table = NULL;
// TODO: compute the appropriate values based on digital loop timing
SetBounds(245, 0, 0, 0, 11);
SetPeriodMultiplier(kPeriodMultiplier_4X);
@@ -134,11 +135,15 @@
}
void Servo::StartLiveWindowMode() {
- m_table->AddTableListener("Value", this, true);
+ if (m_table != NULL) {
+ m_table->AddTableListener("Value", this, true);
+ }
}
void Servo::StopLiveWindowMode() {
- m_table->RemoveTableListener(this);
+ if (m_table != NULL) {
+ m_table->RemoveTableListener(this);
+ }
}
std::string Servo::GetSmartDashboardType() {
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Solenoid.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Solenoid.cpp
index 498a969..2b753d3 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Solenoid.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Solenoid.cpp
@@ -14,6 +14,7 @@
*/
void Solenoid::InitSolenoid()
{
+ m_table = NULL;
char buf[64];
if (!CheckSolenoidModule(m_moduleNumber))
{
@@ -115,12 +116,16 @@
void Solenoid::StartLiveWindowMode() {
Set(false);
- m_table->AddTableListener("Value", this, true);
+ if (m_table != NULL) {
+ m_table->AddTableListener("Value", this, true);
+ }
}
void Solenoid::StopLiveWindowMode() {
Set(false);
- m_table->RemoveTableListener(this);
+ if (m_table != NULL) {
+ m_table->RemoveTableListener(this);
+ }
}
std::string Solenoid::GetSmartDashboardType() {
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/Ultrasonic.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/Ultrasonic.cpp
index a8b3991..e21d227 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/Ultrasonic.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/Ultrasonic.cpp
@@ -56,6 +56,7 @@
*/
void Ultrasonic::Initialize()
{
+ m_table = NULL;
bool originalMode = m_automaticEnabled;
if (m_semaphore == 0) m_semaphore = semBCreate(SEM_Q_PRIORITY, SEM_FULL);
SetAutomaticMode(false); // kill task when adding a new sensor
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketServerStreamProvider.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketServerStreamProvider.cpp
index 2f89af9..97fc3e8 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketServerStreamProvider.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketServerStreamProvider.cpp
@@ -111,8 +111,8 @@
if (connectedSocket == ERROR)
return NULL;
- int on = 1;
- setsockopt(connectedSocket, IPPROTO_TCP, TCP_NODELAY, (char *)&on, sizeof(on));
+ //int on = 1;
+ //setsockopt(connectedSocket, IPPROTO_TCP, TCP_NODELAY, (char *)&on, sizeof(on));
return new FDIOStream(connectedSocket);
}
diff --git a/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketStreamFactory.cpp b/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketStreamFactory.cpp
index 8e3af60..5a12083 100644
--- a/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketStreamFactory.cpp
+++ b/azaleasource/WPILibCProgramming/trunk/WPILib/networktables2/stream/SocketStreamFactory.cpp
@@ -59,8 +59,8 @@
return NULL;
}//TODO close fd if an error occured
- int on = 1;
- setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&on, sizeof(on));
+ //int on = 1;
+ //setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&on, sizeof(on));
return new FDIOStream(sockfd);
#endif