This commit is contained in:
Alexander Junk 2015-07-13 19:32:39 +02:00
parent e82e5729aa
commit 13bbc2d1b1
2 changed files with 10 additions and 8 deletions

View File

@ -44,8 +44,8 @@ typedef struct{
char file_name[FILE_NAME_LEN + 1];
char name[NAME_LEN + 1];
int rfid_uuid;
int finger_uuid;
char rfid_uuid[13];
uint8_t finger_uuid;
int drinks_taken[NUM_OF_DRINKS];

View File

@ -174,9 +174,11 @@ Person read_person(Beerbox *box, char *filename){
read_line_from_file(read, tmp, sizeof(tmp));
strcpy(aperson.name, tmp);
memset(aperson.rfid_uuid, 0, 13);
read_line_from_file(read, tmp, sizeof(tmp));
sscanf(tmp, " %*s %d", &aperson.rfid_uuid);
sscanf(tmp, " %*s %12s", aperson.rfid_uuid);
Serial.print(aperson.rfid_uuid);
read_line_from_file(read, tmp, sizeof(tmp));
@ -231,9 +233,9 @@ void print_person(Beerbox *box, Person *aperson){
sprintf(leckmich,"\nPerson is called \"%s\" and has the filename \"%s\".\n", aperson->name, tmp_filename);
Serial.write(leckmich);
sprintf(leckmich, "rfid_uuid: %d\n", aperson->rfid_uuid);
sprintf(leckmich, "rfid_uuid: %s\n", aperson->rfid_uuid);
Serial.write(leckmich);
sprintf(leckmich, "finger_uuid: %d\n", aperson->finger_uuid);
sprintf(leckmich, "finger_uuid: %u\n", aperson->finger_uuid);
Serial.print(leckmich);
@ -279,9 +281,9 @@ int update_pers_file(Beerbox *box, Person *aperson){
sprintf(leckmich, " %s\n", aperson->name);
write.write(tmp, strlen(tmp));
sprintf(leckmich, "rfid_uuid: %d\n", aperson->rfid_uuid);
sprintf(leckmich, "rfid_uuid: %s\n", aperson->rfid_uuid);
write.write(tmp, strlen(tmp));
sprintf(leckmich, "finger_uuid: %d\n", aperson->finger_uuid);
sprintf(leckmich, "finger_uuid: %u\n", aperson->finger_uuid);
write.write(tmp, strlen(tmp));
for(i = 0; i < NUM_OF_DRINKS; i++){