def o_info(): from os import statvfs from gc import mem_free printTitle("basic info > ") print("This is basic info about system and setup") print("> machine.freq: " + str(Env.freq) + " [Hz]") printLog("memory") print("> ram free: " + str(mem_free()) + " [B]") #print("> flash: "+str(os.statvfs("/"))) ff = int(statvfs("/")[0]) * int(statvfs("/")[3]) print("> flash free: " + str(int(ff / 1000)) + " [kB]") printLog("device") try: with open('config/device.json', 'r') as f: d = f.read() f.close() print(" > config/device: " + d) # device_config = json.loads(d) except Exception as e: print( "Device config 'config/device.json' does not exist, please run setup()" ) printLog("pinout") print(pinout) printLog("io_conf") print(io_conf) printInfo()
def octopus_init(): Env.start = ticks_ms() print("auto Init: " + str(Env.autoInit)) #if Env.autoInit: printTitle("> auto Init ") if io_conf.get('led'): printLog("led.blink()") print("testing led") led.blink() if io_conf.get('ws'): printLog("ws.test()") print("testing ws - RGB led") ws.test() if io_conf.get('led7'): Env.d7 = disp7_init() if io_conf.get('oled'): Env.o = oled_init() if io_conf.get('temp'): Env.t = temp_init() printLog("ticks_diff(ticks_ms(), Env.start)") delta = ticks_diff(ticks_ms(), Env.start) print("delta_time: " + str(delta))
def timer_init(): printLog("timer_init") print("timer tim1 is ready - periodic - 10s") print("for deactivite: tim1.deinit()") tim1.init(period=10000, mode=Timer.PERIODIC, callback=lambda t:timerAction()) Env.timerCounter = 0