39 |
39 |
40 void Calibration_Init(void) |
40 void Calibration_Init(void) |
41 { |
41 { |
42 _fg = TFT_ORANGE; |
42 _fg = TFT_ORANGE; |
43 TFT_setFont(DEJAVU24_FONT, NULL); |
43 TFT_setFont(DEJAVU24_FONT, NULL); |
44 TFT_print("Scherm calibratie", CENTER, 60); |
44 TFT_print((char *)"Scherm calibratie", CENTER, 60); |
45 TFT_setFont(DEJAVU18_FONT, NULL); |
45 TFT_setFont(DEJAVU18_FONT, NULL); |
46 TFT_print("Druk op de oplichtende stippen", CENTER, 90); |
46 TFT_print((char *)"Druk op de oplichtende stippen", CENTER, 90); |
47 } |
47 } |
48 |
48 |
49 |
49 |
50 |
50 |
51 /* |
51 /* |
111 vTaskDelay(100 / portTICK_PERIOD_MS); |
111 vTaskDelay(100 / portTICK_PERIOD_MS); |
112 } |
112 } |
113 |
113 |
114 TFT_fillScreen(TFT_BLACK); |
114 TFT_fillScreen(TFT_BLACK); |
115 TFT_setFont(DEJAVU18_FONT, NULL); |
115 TFT_setFont(DEJAVU18_FONT, NULL); |
116 TFT_print("Scherm calibratie is klaar.", CENTER, 60); |
116 TFT_print((char *)"Scherm calibratie is klaar.", CENTER, 60); |
117 /* |
117 /* |
118 * Calculate the new calibration values. |
118 * Calculate the new calibration values. |
119 * The testdots were 10 pixels of the corners, |
119 * The testdots were 10 pixels of the corners, |
120 * so take that in account. |
120 * so take that in account. |
121 */ |
121 */ |
126 config.ts_ytop = ((cy[0] + cy[2] + cy[4] + cy[6]) / 4) + offset; |
126 config.ts_ytop = ((cy[0] + cy[2] + cy[4] + cy[6]) / 4) + offset; |
127 config.ts_ybottom = ((cy[1] + cy[3] + cy[5] + cy[7]) / 4) - offset; |
127 config.ts_ybottom = ((cy[1] + cy[3] + cy[5] + cy[7]) / 4) - offset; |
128 TS_set_calibration(config.ts_xleft, config.ts_xright, config.ts_ytop, config.ts_ybottom); |
128 TS_set_calibration(config.ts_xleft, config.ts_xright, config.ts_ytop, config.ts_ybottom); |
129 write_config(); |
129 write_config(); |
130 |
130 |
131 Buttons_Add(130, 200, 60, 40, "Ok", 0); |
131 Buttons_Add(130, 200, 60, 40, (char *)"Ok", 0); |
132 Buttons_Show(); |
132 Buttons_Show(); |
133 while (1) { |
133 while (1) { |
134 vTaskDelay(20 / portTICK_PERIOD_MS); |
134 vTaskDelay(20 / portTICK_PERIOD_MS); |
135 if (Buttons_Scan() == 0) { |
135 if (Buttons_Scan() == 0) { |
136 return; |
136 return; |