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