tonykolomeytsev / kekmech-clapi-raspberry Goto Github PK
View Code? Open in Web Editor NEWA simple library for controlling Arduino and STM32 Nucleo via Raspberry Pi using Serial.
License: MIT License
A simple library for controlling Arduino and STM32 Nucleo via Raspberry Pi using Serial.
License: MIT License
There is a blocking code in main_loop method:
def main_loop(self):
while True:
self.task_lock.acquire() # <-------------------------------HERE
# принимаем все входящие сообщения
self.process_input()
if len(self.tasks):
self.process_output()
else:
time.sleep(0) # аналог thread.yield() в других языках
self.task_lock.release() # <--------------------------------- AND HERE
This is because you need to be able to safely add to the list of tasks while running main_loop
. I am sure that there is a more elegant solution, I just do not know about it.
The task is get rid of Lock()
It is necessary to write tests simulating the work of asynchronous requests (Push, Request, LongPoll) to several devices simultaneously. It requires writing mocks.
Запросы, отмеченные как is_infinite=True, магическим образом становятся листенерами сразу на всех устройствах, а не только на том, куда запрос был отправлен. Запрос перестает выполняться через некоторое время, но поток, отправляющий запросы, работу не завершает.
Возможное решение - добавить отдельную логику в виде LongPoll запросов, а из других видов тасков убрать параметр is_infinite.
Ethernet is a faster and more reliable way to transfer data between devices than Serial. The STM32 Nucleo has an Ethernet connector and the Raspberry Pi has such a connector. Due to this, in the future it will be possible to complicate the data transfer protocol.
Rewrite all comments in modules clapi.py
and asynclapi.py
into English. The reality is that you need to learn English and write documentation in English. So the code of this project will become more informative and understandable for more people.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.