Skip to content

Commit f366e47

Browse files
committed
Fix bulb address calculation when there are more than 2 strings in a
group.
1 parent 2f93746 commit f366e47

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

G35StringGroup.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ uint16_t G35StringGroup::get_light_count() {
3535
void G35StringGroup::set_color(uint8_t bulb, uint8_t intensity, color_t color) {
3636
uint8_t string = 0;
3737
while (bulb >= string_offsets_[string] && string < string_count_) {
38-
bulb -= string_offsets_[string++];
38+
string++;
3939
}
4040
if (string < string_count_) {
41+
if (string > 0) {
42+
bulb -= string_offsets_[string - 1];
43+
}
4144
strings_[string]->set_color(bulb, intensity, color);
4245
} else {
4346
// A program is misbehaving.

0 commit comments

Comments
 (0)