Hi everyone,
I have a problem with the touch screen of the pixxi13P2 which freezes after a while... Do you have any experience with this problem? If so, do you have any solutions for me?
You will find the code below :
Hope we can find a solution.
Best regards.
EDIT :
For more information, the screen freezes after about 5min
I have a problem with the touch screen of the pixxi13P2 which freezes after a while... Do you have any experience with this problem? If so, do you have any solutions for me?
You will find the code below :
Code:
#platform "pixxiLCD-13P2CT-CLB" #inherit "4DGL_16bitColours.fnc" #inherit "ledDigitsDisplay.inc" #inherit "VisualConst.inc" #inherit "V0Const.inc" var _state; var _n; var reply; var _trameEV[3] := [0x01, 0x02, 0x03]; var _trameData[3] := [0x01, 0x03, 0x04]; var _trameDefaut[3] := [0x01, 0x04, 0x05]; var _repTrame[16]; var _combuf[6]; var play := 0; var dataToSee:=0; var _hearth := 0; var _reverse := 0; var _nowTime := 0; var _bug := 0; var _chrono := 0; var _timeChrono := 0; var _time := 0; func main() com_Init(_combuf, 6, 0); com_SetBaud(COM0, 11520); pause(1000); media_Init() ; hndl := file_LoadImageControl(0, 0, 3); gfx_BGcolour(0xFFFF) ; touch_Set(TOUCH_ENABLE); gfx_Cls() ; img_ClearAttributes(hndl, iButtonSplash, I_TOUCH_DISABLE); img_Show(hndl, iButtonSplash); img_SetWord(hndl, iButtonSplash, IMAGE_INDEX, 0); img_Show(hndl,iButtonSplash) ; repeat /*txt_MoveCursor(10,10); print("HERE");*/ _state := touch_Get(TOUCH_STATUS); _n := img_Touched(hndl,-1) ; if(_state == TOUCH_PRESSED) if(_n == iButtonSplash) reply := "FORM1"; endif endif if(reply=="FORM1") img_SetAttributes(hndl, iButtonSplash, I_TOUCH_DISABLE); img_SetAttributes(hndl, Form1, I_TOUCH_DISABLE); Form1(); endif if(reply == "FORM2") Form2(); endif if(reply == "FORM4") Form4(); endif forever endfunc func Form1() gfx_Cls() ; gfx_BGcolour(0xFFFF) ; gfx_Cls() ; var _AlreadyTouch := 0; img_ClearAttributes(hndl, iMainButton, I_TOUCH_DISABLE); img_Show(hndl, iMainButton); img_SetWord(hndl, iMainButton, IMAGE_INDEX, 0); img_Show(hndl,iMainButton) ; dataToSee := 3; _nowTime := sys_T(); repeat _state := touch_Get(TOUCH_STATUS); _n := img_Touched(hndl,-1) ; if(_state == TOUCH_PRESSED) if(_n == iMainButton) while(_state == TOUCH_PRESSED) _state := touch_Get(TOUCH_STATUS); wend if(_AlreadyTouch == 0) _AlreadyTouch := 1; img_ClearAttributes(hndl, iInfoButton, I_TOUCH_DISABLE); img_Show(hndl, iInfoButton); img_SetWord(hndl, iInfoButton, IMAGE_INDEX, 0); img_Show(hndl,iInfoButton) ; img_ClearAttributes(hndl, iPlayButton, I_TOUCH_DISABLE); img_Show(hndl, iPlayButton); img_SetWord(hndl, iPlayButton, IMAGE_INDEX, play); img_Show(hndl,iPlayButton) ; img_ClearAttributes(hndl, iiBug, I_TOUCH_DISABLE); img_Show(hndl, iiBug); img_SetWord(hndl, iiBug, IMAGE_INDEX, _bug); img_Show(hndl,iiBug) ; img_ClearAttributes(hndl, iiClock, I_TOUCH_DISABLE); img_Show(hndl, iiClock); img_SetWord(hndl, iiClock, IMAGE_INDEX, 0); img_Show(hndl,iiClock); else _AlreadyTouch := 0; gfx_Cls() ; img_ClearAttributes(hndl, iMainButton, I_TOUCH_DISABLE); img_Show(hndl, iMainButton); img_SetWord(hndl, iMainButton, IMAGE_INDEX, _hearth); img_Show(hndl,iMainButton) ; endif endif if(_n == iPlayButton) if(_bug == 0) Data(0); if(play == 0) _time := sys_T(); play := 1; else if(play == 1) play := 0; endif img_SetWord(hndl, iPlayButton, IMAGE_INDEX, play); img_Show(hndl,iPlayButton) ; endif endif if(_n == iiBug) Data(2); if(_bug == 1) _bug := 0; else _bug := 1; endif play := 0; img_SetWord(hndl, iiBug, IMAGE_INDEX, _bug); img_Show(hndl,iiBug) ; img_SetWord(hndl, iPlayButton, IMAGE_INDEX, play); img_Show(hndl,iPlayButton) ; endif if(_n == iInfoButton) reply := "FORM2"; goto exit; endif if(_n == iiClock) reply := "FORM4"; goto exit; endif endif if(play == 1) checkTempo(); endif if(play == 0 && _AlreadyTouch == 1) img_SetWord(hndl, iPlayButton, IMAGE_INDEX, play); img_Show(hndl,iPlayButton) ; endif if(sys_T() >= (_nowTime + 500) && play == 1) _nowTime := sys_T(); Data(1); endif forever exit: img_SetAttributes(hndl, iPlayButton, I_TOUCH_DISABLE); img_SetAttributes(hndl, iMainButton, I_TOUCH_DISABLE); img_SetAttributes(hndl, iInfoButton, I_TOUCH_DISABLE); img_SetAttributes(hndl, iiClock, I_TOUCH_DISABLE); img_SetAttributes(hndl, iiBug, I_TOUCH_DISABLE); img_SetAttributes(hndl, Form2, I_TOUCH_DISABLE); gfx_Cls() ; endfunc func checkTempo() if(play == 1 && _chrono == 1 && sys_T() >= (_time + (_timeChrono * 1000))) Data(0); play := 0; endif endfunc func Form2() img_ClearAttributes(hndl, iBackArrow, I_TOUCH_DISABLE); img_Show(hndl, iBackArrow); img_SetWord(hndl, iBackArrow, IMAGE_INDEX, 0); img_Show(hndl,iBackArrow) ; img_ClearAttributes(hndl, iDownArrow, I_TOUCH_DISABLE); img_Show(hndl, iDownArrow); img_SetWord(hndl, iDownArrow, IMAGE_INDEX, 0); img_Show(hndl,iDownArrow) ; img_ClearAttributes(hndl, iiUpButton, I_TOUCH_DISABLE); img_Show(hndl, iiUpButton); img_SetWord(hndl, iiUpButton, IMAGE_INDEX, 0); img_Show(hndl,iiUpButton) ; img_SetWord(hndl, iIrradianceMeter, IMAGE_INDEX, 0) ; img_Show(hndl,iIrradianceMeter) ; _nowTime := sys_T(); dataToSee := 0; repeat _state := touch_Get(TOUCH_STATUS); _n := img_Touched(hndl,-1) ; if(_state == TOUCH_PRESSED) if(_n == iBackArrow) reply := "FORM1"; goto exit; endif if(_n == iDownArrow && dataToSee != 2) dataToSee := dataToSee + 1; UIChange(dataToSee); else if(_n == iDownArrow && dataToSee == 2) dataToSee := 0; UIChange(dataToSee); endif if(_n == iiUpButton && dataToSee != 0) dataToSee := dataToSee - 1; UIChange(dataToSee); else if(_n == iiUpButton && dataToSee == 0) dataToSee := 2; UIChange(dataToSee); endif endif checkTempo(); if(sys_T() >= (_nowTime + 250)) _nowTime := sys_T(); Data(1); endif forever exit: img_SetAttributes(hndl, iBackArrow, I_TOUCH_DISABLE); img_SetAttributes(hndl, iDownArrow, I_TOUCH_DISABLE); img_SetAttributes(hndl, iiUpButton, I_TOUCH_DISABLE); //img_SetAttributes(hndl, Form3, I_TOUCH_DISABLE); gfx_Cls() ; endfunc func Form4() gfx_Cls() ; gfx_BGcolour(0xFFFF) ; gfx_Cls() ; img_Show(hndl, iiChrono); ledDigitsDisplay(_timeChrono, iiChrono+1, 64, 3, 1, 40, 0) ; img_ClearAttributes(hndl, iiOnOffChrono, I_TOUCH_DISABLE); img_Show(hndl, iiOnOffChrono); img_SetWord(hndl, iiOnOffChrono, IMAGE_INDEX, _chrono); img_Show(hndl,iiOnOffChrono) ; img_ClearAttributes(hndl, iiBackChrono, I_TOUCH_DISABLE); img_Show(hndl, iiBackChrono); img_SetWord(hndl, iiBackChrono, IMAGE_INDEX, 0); img_Show(hndl,iiBackChrono) ; img_ClearAttributes(hndl, iiUpChrono, I_TOUCH_DISABLE); img_Show(hndl, iiUpChrono); img_SetWord(hndl, iiUpChrono, IMAGE_INDEX, 0); img_Show(hndl,iiUpChrono) ; img_ClearAttributes(hndl, iiDownChrono, I_TOUCH_DISABLE); img_Show(hndl, iiDownChrono); img_SetWord(hndl, iiDownChrono, IMAGE_INDEX, 0); img_Show(hndl,iiDownChrono) ; repeat _state := touch_Get(TOUCH_STATUS); _n := img_Touched(hndl,-1) ; if(_state == TOUCH_PRESSED) while(_state == TOUCH_PRESSED) _state := touch_Get(TOUCH_STATUS); wend if(_n == iiOnOffChrono) if(_chrono == 0) _chrono := 1; else _chrono := 0; endif img_SetWord(hndl, iiOnOffChrono, IMAGE_INDEX, _chrono); img_Show(hndl,iiOnOffChrono) ; endif if(_n == iiUpChrono && _chrono == 1) if(_timeChrono <= 995) _timeChrono := _timeChrono + 5; endif ledDigitsDisplay(_timeChrono, iiChrono+1, 64, 3, 1, 40, 0) ; endif if(_n == iiDownChrono && _chrono == 1) if(_timeChrono > 0) _timeChrono := _timeChrono - 5; endif ledDigitsDisplay(_timeChrono, iiChrono+1, 64, 3, 1, 40, 0) ; endif if(_n == iiBackChrono) reply := "FORM1"; goto exit; endif endif checkTempo(); forever exit: if(_chrono == 1 && _timeChrono == 0) _chrono := 0; endif img_SetAttributes(hndl, iiOnOffChrono, I_TOUCH_DISABLE); img_SetAttributes(hndl, iiBackChrono, I_TOUCH_DISABLE); img_SetAttributes(hndl, iiUpChrono, I_TOUCH_DISABLE); img_SetAttributes(hndl, iiDownChrono, I_TOUCH_DISABLE); endfunc func UIChange(var ui) gfx_Cls() ; img_ClearAttributes(hndl, iDownArrow, I_TOUCH_DISABLE); img_Show(hndl, iDownArrow); img_SetWord(hndl, iDownArrow, IMAGE_INDEX, 0); img_Show(hndl,iDownArrow) ; img_ClearAttributes(hndl, iBackArrow, I_TOUCH_DISABLE); img_Show(hndl, iBackArrow); img_SetWord(hndl, iBackArrow, IMAGE_INDEX, 0); img_Show(hndl,iBackArrow) ; img_ClearAttributes(hndl, iiUpButton, I_TOUCH_DISABLE); img_Show(hndl, iiUpButton); img_SetWord(hndl, iiUpButton, IMAGE_INDEX, 0); img_Show(hndl,iiUpButton) ; switch(ui) case 0 : img_SetWord(hndl, iIrradianceMeter, IMAGE_INDEX, 0) ; img_Show(hndl,iIrradianceMeter) ; break; case 1 : img_SetWord(hndl, iITemperatureMeter, IMAGE_INDEX, 0) ; img_Show(hndl,iITemperatureMeter) ; break; case 2 : img_Show(hndl, iIDebit); ledDigitsDisplay(0, iIDebit+1, 68, 4, 3, 30, 0) ; img_Show(hndl,iILabLPM) ; break; endswitch ReadData(); endfunc func Data(var _dataToSend) var _i; if(_dataToSend == 0) for(_i := 0; _i < 3 ; _i++) serout(_trameEV[_i]); next else if(_dataToSend == 1) for(_i := 0; _i < 3 ; _i++) serout(_trameData[_i]); next else for(_i := 0; _i < 3 ; _i++) serout(_trameDefaut[_i]); next endif pause(100); if(_dataToSend == 1) ReadData(); endif endfunc func ReadData() if(com_Count() > 0) var _i; for(_i := 0; _i < 6 ; _i++) _repTrame[_i] := serin(); next MajUI(); else com_Init(_combuf, 6, 0); endif endfunc func MajUI() switch(dataToSee) case 0 : if(_repTrame[5] == 1) img_SetWord(hndl, iIrradianceMeter, IMAGE_INDEX, 100) ; img_Show(hndl,iIrradianceMeter) ; else img_SetWord(hndl, iIrradianceMeter, IMAGE_INDEX, 0) ; img_Show(hndl,iIrradianceMeter) ; endif break; case 1 : img_SetWord(hndl, iITemperatureMeter, IMAGE_INDEX, _repTrame[0]) ; img_Show(hndl,iITemperatureMeter) ; break; case 2 : if(_repTrame[1] != -1 && _repTrame[2] != -1) ledDigitsDisplay((_repTrame[1] * 255 + _repTrame[2])/10, iIDebit+1, 68, 4, 3, 30, 0) ; img_Show(hndl,iILabLPM) ; else ledDigitsDisplay(0, iIDebit+1, 68, 4, 3, 30, 0) ; img_Show(hndl,iILabLPM) ; endif break; case 3: if(_repTrame[5] == 1) if(_hearth == 3) _reverse := 1; endif if(_hearth == 0) _reverse := 0; endif if(_reverse == 1) _hearth--; else _hearth++; endif else if(_repTrame[5] == 2) _hearth := 4; else _hearth := 0; endif img_SetWord(hndl, iMainButton, IMAGE_INDEX, _hearth); img_Show(hndl,iMainButton) ; break; endswitch endfunc
Best regards.
EDIT :
For more information, the screen freezes after about 5min
Comment