Skip to content

Commit 7138c1a

Browse files
committed
Catch address over-/underflow
1 parent 525fed5 commit 7138c1a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

firmware/MAD_FW_1_0/matrix/matrix.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,9 +681,14 @@ static void matrix_array2buffer(unsigned char *source, volatile unsigned char *d
681681
static void matrix_ascii2buffer()
682682
{
683683
unsigned char temp[MATRIX_DOTS_X];
684-
if (matrix_queue_data > 'z')
684+
685+
if ((matrix_queue_data > '~') || (matrix_queue_data < '!'))
686+
{
687+
matrix_queue_data = '?';
688+
}
689+
else if (matrix_queue_data > 'z')
685690
{
686-
matrix_queue_data = matrix_queue_data - ('z' - 'a') - 1;
691+
matrix_queue_data = matrix_queue_data - ('z' - 'a') - 1;
687692
}
688693
else
689694
{

0 commit comments

Comments
 (0)