would appear to fix map etc

This commit is contained in:
Nico 2021-09-10 13:41:58 +01:00
parent 32d0b54667
commit 139c1293de
1 changed files with 6 additions and 6 deletions

12
out.c
View File

@ -8,7 +8,7 @@ enum messages { SET = 0, ALL, MAP, ROW, COL, LEVEL_SET, LEVEL_ALL, LEVEL_MAP, LE
int length[10] = {3, 1, 10, 3, 3, 3, 1, 66, 10, 10};
/* message */
int msg[68];
char msg[68];
/* buffer for read characters. getchar() is an int not a char! */
int c;
@ -60,12 +60,12 @@ int main(int argc, char *argv[]) {
case ROW:
/* row and col are the same. they take single bytes of data as arrays, for some reason */
int row_data[0];
memcpy(row_data, &msg[3], sizeof(int));
memcpy(row_data, &msg[3], sizeof(char));
monome_led_row(monome, msg[1], msg[2], 1, (const uint8_t*)row_data);
break;
case COL:
int col_data[0];
memcpy(col_data, &msg[3], sizeof(int));
memcpy(col_data, &msg[3], sizeof(char));
monome_led_col(monome, msg[1], msg[2], 1, (const uint8_t*)col_data);
break;
case LEVEL_SET:
@ -76,17 +76,17 @@ int main(int argc, char *argv[]) {
break;
case LEVEL_MAP:
int lmap_data[64];
memcpy(lmap_data, &msg[3], 64 * sizeof(int));
memcpy(lmap_data, &msg[3], 64 * sizeof(char));
monome_led_level_map(monome, msg[1], msg[2], (const uint8_t*)lmap_data);
break;
case LEVEL_ROW:
int lrow_data[8];
memcpy(lrow_data, &msg[3], 8 * sizeof(int));
memcpy(lrow_data, &msg[3], 8 * sizeof(char));
monome_led_level_row(monome, msg[1], msg[2], 1, (const uint8_t*)lrow_data);
break;
case LEVEL_COL:
int lcol_data[8];
memcpy(lcol_data, &msg[3], 8 * sizeof(int));
memcpy(lcol_data, &msg[3], 8 * sizeof(char));
monome_led_level_col(monome, msg[1], msg[2], 1, (const uint8_t*)lcol_data);
break;