added first boot screeen
This commit is contained in:
1
csv/system_info.json
Normal file
1
csv/system_info.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"update_available": false, "first_boot": false}
|
@@ -643,8 +643,6 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# sports
|
# sports
|
||||||
sports_time = datetime.strptime(last_updates['sports'], "%d/%m/%Y %H:%M:%S")
|
sports_time = datetime.strptime(last_updates['sports'], "%d/%m/%Y %H:%M:%S")
|
||||||
|
|
||||||
|
|
||||||
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
NY_time = datetime.now(NY_zone).replace(tzinfo=None)
|
||||||
diff = (NY_time - sports_time).total_seconds()/60 #minutes
|
diff = (NY_time - sports_time).total_seconds()/60 #minutes
|
||||||
if diff >= update_frequencies['sports'] or msg == 'S':
|
if diff >= update_frequencies['sports'] or msg == 'S':
|
||||||
|
11
server.py
11
server.py
@@ -48,6 +48,17 @@ ALLOWED_EXTENSIONS = {'csv', 'png'}
|
|||||||
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
ticker = pexpect.spawn("sudo -E python3 stockTicker.py")
|
||||||
ticker.sendline('*') # run by default
|
ticker.sendline('*') # run by default
|
||||||
time.sleep(8)
|
time.sleep(8)
|
||||||
|
|
||||||
|
system_info = json.load(open('csv/system_info.json'))
|
||||||
|
|
||||||
|
|
||||||
|
if system_info['first_boot']: # let startup message display
|
||||||
|
|
||||||
|
time.sleep(10)
|
||||||
|
system_info['first_boot'] = False
|
||||||
|
json.dump(system_info, open('csv/system_info.json', 'w'))
|
||||||
|
|
||||||
|
|
||||||
ticker.sendline('A') # run by default
|
ticker.sendline('A') # run by default
|
||||||
|
|
||||||
def allowed_file(filename):
|
def allowed_file(filename):
|
||||||
|
@@ -57,7 +57,7 @@ class StockTicker():
|
|||||||
options.chain_length = 2
|
options.chain_length = 2
|
||||||
options.parallel = 1
|
options.parallel = 1
|
||||||
options.hardware_mapping = 'adafruit-hat' # If you have an Adafruit HAT: 'adafruit-hat'
|
options.hardware_mapping = 'adafruit-hat' # If you have an Adafruit HAT: 'adafruit-hat'
|
||||||
options.gpio_slowdown = 1
|
options.gpio_slowdown = 4
|
||||||
options.brightness = self.brightness
|
options.brightness = self.brightness
|
||||||
self.matrix = RGBMatrix(options = options)
|
self.matrix = RGBMatrix(options = options)
|
||||||
print(dir(self.matrix))
|
print(dir(self.matrix))
|
||||||
@@ -325,7 +325,7 @@ class StockTicker():
|
|||||||
return self.delay
|
return self.delay
|
||||||
|
|
||||||
|
|
||||||
def scrollFunctionsAnimated(self, options, animation = 'down'):
|
def scrollFunctionsAnimated(self, options, animation = 'down', repeat = True):
|
||||||
|
|
||||||
# scrolls trhough all functions with animation. Updates functions and remakes images when each function not being dispplayed
|
# scrolls trhough all functions with animation. Updates functions and remakes images when each function not being dispplayed
|
||||||
|
|
||||||
@@ -335,6 +335,7 @@ class StockTicker():
|
|||||||
kill = False
|
kill = False
|
||||||
i = 0 # keep track of which image we are displaying
|
i = 0 # keep track of which image we are displaying
|
||||||
self.double_buffer = self.matrix.CreateFrameCanvas()
|
self.double_buffer = self.matrix.CreateFrameCanvas()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
update_process = Process(target = self.updateMultiple, args = ([options[(i+1) % len(options)]],))
|
update_process = Process(target = self.updateMultiple, args = ([options[(i+1) % len(options)]],))
|
||||||
@@ -423,7 +424,8 @@ class StockTicker():
|
|||||||
|
|
||||||
if kill: break
|
if kill: break
|
||||||
if kill:break
|
if kill:break
|
||||||
|
if not repeat:
|
||||||
|
break
|
||||||
update_process.join()
|
update_process.join()
|
||||||
i+=1
|
i+=1
|
||||||
|
|
||||||
@@ -2711,7 +2713,13 @@ class StockTicker():
|
|||||||
|
|
||||||
elif msg == 'K': # kill
|
elif msg == 'K': # kill
|
||||||
self.resetMatrix()
|
self.resetMatrix()
|
||||||
|
|
||||||
|
|
||||||
|
def run_intro_screen(self):
|
||||||
|
dct = {"feature": "Custom Messages", "speed": "Slow", "animation": "Down", "title": False, "messages": [{"name": "welcome", "text": "Welcome to Fintic", "text_colour": "White", "size": "Large", "background_colour": "Black"}]}
|
||||||
|
json.dump(dct, open('csv/message_settings.json', 'w'))
|
||||||
|
self.scrollFunctionsAnimated(['Custom Messages'], repeat = False)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
with open('log.txt', "a") as log:
|
with open('log.txt', "a") as log:
|
||||||
@@ -2731,6 +2739,18 @@ if __name__ == '__main__':
|
|||||||
#stock_ticker.setImage(start_image)
|
#stock_ticker.setImage(start_image)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
stock_ticker.resetMatrix()
|
stock_ticker.resetMatrix()
|
||||||
|
|
||||||
|
system_info = json.load(open('csv/system_info.json'))
|
||||||
|
|
||||||
|
|
||||||
|
if system_info['first_boot']:
|
||||||
|
stock_ticker.run_intro_screen()
|
||||||
|
stock_ticker.resetMatrix()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#stock_ticker.getLeagueImage('NHL', 'future')
|
#stock_ticker.getLeagueImage('NHL', 'future')
|
||||||
#stock_ticker.getCryptoImage()
|
#stock_ticker.getCryptoImage()
|
||||||
|
Reference in New Issue
Block a user