-
Notifications
You must be signed in to change notification settings - Fork 30
Use board number instead of address in the Mercury class #238
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
Conversation
basil/HL/mercury.py
Outdated
| A protocoll via RS 232 serial port is used with 9600/19200/38400/115200 baud rate. The baud rate | ||
| can be set with dip switches, as well as a hardware address to distinguish several | ||
| devices on one line. The write termination is CR and the read ends with '\r', '\n', '\x03'. | ||
| devices on one line. Keep in mind that the address that is set via the DIP switches corresponds to (board number + 1). Check p.45 of the overall manual below on how to properly set the address of each controller and what the corresponding board number is. The write termination is CR and the read ends with '\r', '\n', '\x03'. |
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 do not enforce line break rules, but can you change this to reflect the line length of the others, please?
basil/HL/mercury.py
Outdated
| self._addresses = [] | ||
| for a in range(16): # Check all possible addresses | ||
| self.write(bytearray.fromhex("01%d" % (a + 30)) + "TB".encode()) # Tell board address | ||
| if self.get_address(a): | ||
| self._addresses.append(a) | ||
| self._board_numbers = [] | ||
| for b in range(16): # Check all possible board numbers | ||
| self.write(bytearray.fromhex("01%d" % (b + 30)) + "TB".encode()) # Tell board number | ||
| if self.get_board_number(b): | ||
| self._board_numbers.append(b) |
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.
Personally, I refrain from using single-character variables; maybe board_n or even board_number is a bit easier to read. Just wanted to point it out, this is no actual change request. Hit "resolve" if you want to keep it as it is.
cbespin
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.
Thanks, looks good to me!
Fixes #237