removed internet chec

Signed-off-by: Ebbe Baß <ebbe@ping-mee.de>
master
Ebbe Baß 2022-04-28 16:46:41 +02:00
parent 4f439dc340
commit 93be9c7910
1 changed files with 16 additions and 27 deletions

43
main.py
View File

@ -2,7 +2,6 @@ import time
import os
from datetime import datetime
try:
import requests
from rpi_ws281x import *
import RPi.GPIO as GPIO
import socket
@ -33,13 +32,6 @@ def debug_print(message: str):
current_time = now.strftime("%H:%M:%S")
print('[DEBUG]['+current_time+'] '+message)
def check_internet(url='http://www.google.com/', timeout=1):
try:
_ = requests.head(url, timeout=timeout)
return True
except requests.ConnectionError:
return False
def wheel(pos):
if pos < 85:
return Color(pos * 3, 255 - pos * 3, 0)
@ -112,26 +104,23 @@ if __name__ == '__main__':
# print(socket_data)
# print(type(socket_data))
if led_power == True:
if check_internet() == False:
blink(strip, Color(255,0,0), Color(255,255,255))
if idle_mode == 1:
rainbowCycle(strip)
elif idle_mode == 2:
setColor(strip, Color(255,0,0))
elif idle_mode == 3:
setColor(strip, Color(0,255,0))
elif idle_mode == 4:
setColor(strip, Color(0,0,255))
elif idle_mode == 5:
setColor(strip, Color(125,245,255))
elif idle_mode == 6:
setColor(strip, Color(255,0,100))
elif idle_mode == 7:
setColor(strip, Color(0,255,255))
else:
if idle_mode == 1:
rainbowCycle(strip)
elif idle_mode == 2:
setColor(strip, Color(255,0,0))
elif idle_mode == 3:
setColor(strip, Color(0,255,0))
elif idle_mode == 4:
setColor(strip, Color(0,0,255))
elif idle_mode == 5:
setColor(strip, Color(125,245,255))
elif idle_mode == 6:
setColor(strip, Color(255,0,100))
elif idle_mode == 7:
setColor(strip, Color(0,255,255))
else:
blink(strip, Color(255,0,0), Color(0,0,0))
time.sleep(1)
blink(strip, Color(255,0,0), Color(0,0,0))
time.sleep(1)
else:
setColor(strip, Color(0,0,0))
time.sleep(1)