Example #1
0
 async def keypad_watcher(self):
     while True:
         key = await self.keypad.get_key()
         #print("Got key:", key)
         if self.watchdog:
             self.watchdog.kick()
         if key == '*':
             beep.beep(1, 50)
             self.clear_command()
         elif key == '#':
             if self.command == '380':
                 print("Starting FTP server")
                 await self.mqtt_service.publish(env.LOG_TOPIC, 'Starting FTP server')
                 #await self.mqtt_service.client.disconnect()
                 import ftp
                 ftp.ftpserver()
             elif self.command == '73738':
                 print("Resetting...")
                 reset()
             else:
                 print("Sending:", self.command)
                 beep.beep(2)
                 await self.mqtt_service.publish(env.MQTT_TOPIC + self.command, '')
             self.clear_command()
         else:
             self.command = self.command + key
             beep.beep()
             print("Command:", self.command)
             b_def = led.BlinkDef(0,0,1,len(self.command),100,500,70,5)
             if self.blinking_id:
                 self.led_service.replace_blinking(self.blinking_id, b_def)
             else:
                 self.blinking_id = self.led_service.start_blinking(b_def)
Example #2
0
def ftp():
    import ftp
    ftp.ftpserver()
Example #3
0
import ftp
ftp.ftpserver()

            pass
    print('network config:', sta_if.ifconfig())


# connecting to WiFi
do_connect()
gc.collect()

# installing dependencies
# import upip
# upip.install('picoweb')
# gc.collect()
# upip.install('micropython-logging')
# gc.collect()
# upip.install('utemplate')
# gc.collect()
# upip.install('micropython-pkg_resources')
# gc.collect()
# upip.install('micropython-btreedb')
# gc.collect()

### ftp server for loading files
from ftp import ftpserver

ftp_server = ftpserver()
ftp_server.start_thread()

import captive_portal.__main__

captive_portal.__main__.main(host=sta_if.ifconfig()[0], port=80)