Add wifi network name and password

This commit is contained in:
Tyler Perkins 2021-12-21 19:43:20 -05:00
parent e1707fcf2a
commit b2cde0d8ce
2 changed files with 29 additions and 2 deletions

View File

@ -86,13 +86,34 @@ void wifi::update_texture(){
//show the QRCode //show the QRCode
tgt.x = -25; tgt.x = -25;
tgt.y = tgt.h; tgt.y = tgt.h - 6;
tgt.w = (SCREEN_WIDTH / 2) ; tgt.w = (SCREEN_WIDTH / 2) ;
std::cerr << "TGT.W : " << tgt.w << "\n";
tgt.h = tgt.w; tgt.h = tgt.w;
SDL_RenderCopy(board::getRenderer(), SDL_RenderCopy(board::getRenderer(),
board::getImage("wifi.png"), NULL, &tgt); board::getImage("wifi.png"), NULL, &tgt);
std::string network_string("Network: ");
network_string += WIFI_NETWORK_NAME;
//show info about the network
tgt.x = (SCREEN_WIDTH / 2) + 25;
tgt.y = 50;
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
network_string.c_str(), &tgt.w, &tgt.h);
SDL_RenderCopy(board::getRenderer(),
board::getString(network_string.c_str(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
tgt.y += tgt.h + 25;
std::string password_string("Password: ");
password_string += WIFI_NETWORK_PASS;
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
password_string.c_str(), &tgt.w, &tgt.h);
SDL_RenderCopy(board::getRenderer(),
board::getString(password_string.c_str(),
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
SDL_SetRenderTarget(board::getRenderer(), NULL); SDL_SetRenderTarget(board::getRenderer(), NULL);
} }

View File

@ -14,4 +14,10 @@ namespace dashboard::panel {
//How long should we wait between updates? in ms //How long should we wait between updates? in ms
//Due to the nature of this panel, this value is ignored //Due to the nature of this panel, this value is ignored
constexpr size_t WIFI_UPDATE_INTERVAL = 60000; constexpr size_t WIFI_UPDATE_INTERVAL = 60000;
//All of the following options WILL be shown on the screen.
//If this is a privacy concernt for you, set the value to be blank
//(ie "") and it will not be shown
constexpr char WIFI_NETWORK_NAME[] = "MyNetwork";
constexpr char WIFI_NETWORK_PASS[] = "MyPassword";
} }