Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ICBM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
detectors
DSSC
ICBM
Commits
a6ff9fad
Commit
a6ff9fad
authored
1 month ago
by
Cyril Danilevski
Browse files
Options
Downloads
Patches
Plain Diff
Tidy up mpod.cpp
parent
25849d7c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
mpod.cpp
+2
-2
2 additions, 2 deletions
mpod.cpp
mpod.hpp
+1
-1
1 addition, 1 deletion
mpod.hpp
rest.cpp
+2
-1
2 additions, 1 deletion
rest.cpp
with
5 additions
and
4 deletions
mpod.cpp
+
2
−
2
View file @
a6ff9fad
...
...
@@ -136,7 +136,7 @@ float MPOD::getFloatFromVarBind(const VarBind *varbind) {
}
String
MPOD
::
toJSON
()
{
String
json
=
"
\"
status
\"
:
{
\n
"
;
String
json
=
"{
\n
"
;
json
+=
"
\"
channel
\"
:"
+
String
(
getChannel
())
+
","
;
json
+=
"
\"
is_on
\"
:"
+
String
(
isOn
())
+
","
;
json
+=
"
\"
ramping_up
\"
:"
+
String
(
isRampingUp
())
+
","
;
...
...
@@ -194,7 +194,7 @@ void initializeSNMP() {
/* setChannelAndWait
* Set a channel's parameters and wait until it's settled.
*/
void
setChannelAndWait
(
IPAddress
*
ipAddr
,
uint16_t
channel
,
uint8_t
output
)
{
void
setChannelAndWait
(
const
IPAddress
*
ipAddr
,
const
uint16_t
channel
,
const
uint8_t
output
)
{
// Send set command
SNMP
::
Message
*
snmp_msg
=
mpod
.
output
(
channel
,
output
);
snmp
.
send
(
snmp_msg
,
*
ipAddr
,
SNMP
::
Port
::
SNMP
);
...
...
This diff is collapsed.
Click to expand it.
mpod.hpp
+
1
−
1
View file @
a6ff9fad
...
...
@@ -95,5 +95,5 @@ extern MPOD mpod;
// Event handler to process SNMP messages
void
onSNMPMessage
(
const
SNMP
::
Message
*
message
,
const
IPAddress
remote
,
const
uint16_t
port
);
void
initializeSNMP
();
void
setChannelAndWait
(
IPAddress
*
,
uint16_t
,
uint8_t
);
void
setChannelAndWait
(
const
IPAddress
*
,
uint16_t
,
uint8_t
);
This diff is collapsed.
Click to expand it.
rest.cpp
+
2
−
1
View file @
a6ff9fad
...
...
@@ -189,7 +189,8 @@ void pollMPODChannel() {
http_msg
+=
ret
;
http_msg
+=
",
\"
success
\"
: "
;
http_msg
+=
channel
?
1
:
0
;
http_msg
+=
",
\"
channel
\"
: "
;
http_msg
+=
",
\"
channel
\"
: "
;
// TODO: test with invalid channel (request w/o "ch" arg). JSON invalid.
http_msg
+=
channel
;
http_msg
+=
"
\n
}"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment