Conversation
Codecov Report
@@ Coverage Diff @@
## develop #388 +/- ##
===========================================
+ Coverage 69.05% 69.34% +0.29%
===========================================
Files 58 59 +1
Lines 4640 4691 +51
Branches 641 650 +9
===========================================
+ Hits 3204 3253 +49
- Misses 1264 1265 +1
- Partials 172 173 +1
Continue to review full report at Codecov.
|
| lat = '{:+07.0f}'.format(self.location.lat.to(u.arcsecond).value) | ||
| lon = '{:+07.0f}'.format(self.location.lon.to(u.arcsecond).value) | ||
|
|
||
| self.query('set_long', lon) |
There was a problem hiding this comment.
For another PR, recall that iOptron told us that we can read the GPS location (once available) only if we don't set the lat/long.
There was a problem hiding this comment.
Yes, and I believe we were waiting to hear back if that ability could ever be regained once we have set it once. I flashed the firmware on my iEQ45 Pro and tried to wait (via the handset) for the GPS to acquire and it never did.
There was a problem hiding this comment.
I didn't ask them that question; the answer we did get sounded definitive: after power-up, don't set lat/long if you want to read the GPS value.
There was a problem hiding this comment.
I'll try and experiment with this some more.
| try: | ||
| self._port = self.config['mount']['port'] | ||
| serial_config = self.config['mount']['serial'] | ||
| self.serial = rs232.SerialData(**serial_config) |
There was a problem hiding this comment.
At this point, I begin to wonder whether we should eliminate SerialData and just use pyserial directly... I'm not certain yet.
|
|
||
| model = mount_info.get('model') | ||
| port = mount_info.get('port') | ||
| serial_info = mount_info['serial'] |
There was a problem hiding this comment.
This block of code seems like it all belongs somewhere in pocs/mount/
There was a problem hiding this comment.
It does, it's part of the plan to support the dependency injection of the mount. All of the _create_XXX methods will be removed as part of that. I was tempted to start on that with this PR but it would have slowed it down a bunch more.
There was a problem hiding this comment.
That's fine, do it later.
| self.mount = mount | ||
|
|
||
| with pytest.raises(AssertionError): | ||
| assert self.mount.query('version') == 'V1.00' |
There was a problem hiding this comment.
I'll make a comment, but it's testing that a basic query won't work until initialization happens.
There was a problem hiding this comment.
Thanks, I didn't realize that.
| assert self.mount.initialize() is True | ||
|
|
||
| def test_version(self): | ||
| assert self.mount.query('version') == 'V1.00' |
There was a problem hiding this comment.
Does this fail as soon as we update the firmware on the unit?
There was a problem hiding this comment.
Sadly, no. As far as I can tell that version number doesn't actually mean anything or relate to a version. You can do a query('firmware_motor') and query('firmware_radec') to get the actual versions. It's never changed in 4+ years.
There was a problem hiding this comment.
Wow. Maybe it represents a protocol identifier?
There was a problem hiding this comment.
Yes, I think so. It is park of the mount handshake for serial communication. See ioptron initialize. That's required by the mount.
| self.mount.set_park_coordinates() | ||
| assert self.mount._park_coordinates is not None | ||
|
|
||
| assert self.mount._park_coordinates.dec.value == -10.0 |
There was a problem hiding this comment.
Empirical but should be some comment about them. Will add.
| def setup(self, config): | ||
|
|
||
| self.config = load_config(ignore_local=True) | ||
| self.config = config |
There was a problem hiding this comment.
Should we not override the location in the config, maybe even run this test with different locations (Northern & Southern Hemisphere and Equator)?
There was a problem hiding this comment.
Then the parking will be messed up. This test should be run when you have an actual mount attached and are wanting to watch what it does so it would in essence be testing your particular configuration.
There was a problem hiding this comment.
Ah, good point. So, if using real hardware (not just on PAN001), you want there to be a pocs_local.yaml file with an accurate location of the mount (OR read it from the mount... if the mount can provide that).
But, if not using real hardware, then we can test with several different locations.
| @@ -40,6 +40,7 @@ def __init__(self, | |||
| port=None, | |||
| baudrate=115200, | |||
There was a problem hiding this comment.
I think we should remove the baudrate, and require that it be provided in the config.
There was a problem hiding this comment.
Maybe a more generic PR for #181 to do this? I could do here though.
There was a problem hiding this comment.
OK, a more generic PR addressing #181 is fine. I'd be happy to work on that when you're done with this.
| port=None, | ||
| baudrate=115200, | ||
| name=None, | ||
| timeout=2.0, |
There was a problem hiding this comment.
I was expecting to see that you'd removed most or all of these params, and replaced them with kwargs to be passed to the serial_for_url call, or to the apply_settings() method of the serial object.
There was a problem hiding this comment.
Just tried doing this and it will involve a number of other changes not specifically related to the mount. I think a #181 specific PR would be best.
| self.ser.stopbits = serial.STOPBITS_ONE | ||
| self.ser.timeout = 2.0 # TODO(jamessynge): Allow caller or config to set. | ||
| self.ser.timeout = timeout | ||
| self.ser.write_timeout = timeout |
There was a problem hiding this comment.
write_timeout of 0 means non-blocking, which might not be quite what you want.
There was a problem hiding this comment.
That's what I've been using as a test and has been working great both for the mount and the arduinos. Was going to ask you specifically about this. Not sure what would otherwise be a good default.
There was a problem hiding this comment.
Given that our messages are short, infrequent and that we (generally) wait for a response, 0 is probably a fine value for write_timeout.
This starts to support serial from config (#181) although only has that option for the mount at this point.
Sets a default timeout of 2.0s for serial devices. Sets 0.0 for the serial mounts.
Adds a far-from-complete hardware test for ioptron.
Fixes #376