Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
718e4334
Commit
718e4334
authored
Nov 03, 2018
by
Micha Mueller
Browse files
Tiny fix and improvement to SensorBase
parent
3ec2f885
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/includes/ConfiguratorTemplate.h
View file @
718e4334
...
...
@@ -341,7 +341,11 @@ protected:
if
(
boost
::
iequals
(
val
.
first
,
"mqttsuffix"
))
{
sBase
.
setMqtt
(
val
.
second
.
data
());
}
else
if
(
boost
::
iequals
(
val
.
first
,
"skipConstVal"
))
{
sBase
.
setSkipConstVal
(
val
.
second
.
data
());
if
(
val
.
second
.
data
()
==
"on"
)
{
sBase
.
setSkipConstVal
(
true
);
}
else
{
sBase
.
setSkipConstVal
(
false
);
}
}
}
sensorBase
(
sBase
,
config
);
...
...
src/includes/SensorBase.h
View file @
718e4334
...
...
@@ -43,6 +43,7 @@ public:
SensorBase
&
operator
=
(
const
SensorBase
&
other
)
{
_name
=
other
.
_name
;
_mqtt
=
other
.
_mqtt
;
_skipConstVal
=
other
.
_skipConstVal
;
_cache
.
reset
(
nullptr
);
_latestValue
.
timestamp
=
other
.
_latestValue
.
timestamp
;
_latestValue
.
value
=
other
.
_latestValue
.
value
;
...
...
@@ -59,13 +60,7 @@ public:
void
setName
(
const
std
::
string
&
name
)
{
_name
=
name
;
}
void
setMqtt
(
const
std
::
string
&
mqtt
)
{
_mqtt
=
mqtt
;
}
void
setSkipConstVal
(
const
std
::
string
&
skipConstVal
)
{
if
(
skipConstVal
==
"on"
)
{
_skipConstVal
=
true
;
}
else
{
_skipConstVal
=
false
;
}
}
void
setSkipConstVal
(
bool
skipConstVal
)
{
_skipConstVal
=
skipConstVal
;
}
const
std
::
size_t
getSizeOfReadingQueue
()
const
{
return
_readingQueue
->
read_available
();
}
std
::
size_t
popReadingQueue
(
reading_t
*
reads
,
std
::
size_t
max
)
const
{
return
_readingQueue
->
pop
(
reads
,
max
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment