aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2021-11-30 16:33:16 +0100
committerlonkaars <loek@pipeframe.xyz>2021-11-30 16:33:16 +0100
commitad4fecdf715e187361f5aca7babe9d349ef1edff (patch)
tree701e89688f11093d9e4fd5bac71c04b9dd20fced
parent687673761e6f8542f8436fb2f0fb633a59978f48 (diff)
vertical scanning fixed
-rw-r--r--software/effects.ino6
-rw-r--r--software/scan.ino11
2 files changed, 11 insertions, 6 deletions
diff --git a/software/effects.ino b/software/effects.ino
index b320e8e..bb2468a 100644
--- a/software/effects.ino
+++ b/software/effects.ino
@@ -44,14 +44,14 @@ void fx_rainfall (unsigned long relative_time) {
return;
}
-/* #define FX_LEN_TEST_LEDS_IN_ORDER (unsigned long) 10e3
+#define FX_LEN_TEST_LEDS_IN_ORDER (unsigned long) 10e3
void test_leds_inorder (unsigned long relative_time) {
memset(led_state, 0, sizeof(led_state));
unsigned long segment_time = FX_LEN_TEST_LEDS_IN_ORDER / 64;
- led_state[(relative_time / segment_time) % 64] = 1;
+ led_state[led_map[(relative_time / segment_time) % 64]] = 1;
return;
-} */
+}
void ( * slideshow_effects [SLIDESHOW_SIZE] )( unsigned long relative_time ) = {
fx_roundabout,
diff --git a/software/scan.ino b/software/scan.ino
index 156627b..ef78b42 100644
--- a/software/scan.ino
+++ b/software/scan.ino
@@ -16,7 +16,7 @@ unsigned char get_state_row(unsigned char row, unsigned char direction) {
for (int i = 0; i < 8; i++)
return_value = return_value | ( led_state[
- direction == SCAN_HOR ? (i + row * 8) : (row + i * 8) ] << (7 - i));
+ direction == SCAN_HOR ? (i + row * 8) : (63- row - i * 8) ] << (7 - i));
return return_value;
}
@@ -24,8 +24,13 @@ unsigned char get_state_row(unsigned char row, unsigned char direction) {
void scan() {
// optimize_scan();
- shift_state[0] = 0x00 ^ (1 << scan_index);
- shift_state[1] = 0xff ^ get_state_row(scan_index, scan_direction);
+ if (scan_direction == SCAN_HOR) {
+ shift_state[0] = 0x00 ^ (1 << scan_index);
+ shift_state[1] = 0xff ^ get_state_row(scan_index, SCAN_HOR);
+ } else {
+ shift_state[0] = 0x00 ^ get_state_row(scan_index, SCAN_VER);
+ shift_state[1] = 0xff ^ (1 << scan_index);
+ }
update_shift_state();