This example demonstrates how to put the display in "sleep mode" after there has been no touch screen activity for a period of time. Powerview displays do not have a processor level sleep mode however the backlight can be turned off which saves a significant amount of power. See display specifications for a listing of the backlight power consumption.
Download the Example Here (created in 4.797 for a PV1100)
To monitor touch screen activity we can make use of a touch screen system variables "allow invalid" property and set its delay to the desired timeout. A variable will go invalid if its application does not refresh the variable periodically with data. The touch screen application will update the touch.current.x variable only when an activated touch element is pressed. We can use this to our advantage and monitor the state of the variable by calling the function "isvalid in a expression. If it has gone invalid that indicates the touch screen has not been actuated by an operator and the backlight can be turned off. Once it becomes active then the backlight can be turned back on.
example: isvalid(Touch_Current_X)
An activity program is used to check the state of the variable once a second and determine if the backlight should be turned on or off. Please note that when the display is first booted the "isvalid" state is not initialized so we have to write a fake value to touch.current.x to seed the invalid state timer.
There is another problem that must be solved and that is once the backlight is turned off the operator may inadvertently press a touch button that then performs an undesired action. For this reason along with turning the backlight off we must switch to a pop-up view that blocks all other touches. Secondarily when the backlight is off you can still see the image on the LCD under the right lighting conditions and angle so the pop-up can be a black rectangle to black out the screen.
Notes are included in the activity program to describe the logic flow.
Comments
0 comments
Please sign in to leave a comment.