-
Notifications
You must be signed in to change notification settings - Fork 0
Arduino Service and Endpoint #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
| @@ -0,0 +1,154 @@ | |||
| #include <DallasTemperature.h> | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should establish convention for where example Arduino sketches go. Essentially this is templating a SCPI-lite device, which isn't really a dripline/dragonfly code element.
In Phase II we stashed them in the hardware repo, which was just an ad hoc solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We move all our arduino code and raspberryPi code here: https://github.com/project8/MainzDripline3/tree/main/MicroControllerScripts
The main purpose is to have it version controlled and backed up.
In this pull request I wanted to give it as an example and thus it may better be in the example folder
|
If I'm understanding this correctly, the EthernetService part of this code is essentially a stripped-back version of the standard EthernetSCPIService that allows for socket instability, and thus flushes the socket connection every time it communicates. Some assorted thoughts this raises (which are not prerequisites for this PR, but maybe to start a discussion that might need to migrate over to an issue thread):
|
wcpettus
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding review to post code comments.
| self.get_str = get_str | ||
|
|
||
| @calibrate() | ||
| def on_get(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it useful to include a logger.debug of the response? like:
https://github.com/driplineorg/dripline-python/blob/main/dripline/implementations/entity_endpoints.py#L50
| __all__ = [] | ||
| __all__.append('EthernetArduinoService') | ||
|
|
||
| class EthernetArduinoService(Service): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add docstring?
|
|
||
| class EthernetArduinoService(Service): | ||
| def __init__(self, | ||
| socket_info, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
given the odd form of socket_info, probably best to define the init args (I know they follow a reduced set of EthernetSCPIService, but since they are independently defined, the docs don't follow)
|
I checked yesterday and our current implementation with the arduino breaks the connection after every command. With this the "cmd_at_reconnect" basically is prohibitive to setup the arduino with the normal SCPI Service since after the cmd_at_reconnect the connection breaks and you do not have a chance to send the actual request. |
|
I digged a bit deeper to figure out if we can use the standard EthernetSCPIService. There are two classes of ethernet shields for arduinos.
The first class of controller chips can be run using the “official” Arduino library Ethernet.h while the second class of chips need different kind of library, i.e. Ethercard.h and UIPEthernet.h The ENC28J60 works very different from the "W5x00" series where the "W5x00" series has a hardware stack for TCP. Currently we use the ENC28J60 with the EtherCard.h library which just allows for a one time connection. With a ENC28J60 and the UIPEthernet.h we would get a TCP connection on the cost of huge memory usage. I have to check if this is possible with our Arduino nano. Alternatively shields with a "W5x00" series chip and the Ethernet.h library would also provide a TCP connection. |
We have several Arduinos that run some sensors and we need to comminicate with.
Since we do not have full SCIPY implementation this is a light weighted version of an endpoint and service.
This code is nicely running at our setup.