Skip to content

Conversation

@Giakou
Copy link
Contributor

@Giakou Giakou commented Feb 27, 2025

Fixes #237

@Giakou Giakou self-assigned this Feb 27, 2025
@Giakou Giakou requested a review from cbespin February 27, 2025 08:30
@Giakou Giakou added the bug label Feb 27, 2025
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'.
Copy link
Contributor

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?

Comment on lines 31 to 35
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)
Copy link
Contributor

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.

Copy link
Contributor

@cbespin cbespin left a 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!

@Giakou Giakou merged commit 91efcd0 into master Mar 26, 2025
5 checks passed
@cbespin cbespin deleted the mercury_controller_fix branch March 26, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mercury controller board number misused as device (address) number

3 participants