-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add sd/sc to allow setting date/time in Click PLC #43
base: master
Are you sure you want to change the base?
Conversation
Makes it more clear that there are a total of X bits, not an additional X bits + the starting one
Modeled after _set_ds Restricted it to only the writable SD registers
Modeled after C coils. Restricted writing to only writable SC addresses
I'll look into the test_driver.py and see about following up with additional tests for this. I didn't run |
Also I’ll send a commit over to update docs / user-facing on which sc/sd are writable |
Hello @ssweber With the Thanksgiving holiday, I'm only seeing this now. Thanks so much for the PR! An initial review looks good, but I want to double check the register value changes. I'm traveling next week but will be able to check this against real hardware 12/9. Also, I have a local work-in-progress branch adding
For now I'm just using |
@alexrudd2. I added in the tests to this branch and closed that PR. I was covering a coworkers job last week, but I should have time this week to run against a ClickPLC. |
... getting my bearings on how to use pytest :) |
Not sure how physical click would respond to setting all these as 1234. So revert.
Nice catch on the SD ranges. (I cherry-picked it as a83d9b1). I've invited you as collaborator so Github actions will run on this PR. Commit whatever you want in this branch, I'll likely squash-merge when we've got things fully tested. |
@@ -145,6 +171,35 @@ async def test_dh_roundtrip(plc_driver): | |||
await plc_driver.set('dh500', 500) | |||
assert await plc_driver.get('dh500') == 500 | |||
|
|||
@pytest.mark.asyncio(loop_scope='session') | |||
async def test_sd_roundtrip(plc_driver): | |||
"""Confirm writable SD ints are read back correctly after being set.""" |
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.
Let's split out the roundtrips for sd29
and sd35
into a separate test that fully sets the time, since that's what you actually care about.
At some point I expect there will be explicit functions for each of the 'special' SD registers.
Hello, Thanks for the library!
I wrote a short script to sync all my clicks on the network with my computer's clock. sync_clickplc_datetime.py I then realized that writing SD, and read/writing SC wasn't added yet. I added necessary changes / modeling them after the C and DS corresponding functions. I tested my script, and it did set correctly!
Let me know if it looks OK. Thanks