and in the main.py code https://github.com/divergentti/airquali ... en/main.py I start reading loop in the main:
Code: Select all
async def main(): # asyncio.create_task(mqtt_up_loop()) """ # Create loops here! loop = asyncio.get_event_loop() loop.create_task(co2sensor.read_co2_loop()) loop.create_task(wifinet.collect_carbage_and_update_status_loop()) loop.create_task(show_what_i_do()) if (display.connect_to_wifi is True) and (wifinet.network_connected is False): await wifinet.connect_to_network() if wifinet.network_connected is True: display.row_by_row_text("Network up, begin operations", 'blue') await display.run_display() else: display.row_by_row_text("Network down, running setup", 'yellow') await display.show_network_setup_screen() # loop.run_forever() while True: await asyncio.sleep(1) if __name__ == "__main__": asyncio.run(main())
Two questions: why ESP32 boots again if I connect to it with USB serial and why UART1 (pins 16 and 17) is not functioning after cold boot? They are somehow related.
EDIT: today (January 16th) I added PMS7003 particle sensor reading asynchronously via StreamReader to the code and used UART2 in GPIO pins 32 and 33 and that seems to work fine after power on boot etc. UART0 is not usable due to REPL, and I tested UART1 in other GPIO pins, but that brings error during boot. Code including asynchronous read for PMS7003 sensor at https://github.com/divergentti/airquali ... en/main.py