Comments (16)
Ah, I just noticed (ii) has been done by @dlech in #5.
from bricknil.
I gave it a go and and implemented (iii) and (iv) on top if @dlech's PR #5.
You may find the code here: https://github.com/janvrany/bricknil/tree/simplify
Tested with BLEAK commit 472b576ef76f88a2830c823ed0970b79a032e5a6.
The code is not good enough to make a PR, however any comments would be appreciated.
from bricknil.
Maybe you should make a PR anyway so that it is easier to comment?
from bricknil.
Right, that make sense. Let me at least do a quick pass over comments and function names to remove (now obsolete) references to curio. Thanks!
from bricknil.
Just to make sure: will this proposal make possible such code:
hub1.motor1.set_speed(100)
sleep(1)
hub2.motor2.set_speed(100)
i.e. not have a separate run
method for each hub that needs heavy intercommunication?
(the code above is simplified, as I understand, there would be still await
, async
)
from bricknil.
@positron96: I'm afraid it would not and AFAIK it is not possible now anyways.
However, I agree this is a limitation as one hub might not be enough for more creative models. I'd like separate the concept of a model (and it's run()
method) and the hubs themselves. One would then define its own model with one run()
and attach hubs to the model. So you can write something like:
class CoolButComplexModel(bricknil.Model):
def __init__(...):
...
async def run(self):
self.hub1.motor1.set_speed(100)
sleep(1)
self.hub2.motor2.set_speed(100)
While I think this is desirable, such change is outside the (proposed) scope of this issue.
Maybe open another?
from bricknil.
@dlech , @virantha : to start a more detailed discussion, I've opened a PR with mu current working code: see PR #11 Code simplification
from bricknil.
@janvrany Hi, are all your changes which are mentioned in the PR also in the branch "simplify" in your forked repository?
from bricknil.
@justxi I'll check later today.
As this repository seems to be..."quiet" so to say, I went ahead and did more radical refactorings / cleanups (to suit my needs) I'll have a look and push my latest code.
Will let you know.
from bricknil.
@janvrany Thanks.
from bricknil.
Hi, are all your changes which are mentioned in the PR also in the branch "simplify" in your forked repository?
Yes.
Moreover, my current development version is in branch devel
- https://github.com/janvrany/bricknil/tree/devel. Let me know if you have more questions / issues (maybe by opening an issue on my repo, not sure @virantha wants this repo be polluted by issues for some other code :-)
from bricknil.
@janvrany I'm just stumbling on this now and wondering what you suggest as a starting point to test your changes? Should I test the 'simple' branch or your 'devel' one?
For now I am trying the devel branch, but I'm also wondering if the documentation of methods has been updated?
from bricknil.
but I'm also wondering if the documentation of methods has been updated?
Sorry, not sure what do you mean. Can you elaborate?
Generally, I tried to update comments in the code, the rest (doc, test) almost certainly is rotten (i.e, not up-to-date).
I did not bother with that until I get some feedback on changes in the code, but that did not really happen for one reason or another. Seems to me @virantha is either not around anymore or not interested.
@virantha : are you still here? Any comments?
from bricknil.
'I tried to update comments in the code, the rest (doc, test) almost certainly is rotten (i.e, not up-to-date).'
That answers my question, thanks. I have done just enough to get the Duplo train up and running and so far there are no crashes (that aren't my fault...) and it does seem more responsive. Thanks for the efforts.
If it is all right with you I have one issue and I figure I should open it against you repository as it is more up-to-date, or should I put it here?
from bricknil.
I have done just enough to get the Duplo train up and running
Glad to hear that. I was wondering whether it works with anything but (my) technic hub, thanks!
it against you repository as it is more up-to-date, or should I put it here?
I would say against mine, given that there's no response from @virantha for more than half a year now.
That's said, I cannot promise I'll jump on it and fix, I'm fairly busy lately. But Iwill do my best and merge PR's
(as long as it won't break my technic stuff :-) So if it's okay with you, let's move to my fork.
from bricknil.
Sounds good, I'm new to Python so there's nothing coming fast. Also there's no obligations coming from me, I understand life is busy.
from bricknil.
Related Issues (20)
- ModuleNotFoundError: No module named 'Windows' HOT 3
- I want to have multiple functions to control the Lego hub motors not Just the run() function
- Documentation clarification - Windows USB adapter support HOT 1
- Hub disconnects on first write?
- crashes one first communication with boost sensor HOT 3
- ID of sensors inside Technic Plus Hub HOT 3
- Minor changes to make it works with bleak 0.6.4 HOT 9
- Dashboard & API
- Technic Control+ Hub gets disconnected on "notify" (raspberry pi 4) HOT 2
- Not able to run lego passenger train due to Bleak error
- Duplo Train - Bricknil Traceback Crash HOT 7
- Cant connect Lego Move Hub HOT 3
- Train Hub not advertised/connected HOT 1
- Support for Large Technic Motor (88013), e.g. for Lego Crocodile (10277) HOT 2
- Cannot connect to Large Angular Motor for a Technic Hub set HOT 1
- Controlling 2 Train motors in a hub
- Bluetooth discovery sometimes errors out
- Windows 11: Bleak discover has an exception: Unhandled Exception: System.NotSupportedException: Cannot create uninitialized instances of types requiring managed activation.
- Raspberry Pi: Software caused connection abort HOT 1
- MicroPython support? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bricknil.