Enable reverse display of the Max7219 digit (#1234)

* add reverse option

* Update max7219digit.cpp

adding space for formatting

* Update esphome/components/max7219digit/display.py

Copy past error...

Co-authored-by: Otto Winter <otto@otto-winter.com>

Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
rspaargaren
2020-09-27 19:17:28 +02:00
committed by GitHub
parent 0e59243b83
commit 0ccfdd4711
3 changed files with 10 additions and 1 deletions
@@ -108,7 +108,11 @@ void MAX7219Component::display() {
// Send the data to the chip
for (uint8_t i = 0; i < this->num_chips_; i++) {
for (uint8_t j = 0; j < 8; j++) {
pixels[j] = this->max_displaybuffer_[i * 8 + j];
if (this->reverse_) {
pixels[j] = this->max_displaybuffer_[(this->num_chips_ - i - 1) * 8 + j];
} else {
pixels[j] = this->max_displaybuffer_[i * 8 + j];
}
}
this->send64pixels(i, pixels);
}