diff --git a/preload/apps/analog_clock/__init__.py b/preload/apps/analog_clock/__init__.py index 0dabbb1c973654f321a980dc9338cc70bbf83cea..d97f8b50cc9f023a7cb88e70d99860373b4a3162 100644 --- a/preload/apps/analog_clock/__init__.py +++ b/preload/apps/analog_clock/__init__.py @@ -189,7 +189,7 @@ class Clock: def updateClock(self, disp, localtime): disp.clear(self.background_col) - disp.pixel(self.center[0] + self.offsetx, self.center[1], col=self.center_col) + #disp.pixel(self.center[0] + self.offsetx, self.center[1], col=self.center_col) hour_coords = self.circlePoint( math.radians( (((localtime[3] % 12) / 12.0) if localtime[3] else 0) * 360 @@ -198,7 +198,7 @@ class Clock: ) ) minute_coords = self.circlePoint(math.radians(localtime[4] * 6 + 270)) - second_coords = self.circlePoint(math.radians(localtime[5] * 6 + 270)) + second_coords = self.circlePoint((math.radians(time.time_ms()%60000)/1000.0 * 6 + 270)) for i in range(60): degree = i * 6 + 90 @@ -305,14 +305,11 @@ class Clock: vector = self.normVector(vector) destination = self.addVector(source, self.multiplyVector(vector, length)) - disp.line( - round(source[0]) + self.offsetx, - round(source[1]), - round(destination[0]) + self.offsetx, - round(destination[1]), - col=col, - size=thickness, - ) + disp.rgba(col[0]/255.0, col[1]/255.0, col[2]/255.0, 1.0) + disp.move_to(source[0] + self.offsetx, source[1]) + disp.line_to(destination[0] + self.offsetx, destination[1]) + disp.line_width(thickness) + disp.stroke() def normVector(self, v): length = math.sqrt(sum([i ** 2 for i in v]))