wip: separate clock and rest into separate apps.
This commit is contained in:
		| @@ -3,7 +3,7 @@ import colorsys | ||||
| import pygame.gfxdraw | ||||
| import time | ||||
| import pygame | ||||
| import numpy | ||||
| import numpy as np | ||||
|  | ||||
| class ClockOut: | ||||
|     """Creates a drawable window in case the real hardware is not accessible. For development""" | ||||
| @@ -11,7 +11,7 @@ class ClockOut: | ||||
|         self.pixel_size = 20 | ||||
|  | ||||
|         self.shape = shape | ||||
|         self.pixels = numpy.zeros((*shape,3), dtype=int) | ||||
|         self.pixels = np.zeros((*shape,3), dtype=int) | ||||
|         self.WIDTH = shape[1] | ||||
|         self.HEIGHT = shape[0] | ||||
|         self.window_width = self.WIDTH * self.pixel_size | ||||
| @@ -22,13 +22,17 @@ class ClockOut: | ||||
|         self.screen = pygame.display.set_mode([self.window_width, self.window_height]) | ||||
|  | ||||
|  | ||||
|     def put(self, matrix): | ||||
|     def put(self, matrices): | ||||
|         self.screen.fill((0, 0, 0)) | ||||
|         for event in pygame.event.get(): # User did something | ||||
|             if event.type == pygame.QUIT: | ||||
|                 print("Exiting...") | ||||
|                 pygame.quit() | ||||
|                 sys.exit() | ||||
|              | ||||
|         if self.shape == (16, 32): | ||||
|             matrix = np.concatenate((matrices[0], matrices[1]), axis=1) | ||||
|  | ||||
|         self.pixels = matrix | ||||
|         self.draw_pixels() | ||||
|          | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| import colorsys | ||||
| import time | ||||
| import numpy | ||||
| import numpy as np | ||||
| try: | ||||
|     import RPi.GPIO as GPIO | ||||
|     SETUP_FAIL = False | ||||
| @@ -68,9 +68,10 @@ class ClockOut: | ||||
|             GPIO.output(self.PIN_CLK, GPIO.LOW) | ||||
|  | ||||
|  | ||||
|     def put(self, matrix): | ||||
|     def put(self, matrices): | ||||
|         """Sets a height x width matrix directly""" | ||||
|         self.reset_clock() | ||||
|         matrix = np.concatenate((matrices[0], matrices[1]), axis=0) # or 1?? | ||||
|         self.show(matrix) | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Remy Moll
					Remy Moll