Is there any way to force touch screen calibration only the first boot after flash? Thank you, Errol
Force Touch calibration after first boot.
Sorry, i wasn't clear. I want to automate calibration. The end user must be forced to do calibration after flash. I can't tell my end user that he must plug in a mouse to calibrate first. Thank you, Errol
I made following mecanism : I written an application that is launched when Windows CE starts up. This application reads a key in registry. If the key is not present, it deduces that it is the first start of the board after the flash. In this case, I force calibration (call of the TouchCalibrate() function). After that, the application creates the key in registry. If the key is present, then it's not the first start after flash. domdom
This was what i had in mind also. Maybe it should be built into the touch driver? :-) Thank you, Errol
Yes, it could be done into the touch driver... ;o) I just adapted to the mini2440 the solution I described in my previous post. You just have to create a subproject (console application, I called it TouchCalibrateAtFirstStart), copy the following source code in the main source. Don't forget to add following lines in .reg file of the subproject : [HKEY_LOCAL_MACHINE\Init] "Depend80"=hex:14,00,1E,00 "Launch80"="\\windows\\TouchCalibrateAtFirstStart.exe" domodom // TouchCalibrateAtFirstStart.cpp : Defines the entry point for the console application. // // This application launch touch calibration if the registry has been erased. // To detect the deletion of the registry, the application seeks a key in registry. // If the key is not found, he deduces that the registry has been cleared and launch touch calibration. // Once the calibration sequence, the key is created in the registry. // If the key is found, it search a subkey and verify its value. If subkey is not found or value is different of '1', // touch calibration is launched #include "stdafx.h" #include <windows.h> #include <pwinuser.h> #define FIRST_START_KEY L"SOFTWARE\\Domodom\\FirstStart" #define FIRST_START_SUBKEY_NAME L"Active" // This function is called at each first start after flash (when registry has been erased) void fct1erDemarrage(HKEY myKey) { long retour; DWORD dwValue = 0; DWORD dwSize = sizeof(dwValue); TouchCalibrate() ; // ajout de la clé retour = RegCreateKeyEx(HKEY_LOCAL_MACHINE, FIRST_START_KEY, 0, NULL, 0, 0, NULL, &myKey, NULL); if (retour == ERROR_SUCCESS ) { dwValue = 1; retour = RegSetValueEx(myKey, FIRST_START_SUBKEY_NAME, 0, REG_DWORD, (BYTE*)&dwValue, sizeof(dwSize)); } } int _tmain(int argc, TCHAR *argv[], TCHAR *envp[]) { boolean ret; long retour; HKEY myKey; DWORD dwValue = 0; DWORD dwSize = sizeof(dwValue); // S'agit-t-il d'un premier démarrage après un effacement de la registry ?? retour = RegOpenKeyEx(HKEY_LOCAL_MACHINE, FIRST_START_KEY, 0, 0, &myKey); if (retour != ERROR_SUCCESS) { // key not found -> it's the first start after flash fct1erDemarrage(myKey); } else { WCHAR valueName[500]; DWORD sizeValueName, type, sizeData, index; BYTE data[1000]; sizeValueName = 500; sizeData = 500; // we found the key, we verify the value of FIRST_START_SUBKEY_NAME subkey ret = 0; index = 0; while(ret == 0) { if (ret == 0) { ret = RegEnumValue(myKey, index, valueName, &sizeValueName, NULL, &type, data, &sizeData); if (ret == 0) { if (type == REG_DWORD) { // if subkey type is DWORD if (!wcscmp(FIRST_START_SUBKEY_NAME, valueName)) { // if subkey name == FIRST_START_SUBKEY_NAME // subkey found, we must verify its value if (data[0] != 1) { // value != 1 -> first start fct1erDemarrage(myKey); } else { break; // value == 1 -> not the first start } } } } else { // subkey not found -> first start fct1erDemarrage(myKey); break; } sizeValueName = 1000; sizeData = 1000; index++; } } } return 0; }
Hi, domdom or anyone Thank for your guid, I following your source code but I don't know the function "TouchCalibrate()" for use in fct1erDemarrage function. Can you give the detail or guid about TouchCalibrate() function me? ,it essential for me to try out this your example. Thank you for advance.
TouchCalibrate() is a Windows CE function, you can find its definition in C:\WINCE600\PUBLIC\COMMON\OAK\INC\pwinuser.h. You need to link your application with coreddl.lib. domdom
Lol. I included this code in the Touch Driver, calling it from the TSP_PowerON() function. From debug output i can see that it gets called, but i guess the system isn't booted far enough to display the TouchCalibrate screen... :( Now playing with nboot. will come back to this... Thanks, Errol
Good idea ! Maybe you could create a thread that waits 1 or 2 seconds before to execute my code, then ends itself ? I'm not sure, but I wonder if TSP_PowerON() is not called by power management... But in DdsiTouchPanelEnable() that seems to be called just 1 time at the beginning, you could create the thread I just described... I don't have time to test for the moment, I need to finish my SPI driver... domdom
Will look into it. But i first want to get power management working. Having trouble with the power button driver...
Here is the integrated touch driver + auto calibration. No more mouse needed to start calibration. :-) 1. Replace your touch driver with this one. 2. Delete the default calibration data in the BSP. The calibration data is in: Solution 'Mini2440' \Mini2440 \C:/WINCE600 \PLATFORM \Mini2440 \Parameter Files \platform.reg In the registry explorer go to HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\TOUCH and delete "CallibrationData". This data is for the 3.5" screen, i assume... Thanks, Errol
Hello. I am an student from Spain and i need calibrate the touch screen at first start. I have the friendly arm with the screen A70 and I am doing I follow the topic, but i do not the steps, because the Visual Studio works more than 2 hours and continued compiling the OS, and normally, the visual studio does the compiling in 15 minutes. First, i replace the original file "s3c2440a_touch.ccp" for the second file "s3c2440a_touch.ccp" (21.29KB). And second, i delete all the line that "CallibrationData".... in the file "platform.reg". So I can not compiling the OS. Could anyone helps me? Thanks