Commit bc20374b302e433761bfc13013c2ce819522c876

Authored by henyxia
1 parent fbc5816b

Low IPS

Showing 3 changed files with 19 additions and 20 deletions   Show diff stats
@@ -15,7 +15,7 @@ int main(void) @@ -15,7 +15,7 @@ int main(void)
15 pthread_t tUI; 15 pthread_t tUI;
16 pthread_t tNFC; 16 pthread_t tNFC;
17 pthread_t tBUS; 17 pthread_t tBUS;
18 - //pthread_t tHVC; 18 + pthread_t tHVC;
19 initUILog(); 19 initUILog();
20 if(!initLog()) 20 if(!initLog())
21 { 21 {
@@ -38,21 +38,16 @@ int main(void) @@ -38,21 +38,16 @@ int main(void)
38 printx(ERROR, MAIN, "Unable to start the BUS interface\n"); 38 printx(ERROR, MAIN, "Unable to start the BUS interface\n");
39 return 3; 39 return 3;
40 } 40 }
41 - pthread_create(&tBUS, NULL, processBus, NULL);/* 41 + pthread_create(&tBUS, NULL, processBus, NULL);
42 if(!initHVC()) 42 if(!initHVC())
43 { 43 {
44 printx(ERROR, MAIN, "Unable to start the HVC interface\n"); 44 printx(ERROR, MAIN, "Unable to start the HVC interface\n");
45 return 4; 45 return 4;
46 } 46 }
47 -<<<<<<< Updated upstream  
48 - pthread_create(&tHVC, NULL, processHVC, NULL);*/  
49 - //initProcessHeat();  
50 -=======  
51 pthread_create(&tHVC, NULL, processHVC, NULL); 47 pthread_create(&tHVC, NULL, processHVC, NULL);
52 initProcessHeat(); 48 initProcessHeat();
53 setPumpOn(); 49 setPumpOn();
54 processHeat(NULL); 50 processHeat(NULL);
55 ->>>>>>> Stashed changes  
56 51
57 pthread_join(tUI, NULL); 52 pthread_join(tUI, NULL);
58 closeLog(); 53 closeLog();
@@ -13,10 +13,10 @@ @@ -13,10 +13,10 @@
13 #define HEADER_TEXT_LENGTH 24 13 #define HEADER_TEXT_LENGTH 24
14 #define LOG_LINES 35 14 #define LOG_LINES 35
15 #define LOG_LENGTH 82 15 #define LOG_LENGTH 82
16 -#define IPS 20 16 +#define IPS 2
17 #define SCREEN_TIME 1000000/IPS 17 #define SCREEN_TIME 1000000/IPS
18 #define SC_HOME 0 18 #define SC_HOME 0
19 -#define SC_MAIN 0 19 +#define SC_MAIN 1
20 #define SPACES " " 20 #define SPACES " "
21 char started[TIME_LENGTH]; 21 char started[TIME_LENGTH];
22 char uid[HEADER_TEXT_LENGTH]; 22 char uid[HEADER_TEXT_LENGTH];
@@ -59,7 +59,7 @@ void processScreen() @@ -59,7 +59,7 @@ void processScreen()
59 { 59 {
60 if(actScreen == SC_HOME) 60 if(actScreen == SC_HOME)
61 { 61 {
62 - if(strcmp(uid, "") == 0) 62 + if(uid[0] == '\0')
63 return; 63 return;
64 else 64 else
65 { 65 {
@@ -73,7 +73,7 @@ void* drawUI(void* we) @@ -73,7 +73,7 @@ void* drawUI(void* we)
73 { 73 {
74 while(!uiStop) 74 while(!uiStop)
75 { 75 {
76 - //processScreen(); 76 + processScreen();
77 usleep(SCREEN_TIME); 77 usleep(SCREEN_TIME);
78 } 78 }
79 79
@@ -93,12 +93,7 @@ void initUILog() @@ -93,12 +93,7 @@ void initUILog()
93 started[0]='\0'; 93 started[0]='\0';
94 mainPid = getpid(); 94 mainPid = getpid();
95 uid[0]='\0'; 95 uid[0]='\0';
96 -<<<<<<< Updated upstream  
97 - uidDate[0]='\0';  
98 - //initUSB();  
99 -=======  
100 initUSB(); 96 initUSB();
101 ->>>>>>> Stashed changes  
102 } 97 }
103 98
104 void setStartTime(char* sT) 99 void setStartTime(char* sT)
@@ -15,6 +15,13 @@ libusb_device_handle* screenHandle; @@ -15,6 +15,13 @@ libusb_device_handle* screenHandle;
15 unsigned char data[MAX_SIZE_OUT]; 15 unsigned char data[MAX_SIZE_OUT];
16 unsigned short dataPointer = 0; 16 unsigned short dataPointer = 0;
17 17
  18 +void blackScreen(void)
  19 +{
  20 + unsigned char data[] = {0x81, 0x00, 0x00};
  21 + int transfered;
  22 + libusb_bulk_transfer(screenHandle, ENDPOINT_OUT, data, 3, &transfered, 0);
  23 +}
  24 +
18 void fillDataWithHeader(void) 25 void fillDataWithHeader(void)
19 { 26 {
20 data[dataPointer] = 0x82; // HEADER 27 data[dataPointer] = 0x82; // HEADER
@@ -58,6 +65,7 @@ void displayPicture(char* filename) @@ -58,6 +65,7 @@ void displayPicture(char* filename)
58 { 65 {
59 FILE* file = NULL; 66 FILE* file = NULL;
60 file = fopen(filename, "r"); 67 file = fopen(filename, "r");
  68 + dataPointer = 0;
61 69
62 if(file == NULL) 70 if(file == NULL)
63 { 71 {
@@ -80,6 +88,11 @@ void displayPicture(char* filename) @@ -80,6 +88,11 @@ void displayPicture(char* filename)
80 if(dataPointer == MAX_SIZE_OUT) 88 if(dataPointer == MAX_SIZE_OUT)
81 sendUSBData(i); 89 sendUSBData(i);
82 } 90 }
  91 +
  92 + if(dataPointer != 0)
  93 + sendUSBData(-1);
  94 +
  95 + printf("Screen updated\n");
83 } 96 }
84 97
85 bool initUSB(void) 98 bool initUSB(void)
@@ -166,10 +179,6 @@ bool initUSB(void) @@ -166,10 +179,6 @@ bool initUSB(void)
166 179
167 libusb_free_config_descriptor(dConfig); 180 libusb_free_config_descriptor(dConfig);
168 181
169 - unsigned char data[] = {0x81, 0x00, 0x00};  
170 - int transfered;  
171 - libusb_bulk_transfer(screenHandle, ENDPOINT_OUT, data, 3, &transfered, 0);  
172 -  
173 displayPicture("img/home.boz"); 182 displayPicture("img/home.boz");
174 183
175 return true; 184 return true;