1
0

kimera: Fix the error handling of reading matrix mapping

This commit is contained in:
Kai Ryu 2014-11-11 16:16:53 +09:00
parent bcee04659b
commit f9e449f7cf

View File

@ -99,13 +99,16 @@ uint8_t read_matrix_mapping(void)
uint8_t error = 0;
/* read number of rows and cols */
row_count = eeprom_read_byte(EECONFIG_ROW_COUNT);
col_count = eeprom_read_byte(EECONFIG_COL_COUNT);
if (row_count == 0) error++;
if (row_count == UNCONFIGURED) error++;
if (col_count == 0) error++;
if (col_count == UNCONFIGURED) error++;
if (row_count + col_count > PX_COUNT) error++;
uint8_t rows = eeprom_read_byte(EECONFIG_ROW_COUNT);
uint8_t cols = eeprom_read_byte(EECONFIG_COL_COUNT);
if (rows == 0) error++;
if (rows == UNCONFIGURED) error++;
if (cols == 0) error++;
if (cols == UNCONFIGURED) error++;
if (rows + cols > PX_COUNT) error++;
if (error) return error;
row_count = rows;
col_count = cols;
/* read row mapping */
uint8_t *mapping = EECONFIG_ROW_COL_MAPPING;