2024-08-14 12:54:42 +02:00
|
|
|
import asyncio
|
|
|
|
|
|
|
|
from lib.topic_message import TMQueue
|
2024-08-29 16:02:11 +02:00
|
|
|
from async_tasks.onboard_tasks import measure_sensors
|
2024-08-14 12:54:42 +02:00
|
|
|
|
|
|
|
async def main_wifi(uuid, sensors, mqtt_client, temperature_topic, inbound_topic):
|
|
|
|
from async_tasks.wireless_tasks import mqtt_publish_tmsgs
|
|
|
|
outbound_queue = TMQueue()
|
|
|
|
asyncio.create_task(measure_sensors(sensors, 1, uuid, outbound_queue, temperature_topic))
|
|
|
|
asyncio.create_task(mqtt_publish_tmsgs(mqtt_client, outbound_queue, 0.5))
|
|
|
|
|
|
|
|
while True:
|
|
|
|
await asyncio.sleep(5)
|
|
|
|
|
|
|
|
async def main_wired(uuid, sensors, temperature_topic, inbound_topic):
|
|
|
|
from async_tasks.wired_tasks import usb_send_data
|
|
|
|
outbound_queue = TMQueue()
|
|
|
|
asyncio.create_task(measure_sensors(sensors, 1, uuid, outbound_queue, temperature_topic))
|
|
|
|
asyncio.create_task(usb_send_data(outbound_queue, 0.5))
|
|
|
|
|
|
|
|
while True:
|
|
|
|
await asyncio.sleep(5)
|