예제 #1
0
tft.goto_pixel(SerialTFT.Screen.width_half-5,5)
tft.write('12')

tft.goto_pixel(SerialTFT.Screen.width_half-3,SerialTFT.Screen.height-13)
tft.write('6')

tft.goto_pixel(SerialTFT.Screen.width_half+50,SerialTFT.Screen.height_half-3)
tft.write('3')

tft.goto_pixel(SerialTFT.Screen.width_half-54,SerialTFT.Screen.height_half-3)
tft.write('9')

# Draw clock outline
tft.fg_color(CLOCK_OUTLINE)
tft.draw_filled_circle(CLOCK_ORIGIN_X,CLOCK_ORIGIN_Y,CLOCK_RADIUS)

# Fill clock with background
tft.fg_color(CLOCK_BACKGROUND)
tft.draw_filled_circle(CLOCK_ORIGIN_X,CLOCK_ORIGIN_Y,CLOCK_RADIUS-2)

# Draw the hub at the clock center
tft.fg_color(CLOCK_CENTER)
tft.draw_filled_circle(CLOCK_ORIGIN_X,CLOCK_ORIGIN_Y,3)

lasthour	= time.localtime().tm_hour
lastmin		= time.localtime().tm_min
lastsec		= time.localtime().tm_sec

def tick():
	global lasthour, lastmin, lastsec
예제 #2
0
# First result is unreliable
result.pop(0)
print('Average rate: ' + str(reduce(lambda x, y: x + y, result) / len(result)))

print('--------------------------------------')

print('Testing filled circle draw rate')
result = []
circle_count = 0
last_sec = time.localtime().tm_sec
total_count = 0
while len(result) < 10:
	for color in colors:
		#tft.fg_color(color)
		tft.draw_filled_circle(SerialTFT.Screen.width_half+randint(-50,50),SerialTFT.Screen.height_half+randint(-40,40),randint(1,40),color)
		circle_count += 1
		total_count += 1
		if time.localtime().tm_sec !=last_sec:
			last_sec = time.localtime().tm_sec
			print('Drawn ' + str(circle_count))
			result.append(circle_count)
			circle_count = 0

# First result is unreliable
result.pop(0)
print('Average rate: ' + str(reduce(lambda x, y: x + y, result) / len(result)))

print('--------------------------------------')