diff --git a/csv/system_info.json b/csv/system_info.json new file mode 100644 index 0000000..c82636f --- /dev/null +++ b/csv/system_info.json @@ -0,0 +1 @@ +{"update_available": false, "first_boot": false} \ No newline at end of file diff --git a/database_caller.py b/database_caller.py index 9f94e52..3dd3022 100755 --- a/database_caller.py +++ b/database_caller.py @@ -643,8 +643,6 @@ if __name__ == '__main__': # sports sports_time = datetime.strptime(last_updates['sports'], "%d/%m/%Y %H:%M:%S") - - NY_time = datetime.now(NY_zone).replace(tzinfo=None) diff = (NY_time - sports_time).total_seconds()/60 #minutes if diff >= update_frequencies['sports'] or msg == 'S': diff --git a/server.py b/server.py index 43c63e0..2eb1299 100755 --- a/server.py +++ b/server.py @@ -48,6 +48,17 @@ ALLOWED_EXTENSIONS = {'csv', 'png'} ticker = pexpect.spawn("sudo -E python3 stockTicker.py") ticker.sendline('*') # run by default 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 def allowed_file(filename): diff --git a/stockTicker.py b/stockTicker.py index a104cd3..1c5a953 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -57,7 +57,7 @@ class StockTicker(): options.chain_length = 2 options.parallel = 1 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 self.matrix = RGBMatrix(options = options) print(dir(self.matrix)) @@ -325,7 +325,7 @@ class StockTicker(): 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 @@ -335,6 +335,7 @@ class StockTicker(): kill = False i = 0 # keep track of which image we are displaying self.double_buffer = self.matrix.CreateFrameCanvas() + while True: 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 not repeat: + break update_process.join() i+=1 @@ -2711,7 +2713,13 @@ class StockTicker(): elif msg == 'K': # kill 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__': with open('log.txt', "a") as log: @@ -2731,6 +2739,18 @@ if __name__ == '__main__': #stock_ticker.setImage(start_image) time.sleep(2) 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.getCryptoImage()