mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Remove JNI logging (#1872)
This commit is contained in:
committed by
Peter Johnson
parent
3e0f7d0995
commit
dd928b4cbf
@@ -17,18 +17,9 @@
|
||||
#include "HALUtil.h"
|
||||
#include "edu_wpi_first_hal_InterruptJNI.h"
|
||||
#include "hal/Interrupts.h"
|
||||
#include "hal/cpp/Log.h"
|
||||
|
||||
using namespace frc;
|
||||
|
||||
TLogLevel interruptJNILogLevel = logERROR;
|
||||
|
||||
#define INTERRUPTJNI_LOG(level) \
|
||||
if (level > interruptJNILogLevel) \
|
||||
; \
|
||||
else \
|
||||
Log().Get(level)
|
||||
|
||||
// Thread where callbacks are actually performed.
|
||||
//
|
||||
// JNI's AttachCurrentThread() creates a Java Thread object on every
|
||||
@@ -129,15 +120,9 @@ JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_InterruptJNI_initializeInterrupts
|
||||
(JNIEnv* env, jclass, jboolean watcher)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI initializeInterrupts";
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "watcher = " << static_cast<bool>(watcher);
|
||||
|
||||
int32_t status = 0;
|
||||
HAL_InterruptHandle interrupt = HAL_InitializeInterrupts(watcher, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Interrupt Handle = " << interrupt;
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
|
||||
CheckStatusForceThrow(env, status);
|
||||
return (jint)interrupt;
|
||||
}
|
||||
@@ -151,10 +136,6 @@ JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_InterruptJNI_cleanInterrupts
|
||||
(JNIEnv* env, jclass, jint interruptHandle)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI cleanInterrupts";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
int32_t status = 0;
|
||||
auto param =
|
||||
HAL_CleanInterrupts((HAL_InterruptHandle)interruptHandle, &status);
|
||||
@@ -162,8 +143,6 @@ Java_edu_wpi_first_hal_InterruptJNI_cleanInterrupts
|
||||
delete static_cast<InterruptJNI*>(param);
|
||||
}
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
|
||||
// ignore status, as an invalid handle just needs to be ignored.
|
||||
}
|
||||
|
||||
@@ -177,16 +156,10 @@ Java_edu_wpi_first_hal_InterruptJNI_waitForInterrupt
|
||||
(JNIEnv* env, jclass, jint interruptHandle, jdouble timeout,
|
||||
jboolean ignorePrevious)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI waitForInterrupt";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
int32_t status = 0;
|
||||
int32_t result = HAL_WaitForInterrupt((HAL_InterruptHandle)interruptHandle,
|
||||
timeout, ignorePrevious, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
|
||||
CheckStatus(env, status);
|
||||
return result;
|
||||
}
|
||||
@@ -200,15 +173,9 @@ JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_InterruptJNI_enableInterrupts
|
||||
(JNIEnv* env, jclass, jint interruptHandle)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI enableInterrupts";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
int32_t status = 0;
|
||||
HAL_EnableInterrupts((HAL_InterruptHandle)interruptHandle, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
@@ -221,15 +188,9 @@ JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_InterruptJNI_disableInterrupts
|
||||
(JNIEnv* env, jclass, jint interruptHandle)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI disableInterrupts";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
int32_t status = 0;
|
||||
HAL_DisableInterrupts((HAL_InterruptHandle)interruptHandle, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
@@ -242,16 +203,10 @@ JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_hal_InterruptJNI_readInterruptRisingTimestamp
|
||||
(JNIEnv* env, jclass, jint interruptHandle)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Calling INTERRUPTJNI readInterruptRisingTimestamp";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
int32_t status = 0;
|
||||
jlong timeStamp = HAL_ReadInterruptRisingTimestamp(
|
||||
(HAL_InterruptHandle)interruptHandle, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
CheckStatus(env, status);
|
||||
return timeStamp;
|
||||
}
|
||||
@@ -265,16 +220,10 @@ JNIEXPORT jlong JNICALL
|
||||
Java_edu_wpi_first_hal_InterruptJNI_readInterruptFallingTimestamp
|
||||
(JNIEnv* env, jclass, jint interruptHandle)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Calling INTERRUPTJNI readInterruptFallingTimestamp";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
int32_t status = 0;
|
||||
jlong timeStamp = HAL_ReadInterruptFallingTimestamp(
|
||||
(HAL_InterruptHandle)interruptHandle, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
CheckStatus(env, status);
|
||||
return timeStamp;
|
||||
}
|
||||
@@ -289,18 +238,11 @@ Java_edu_wpi_first_hal_InterruptJNI_requestInterrupts
|
||||
(JNIEnv* env, jclass, jint interruptHandle, jint digitalSourceHandle,
|
||||
jint analogTriggerType)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI requestInterrupts";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "digitalSourceHandle = " << digitalSourceHandle;
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "analogTriggerType = " << analogTriggerType;
|
||||
|
||||
int32_t status = 0;
|
||||
HAL_RequestInterrupts((HAL_InterruptHandle)interruptHandle,
|
||||
(HAL_Handle)digitalSourceHandle,
|
||||
(HAL_AnalogTriggerType)analogTriggerType, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
@@ -313,21 +255,13 @@ JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_InterruptJNI_attachInterruptHandler
|
||||
(JNIEnv* env, jclass, jint interruptHandle, jobject handler, jobject param)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI attachInterruptHandler";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
|
||||
jclass cls = env->GetObjectClass(handler);
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "class = " << cls;
|
||||
if (cls == 0) {
|
||||
INTERRUPTJNI_LOG(logERROR) << "Error getting java class";
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
jmethodID mid = env->GetMethodID(cls, "apply", "(ILjava/lang/Object;)V");
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "method = " << mid;
|
||||
if (mid == 0) {
|
||||
INTERRUPTJNI_LOG(logERROR) << "Error getting java method ID";
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
@@ -336,13 +270,10 @@ Java_edu_wpi_first_hal_InterruptJNI_attachInterruptHandler
|
||||
intr->Start();
|
||||
intr->SetFunc(env, handler, mid, param);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "InterruptThreadJNI Ptr = " << intr;
|
||||
|
||||
int32_t status = 0;
|
||||
HAL_AttachInterruptHandler((HAL_InterruptHandle)interruptHandle,
|
||||
interruptHandler, intr, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
@@ -356,19 +287,10 @@ Java_edu_wpi_first_hal_InterruptJNI_setInterruptUpSourceEdge
|
||||
(JNIEnv* env, jclass, jint interruptHandle, jboolean risingEdge,
|
||||
jboolean fallingEdge)
|
||||
{
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Calling INTERRUPTJNI setInterruptUpSourceEdge";
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Interrupt Handle = " << (HAL_InterruptHandle)interruptHandle;
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Rising Edge = " << static_cast<bool>(risingEdge);
|
||||
INTERRUPTJNI_LOG(logDEBUG)
|
||||
<< "Falling Edge = " << static_cast<bool>(fallingEdge);
|
||||
|
||||
int32_t status = 0;
|
||||
HAL_SetInterruptUpSourceEdge((HAL_InterruptHandle)interruptHandle, risingEdge,
|
||||
fallingEdge, &status);
|
||||
|
||||
INTERRUPTJNI_LOG(logDEBUG) << "Status = " << status;
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user