mirror of
https://github.com/Clortox/dashboard.git
synced 2024-12-29 14:38:00 +00:00
Add qrcode to wifi panel
This commit is contained in:
parent
0b6cf2ca52
commit
baa4e5f035
@ -83,5 +83,7 @@ for you. You can add your SSID and password by editing the `WIFI_SSID` and
|
||||
image.
|
||||
|
||||
The qr code generation relies on the program `qrencode`. It can be installed on
|
||||
any debian system using `sudo apt install qrencode`
|
||||
any debian system using `sudo apt install qrencode`. By default the image has a
|
||||
transparent background. If you would like a different background, you will need
|
||||
to adjust wifi.cpp to adjust where it is located to your preference.
|
||||
|
||||
|
@ -6,7 +6,7 @@ if [ $# -ne 2 ]; then
|
||||
echo "The result will be in wifi.png"
|
||||
fi
|
||||
|
||||
qrencode -s 6 -o "./img/wifi.png" "WIFI:T:WPA;S:$1;P:$2;;"
|
||||
qrencode -s 6 --background=FFFFFF00 -o "./img/wifi.png" "WIFI:T:WPA;S:$1;P:$2;;"
|
||||
|
||||
echo "Your wifi qrcode is wifi.png !"
|
||||
echo "Your wifi qrcode is now in the local img folder as wifi.png"
|
||||
|
@ -24,6 +24,7 @@ const char* IMAGE_LOCATIONS[] = {
|
||||
"bmp_24.png",
|
||||
"sky.png",
|
||||
"wifi_background.jpg",
|
||||
"wifi.png",
|
||||
};
|
||||
size_t IMAGE_LOCATIONS_LENGTH = sizeof(IMAGE_LOCATIONS)/sizeof(IMAGE_LOCATIONS[0]);
|
||||
|
||||
|
@ -69,8 +69,29 @@ void wifi::update_texture(){
|
||||
SDL_RenderCopy(board::getRenderer(),
|
||||
board::getImage("wifi_background.jpg"), NULL, NULL);
|
||||
|
||||
//place the title
|
||||
tgt.x = 50;
|
||||
tgt.y = 50;
|
||||
TTF_SizeText(board::getFont({ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }),
|
||||
"Wireless",
|
||||
&tgt.w, &tgt.h);
|
||||
//Note about the string "Wireless"
|
||||
//Because this is only called once, it makes more sense to not have
|
||||
//"Wireless" as a static string, and instead generate it dynamically once,
|
||||
//copy it into this _texture, and then delete if once it goes out of the
|
||||
//LRU. This way, we dont waste memory holding a string we only copy once
|
||||
SDL_RenderCopy(board::getRenderer(),
|
||||
board::getString("Wireless",
|
||||
{ "Roboto_Mono/RobotoMono-Medium.ttf", 50 }), NULL, &tgt);
|
||||
|
||||
|
||||
//show the QRCode
|
||||
tgt.x = -25;
|
||||
tgt.y = tgt.h;
|
||||
tgt.w = (SCREEN_WIDTH / 2) ;
|
||||
std::cerr << "TGT.W : " << tgt.w << "\n";
|
||||
tgt.h = tgt.w;
|
||||
SDL_RenderCopy(board::getRenderer(),
|
||||
board::getImage("wifi.png"), NULL, &tgt);
|
||||
|
||||
|
||||
SDL_SetRenderTarget(board::getRenderer(), NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user