Conversation
Merge master into dev.
Merge in protocol.
Update Pipfile
| return name.replace(' Line', '').replace(' line', '').split(' - ') | ||
|
|
||
| def update_state(self, interval): | ||
| def update_state(self, interval: int): |
There was a problem hiding this comment.
Interval is actually unused. Was going to use it to compute percentage, but that's done in the server-side now.
| strip = dest_to_strip[s[1]] | ||
| strip_state = self.strip_states[strip] | ||
| # print(t) | ||
| train_destination = dest_to_strip[s[1]] |
There was a problem hiding this comment.
train_destination actually isn't the train's destination. It's the 2-tuple (Colour, Direction).
| if len(trip_stops[t.trip_id]) > len(self.used_strips[strip]): | ||
| print(f' WARNING: trip {t.trip_id} has more stops than LEDS on {strip}.') | ||
| continue | ||
| # if len(trip_stops[t.trip_id]) > len(self.line_strip_mapping[train_destination]): |
There was a problem hiding this comment.
Why did you comment this out?
| cmd = message.build_flash_command(pin, s_state.colour.value) | ||
| else: | ||
| print('No command matched.') | ||
|
|
|
|
||
|
|
||
| class MessageType(enum.Enum): | ||
| OFF = enum.auto() |
There was a problem hiding this comment.
Instead of using enum.auto(), you can use the protocol's number values, then use these when building the string instead of hardcoding it further down.
| return b'0,%d,0,0;' % id | ||
|
|
||
|
|
||
| def build_on_command(id: int, color: int) -> bytes: |
There was a problem hiding this comment.
Not sure about the protocol, but add percent as an optional param to build_on, maybe?
| def build_flash_command(id: int, color: int) -> bytes: | ||
| return b'2,%d,%d,0;' % (id, color) | ||
|
|
||
|
|
There was a problem hiding this comment.
What exactly is the difference between fade and flash?
Is fade merely on, but with opacity?
| @@ -0,0 +1,41 @@ | |||
| class RGBColour: | |||
There was a problem hiding this comment.
__eq__ and __hash__ could be added. Will help if we ever need to use these as dict keys.
Work in progress. Opening this pull request to set some goals.
Still need to work on the following: