Skip to content

Commit

Permalink
added rudimentary matrix prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
tfeldmann committed Dec 20, 2013
1 parent d22e001 commit 514e0ee
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 11 deletions.
51 changes: 50 additions & 1 deletion Firmware/Controller.ino
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,18 @@ void controller_buttons()
brightness_next_step();
}

// switch through demo modes
// cycle through demo modes
if (btn1.read() && btn2.risingEdge())
{
if (STATE_IS_ACTIVE(STATE_TIMEWORDS))
STATE_SWITCH(STATE_WHITE);

if (STATE_IS_ACTIVE(STATE_WHITE))
STATE_SWITCH(STATE_MATRIX);

if (STATE_IS_ACTIVE(STATE_MATRIX))
STATE_SWITCH(STATE_ES_LACHT_NE_KUH);

if (STATE_IS_ACTIVE(STATE_ES_LACHT_NE_KUH))
STATE_SWITCH(STATE_TIMEWORDS);
}
Expand Down Expand Up @@ -153,6 +158,50 @@ STATEMACHINE
STATE_LEAVE
END_OF_STATE

STATE_ENTER(STATE_MATRIX)
brightness = 1;
matrix_clear();
// light first line
for (byte x = 0; x < COLS; x++)
{
matrix[0][x] = 255;
}
STATE_LOOP
brightness = 1;
static int _ovf10 = 0;
static int _ovf30 = 0;

// every 10 updates
if (++_ovf10 == 10)
{
_ovf10 = 0;

// move rows one down
for (byte y = ROWS - 1; y > 0; y--)
{
for (byte x = 0; x < COLS; x++)
{
matrix[y][x] = matrix[y-1][x];
}
}

// darken first line
for (byte x = 0; x < COLS; x++)
{
matrix[0][x] = 0.8 * matrix[0][x];
}
}

// every 30 steps add a light
if (++_ovf30 == 30)
{
_ovf30 = 0;
byte col = rand() % COLS;
matrix[0][col] = constrain(matrix[0][col] + rand() % 255, 0, 255);
}
STATE_LEAVE
END_OF_STATE

STATE_ENTER(STATE_ES_LACHT_NE_KUH)
matrix_clear();
corner_clear();
Expand Down
6 changes: 3 additions & 3 deletions Firmware/Time.ino
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ void time_startTimer()

ISR(TIMER1_OVF_vect)
{
noInterrupts(); // disable all interrupts
noInterrupts(); // disable all interrupts
time_addSecond();
TCNT1 = 3036;
interrupts(); // enable all interrupts
TCNT1 = 3036; // preload timer
interrupts(); // enable all interrupts
}


Expand Down
1 change: 1 addition & 0 deletions Firmware/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ STATES(
STATE_TEMPERATURE,
STATE_WAIT_FOR_DCF,
STATE_WHITE,
STATE_MATRIX,
STATE_ES_LACHT_NE_KUH,
STATE_STREAM,
);
10 changes: 5 additions & 5 deletions Software/qlocktoo/marquee/fixed_width.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 1, 1, 1, 0],
[1, 1, 1, 1, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
Expand Down Expand Up @@ -1114,8 +1114,8 @@
[0, 0, 0, 1, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1],
[0, 0, 0, 0, 0]
[0, 0, 0, 1, 0],
[0, 0, 0, 0, 1]
],

")":
Expand All @@ -1128,8 +1128,8 @@
[0, 1, 0, 0, 0],
[0, 1, 0, 0, 0],
[0, 1, 0, 0, 0],
[1, 0, 0, 0, 0],
[0, 0, 0, 0, 0]
[0, 1, 0, 0, 0],
[1, 0, 0, 0, 0]
],

">":
Expand Down
2 changes: 0 additions & 2 deletions Software/qlocktoo/marquee/marquee.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@ def cursorPositionChanged(self, old, new):
self.marquee.setText(text)
if len(text) > 0:
self.device.matrix = self.marquee.regionFromLetter(new)
else:
print "test"

def _frequency(self, speed):
"""
Expand Down

0 comments on commit 514e0ee

Please sign in to comment.