Merge pull request #107 from ganbariley/master
Adds torch capability to emfcampqueer_home appsammachin-gprs
commit
46f71f57f6
|
@ -12,6 +12,12 @@ ___bootstrapped___ = False
|
|||
import ugfx
|
||||
from homescreen import *
|
||||
import time
|
||||
from tilda import Buttons
|
||||
from machine import Pin
|
||||
from machine import Neopix
|
||||
|
||||
torch = Pin(Pin.GPIO_FET)
|
||||
neo = Neopix()
|
||||
|
||||
# Padding for name
|
||||
intro_height = 30
|
||||
|
@ -26,6 +32,8 @@ logo_width = 56
|
|||
# Maximum length of name before downscaling
|
||||
max_name = 8
|
||||
|
||||
torch_on = False
|
||||
|
||||
# Background stuff
|
||||
init()
|
||||
ugfx.clear(ugfx.html_color(0x800080))
|
||||
|
@ -82,4 +90,13 @@ while True:
|
|||
if value_battery:
|
||||
text += "Battery: %s%%" % int(value_battery)
|
||||
status.text(text)
|
||||
if Buttons.is_pressed(Buttons.BTN_Star):
|
||||
if torch_on:
|
||||
torch_on = False
|
||||
torch.off()
|
||||
neo.display([0,0])
|
||||
else:
|
||||
torch_on = True
|
||||
torch.on()
|
||||
neo.display([0xffffff,0xffffff])
|
||||
sleep_or_exit(0.5)
|
||||
|
|
Loading…
Reference in New Issue