mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-11-25 07:43:04 +05:00
refactor: simplify conditions and standardize formatting
This commit is contained in:
1 parent
d1a44de0df
commit
1d1a57ecad
9 files changed
+212
-187
No files matched your search
+15
-15
@@ -193,24 +193,24 @@ public:
|
||||
}
|
||||
|
||||
static bool isDifferent(const Settings& previous, const Settings& current) {
|
||||
return previous.enabled != current.enabled
|
||||
|| strcmp(previous.name, current.name) != 0
|
||||
|| strcmp(previous.slug, current.slug) != 0
|
||||
|| previous.purpose != current.purpose
|
||||
|| previous.type != current.type
|
||||
|| previous.gpio != current.gpio
|
||||
|| !isEqualAddress(previous.address, current.address)
|
||||
|| isFloatDifferent(previous.offset, current.offset, 0.0001f)
|
||||
|| isFloatDifferent(previous.factor, current.factor, 0.0001f)
|
||||
|| previous.filtering != current.filtering
|
||||
|| isFloatDifferent(previous.filteringFactor, current.filteringFactor, 0.0001f);
|
||||
return previous.enabled != current.enabled ||
|
||||
strcmp(previous.name, current.name) != 0 ||
|
||||
strcmp(previous.slug, current.slug) != 0 ||
|
||||
previous.purpose != current.purpose ||
|
||||
previous.type != current.type ||
|
||||
previous.gpio != current.gpio ||
|
||||
!isEqualAddress(previous.address, current.address) ||
|
||||
isFloatDifferent(previous.offset, current.offset, 0.0001f) ||
|
||||
isFloatDifferent(previous.factor, current.factor, 0.0001f) ||
|
||||
previous.filtering != current.filtering ||
|
||||
isFloatDifferent(previous.filteringFactor, current.filteringFactor, 0.0001f);
|
||||
}
|
||||
|
||||
static bool hasEnabledAndValid(const Settings& sensor) {
|
||||
return sensor.enabled
|
||||
&& sensor.slug[0] != '\0'
|
||||
&& sensor.type != Type::NOT_CONFIGURED
|
||||
&& sensor.purpose != Purpose::NOT_CONFIGURED;
|
||||
return sensor.enabled &&
|
||||
sensor.slug[0] != '\0' &&
|
||||
sensor.type != Type::NOT_CONFIGURED &&
|
||||
sensor.purpose != Purpose::NOT_CONFIGURED;
|
||||
}
|
||||
|
||||
static bool hasEnabledAndValid(const uint8_t id) {
|
||||
|
||||
Reference in new issue
Block a user