Implement GetAllSolenoids in the HAL so that SolenoidBase doesn't have to
read each solenoid individually.
Change-Id: I85559565949f7a7119ead410187235636a63f0ed
Having the HAL take a NATIVE_MULTIWAIT_ID without any way to get that
structure from extern "C" code is a problem. This makes it so it just
takes a MULTIWAIT_ID, and then grabs the native handle inside the HAL.
Change-Id: I06da18ba34adcea2f16e4e53da672f38be79e28e
Signed-off-by: Dustin Spicuzza <dustin@virtualroadside.com>
In the current HAL, once the port structures were created, there was no
way to free the structures. The way the C++ libraries were written this
wasn't a problem, since it grabbed a copy of each and stored them in an
array on bootup. However java does not do this, and grabs new ports
every time an object is created. This causes memory leaks if an object
is ever disposed in java. The same thing looks to be happening in
python, and C# does it too currently, but that would change if this gets
merged.
Adds java memory management fixes
Adds memory management to AnalogInput and Analog Output C++
SolenoidPorts and Digital Ports are all hold static arrays with their
port pointers (although solenoid overwrites them if a new solenoid on
the same module is created), however analog always grabbed new pointers.
I would fix the solenoid one, but I don't know what the ideal way to do
it would be.
Silently ignores free(null) calls by checking passed parameter is non-null.
Change-Id: Id32993b57b53f896e46e55c97541d3bd90b52648
For the previous couple of months, the PID tests have been hanging.
The reason that the tests have been hanging lies with the Notifier,
not the PID controller. Basically, a deadlock was occuring during
Notifier destruction when the notifier destructor was called while
the notifier interrupt handler was being called. Because the low-level
interrupt manager waits for the interrupt handler to finish executing before
disabling itself, the notifier destructor would not exit until the
ProcessQueue function finished. However, at the same time, the handler
was attempting to lock the queueMutex before continuing; the Notifier
destructor had locked the queueMutex while wrapping things up, meaning
that the last run of the handler would not complete until the destructor
did, resulting in a deadlock.
In order to repair this, I reduced the scope of the lock on the queueMutex
in the destructor so that it only locks when absolutely necessary. This
should work now.
This bug was likely introduced over the summer when we updated to stl
mutexes and locks, which may have messed up the original lock structure.
This likely did not affect any teams, as it can only occur if you are actively
destroying every* Notifier object present and if the destructor happens to be
called while the handler is being run.
*Note: the component of the destructor causing issues only ran if the last
Notifier object is being destroyed.
Change-Id: I38ba4e60816a2a8d523e927c25378390a0755444
New functions were added to CanTalonSRX in the HAL, however they were
not added to the C side of the library.
Change-Id: I15197e5dce5db0f5ff207d1318c21be485c90741
All other HAL functions have status as the last parameter, only PDP did not.
This changes makes the PDP parameter order consistent with the rest of the HAL.
Change-Id: I725e33f75deab34e6a83b7048b2d6c365fa56a21
This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.
The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.
Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
Refactor common implementation parts of AnalogGyro into GyroBase.
This will make it possible to add digital gyros in a similar way to how
digital accelerometers were added.
Change-Id: I437ef259e9ecb81f18a91a95c5a58b6607db5e15
If built without asserts enabled (e.g. -DNDEBUG), HALInitialize won't get
called. Instead call outside the assert and then do the assert.
Change-Id: I51546b9f9fc9a74f8a3a732c4b754257d9697e46
These changes both simplify the Java code and improve performance across the
JNI boundary.
This also fixes the AnalogCrossConnectTest by adding delays to
setInterruptHigh() and setInterruptLow() to ensure the change in voltage has
time to propagate and extends the timeouts in AbstractInterruptTest.
Detailed changes:
Hoisted status checks to C. This avoids the need to create direct byte
buffers (expensive) and significantly simplifies the Java code. The C code
now directly generates the exception or reports the error to the DS.
The JVM pointer is now a global across the JNI, initialized by the OnLoad
function, avoiding the need for some of the class-specific initializers to
get this pointer for callbacks.
Opaque pointers (such as ports) are now passed as long values rather than
with a ByteBuffer wrapper.
Added extern "C" to source files. This allows earlier detection of JNI
definition mismatches to the Java source headers.
Changed JNI signatures to more closely match HAL signatures (in particular,
boolean is now universally used instead of byte for HAL bool, which cleans
up mapping back and forth to 1/0 from true/false).
Change-Id: I4ea0032cabb0871cd74106a3a70d947258c29d2d