This commit is contained in:
Neythen 2021-11-18 17:50:50 +00:00
parent 2cc6afc5cf
commit b4c7c505f0
11 changed files with 89 additions and 31 deletions

View File

@ -1 +1 @@
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 42.95, "24hr_change": -2.0434968411618937}, "BTC,USD": {"current": 60594, "24hr_change": -0.03867146261533629}, "ETH,BTC": {"current": 0.07020828, "24hr_change": -0.632522958888375}, "ADA,GBP": {"current": 1.39, "24hr_change": -2.1188381102215366}}} {"feature": "Stocks", "speed": "medium", "animation": "down", "percent": false, "point": false, "logos": true, "chart": false, "title": true, "symbols": {"NEO,USD": {"current": 40.04, "24hr_change": -7.092150997474435}, "BTC,USD": {"current": 58197, "24hr_change": -3.8902517485472328}, "ETH,BTC": {"current": 0.07043227, "24hr_change": -3.9373132260122343}, "ADA,GBP": {"current": 1.32, "24hr_change": -5.336498540074388}}}

View File

@ -1 +1 @@
{"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": {"main_weather": "Clear", "description": "clear sky", "temp": -1.06, "min_temp": -1.06, "max_temp": 12.94, "feels_like": -1.06, "humidity": 49, "clouds": 0, "wind_speed": 0.71, "wind_direction": 25, "visibility": 10000, "uv": 0, "rain_chance": 0}, "London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 6.83, "min_temp": 6.83, "max_temp": 11.37, "feels_like": 4.93, "humidity": 88, "clouds": 100, "wind_speed": 2.68, "wind_direction": 268, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 0.41, "min_temp": -2.12, "max_temp": 0.41, "feels_like": -2.18, "humidity": 84, "clouds": 100, "wind_speed": 2.17, "wind_direction": 224, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "broken clouds", "temp": 11.46, "min_temp": 11.46, "max_temp": 17.07, "feels_like": 10.52, "humidity": 71, "clouds": 75, "wind_speed": 0.89, "wind_direction": 346, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true} {"feature": "Current Weather", "speed": "medium", "animation": "down", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"London": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 12.65, "min_temp": 7.04, "max_temp": 12.86, "feels_like": 12.22, "humidity": 86, "clouds": 90, "wind_speed": 4.12, "wind_direction": 240, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Tokyo": {"main_weather": "Clouds", "description": "scattered clouds", "temp": 10.82, "min_temp": 10.82, "max_temp": 16.96, "feels_like": 9.92, "humidity": 75, "clouds": 40, "wind_speed": 0.89, "wind_direction": 301, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Beijing": {"main_weather": "Clouds", "description": "overcast clouds", "temp": 7.94, "min_temp": 5.1, "max_temp": 9.51, "feels_like": 5.35, "humidity": 29, "clouds": 86, "wind_speed": 4.25, "wind_direction": 43, "visibility": 10000, "uv": 0, "rain_chance": 0}, "Moscow": {"main_weather": "Snow", "description": "light snow", "temp": -1.01, "min_temp": -2.28, "max_temp": 0.08, "feels_like": -6.37, "humidity": 73, "clouds": 48, "wind_speed": 5.33, "wind_direction": 223, "visibility": 10000, "uv": 0, "rain_chance": 0}}, "current_weather": true}

View File

@ -1 +1 @@
{"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"Beijing": [{"main_weather": "Clouds", "description": "few clouds", "min_temp": -1.06, "max_temp": 12.94}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 5.15, "max_temp": 9.77}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 6.02, "max_temp": 9.97}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 2.73, "max_temp": 8.78}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.16, "max_temp": 3.35}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.02, "max_temp": 3.5}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.05, "max_temp": 4.64}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 0.23, "max_temp": 7.72}], "London": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 6.83, "max_temp": 11.37}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 6.99, "max_temp": 13.15}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 9.22, "max_temp": 13.85}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 8.67, "max_temp": 12.75}, {"main_weather": "Rain", "description": "light rain", "min_temp": 6.23, "max_temp": 9.51}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 5.99, "max_temp": 8.96}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 5.47, "max_temp": 8.48}, {"main_weather": "Rain", "description": "light rain", "min_temp": 4.07, "max_temp": 7.85}], "Moscow": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -2.12, "max_temp": 0.41}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.63, "max_temp": 0.24}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -0.6, "max_temp": 1.53}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.88, "max_temp": 5.22}, {"main_weather": "Snow", "description": "light snow", "min_temp": 0.72, "max_temp": 2.13}, {"main_weather": "Snow", "description": "light snow", "min_temp": -3.96, "max_temp": 0.25}, {"main_weather": "Snow", "description": "light snow", "min_temp": -4.37, "max_temp": -1.28}, {"main_weather": "Snow", "description": "snow", "min_temp": -0.46, "max_temp": 1.39}], "Tokyo": [{"main_weather": "Rain", "description": "light rain", "min_temp": 11.46, "max_temp": 17.07}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 13.12, "max_temp": 17.24}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 13.09, "max_temp": 16.3}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.04, "max_temp": 14.23}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 12.46, "max_temp": 16.24}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.46, "max_temp": 15.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.71, "max_temp": 14.18}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 9.46, "max_temp": 14.24}]}, "current_weather": true} {"feature": "Current Weather", "speed": "medium", "animation": "continuous", "temp": "celsius", "wind_speed": "miles/sec", "colour": "white", "city_colour": "yellow", "title": true, "locations": {"London": [{"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 7.04, "max_temp": 12.86}, {"main_weather": "Clouds", "description": "few clouds", "min_temp": 8.55, "max_temp": 13.28}, {"main_weather": "Clouds", "description": "scattered clouds", "min_temp": 7.99, "max_temp": 11.54}, {"main_weather": "Rain", "description": "light rain", "min_temp": 4.32, "max_temp": 9.28}, {"main_weather": "Rain", "description": "light rain", "min_temp": 4.39, "max_temp": 8.95}, {"main_weather": "Rain", "description": "light rain", "min_temp": 5.13, "max_temp": 8.18}, {"main_weather": "Rain", "description": "light rain", "min_temp": 5.37, "max_temp": 7.39}, {"main_weather": "Rain", "description": "light rain", "min_temp": 3.32, "max_temp": 5.61}], "Tokyo": [{"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 10.82, "max_temp": 16.96}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 13.33, "max_temp": 17.6}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 13.65, "max_temp": 15.41}, {"main_weather": "Rain", "description": "moderate rain", "min_temp": 13.74, "max_temp": 17.5}, {"main_weather": "Rain", "description": "light rain", "min_temp": 13.11, "max_temp": 16.33}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.02, "max_temp": 14.72}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 9.14, "max_temp": 13.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 10.21, "max_temp": 14.42}], "Beijing": [{"main_weather": "Rain", "description": "light rain", "min_temp": 5.1, "max_temp": 9.51}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 5.47, "max_temp": 9.38}, {"main_weather": "Clouds", "description": "broken clouds", "min_temp": 2.66, "max_temp": 8.26}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.1, "max_temp": 2.91}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -0.03, "max_temp": 6.36}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": 0.45, "max_temp": 6.06}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 2.37, "max_temp": 7.28}, {"main_weather": "Clear", "description": "clear sky", "min_temp": 1.03, "max_temp": 6.71}], "Moscow": [{"main_weather": "Snow", "description": "light snow", "min_temp": -2.28, "max_temp": 0.08}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -0.72, "max_temp": 1.66}, {"main_weather": "Snow", "description": "rain and snow", "min_temp": 0.3, "max_temp": 1.58}, {"main_weather": "Clouds", "description": "overcast clouds", "min_temp": -0.36, "max_temp": 2.01}, {"main_weather": "Snow", "description": "light snow", "min_temp": -3.24, "max_temp": 0.91}, {"main_weather": "Snow", "description": "light snow", "min_temp": -5.23, "max_temp": -2.9}, {"main_weather": "Snow", "description": "light snow", "min_temp": -1.2, "max_temp": 1.62}, {"main_weather": "Clear", "description": "clear sky", "min_temp": -1.72, "max_temp": 1.17}]}, "current_weather": true}

View File

@ -1 +1 @@
["Stocks"] ["Stocks", "Crypto"]

View File

@ -1 +1 @@
{"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 339.89, "opening": 339.29}, "GOOG": {"current": 2990.345, "opening": 2984.38}}} {"feature": "Stocks", "speed": "medium", "animation": "down", "percent": true, "point": true, "logos": false, "chart": false, "title": true, "symbols": {"MSFT": {"current": 341.4, "opening": 338.12}, "GOOG": {"current": 3019.28, "opening": 2983.88}}}

13
log.txt
View File

@ -0,0 +1,13 @@
[Errno 13] Permission denied: './display_images/Stocks.ppm'. file: stockTicker.py. line: 2476. type: <class 'PermissionError'>
Traceback (most recent call last):
File "stockTicker.py", line 2476, in <module>
stock_ticker.process_msg(msg)
File "stockTicker.py", line 2437, in process_msg
self.scrollFunctionsAnimated(userSettings, animation = 'down')
File "stockTicker.py", line 329, in scrollFunctionsAnimated
self.updateMultiple([options[0]])
File "stockTicker.py", line 289, in updateMultiple
img.save('./display_images/'+ option+ '.ppm')
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 1991, in save
fp = builtins.open(filename, "w+b")
PermissionError: [Errno 13] Permission denied: './display_images/Stocks.ppm'

View File

@ -36,6 +36,7 @@ CSV_FOLDER = 'csv/new/'
ALLOWED_EXTENSIONS = {'csv', 'png'} ALLOWED_EXTENSIONS = {'csv', 'png'}
ticker = pexpect.spawn("sudo -E taskset -c 3 python3 stockTicker.py") ticker = pexpect.spawn("sudo -E taskset -c 3 python3 stockTicker.py")
ticker.sendline('*') # run by default
ticker.sendline('A') # run by default ticker.sendline('A') # run by default
@ -104,7 +105,7 @@ def index():
@app.route("/start", methods = ['PUT', 'POST']) @app.route ("/start", methods = ['PUT', 'POST'])
def start(): def start():
global displaying_screensaver global displaying_screensaver
global ticker global ticker
@ -149,6 +150,24 @@ def start():
ticker.sendline('A') ticker.sendline('A')
return index() return index()
@app.route("/stop")
def stop():
print('stop')
global ticker
global displaying_screensaver
if not displaying_screensaver:
ticker.sendline('K')
else:
screensaver_p.close()
if displaying_screensaver:
screensaver_p.close()
api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
ticker = pexpect.spawn("sudo -E taskset -c 3 python3 stockTicker.py")
displaying_screensaver = False
return index()
@app.route("/display_format", methods = ['PUT', 'POST', 'GET']) @app.route("/display_format", methods = ['PUT', 'POST', 'GET'])
def display_format(): def display_format():
global professional global professional
@ -208,7 +227,32 @@ def upload():
return index() return index()
@app.route("/brightness", methods=['PUT','POST'])
def brightness():
global brightness
data= request.data.decode('utf-8')
settings = json.loads(data)
print(settings)
brightness =settings['brightness']
print(str(int(brightness) - 1))
ticker.sendline(str(int(brightness) - 1))
f = open('csv/settings.csv', 'r')
CSV = csv.reader(f)
next(CSV)
for line in CSV:
speed, _ = line
f.close()
f = open('csv/settings.csv', 'w+')
f.write('speed,brightness\n')
f.write(str(speed) + ',' + str(brightness))
f.close()
global LastCommand
LastCommand = 'Change Brightness'
return index()
@app.route("/screensaver", methods = ['PUT', 'POST']) @app.route("/screensaver", methods = ['PUT', 'POST'])
def screensaver(): def screensaver():
@ -220,6 +264,9 @@ def screensaver():
ticker.close() ticker.close()
data = str(request.data) data = str(request.data)
if displaying_screensaver:
screensaver_p.close()
if "Pulsating Colors" in data: if "Pulsating Colors" in data:
screensaver_p = pexpect.spawn("sudo -E python3 ./rpi-rgb-led-matrix/bindings/python/samples/pulsing-colors.py") screensaver_p = pexpect.spawn("sudo -E python3 ./rpi-rgb-led-matrix/bindings/python/samples/pulsing-colors.py")
@ -368,17 +415,7 @@ def save_message_settings(input_settings):
json.dump(input_settings, open('csv/message_settings.json', 'w+')) json.dump(input_settings, open('csv/message_settings.json', 'w+'))
@app.route("/stop")
def stop():
print('stop')
ticker.sendline('K')
global displaying_screensaver
if displaying_screensaver:
screensaver.close()
api_caller = pexpect.spawn("sudo -E python3 api_caller.py")
ticker = pexpect.spawn("sudo -E taskset -c 3 python3 stockTicker.py")
displaying_screensaver = False
return index()
@app.route("/shutdown") @app.route("/shutdown")
def shutdown(): def shutdown():

View File

@ -826,6 +826,19 @@ stopButton.addEventListener("click", () => {
}); });
}); });
var stopButton = document.getElementById("screensaver-btn");
stopButton.addEventListener("click", () => {
let anim = localStorage.getItem("inputAnimation");
fetch("/screensaver", {
method: "POST",
body: anim,
});
});
var dispFormatButton = document.getElementById("dispformat-btn"); var dispFormatButton = document.getElementById("dispformat-btn");
var displayFormats = document.getElementById("inputDisplayFormat"); var displayFormats = document.getElementById("inputDisplayFormat");
@ -1270,11 +1283,6 @@ let inputAnimationBtn = document.getElementById("input-animation-btn");
inputAnimationBtn.addEventListener("click", () => { inputAnimationBtn.addEventListener("click", () => {
localStorage.setItem("inputAnimation", inputAnimation.value); localStorage.setItem("inputAnimation", inputAnimation.value);
fetch("/screensaver", {
method: "POST",
body: inputAnimation.value,
});
}); });
// scroll speed row two // scroll speed row two

View File

@ -2456,7 +2456,8 @@ if __name__ == '__main__':
start_image = Image.open('./logos/startup_logo.png') start_image = Image.open('./logos/startup_logo.png')
msg = getInput()
if msg =='*':
stock_ticker.setImage(start_image) stock_ticker.setImage(start_image)
time.sleep(1) time.sleep(1)
stock_ticker.resetMatrix() stock_ticker.resetMatrix()

View File

@ -62,7 +62,7 @@
<a id="stop-btn" class="btn btn-stop-display">Stop Display</a> <a id="stop-btn" class="btn btn-stop-display">Stop Display</a>
</li> </li>
<li> <li>
<a href="#" class="btn btn-warning text-white">Screensaver</a> <a id="screensaver-btn" class="btn btn-warning text-white">Screensaver</a>
</li> </li>
<li><a id="shutdown-btn" class="btn btn-danger">Shut Down</a></li> <li><a id="shutdown-btn" class="btn btn-danger">Shut Down</a></li>
</ul> </ul>

View File

@ -1,5 +1,4 @@
git fetch --all
git reset --hard origin/master
git pull origin master git pull origin master
./setup.sh ./setup.sh