-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add screen power on/off capability to web interface, refactorings #279
Conversation
Hold on; looks like some more changes are required to update the screen status icon after the screens have been turned on/off |
ce43645
to
198729a
Compare
OK, should be fine now (tested on 5th floor). |
|
||
bool _getResult(const std::vector<bool>& results) | ||
{ | ||
for (const auto result : results) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (const auto result : results) | |
return std::find(results.begin(), results.end(), false) == results.end(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, done
{ | ||
ScreenState _getResult(const std::vector<ScreenState>& results) | ||
{ | ||
const auto state = results[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if results empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this function should be safe even though it normally doesn't happen in this context, updated.
namespace | ||
{ | ||
const int serialTimeout = 1000; // in ms | ||
const int powerStateTimer = 60000; // in ms | ||
const int readTimeoutMs = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const int readTimeoutMs = 1000; | |
constexpr int readTimeoutMs = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
#ifndef ScreenController_H | ||
#define ScreenController_H | ||
#ifndef SCREEN_CONTROLLER_H | ||
#define SCREEN_CONTROLLER_H |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer #pragma once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it's less work and less error prone, I was using pragma once before joining the BBP then I stopped to maintain a consistent style, and now I got used to doing it by hand... ;-) The only times I found hard-coded names to be useful is in the rare cases when you need fine control over which files are included when using conflicting or broken third-party libraries. But that's very uncommon and I agree that it does not apply to this project. Maybe I should consider doing a batch change at some point.
No description provided.