[max7219digit] support flip_x when rotate_chip is 90° or 270° (#6109)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
@@ -271,7 +271,11 @@ void MAX7219Component::send64pixels(uint8_t chip, const uint8_t pixels[8]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this->orientation_ == 1) {
|
} else if (this->orientation_ == 1) {
|
||||||
b = pixels[col];
|
if (this->flip_x_) {
|
||||||
|
b = pixels[7 - col];
|
||||||
|
} else {
|
||||||
|
b = pixels[col];
|
||||||
|
}
|
||||||
} else if (this->orientation_ == 2) {
|
} else if (this->orientation_ == 2) {
|
||||||
for (uint8_t i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
if (this->flip_x_) {
|
if (this->flip_x_) {
|
||||||
@@ -282,7 +286,11 @@ void MAX7219Component::send64pixels(uint8_t chip, const uint8_t pixels[8]) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (uint8_t i = 0; i < 8; i++) {
|
for (uint8_t i = 0; i < 8; i++) {
|
||||||
b |= ((pixels[7 - col] >> i) & 1) << (7 - i);
|
if (this->flip_x_) {
|
||||||
|
b |= ((pixels[col] >> i) & 1) << (7 - i);
|
||||||
|
} else {
|
||||||
|
b |= ((pixels[7 - col] >> i) & 1) << (7 - i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// send this byte to display at selected chip
|
// send this byte to display at selected chip
|
||||||
|
|||||||
Reference in New Issue
Block a user