From ad4fecdf715e187361f5aca7babe9d349ef1edff Mon Sep 17 00:00:00 2001 From: lonkaars Date: Tue, 30 Nov 2021 16:33:16 +0100 Subject: vertical scanning fixed --- software/effects.ino | 6 +++--- software/scan.ino | 11 ++++++++--- 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(); -- cgit v1.2.3