import ugfx, appglue, wifi
#import ugfx, gc, wifi, badge, deepsleep, urandom, network,random
# import gc, urequests as requests
#from time import sleep


ugfx.init()
ugfx.LUT_FULL
ugfx.input_init()

# Make sure WiFi is connected
wifi.init()
ugfx.clear(ugfx.BLACK)
ugfx.flush()
ugfx.clear(ugfx.WHITE)
ugfx.flush()

    
def home(pressed):
  if pressed:
    appglue.home()

ugfx.input_attach(ugfx.BTN_B, home)


#ugfx.string(10,10,"Waiting for wifi...","Roboto_Regular12", 0)
#ugfx.flush()

# Wait for WiFi connection
#while not wifi.sta_if.isconnected():
#    sleep(0.1)
#    pass

#ugfx.clear(ugfx.WHITE)
#ugfx.flush()


#def main():
#    show_space_status(1)

#def go_home(pushed):
#  if(pushed):
#        import machine
#        machine.deepsleep(1)

#ugfx.input_attach(ugfx.BTN_A, show_space_status)
#ugfx.input_attach(ugfx.BTN_B, go_home)
#main()