diff --git a/.gitignore b/.gitignore index 9f193dc..ec7c31d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ bin/* #ignore config file src/config.hpp + +#ignore wifi image +img/wifi.png diff --git a/Makefile b/Makefile index 3305878..3cde7e5 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,9 @@ DEFINITIONS = -DDATA_='"$(DATA)"' DEFINITIONS += -DDATA_IMG_='"$(DATA_IMG)"' DEFINITIONS += -DDATA_FONT_='"$(DATA_FONT)"' +WIFI_SSID = "DEFAULT_WIFI" +WIFI_PASS = "DEFAULT_PASS" + all : $(OBJ) @echo LD $@ @$(CC) $(FLAGS) $(CFLAGS) -o $(BIN)/$(TARGET) $(OBJ) $(LIBRARIES) @@ -50,10 +53,13 @@ all : $(OBJ) src/config.hpp : cp src/config.def.hpp src/config.hpp +img/wifi.png : + ./scripts/wifi.sh $(WIFI_SSID) $(WIFI_PASS) + open : all $(BIN)/$(TARGET) -$(OBJ): src/config.hpp +$(OBJ): src/config.hpp img/wifi.png install : all mkdir -p $(PREFIX)/bin @@ -73,5 +79,8 @@ clean : find . -type f -name '*.o' -delete rm -rf $(BIN)/* +clean-wifi: + rm -f ./img/wifi.png + clean-config : rm -rf src/config.hpp diff --git a/README.md b/README.md index bb7e468..d75ceec 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ Features/TODO - Write straight to framebuffer (sdl2) (DONE) - Display Weather rss feed (DONE) +- Display Wifi qrcode (DONE) - Display camera feed - Display who is home - Display network speed @@ -70,3 +71,17 @@ To install: To 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` + diff --git a/scripts/.gitignore b/scripts/.gitignore new file mode 100644 index 0000000..e33609d --- /dev/null +++ b/scripts/.gitignore @@ -0,0 +1 @@ +*.png diff --git a/scripts/.gitkeep b/scripts/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/scripts/wifi.sh b/scripts/wifi.sh new file mode 100755 index 0000000..92693d0 --- /dev/null +++ b/scripts/wifi.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ $# -ne 2 ]; then + echo "Format:" + echo "./wifi.sh " + 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"