Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ ifeq (${LANG},DE)
SHARED_FLAGS += -DLANG_DE
endif

ifeq (${INVERTED},1)
SHARED_FLAGS += -DINVERTED
endif

CFLAGS += ${SHARED_FLAGS} -std=c11
CXXFLAGS += ${SHARED_FLAGS} -std=c++11 -fno-rtti -fno-exceptions

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,9 @@ presence anymore"). This is quite improbable, though.

Please remove and insert the battery again. Make sure that the battery has enough
current and replcace the battery if the LED are dark.

## Wrong display ordered

If you ordered the wrong display (AS instead BS variant, e.g. for Mini Rocket
788AS (Common Cathode) instead 788BS (Common Anode), you can set the build
parameter `INVERTED=1` to build a corresponding firmware.
45 changes: 44 additions & 1 deletion src/display.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ Display::Display()
void Display::disable()
{
TIMSK0 &= ~_BV(TOIE0);

#ifdef INVERTED
PORTB = 0xFF;
#else
PORTB = 0;
#endif

PORTD = 0;
}

Expand All @@ -53,9 +59,19 @@ void Display::multiplex()
* To avoid flickering, do not put any code (or expensive index
* calculations) between the following three lines.
*/
#ifdef INVERTED
PORTB = 0xFF;
#else
PORTB = 0;
#endif

PORTD = disp_buf[active_col];

#ifdef INVERTED
PORTB = ~_BV(active_col);
#else
PORTB = _BV(active_col);
#endif

if (++active_col == 8) {
active_col = 0;
Expand Down Expand Up @@ -109,21 +125,41 @@ void Display::update() {
*/
if (current_anim->direction == 0) {
if (char_pos == 0) {
#ifdef INVERTED
disp_buf[7] = 0x00; // whitespace
#else
disp_buf[7] = 0xff; // whitespace
#endif
} else {
#ifdef INVERTED
disp_buf[7] = pgm_read_byte(&glyph_addr[char_pos]);
#else
disp_buf[7] = ~pgm_read_byte(&glyph_addr[char_pos]);
#endif
}
} else {
if (char_pos == 0) {
#ifdef INVERTED
disp_buf[0] = 0x00; // whitespace
#else
disp_buf[0] = 0xff; // whitespace
#endif
} else {
#ifdef INVERTED
disp_buf[0] = pgm_read_byte(&glyph_addr[glyph_len - char_pos + 1]);
#else
disp_buf[0] = ~pgm_read_byte(&glyph_addr[glyph_len - char_pos + 1]);
#endif
}
}

} else if (current_anim->type == AnimationType::FRAMES) {
for (i = 0; i < 8; i++) {
#ifdef INVERTED
disp_buf[i] = current_anim->data[str_pos+i];
#else
disp_buf[i] = ~current_anim->data[str_pos+i];
#endif
}
str_pos += 8;
}
Expand Down Expand Up @@ -222,8 +258,15 @@ void Display::update() {

void Display::reset()
{
for (uint8_t i = 0; i < 8; i++)
for (uint8_t i = 0; i < 8; i++) {
#ifdef INVERTED
disp_buf[i] = 0x00;
#else
disp_buf[i] = 0xff;
#endif
}


update_cnt = 0;
repeat_cnt = 0;
str_pos = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// to display firmware version (v2.1) when storage is empty on first turn on
#define FW_REV_MAJOR 2
#define FW_REV_MINOR 1
#define FW_REV_MINOR 2



Expand Down