Commit fbc5816b8e954fb708b5e83f81aa606c3c4d1477

Authored by henyxia
1 parent bf0cbb04

UI should be updated by a NFC tag

Showing 2 changed files with 28 additions and 13 deletions   Show diff stats
... ... @@ -15,18 +15,20 @@
15 15 #define LOG_LENGTH 82
16 16 #define IPS 20
17 17 #define SCREEN_TIME 1000000/IPS
  18 +#define SC_HOME 0
  19 +#define SC_MAIN 0
18 20 #define SPACES " "
19   -char started[TIME_LENGTH];
20   -char uid[HEADER_TEXT_LENGTH];
21   -char uidDate[HEADER_TEXT_LENGTH];
22   -char cmd[LOG_LENGTH];
23   -pid_t mainPid;
24   -bool heat = false;
25   -bool pump = false;
  21 +char started[TIME_LENGTH];
  22 +char uid[HEADER_TEXT_LENGTH];
  23 +char cmd[LOG_LENGTH];
  24 +pid_t mainPid;
  25 +bool heat = false;
  26 +bool pump = false;
26 27 unsigned int temp = 1;
27 28 unsigned int debit = 1;
28   -struct termios old={0};
29   -bool uiStop = false;
  29 +struct termios old={0};
  30 +bool uiStop = false;
  31 +int actScreen = SC_HOME;
30 32  
31 33 void stopUI()
32 34 {
... ... @@ -55,7 +57,16 @@ void setDebit(unsigned int d)
55 57  
56 58 void processScreen()
57 59 {
58   -
  60 + if(actScreen == SC_HOME)
  61 + {
  62 + if(strcmp(uid, "") == 0)
  63 + return;
  64 + else
  65 + {
  66 + actScreen = SC_MAIN;
  67 + displayPicture("img/main.boz");
  68 + }
  69 + }
59 70 }
60 71  
61 72 void* drawUI(void* we)
... ... @@ -71,9 +82,9 @@ void* drawUI(void* we)
71 82  
72 83 void setTagName(char* tag)
73 84 {
74   - time_t now = time(NULL);
  85 + //time_t now = time(NULL);
75 86 strcpy(uid, tag);
76   - strftime(uidDate, HEADER_TEXT_LENGTH, "%F-%T:%d", localtime(&now));
  87 + //strftime(uidDate, HEADER_TEXT_LENGTH, "%F-%T:%d", localtime(&now));
77 88 }
78 89  
79 90 void initUILog()
... ... @@ -82,8 +93,12 @@ void initUILog()
82 93 started[0]='\0';
83 94 mainPid = getpid();
84 95 uid[0]='\0';
  96 +<<<<<<< Updated upstream
85 97 uidDate[0]='\0';
86 98 //initUSB();
  99 +=======
  100 + initUSB();
  101 +>>>>>>> Stashed changes
87 102 }
88 103  
89 104 void setStartTime(char* sT)
... ...
... ... @@ -47,7 +47,7 @@ void fillDataWithSubHeader(void)
47 47  
48 48 void sendUSBData(int i)
49 49 {
50   - printf("Sending data %d\n", i);
  50 + //printf("Sending data %d\n", i);
51 51 int transfered;
52 52 libusb_bulk_transfer(screenHandle, ENDPOINT_OUT, data, dataPointer, &transfered, 0);
53 53 dataPointer = 0;
... ...