code style
This commit is contained in:
Executable → Regular
+2
-2
@@ -692,7 +692,7 @@ result_t BusHandler::handleSymbol() {
|
||||
long long latencyLong = (sentTime.tv_sec*1000000000 + sentTime.tv_nsec
|
||||
- m_lastSynReceiveTime.tv_sec*1000000000 - m_lastSynReceiveTime.tv_nsec)/1000;
|
||||
if (latencyLong >= 0 && latencyLong <= 10000) { // skip clock skew or out of reasonable range
|
||||
int latency = (int)latencyLong;
|
||||
int latency = static_cast<int>(latencyLong);
|
||||
logDebug(lf_bus, "arbitration delay %d micros", latency);
|
||||
if (m_arbitrationDelayMin < 0 || (latency < m_arbitrationDelayMin || latency > m_arbitrationDelayMax)) {
|
||||
if (m_arbitrationDelayMin == -1 || latency < m_arbitrationDelayMin) {
|
||||
@@ -1022,7 +1022,7 @@ void BusHandler::measureLatency(struct timespec* sentTime, struct timespec* recv
|
||||
if (latencyLong < 0 || latencyLong > 1000) {
|
||||
return; // clock skew or out of reasonable range
|
||||
}
|
||||
int latency = (int)latencyLong;
|
||||
int latency = static_cast<int>(latencyLong);
|
||||
logDebug(lf_bus, "send/receive symbol latency %d ms", latency);
|
||||
if (m_symbolLatencyMin >= 0 && (latency >= m_symbolLatencyMin && latency <= m_symbolLatencyMax)) {
|
||||
return;
|
||||
|
||||
Executable → Regular
+8
-2
@@ -698,10 +698,16 @@ class BusHandler : public WaitThread {
|
||||
/** the maximal measured latency between send and receive of a symbol in milliseconds, -1 if not yet known. */
|
||||
int m_symbolLatencyMax;
|
||||
|
||||
/** the minimal measured delay between received SYN and sent own master address in microseconds, -1 if not yet known. */
|
||||
/**
|
||||
* the minimal measured delay between received SYN and sent own master address in microseconds,
|
||||
* -1 if not yet known.
|
||||
*/
|
||||
int m_arbitrationDelayMin;
|
||||
|
||||
/** the maximal measured delay between received SYN and sent own master address in microseconds, -1 if not yet known. */
|
||||
/**
|
||||
* the maximal measured delay between received SYN and sent own master address in microseconds,
|
||||
* -1 if not yet known.
|
||||
*/
|
||||
int m_arbitrationDelayMax;
|
||||
|
||||
/** the time of the last received SYN symbol, or 0 for never. */
|
||||
|
||||
+3
-2
@@ -1197,8 +1197,9 @@ int main(int argc, char* argv[]) {
|
||||
signal(SIGTERM, signalHandler);
|
||||
|
||||
logNotice(lf_main, PACKAGE_STRING "." REVISION " started%s",
|
||||
opt.scanConfig ? opt.initialScan == ESC ? " with auto scan" : opt.initialScan == BROADCAST ? " with broadcast scan"
|
||||
: opt.initialScan == SYN ? " with full scan" : " with single scan" : "");
|
||||
opt.scanConfig ? opt.initialScan == ESC ? " with auto scan"
|
||||
: opt.initialScan == BROADCAST ? " with broadcast scan" : opt.initialScan == SYN ? " with full scan"
|
||||
: " with single scan" : "");
|
||||
|
||||
// load configuration files
|
||||
loadConfigFiles(s_messageMap);
|
||||
|
||||
Executable → Regular
+2
-2
@@ -722,7 +722,7 @@ result_t MainLoop::executeRead(const vector<string>& args, const string& levels,
|
||||
result_t ret;
|
||||
symbol_t address = (symbol_t)parseInt(args[argPos].c_str(), 16, 0, 0xff, &ret);
|
||||
if (ret != RESULT_OK || !isValidAddress(address, dest) || (dest == isMaster(address))) {
|
||||
return RESULT_ERR_INVALID_ADDR; // deny send from slave address and to master addresses
|
||||
return RESULT_ERR_INVALID_ADDR; // deny send from slave address and to master addresses
|
||||
}
|
||||
if (dest) {
|
||||
dstAddress = address;
|
||||
@@ -949,7 +949,7 @@ result_t MainLoop::executeWrite(const vector<string>& args, const string levels,
|
||||
result_t ret;
|
||||
symbol_t address = (symbol_t)parseInt(args[argPos].c_str(), 16, 0, 0xff, &ret);
|
||||
if (ret != RESULT_OK || !isValidAddress(address, dest) || (!dest && !isMaster(address))) {
|
||||
return RESULT_ERR_INVALID_ADDR; // deny send from slave address
|
||||
return RESULT_ERR_INVALID_ADDR; // deny send from slave address
|
||||
}
|
||||
if (dest) {
|
||||
dstAddress = address;
|
||||
|
||||
@@ -658,7 +658,8 @@ bool SingleDataField::hasFullByteOffset(bool after) const {
|
||||
}
|
||||
|
||||
size_t SingleDataField::getCount(PartType partType, const char* fieldName) const {
|
||||
return isIgnored() || (partType != pt_any && partType != m_partType) || (fieldName != NULL && m_name != fieldName) ? 0 : 1;
|
||||
return isIgnored() || (partType != pt_any && partType != m_partType) || (fieldName != NULL && m_name != fieldName)
|
||||
? 0 : 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ result_t NetworkDevice::open() {
|
||||
return RESULT_ERR_GENERIC_IO;
|
||||
}
|
||||
if (!m_udp) {
|
||||
usleep(25000); // wait 25ms for potential initial garbage
|
||||
usleep(25000); // wait 25ms for potential initial garbage
|
||||
}
|
||||
int cnt;
|
||||
symbol_t buf[MTU];
|
||||
|
||||
@@ -747,7 +747,7 @@ result_t Message::decodeLastData(bool leadingSeparator, const char* fieldName,
|
||||
fieldIndex -= m_data->getCount(pt_masterData, fieldName);
|
||||
if (fieldIndex < 0) {
|
||||
skipSlaveData = true;
|
||||
fieldIndex = 0;
|
||||
fieldIndex = 0;
|
||||
}
|
||||
}
|
||||
if (!skipSlaveData) {
|
||||
|
||||
Reference in New Issue
Block a user