Add wifi qrcode script and instructions

This commit is contained in:
Tyler Perkins 2021-12-21 17:53:24 -05:00
parent d98b7764e2
commit 0b6cf2ca52
6 changed files with 41 additions and 1 deletions

3
.gitignore vendored
View File

@ -10,3 +10,6 @@ bin/*
#ignore config file #ignore config file
src/config.hpp src/config.hpp
#ignore wifi image
img/wifi.png

View File

@ -39,6 +39,9 @@ DEFINITIONS = -DDATA_='"$(DATA)"'
DEFINITIONS += -DDATA_IMG_='"$(DATA_IMG)"' DEFINITIONS += -DDATA_IMG_='"$(DATA_IMG)"'
DEFINITIONS += -DDATA_FONT_='"$(DATA_FONT)"' DEFINITIONS += -DDATA_FONT_='"$(DATA_FONT)"'
WIFI_SSID = "DEFAULT_WIFI"
WIFI_PASS = "DEFAULT_PASS"
all : $(OBJ) all : $(OBJ)
@echo LD $@ @echo LD $@
@$(CC) $(FLAGS) $(CFLAGS) -o $(BIN)/$(TARGET) $(OBJ) $(LIBRARIES) @$(CC) $(FLAGS) $(CFLAGS) -o $(BIN)/$(TARGET) $(OBJ) $(LIBRARIES)
@ -50,10 +53,13 @@ all : $(OBJ)
src/config.hpp : src/config.hpp :
cp src/config.def.hpp src/config.hpp cp src/config.def.hpp src/config.hpp
img/wifi.png :
./scripts/wifi.sh $(WIFI_SSID) $(WIFI_PASS)
open : all open : all
$(BIN)/$(TARGET) $(BIN)/$(TARGET)
$(OBJ): src/config.hpp $(OBJ): src/config.hpp img/wifi.png
install : all install : all
mkdir -p $(PREFIX)/bin mkdir -p $(PREFIX)/bin
@ -73,5 +79,8 @@ clean :
find . -type f -name '*.o' -delete find . -type f -name '*.o' -delete
rm -rf $(BIN)/* rm -rf $(BIN)/*
clean-wifi:
rm -f ./img/wifi.png
clean-config : clean-config :
rm -rf src/config.hpp rm -rf src/config.hpp

View File

@ -9,6 +9,7 @@ Features/TODO
- Write straight to framebuffer (sdl2) (DONE) - Write straight to framebuffer (sdl2) (DONE)
- Display Weather rss feed (DONE) - Display Weather rss feed (DONE)
- Display Wifi qrcode (DONE)
- Display camera feed - Display camera feed
- Display who is home - Display who is home
- Display network speed - Display network speed
@ -70,3 +71,17 @@ To install:
To uninstall: To uninstall:
`make uninstall` `make uninstall`
Wifi
----
The makefile by default will call a script that will generate a wifi qr code
for you. You can add your SSID and password by editing the `WIFI_SSID` and
`WIFI_PASS` variables in the make file, or by calling the script yourself in
`./scripts`. You can cleanup the wifi image at any time by calling
`make clean-wifi`. Next time the executable is built it will regenerate the
image.
The qr code generation relies on the program `qrencode`. It can be installed on
any debian system using `sudo apt install qrencode`

1
scripts/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.png

0
scripts/.gitkeep Normal file
View File

12
scripts/wifi.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Format:"
echo "./wifi.sh <SSID> <PASSWORD>"
echo "The result will be in wifi.png"
fi
qrencode -s 6 -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"