groupgets / purethermal1-firmware

Reference firmware for PureThermal 1 FLIR Lepton Dev Kit
MIT License
126 stars 64 forks source link

UART Protothread receive problem #31

Open kamil321-rgb opened 4 years ago

kamil321-rgb commented 4 years ago

Hi I created my own board using this firmware. I have a hub which connect stm32 through ftdi uart<->usb and stm32 usb directly with hub so i can send/receive uart commands and send camera stream pretty easy. It works ok with sending message but I have problem with receiving. Code below https://pastebin.com/ydcN6BiC So I created thread call comm_task and sending message about fpatemperature() - its i2c query. I want to send in about 100ms so I write do while loop with YIELD_UNTIL. For sending I used SPAWN with PutSerialBuffer function. As i said this works fine.

But i created another task with getSerialBuffer to receive some commands but in this code it waits for 20 chars #define max_chars 20 and then send message.

What i want to achieve is sending messages every 100ms (no matter what) and if i receive some commands simply echo them. I could use interrupts but i suppose it could destroy my stream video and protothreads. So for my purpose its better for using protohtreads. Can somebody help me with this?