Skip to content

Commit

Permalink
Alternative between Time and IP Address
Browse files Browse the repository at this point in the history
Alternate between Time and IP Address in 4 second
intervals so users can see the IP they need to connect
to for accessing the web interface.
  • Loading branch information
sieren committed Feb 13, 2020
1 parent 6d3b1c2 commit 5763c30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main/ui/UIStatusBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ namespace gfx
{
mLastUpdate = std::chrono::system_clock::now();
mNeedsRedraw = true;
mIsWifiDisplayed = !mIsWifiDisplayed;
}
if (mNeedsRedraw == false)
{
Expand All @@ -78,7 +79,8 @@ namespace gfx
mpScreen->drawJpg(util::GetIconFilePath(mMqttImage), mMqttImageFrame.position);

auto textLabelFrame = mFrame;
const auto textLabel = mTextLabel == "" ? ntp::util::GetCurrentTime() : mTextLabel;
const auto timeIpAddrLabel = mIsWifiDisplayed ? mIpAddressLabel : ntp::util::GetCurrentTime();
const auto textLabel = mTextLabel == "" ? timeIpAddrLabel : mTextLabel;
const auto textWidth = mpScreen->getTextWidth(textLabel.c_str());
const auto centerPoint = mFrame.getCenterPoint();
textLabelFrame.position.x = centerPoint.x - textWidth / 2;
Expand Down
1 change: 1 addition & 0 deletions main/ui/UIStatusBarWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ namespace gfx
std::string mTimeLabel = "0:00";
std::string mTextLabel = "";
std::chrono::system_clock::time_point mLastUpdate;
bool mIsWifiDisplayed = false;
};
} // namespace gfx

0 comments on commit 5763c30

Please sign in to comment.