Commit f11f8bb0 authored by Alessio Netti's avatar Alessio Netti

Merge remote-tracking branch 'remotes/origin/development'

parents 49d8cb4e 2f5bacbb
......@@ -212,11 +212,14 @@ public:
* @return Messages/s
*/
virtual float getMsgRate() override {
float msgRate = 0;
for (const auto &u : _units) {
msgRate += (float)u->getBaseOutputs().size() * (1000.0f / (float)_interval) / (float)_minValues;
}
return msgRate;
float val = 0.0f;
for (const auto &u : this->getUnits())
for(const auto &s : u->getBaseOutputs()) {
if (s->getSubsampling() > 0)
val += 1.0f / ((float) s->getSubsampling());
}
this->releaseUnits();
return val * (1000.0f / (float)_interval) / (float)_minValues;
}
/**
......
......@@ -203,7 +203,8 @@ class SensorGroupInterface {
virtual float getMsgRate() {
float val = 0;
for (const auto s: _baseSensors) {
val+= 1.0f / s->getSubsampling();
if(s->getSubsampling() > 0)
val+= 1.0f / (float)s->getSubsampling();
}
return val * (1000.0f / (float)_interval) / (float)_minValues;
}
......
......@@ -75,9 +75,8 @@ int LenovoXCC::getBulkPower(std::vector<reading_t> &readings) {
try {
len = _host->sendRawCmd(getBulkCmd, sizeof(getBulkCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 1;
} catch (...) {
throw;
}
if ((len == 208) && (buf[0] == 0x32) && (buf[1] == 0x00)) {
......@@ -104,9 +103,8 @@ int LenovoXCC::getBulkEnergy(std::vector<reading_t> &readings) {
int len = -1;
try {
len = _host->sendRawCmd(getBulkCmd, sizeof(getBulkCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 1;
} catch (...) {
throw;
}
if ((len == 212) && (buf[0] == 0x32) && (buf[1] == 0x00)) {
......@@ -151,9 +149,8 @@ int LenovoXCC::readSingleEnergyRaw(uint64_t &timeStamp, uint64_t &energy) {
int len = -1;
try {
len = _host->sendRawCmd(getSingleEnergyCmd, sizeof(getSingleEnergyCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 1;
} catch (...) {
throw;
}
if ((len == 16) && (buf[0] == 0x32) && (buf[1] == 0x00)) {
......@@ -183,9 +180,8 @@ int LenovoXCC::openDatastore() {
int len = -1;
try {
len = _host->sendRawCmd(getHandleCmd, sizeof(getHandleCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 255;
} catch (...) {
throw;
}
if ((len == 9) && (buf[0] == 0x90) && (buf[1] == 0x00)) {
......@@ -208,9 +204,8 @@ int LenovoXCC::closeDatastore() {
int len = -1;
try {
len = _host->sendRawCmd(closeHandleCmd, sizeof(closeHandleCmd), buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 255;
} catch (...) {
throw;
}
if ((len == 5) && (buf[0] == 0x90) && (buf[1] == 0x00)) {
......@@ -229,9 +224,8 @@ int LenovoXCC::readDatastoreRange(uint32_t offset, uint16_t count, uint8_t *buf,
int len = -1;
try {
len = _host->sendRawCmd(getDataCmd, sizeof(getDataCmd), buf, bufLen);
} catch (const std::exception &e) {
throw e;
return -1;
} catch (...) {
throw;
}
if ((len >= 2) && (buf[0] == 0x90) && (buf[1] == 0x00)) {
......@@ -246,9 +240,8 @@ uint64_t LenovoXCC::readDatastoreTimestamp() {
int len = -1;
try {
len = readDatastoreRange(0, 16, buf, sizeof(buf));
} catch (const std::exception &e) {
throw e;
return 0;
} catch (...) {
throw;
}
if ((len == 23) && (buf[0] == 0x90) && (buf[1] == 0x00)){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment