mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
Renamed "pin" to "channel" and variables with underscores now use mixed case (#194)
This commit is contained in:
committed by
Peter Johnson
parent
227fdc1a60
commit
45b8e9ab4f
@@ -26,8 +26,8 @@ static priority_mutex newDSDataAvailableMutex;
|
||||
|
||||
extern "C" {
|
||||
int32_t HAL_SetErrorData(const char* errors, int32_t errorsLength,
|
||||
int32_t wait_ms) {
|
||||
return setErrorData(errors, errorsLength, wait_ms);
|
||||
int32_t waitMs) {
|
||||
return setErrorData(errors, errorsLength, waitMs);
|
||||
}
|
||||
|
||||
int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
|
||||
@@ -37,17 +37,17 @@ int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
|
||||
// messages and only printing again if they're longer than 1 second old.
|
||||
static constexpr int KEEP_MSGS = 5;
|
||||
std::lock_guard<priority_mutex> lock(msgMutex);
|
||||
static std::string prev_msg[KEEP_MSGS];
|
||||
static uint64_t prev_msg_time[KEEP_MSGS] = {0, 0, 0};
|
||||
static std::string prevMsg[KEEP_MSGS];
|
||||
static uint64_t prevMsgTime[KEEP_MSGS] = {0, 0, 0};
|
||||
|
||||
int32_t status = 0;
|
||||
uint64_t curTime = HAL_GetFPGATime(&status);
|
||||
int i;
|
||||
for (i = 0; i < KEEP_MSGS; ++i) {
|
||||
if (prev_msg[i] == details) break;
|
||||
if (prevMsg[i] == details) break;
|
||||
}
|
||||
int retval = 0;
|
||||
if (i == KEEP_MSGS || (curTime - prev_msg_time[i]) >= 1000000) {
|
||||
if (i == KEEP_MSGS || (curTime - prevMsgTime[i]) >= 1000000) {
|
||||
retval = FRC_NetworkCommunication_sendError(isError, errorCode, isLVCode,
|
||||
details, location, callStack);
|
||||
if (printMsg) {
|
||||
@@ -62,16 +62,16 @@ int32_t HAL_SendError(HAL_Bool isError, int32_t errorCode, HAL_Bool isLVCode,
|
||||
if (i == KEEP_MSGS) {
|
||||
// replace the oldest one
|
||||
i = 0;
|
||||
uint64_t first = prev_msg_time[0];
|
||||
uint64_t first = prevMsgTime[0];
|
||||
for (int j = 1; j < KEEP_MSGS; ++j) {
|
||||
if (prev_msg_time[j] < first) {
|
||||
first = prev_msg_time[j];
|
||||
if (prevMsgTime[j] < first) {
|
||||
first = prevMsgTime[j];
|
||||
i = j;
|
||||
}
|
||||
}
|
||||
prev_msg[i] = details;
|
||||
prevMsg[i] = details;
|
||||
}
|
||||
prev_msg_time[i] = curTime;
|
||||
prevMsgTime[i] = curTime;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user