AlexmagToast / LinuxCNC_ArduinoConnector

This Projekt enables you to connect an Arduino to LinuxCNC and provides as many IO's as you could ever wish for. This Software is used as IO Expansion for LinuxCNC.
60 stars 15 forks source link

Migrating config to separate .h file #11

Closed KennethThompson closed 1 year ago

KennethThompson commented 1 year ago

Moved all config to its own .h file. This should make merging a bit easier between the repo and local copy

KennethThompson commented 1 year ago

I've begun adding in the Ethernet/WIFI code. This version will only support socket-based connections as detecting connect/disconnect is robust. Future version could use UDP, but someone needs to think through how to provide connection state tracking through initial handshake, timeout etc.

AlexmagToast commented 1 year ago

I am following your development closely. What kind of Ethernet adapter did you order? I think outsourcing the config in a seperate file will turn out nicely, it propably will also make sharing configurations with others easyer.

Let me know if i can assist in some way.

KennethThompson commented 1 year ago

https://www.amazon.com/dp/B00AXVX5D0?psc=1&ref=ppx_yo2ov_dt_b_product_details <-- seems to work well. I am using my UNO R4 wifi board for development purposes.

KennethThompson commented 1 year ago

I should have more code submitted tonight. I have some ideas for the protocol in order to support multiple arduinos and to ensure that protocol version checks are happening so the python side doesn't cause unexpected behavior in the arduino, or vice-versa. Each message will likely be a simple json string- more to come

KennethThompson commented 1 year ago

Thanks for the offer to help! Since you already put a ton of time into the code already, I am happy to finish out this phase. I want to use this Ethernet version for my own projects, so my motivation is selfish!

AlexmagToast commented 1 year ago

i've also thought about compatiblity for more than one arduino. Wouldn't it be easyer to just rename the py file to arduino2-connector and open it in a second instance? Also i wouldn't know how i'd implement settings for multiple arduinos in one file. I'm curious what you come up with.

KennethThompson commented 1 year ago

i've also thought about compatiblity for more than one arduino. Wouldn't it be easyer to just rename the py file to arduino2-connector and open it in a second instance? Also i wouldn't know how i'd implement settings for multiple arduinos in one file. I'm curious what you come up with.

My idea was to index the arduinos starting from 0. On the python side, the settings can be stored per-Arduino in a map/container based on the index. I am not that familiar with how Linuxcnc does the pin-publication, but I am sure there is an approach that could work. It may be better to use your idea of just loading in additional .py files to the HAL. Need to think through the pros and cons

KennethThompson commented 1 year ago

Sent you a friend request on discord.

AlexmagToast commented 1 year ago

yes. arduino.0.feature.io is the obvious choice. Hm now that i think about it the external config could solve this issue. i will continue to think about it.