コード例 #1
0
ファイル: main.py プロジェクト: wwqrd/gumshoe
 def load(self):
     heat = database_get('gumshoe_stats_heat')
     if heat:
         self.heat_factor = heat
     captures = database_get('gumshoe_stats_captures')
     if captures:
         self.captures = captures
コード例 #2
0
def tick():
	global wheelColour, ledcount, sequence, ledpin

	pin = pyb.Pin(ledpin)
	neo = pyb.Neopix(pin)

	leds = [0x000000] * ledcount

	if (sequence == "rainbow"):
		wheelColour = (wheelColour + 8) & 255
		for ledNumber in range(0, ledcount):
			pos = ((ledNumber*8)+wheelColour)
			pos = pos & 255
			leds[ledNumber] = Wheel(pos).get_neo()
	elif (sequence == "matrix"):
		for ledNumber in range(0, ledcount):
			led_green = (pyb.rng() & 255)
			led_colour = Colour(0, led_green, 0)
			if led_green < 230:
				led_colour.set_g(int(led_green / 8))
			if led_green > 253:
				led_colour.set_hex('#ffffff')
			leds[ledNumber] = led_colour.get_neo()
	elif (sequence == "colour"):
		colour = database.database_get("led-colour", "#ffffff")
		tmp_colour = Colour()
		tmp_colour.set_hex(colour)
		leds = [tmp_colour.get_neo()] * ledcount
	neo.display(leds)
コード例 #3
0
def draw(x, y, window):
    global obj
    global sty
    if len(obj) == 0:

        sty = ugfx.Style()
        sty.set_enabled([ugfx.RED, ugfx.BLACK, ugfx.GREY, ugfx.GREY])

        #ugfx.Imagebox(0,0,window.width(),window.height(),"apps/home/back.bmp",0, win2)
        ugfx.set_default_font(ugfx.FONT_NAME)
        l = ugfx.Label(5,
                       20,
                       310,
                       window.height() - 20,
                       database_get("display-name", "<not actually set yet>"),
                       parent=window)
        obj.append(l)
        ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)
        obj.append(
            ugfx.Label(5,
                       0,
                       310,
                       20,
                       "My name is...",
                       parent=window,
                       style=sty))
        #ugfx.text(40,80,database_get("display-name", "<not set yet>"),ugfx.BLUE)
        #ugfx.circle(140,150,40,ugfx.GREEN)
        #ugfx.circle(160,150,40,ugfx.GREEN)
        #ugfx.circle(180,150,40,ugfx.GREEN)
        window.show()
    else:
        window.hide()
        window.show()
コード例 #4
0
def tick():
    bv = str(onboard.get_battery_voltage())
    uv = str(onboard.get_unreg_voltage())
    li = str(onboard.get_light())
    wifi.nic().get_rssi()

    aps = wifi.nic().list_aps()
    highest_rssi = -200
    nearestbssid = ""
    for a in aps:
        if (a['rssi'] > highest_rssi) and (a['rssi'] < 0):
            highest_rssi = a['rssi']
            nearestbssid = binascii.hexlify(a['bssid'])

    logfile = "log.txt"
    if not highest_rssi > -200:
        rssis = ","
        json = {"vbat": bv, "vunreg": uv, "light": li}
    else:
        rssis = str(highest_rssi) + "," + str(nearestbssid)
        r1 = stm.mem32[0x1FFF7590]
        r1 |= (stm.mem32[0x1FFF7594] << 32)
        r1 |= (stm.mem32[0x1FFF7598] << 64)
        json = {
            "vbat": bv,
            "vunreg": uv,
            "light": li,
            "rssi": str(highest_rssi),
            "bssid": str(nearestbssid),
            "uuid": "%x" % r1
        }

    if database_get("stats_upload"):
        try:
            if wifi.nic().is_connected():
                with http_client.post('http://api.badge.emfcamp.org/api/barms',
                                      json=json):
                    pass
        except OSError as e:
            print("Upload failed " + str(e))

    try:
        if not is_file(logfile):
            with open(logfile, "w") as f:
                f.write("vbat, vunreg, light, rssi, bssid \r\n")

        with open(logfile, "a") as f:
            f.write(bv + ", " + uv + ", " + li + ", " + rssis + "\r\n")
    except OSError as e:
        print("Logging failed: " + str(e))
        return "Logging failed"
コード例 #5
0
ファイル: external.py プロジェクト: emfcamp/Mk3-Firmware
def tick():
	bv = str(onboard.get_battery_voltage())
	uv = str(onboard.get_unreg_voltage())
	li = str(onboard.get_light())
	wifi.nic().get_rssi()

	aps = wifi.nic().list_aps()
	highest_rssi = -200
	nearestbssid = ""
	for a in aps:
		if (a['rssi'] > highest_rssi) and (a['rssi'] < 0):
			highest_rssi = a['rssi']
			nearestbssid = binascii.hexlify(a['bssid'])

	logfile = "log.txt"
	if not highest_rssi > -200:
		rssis = ","
		json={"vbat" : bv, "vunreg" : uv, "light" : li}
	else:
		rssis = str(highest_rssi) + "," + str(nearestbssid)
		r1 = stm.mem32[0x1FFF7590]
		r1 |= (stm.mem32[0x1FFF7594]<<32)
		r1 |= (stm.mem32[0x1FFF7598]<<64)
		json={"vbat" : bv, "vunreg" : uv, "light" : li, "rssi" : str(highest_rssi), "bssid" : str(nearestbssid), "uuid":"%x" % r1}

	if database_get("stats_upload"):
		try:
			if wifi.nic().is_connected():
				with http_client.post('http://api.badge.emfcamp.org/api/barms', json=json):
					pass
		except OSError as e:
			print("Upload failed " + str(e))

	try:
		if not is_file(logfile):
			with open(logfile, "w") as f:
				f.write("vbat, vunreg, light, rssi, bssid \r\n")

		with open(logfile, "a") as f:
			f.write(bv + ", " + uv + ", " + li + ", " + rssis + "\r\n")
	except OSError as e:
		print("Logging failed: " + str(e))
		return "Logging failed"
コード例 #6
0
ファイル: draw_name.py プロジェクト: emfcamp/Mk3-Firmware
def draw(x,y,window):
	global obj
	global sty
	if len(obj) == 0:
	
		sty = ugfx.Style()
		sty.set_enabled([ugfx.RED, ugfx.BLACK, ugfx.GREY, ugfx.GREY])
		
		
		#ugfx.Imagebox(0,0,window.width(),window.height(),"apps/home/back.bmp",0, win2)
		ugfx.set_default_font(ugfx.FONT_NAME)
		l=ugfx.Label(5,20,310,window.height()-20,database_get("display-name", "<not actually set yet>"),parent=window)
		obj.append(l)
		ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)
		obj.append(ugfx.Label(5,0,310,20,"My name is...",parent=window,style=sty))
		#ugfx.text(40,80,database_get("display-name", "<not set yet>"),ugfx.BLUE)
		#ugfx.circle(140,150,40,ugfx.GREEN)
		#ugfx.circle(160,150,40,ugfx.GREEN)
		#ugfx.circle(180,150,40,ugfx.GREEN)
		window.show()
	else:
		window.hide()
		window.show()
コード例 #7
0
ファイル: main.py プロジェクト: SimonWoolf/Mk3-Firmware
scale_c = [-255, -255, 0, 100]
colour = [ugfx.RED, ugfx.ORANGE, ugfx.YELLOW, ugfx.BLUE]

buttons.disable_menu_reset()

ugfx.set_default_font(ugfx.FONT_TITLE)
title = ugfx.Label(3, 3, wi - 10, 45, "Log Viewer", parent=win_header)
ugfx.set_default_font(ugfx.FONT_SMALL)
chk_upload = ugfx.Checkbox(190,
                           3,
                           130,
                           20,
                           "M: Enable uplink",
                           parent=win_header)
chk_upload.attach_input(ugfx.BTN_MENU, 0)
if database_get("stats_upload"):
    chk_upload.checked(1)

win_header.show()
win_legend.show()

ugfx.set_default_font(ugfx.FONT_MEDIUM)
ugfx.set_default_style(s)

graph = ugfx.Graph(0, 33, wi, hi - 33 - 33, 3, 3)
graph.appearance(ugfx.Graph.STYLE_POINT, ugfx.Graph.POINT_NONE, 0, 0)
wi_g = wi - 3
graph.show()
ugfx.set_default_font(ugfx.FONT_SMALL)
win_zoom = ugfx.Container(1, 33, 92, 25)
btnl = ugfx.Button(3, 3, 20, 20, "<", parent=win_zoom)
コード例 #8
0
		wheelColour = (wheelColour + 8) & 255
		for ledNumber in range(0, ledcount):
			pos = ((ledNumber*8)+wheelColour)
			pos = pos & 255
			leds[ledNumber] = Wheel(pos).get_neo()
	elif (sequence == "matrix"):
		for ledNumber in range(0, ledcount):
			led_green = (pyb.rng() & 255)
			led_colour = Colour(0, led_green, 0)
			if led_green < 230:
				led_colour.set_g(int(led_green / 8))
			if led_green > 253:
				led_colour.set_hex('#ffffff')
			leds[ledNumber] = led_colour.get_neo()
	elif (sequence == "colour"):
		colour = database.database_get("led-colour", "#ffffff")
		tmp_colour = Colour()
		tmp_colour.set_hex(colour)
		leds = [tmp_colour.get_neo()] * ledcount
	neo.display(leds)

# 67 LEDs because thats how many i have on my lanyard
ledcount = database.database_get("led-count", 67)
# show the rainbow sequence by default
sequence = database.database_get("led-seq-name", "rainbow")
# default to pb13, which is the onboard neopixel
ledpin = database.database_get("led-port", "PB13")

wheelColour = 0
period = database.database_get("led-period", 50)
コード例 #9
0
ファイル: main.py プロジェクト: emfcamp/Mk3-Firmware

toplot = ['vbat','vunreg','light','rssi']
# scale  to fit on the y scale (range 0->150)
scale_m = [75,   75,   0.4,  1]
scale_c = [-255, -255, 0,    100]
colour =  [ugfx.RED, ugfx.ORANGE, ugfx.YELLOW, ugfx.BLUE]

buttons.disable_menu_reset()

ugfx.set_default_font(ugfx.FONT_TITLE)
title = ugfx.Label(3,3,wi-10,45,"Log Viewer",parent=win_header)
ugfx.set_default_font(ugfx.FONT_SMALL)
chk_upload = ugfx.Checkbox(190,3,130,20,"M: Enable uplink",parent=win_header)
chk_upload.attach_input(ugfx.BTN_MENU,0)
if database_get("stats_upload"):
	chk_upload.checked(1)

win_header.show()
win_legend.show()

ugfx.set_default_font(ugfx.FONT_MEDIUM)
ugfx.set_default_style(s)

graph = ugfx.Graph(0,33,wi,hi-33-33,3,3)
graph.appearance(ugfx.Graph.STYLE_POINT, ugfx.Graph.POINT_NONE, 0, 0)
wi_g = wi - 3
graph.show()
ugfx.set_default_font(ugfx.FONT_SMALL)
win_zoom = ugfx.Container(1,33,92,25)
btnl = ugfx.Button(3,3,20,20,"<",parent=win_zoom)
コード例 #10
0
ファイル: file_loader.py プロジェクト: emfcamp/Mk3-Firmware
def file_loader():
	width = ugfx.width()
	height = ugfx.height()
	buttons.disable_menu_reset()

	# Create visual elements
	win_header = ugfx.Container(0,0,width,30)
	win_files = ugfx.Container(0,33,int(width/2),height-33)
	win_preview = ugfx.Container(int(width/2)+2,33,int(width/2)-2,height-33)
	components = [win_header, win_files, win_preview]
	ugfx.set_default_font(ugfx.FONT_TITLE)
	components.append(ugfx.Label(3,3,width-10,29,"Choose App",parent=win_header))
	ugfx.set_default_font(ugfx.FONT_MEDIUM)
	options = ugfx.List(0,30,win_files.width(),win_files.height()-30,parent=win_files)
	btnl = ugfx.Button(5,3,20,20,"<",parent=win_files)
	btnr = ugfx.Button(win_files.width()-7-20,3,20,20,">",parent=win_files)
	btnr.attach_input(ugfx.JOY_RIGHT,0)
	btnl.attach_input(ugfx.JOY_LEFT,0)
	components.append(options)
	components.append(btnr)
	components.append(btnl)
	ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)
	l_cat = ugfx.Label(30,3,100,20,"Built-in",parent=win_files)
	components.append(l_cat)
	components.append(ugfx.Button(10,win_preview.height()-25,20,20,"A",parent=win_preview))
	components.append(ugfx.Label(35,win_preview.height()-25,50,20,"Run",parent=win_preview))
	components.append(ugfx.Button(80,win_preview.height()-25,20,20,"B",parent=win_preview))
	components.append(ugfx.Label(105,win_preview.height()-25,100,20,"Back",parent=win_preview))
	components.append(ugfx.Button(10,win_preview.height()-50,20,20,"M",parent=win_preview))
	components.append(ugfx.Label(35,win_preview.height()-50,100,20,"Pin/Unpin",parent=win_preview))
	ugfx.set_default_font(ugfx.FONT_SMALL)
	author = ugfx.Label(1,win_preview.height()-78,win_preview.width()-3,20,"by: ",parent=win_preview)
	desc = ugfx.Label(3,1,win_preview.width()-10,win_preview.height()-83,"",parent=win_preview,justification=ugfx.Label.LEFTTOP)
	components.append(author)
	components.append(desc)

	pinned = database_get("pinned_apps", [])
	catergories = get_local_app_categories()
	c_ptr = 0

	try:
		win_header.show()
		win_files.show()
		win_preview.show()

		pinned = database_get("pinned_apps", [])
	#	apps = []
		apps_path = []

		if is_dir("apps"):
			for app in os.listdir("apps"):
				path = "apps/" + app
				if is_dir(path) and is_file(path + "/main.py"):
					apps_path.append(path + "/main.py")
		if is_dir("examples"):
			for app in os.listdir("examples"):
				path = "examples/" + app
				if is_file(path) and path.endswith(".py"):
					apps_path.append(path)

		displayed_apps = update_options(options, catergories[c_ptr], pinned)

		index_prev = -1;

		while True:
			pyb.wfi()
			ugfx.poll()

			if index_prev != options.selected_index():
				if options.selected_index() < len(displayed_apps):
					author.text("by: %s" % displayed_apps[options.selected_index()].user)
					desc.text(displayed_apps[options.selected_index()].description)
				index_prev = options.selected_index()

			if buttons.is_triggered("JOY_LEFT"):
				if c_ptr > 0:
					c_ptr -= 1
					btnl.set_focus()
					l_cat.text(catergories[c_ptr])
					displayed_apps = update_options(options, catergories[c_ptr], pinned)
					index_prev = -1

			if buttons.is_triggered("JOY_RIGHT"):
				if c_ptr < len(catergories)-1:
					c_ptr += 1
					btnr.set_focus()
					l_cat.text(catergories[c_ptr])
					displayed_apps = update_options(options, catergories[c_ptr], pinned)
					index_prev = -1

			if buttons.is_triggered("BTN_MENU"):
				app = displayed_apps[options.selected_index()]
				if app.folder_name in pinned:
					pinned.remove(app.folder_name)
				else:
					pinned.append(app.folder_name)
				update_options(options, catergories[c_ptr], pinned)
				database_set("pinned_apps", pinned)

			if buttons.is_triggered("BTN_B"):
				return None

			if buttons.is_triggered("BTN_A"):
				return displayed_apps[options.selected_index()]

	finally:
		for component in components:
			component.destroy()
コード例 #11
0
def quick_launch_screen():
	wi = ugfx.width()
	hi = ugfx.height()

	win_header = ugfx.Container(0,0,wi,30)
	win_quick = ugfx.Container(0,33,wi,hi-33-33)
	win_help = ugfx.Container(0,hi-30,wi,30)

	DEFAULT_APPS = ["app_library", "changename", "alistair~selectwifi", "snake"]
	with Database() as db:
		pinned = [App(a) for a in db.get("pinned_apps", DEFAULT_APPS)]
		pinned = [app for app in pinned if app.loadable] # Filter out deleted apps
		pinned = pinned[:7] # Limit to 7
		db.set("pinned_apps", [app.folder_name for app in pinned])

	ugfx.set_default_font(ugfx.FONT_TITLE)
	title = ugfx.Label(3,3,wi-10,45,"EMF Camp 2016",parent=win_header)

	ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)

	pinned_buttons = []
	for i in range(0, 8):
		x = i % 2
		y = i // 2
		button_title = "Installed Apps" if i == 7 else ""
		if i < len(pinned):
			button_title = pinned[i].title
		pinned_buttons.append(ugfx.Button(35 + 155 * x, 5 + 40 * y, 120, 35, button_title, parent=win_quick))

	btn_ok = ugfx.Button(10,5,20,20,"A",parent=win_help,shape=ugfx.Button.ELLIPSE)
	l_ok = ugfx.Label(40,5,100,20,"Run",parent=win_help)

	btn_back = ugfx.Button(100,5,20,20,"B",parent=win_help,shape=ugfx.Button.ELLIPSE)
	l_back = ugfx.Label(130,5,100,20,"Back",parent=win_help)

	btn_menu = ugfx.Button(200,5,20,20,"M",parent=win_help,shape=ugfx.Button.ROUNDED)
	l_menu = ugfx.Label(230,5,100,20,"Menu",parent=win_help)

	win_header.show()
	win_quick.show()
	win_help.show()

	buttons.init()
	cursor = {"x": 0, "y": 0}
	last_cursor = cursor.copy()
	_draw_cursor(0, 0, ugfx.RED, win_quick)

	if not database_get("quicklaunch_firstrun"):
		dialogs.notice("""This screen displays the most commonly used apps.
Apps pinned here can also interact with the name screen.
To view all apps, pin and un-pin, select 'Installed Apps'
		""", title="TiLDA - Quick Launch", close_text="Close")
		database_set("quicklaunch_firstrun", True)

	try:
		while True:
			pyb.wfi()

			if buttons.is_triggered("JOY_UP"):
				cursor["y"] = max(0, cursor["y"] - 1)
			if buttons.is_triggered("JOY_DOWN"):
				cursor["y"] = min(3, cursor["y"] + 1)
			if buttons.is_triggered("JOY_RIGHT"):
				cursor["x"] = 1
			if buttons.is_triggered("JOY_LEFT"):
				cursor["x"] = 0

			if cursor["x"] != last_cursor["x"] or cursor["y"] != last_cursor["y"]: # Has the cursor moved?
				_draw_cursor(last_cursor["x"], last_cursor["y"], dialogs.default_style_badge.background(), win_quick)
				_draw_cursor(cursor["x"], cursor["y"], ugfx.RED, win_quick)
				last_cursor = cursor.copy()

			if buttons.is_triggered("BTN_B"):
				return None

			#if buttons.is_triggered("BTN_MENU"):
			#	open unpin dialog
			#	break;

			if buttons.is_triggered("BTN_A"):
				index = cursor["x"] + cursor["y"] * 2
				if index == 7:
					return "file_loader"
				if index < len(pinned):
					return pinned[index]
	finally:
		buttons.disable_all_interrupt()

		win_header.hide()
		win_quick.hide()
		win_help.hide()
		for b in pinned_buttons:
			b.destroy()
		btn_ok.destroy()
		l_ok.destroy()
		btn_back.destroy()
		l_back.destroy()
		btn_menu.destroy()
		l_menu.destroy()
		win_header.destroy()
		win_quick.destroy()
		win_help.destroy()
		title.destroy()
コード例 #12
0
def file_loader():
    width = ugfx.width()
    height = ugfx.height()
    buttons.disable_menu_reset()

    # Create visual elements
    win_header = ugfx.Container(0, 0, width, 30)
    win_files = ugfx.Container(0, 33, int(width / 2), height - 33)
    win_preview = ugfx.Container(
        int(width / 2) + 2, 33,
        int(width / 2) - 2, height - 33)
    components = [win_header, win_files, win_preview]
    ugfx.set_default_font(ugfx.FONT_TITLE)
    components.append(
        ugfx.Label(3, 3, width - 10, 29, "Choose App", parent=win_header))
    ugfx.set_default_font(ugfx.FONT_MEDIUM)
    options = ugfx.List(0,
                        30,
                        win_files.width(),
                        win_files.height() - 30,
                        parent=win_files)
    btnl = ugfx.Button(5, 3, 20, 20, "<", parent=win_files)
    btnr = ugfx.Button(win_files.width() - 7 - 20,
                       3,
                       20,
                       20,
                       ">",
                       parent=win_files)
    btnr.attach_input(ugfx.JOY_RIGHT, 0)
    btnl.attach_input(ugfx.JOY_LEFT, 0)
    components.append(options)
    components.append(btnr)
    components.append(btnl)
    ugfx.set_default_font(ugfx.FONT_MEDIUM_BOLD)
    l_cat = ugfx.Label(30, 3, 100, 20, "Built-in", parent=win_files)
    components.append(l_cat)
    components.append(
        ugfx.Button(10,
                    win_preview.height() - 25,
                    20,
                    20,
                    "A",
                    parent=win_preview))
    components.append(
        ugfx.Label(35,
                   win_preview.height() - 25,
                   50,
                   20,
                   "Run",
                   parent=win_preview))
    components.append(
        ugfx.Button(80,
                    win_preview.height() - 25,
                    20,
                    20,
                    "B",
                    parent=win_preview))
    components.append(
        ugfx.Label(105,
                   win_preview.height() - 25,
                   100,
                   20,
                   "Back",
                   parent=win_preview))
    components.append(
        ugfx.Button(10,
                    win_preview.height() - 50,
                    20,
                    20,
                    "M",
                    parent=win_preview))
    components.append(
        ugfx.Label(35,
                   win_preview.height() - 50,
                   100,
                   20,
                   "Pin/Unpin",
                   parent=win_preview))
    ugfx.set_default_font(ugfx.FONT_SMALL)
    author = ugfx.Label(1,
                        win_preview.height() - 78,
                        win_preview.width() - 3,
                        20,
                        "by: ",
                        parent=win_preview)
    desc = ugfx.Label(3,
                      1,
                      win_preview.width() - 10,
                      win_preview.height() - 83,
                      "",
                      parent=win_preview,
                      justification=ugfx.Label.LEFTTOP)
    components.append(author)
    components.append(desc)

    pinned = database_get("pinned_apps", [])
    catergories = get_local_app_categories()
    c_ptr = 0

    try:
        win_header.show()
        win_files.show()
        win_preview.show()

        pinned = database_get("pinned_apps", [])
        #	apps = []
        apps_path = []

        if is_dir("apps"):
            for app in os.listdir("apps"):
                path = "apps/" + app
                if is_dir(path) and is_file(path + "/main.py"):
                    apps_path.append(path + "/main.py")
        if is_dir("examples"):
            for app in os.listdir("examples"):
                path = "examples/" + app
                if is_file(path) and path.endswith(".py"):
                    apps_path.append(path)

        displayed_apps = update_options(options, catergories[c_ptr], pinned)

        index_prev = -1

        while True:
            pyb.wfi()
            ugfx.poll()

            if index_prev != options.selected_index():
                if options.selected_index() < len(displayed_apps):
                    author.text("by: %s" %
                                displayed_apps[options.selected_index()].user)
                    desc.text(
                        displayed_apps[options.selected_index()].description)
                index_prev = options.selected_index()

            if buttons.is_triggered("JOY_LEFT"):
                if c_ptr > 0:
                    c_ptr -= 1
                    btnl.set_focus()
                    l_cat.text(catergories[c_ptr])
                    displayed_apps = update_options(options,
                                                    catergories[c_ptr], pinned)
                    index_prev = -1

            if buttons.is_triggered("JOY_RIGHT"):
                if c_ptr < len(catergories) - 1:
                    c_ptr += 1
                    btnr.set_focus()
                    l_cat.text(catergories[c_ptr])
                    displayed_apps = update_options(options,
                                                    catergories[c_ptr], pinned)
                    index_prev = -1

            if buttons.is_triggered("BTN_MENU"):
                app = displayed_apps[options.selected_index()]
                if app.folder_name in pinned:
                    pinned.remove(app.folder_name)
                else:
                    pinned.append(app.folder_name)
                update_options(options, catergories[c_ptr], pinned)
                database_set("pinned_apps", pinned)

            if buttons.is_triggered("BTN_B"):
                return None

            if buttons.is_triggered("BTN_A"):
                return displayed_apps[options.selected_index()]

    finally:
        for component in components:
            component.destroy()
コード例 #13
0
ファイル: main.py プロジェクト: bruntonspall/emflap
import pyb
import ugfx
import buttons
import database

ugfx.init()
ugfx.enable_tear()
buttons.init()
buttons.disable_menu_reset()

score = 0
grid_size = 8;
bird_colour = ugfx.YELLOW
back_colour = ugfx.BLACK
pipe_colour = ugfx.BLUE
gap = database.database_get("emflap.gap", 8)
pipe_diff = database.database_get("emflap.pipe_diff", 5)
high_score = database.database_get("emflap.highscore",0)
jump = database.database_get("emflap.jump",-2)
speed = database.database_get("emflap.speed",100)

def play_game():
    global score
    pipe_heights = []
    score = 0
    playing = True
    x = 6
    y = 17
    dx = 1
    dy = -2