From 13bbc2d1b1c6300fed507d8362b82ce94a76f30e Mon Sep 17 00:00:00 2001 From: Alexander Junk Date: Mon, 13 Jul 2015 19:32:39 +0200 Subject: [PATCH] merge --- beerbox.h | 4 ++-- beerbox.ino | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/beerbox.h b/beerbox.h index 1ee1182..6a40410 100644 --- a/beerbox.h +++ b/beerbox.h @@ -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]; diff --git a/beerbox.ino b/beerbox.ino index 072db24..186c28e 100644 --- a/beerbox.ino +++ b/beerbox.ino @@ -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++){