From 0dece8f0a5d5e7fc4aa25de063e990a9945754f5 Mon Sep 17 00:00:00 2001 From: onlaj Date: Thu, 21 Sep 2023 19:33:55 +0200 Subject: [PATCH 1/5] Run disable_ap.sh script on Visualizer's boot if hotspot id disabled --- lib/hotspot.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/hotspot.py b/lib/hotspot.py index 551fec4f..3908d954 100644 --- a/lib/hotspot.py +++ b/lib/hotspot.py @@ -33,6 +33,14 @@ def manage_hotspot(hotspot, usersettings, midiports, first_run=False): if is_hotspot_active(usersettings): disconnect_from_wifi(hotspot, usersettings) return + else: + try: + print("Running disable_ap.sh") + subprocess.Popen(['sudo', './disable_ap.sh'], stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL) + except Exception as error: + # handle the exception + print("An exception occurred while shutting down a hotspot:", error) # Calculate time passed without Wi-fi current_time = time.time() @@ -139,6 +147,7 @@ def connect_to_wifi(ssid, password, hotspot, usersettings): ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ + scan_ssid=1 ssid="%s" %s }""" From 6a873848be6a5424c2e0852a06796feb7631c582 Mon Sep 17 00:00:00 2001 From: onlaj Date: Fri, 22 Sep 2023 20:37:45 +0200 Subject: [PATCH 2/5] Shorten sleep time in scripts --- disable_ap.sh | 4 ++-- enable_ap.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/disable_ap.sh b/disable_ap.sh index 2f8a8a3e..0c9c24ca 100644 --- a/disable_ap.sh +++ b/disable_ap.sh @@ -13,7 +13,7 @@ sudo cp config/wpa_disable_ap.conf /etc/wpa_supplicant/wpa_supplicant.conf sleep 1 sudo wpa_cli -i wlan0 reconfigure sudo wpa_cli -i p2p-dev-wlan0 -sleep 5 +sleep 2 sudo ifconfig wlan0 down -sleep 5 +sleep 2 sudo ifconfig wlan0 up \ No newline at end of file diff --git a/enable_ap.sh b/enable_ap.sh index 701083de..64745ec8 100644 --- a/enable_ap.sh +++ b/enable_ap.sh @@ -13,11 +13,11 @@ sudo cp config/wpa_enable_ap.conf /etc/wpa_supplicant/wpa_supplicant.conf sleep 1 sudo wpa_cli -i wlan0 reconfigure sudo wpa_cli -i p2p-dev-wlan0 reconfigure -sleep 5 +sleep 2 sudo ifconfig wlan0 down -sleep 5 +sleep 3 sudo ifconfig wlan0 up -sleep 8 +sleep 2 # Check if hostapd is masked, and unmask it if needed if [[ $(sudo systemctl is-enabled hostapd) == "masked" ]]; then From 3184f3910b66320a4a107706a68b4e0f77bc2fa3 Mon Sep 17 00:00:00 2001 From: onlaj Date: Fri, 22 Sep 2023 20:42:58 +0200 Subject: [PATCH 3/5] Remove `href="#/"` from some elements --- webinterface/static/index.js | 2 +- webinterface/templates/home.html | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/webinterface/static/index.js b/webinterface/static/index.js index 70a6174d..4f5ba7bb 100644 --- a/webinterface/static/index.js +++ b/webinterface/static/index.js @@ -61,7 +61,7 @@ let ticker = new AdjustingInterval(play_tick_sound, 60000 / beats_per_minute); function loadAjax(subpage) { - if (!subpage) { + if (!subpage || subpage === "/") { subpage = "home" } document.getElementById("main").classList.remove("show"); diff --git a/webinterface/templates/home.html b/webinterface/templates/home.html index 0a1b3f30..564ce802 100644 --- a/webinterface/templates/home.html +++ b/webinterface/templates/home.html @@ -33,7 +33,7 @@
+ sm:col-span-6 xl:col-span-3 intro-y bg-gray-200 dark:bg-gray-700">
+ sm:col-span-6 xl:col-span-3 intro-y bg-gray-200 dark:bg-gray-700">
+ sm:col-span-6 xl:col-span-3 intro-y bg-gray-200 dark:bg-gray-700">
+ sm:col-span-6 xl:col-span-3 intro-y bg-gray-200 dark:bg-gray-700">
+ sm:col-span-6 xl:col-span-3 intro-y bg-gray-200 dark:bg-gray-700">
@@ -166,7 +166,7 @@
+ sm:col-span-6 xl:col-span-3 intro-y bg-gray-200 dark:bg-gray-700">
+ bg-gray-200 dark:bg-gray-700">
+ bg-gray-200 dark:bg-gray-700">
From a77b288cfa7e1f4987b95f93c116ce323173f4a7 Mon Sep 17 00:00:00 2001 From: onlaj Date: Sun, 24 Sep 2023 01:09:49 +0200 Subject: [PATCH 4/5] Avoid IndexError exception when checking if LED can be overwritten --- lib/functions.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/functions.py b/lib/functions.py index f92e1227..2d43d44b 100644 --- a/lib/functions.py +++ b/lib/functions.py @@ -372,8 +372,10 @@ def gammacurve(x, p): def check_if_led_can_be_overwrite(i, ledstrip, ledsettings): if ledsettings.adjacent_mode == "Off": - if ledstrip.keylist_status[i] == 0 and ledstrip.keylist[i] == 0: - return True + if i < len(ledstrip.keylist_status) and i < len(ledstrip.keylist): + if ledstrip.keylist_status[i] == 0 and ledstrip.keylist[i] == 0: + return True + return False else: if 1 < i < (ledstrip.led_number - 1): if ledstrip.keylist[i + 1] == ledstrip.keylist[i - 1] == ledstrip.keylist[i] \ From be7a316c26497dbdab11b4496a4374cd8ed6b81d Mon Sep 17 00:00:00 2001 From: onlaj Date: Sun, 24 Sep 2023 12:04:03 +0200 Subject: [PATCH 5/5] Fix styling of adjustment's inputs --- webinterface/templates/ledsettings.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webinterface/templates/ledsettings.html b/webinterface/templates/ledsettings.html index 9277ef1d..d8744e0a 100644 --- a/webinterface/templates/ledsettings.html +++ b/webinterface/templates/ledsettings.html @@ -169,7 +169,7 @@ + text-center rounded-2xl leading-tight focus:outline-none focus:bg-white focus:border-gray-500">