CN106249872B - A kind of control method of proximity sensor, device and mobile terminal - Google Patents

A kind of control method of proximity sensor, device and mobile terminal Download PDF

Info

Publication number
CN106249872B
CN106249872B CN201610555614.5A CN201610555614A CN106249872B CN 106249872 B CN106249872 B CN 106249872B CN 201610555614 A CN201610555614 A CN 201610555614A CN 106249872 B CN106249872 B CN 106249872B
Authority
CN
China
Prior art keywords
proximity sensor
proximity
decision threshold
threshold
values
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610555614.5A
Other languages
Chinese (zh)
Other versions
CN106249872A (en
Inventor
张强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201610555614.5A priority Critical patent/CN106249872B/en
Publication of CN106249872A publication Critical patent/CN106249872A/en
Application granted granted Critical
Publication of CN106249872B publication Critical patent/CN106249872B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/011Arrangements for interaction with the human body, e.g. for user immersion in virtual reality
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/042Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means by opto-electronic means
    • G06F3/0421Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means by opto-electronic means by interrupting or reflecting a light beam, e.g. optical touch-screen
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/03Arrangements for converting the position or the displacement of a member into a coded form
    • G06F3/041Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means
    • G06F3/043Digitisers, e.g. for touch screens or touch pads, characterised by the transducing means using propagating acoustic waves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2203/00Indexing scheme relating to G06F3/00 - G06F3/048
    • G06F2203/041Indexing scheme relating to G06F3/041 - G06F3/045
    • G06F2203/041012.5D-digitiser, i.e. digitiser detecting the X/Y position of the input means, finger or stylus, also when it does not touch, but is proximate to the digitiser's interaction surface and also measures the distance of the input means within a short range in the Z direction, possibly with a separate measurement setup

Abstract

The embodiment of the invention discloses a kind of control method of proximity sensor, device and mobile terminals.This method comprises: obtaining the current proximity values of proximity sensor;Proximity values constant interval is set according to current proximity values, proximity sensor is written using two boundary values of constant interval as the upper limit threshold of first kind decision threshold and lower threshold;When receiving close/separate Status Change interruption that proximity sensor is generated based on first kind decision threshold, enables preset threshold dynamic adjustment algorithm and dynamic adjustment is carried out to the upper limit threshold and lower threshold of first kind decision threshold, obtain the second class decision threshold;Control proximity sensor is carried out based on the second class decision threshold close to the/judgement far from state.The embodiment of the present invention can avoid that data are rapidly frequently written into threshold register, can reduce the burden of system, can also reduce the loss of proximity sensor chip by using above-mentioned technical proposal.

Description

A kind of control method of proximity sensor, device and mobile terminal
Technical field
The present embodiments relate to technical field of mobile terminals more particularly to a kind of control methods of proximity sensor, dress It sets and mobile terminal.
Background technique
Currently, proximity sensor has become the standard configuration of mobile terminal, mobile terminal can be realized using proximity sensor In various functions, for example, call when prevent because face touch screen cause maloperation, adjust automatically backlight and touch screen to put out Shield gesture identification etc..
The measured value of proximity sensor is referred to alternatively as close to (proximity) value, and proximity values can be used for indicating approaching sensing The size of the distance between device and object.In order to allow proximity sensor detection object close to/far from state, can generally set in advance Set decision threshold, decision threshold is generally comprised close to threshold value and far from threshold value, by comparing current proximity values and decision threshold it Between size relation come to close to/determine far from state.
However, may have several factors influences the measured value of proximity sensor in the use process of mobile terminal, Such as the working condition and the use state of user etc. of environmental factor, proximity sensor itself all can be to the surveys of proximity sensor Magnitude impacts.In order to guarantee that close/separate state of accurate judgement needs after proximity sensor is enabled using threshold value Dynamic adjustment algorithm dynamically adjusts decision threshold, which can generally be operated with faster speed (period of such as 100ms) and be connect The threshold register of nearly sensor chip, i.e., data are rapidly written into threshold register, not only will increase system in this way Burden, but also will increase the loss of proximity sensor chip.
Summary of the invention
The purpose of the embodiment of the present invention is that a kind of control method of proximity sensor, device and mobile terminal are provided, with excellent Change the existing scheme controlled proximity sensor.
In a first aspect, the embodiment of the invention provides a kind of control methods of proximity sensor, comprising:
Obtain the current proximity values of proximity sensor;
Proximity values constant interval is set according to the current proximity values, two boundary values of the constant interval are made respectively The proximity sensor is written for the upper limit threshold and lower threshold of first kind decision threshold, wherein at the current proximity values In in set proximity values constant interval;
It receives in close/separate Status Change that the proximity sensor is generated based on the first kind decision threshold When disconnected, enable preset threshold dynamic adjustment algorithm and dynamic is carried out to the upper limit threshold and lower threshold of the first kind decision threshold Adjustment, obtains the second class decision threshold;
The proximity sensor is controlled to carry out based on the second class decision threshold close to the/judgement far from state.
Second aspect, the embodiment of the invention provides a kind of control devices of proximity sensor, comprising:
Proximity values obtain module, for obtaining the current proximity values of proximity sensor;
Constant interval setting module, for setting proximity values constant interval according to the current proximity values, wherein described to work as Preceding proximity values are in set proximity values constant interval;
First kind decision threshold determining module, for sentencing two boundary values of the constant interval as the first kind The proximity sensor is written in the upper limit threshold and lower threshold for determining threshold value;
Second class decision threshold determining module, for receiving the proximity sensor based on the first kind decision threshold When close/separate Status Change for being worth and generating is interrupted, enabling preset threshold dynamic adjustment algorithm is to the first kind decision threshold The upper limit threshold and lower threshold of value carry out dynamic adjustment, obtain the second class decision threshold;
State determines control module, is connect for controlling the proximity sensor based on the second class decision threshold Closely/judgement far from state.
The third aspect, the embodiment of the invention provides a kind of mobile terminal, the mobile terminal is integrated with implementation of the present invention The control device of proximity sensor described in example.
The control program of the proximity sensor provided in the embodiment of the present invention obtains the current proximity values of proximity sensor, Proximity values constant interval is set according to current proximity values, using two boundary values of constant interval as first kind decision threshold Upper limit threshold and lower threshold be written proximity sensor, receive proximity sensor and generated based on first kind decision threshold It when close/separate Status Change is interrupted, can illustrate that certain variation has occurred in proximity values, enable preset threshold dynamic again at this time and adjust Whole algorithm carries out dynamic adjustment to the upper limit threshold and lower threshold of first kind decision threshold, obtains the second class decision threshold, controls Proximity sensor processed is carried out based on the second class decision threshold close to the/judgement far from state.By using above-mentioned technical side Case enables preset threshold dynamic adjustment algorithm just when proximity values change a lot to determine decision threshold, avoids frequently fast Data are written into the threshold register of proximity sensor in fast ground, can reduce the burden of system, and then save mobile terminal power consumption, The loss of proximity sensor chip can also be reduced.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of the control method for proximity sensor that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow diagram of the control method of proximity sensor provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of flow diagram of the control method for preferred proximity sensor that the embodiment of the present invention three provides;
Fig. 4 is the structural block diagram of the control device for the proximity sensor that the embodiment of the present invention four provides.
Specific embodiment
To further illustrate the technical scheme of the present invention below with reference to the accompanying drawings and specific embodiments.It is understood that It is that specific embodiment described herein is used only for explaining the present invention rather than limiting the invention.It further needs exist for illustrating , only the parts related to the present invention are shown for ease of description, in attached drawing rather than entire infrastructure.
It should be mentioned that some exemplary embodiments are described as before exemplary embodiment is discussed in greater detail The processing or method described as flow chart.Although each step is described as the processing of sequence by flow chart, many of these Step can be implemented concurrently, concomitantly or simultaneously.In addition, the sequence of each step can be rearranged.When its operation The processing can be terminated when completion, it is also possible to have the additional step being not included in attached drawing.The processing can be with Corresponding to method, function, regulation, subroutine, subprogram etc..
Embodiment one
Fig. 1 is a kind of flow diagram of the control method for proximity sensor that the embodiment of the present invention one provides, this method It can be executed by the control device of proximity sensor, wherein the device can be implemented by software and/or hardware, and can generally be integrated in shifting In dynamic terminal.As shown in Figure 1, this method comprises:
Step 101, the current proximity values for obtaining proximity sensor.
Illustratively, the concretely mobile phone, smartwatch, tablet computer, game machine, a of the mobile terminal in the present embodiment Personal digital assistant and digital multimedia player etc. are configured with the various equipment of proximity sensor.
Proximity sensor in the present embodiment can be the proximity sensor of any one type, as long as can recognize that outer Boundary's object close to or away from movement, for example, it may be infrared proximity transducer or ultrasonic type proximity sensor etc. Deng.Proximity sensor generally measures object with the variation of the distance between measured external object and proximity sensor value Close to or away from the measured value of proximity sensor is referred to alternatively as proximity values, and proximity values can be used for indicating proximity sensor and object The size of the distance between body.Relationship between proximity values and distance value can be directly proportional or inversely proportional, tool Body can be determined according to the working principle of proximity sensor.Threshold register in proximity sensor can be stored for determining to connect Closely/decision threshold far from state, the decision threshold generally comprise upper limit threshold and lower threshold, when proximity values are by being less than the upper limit Threshold value becomes greater than upper limit threshold, or from when becoming smaller than lower threshold greater than lower threshold, proximity sensor can be generated and be connect Closely/interrupted far from Status Change, illustrate that close/separate state is changed.It is close/to interrupt far from Status Change including two kinds Change is interrupted, i.e., is interrupted from the change for becoming proximity state far from state and become in the change far from state from proximity state It is disconnected.
By taking infrared proximity transducer as an example, infrared proximity transducer is built-in with infrared transmitting tube and infrared receiving tube, infrared Transmitting tube launches outward infrared ray, detects infra-red intensity received by infrared receiving tube to measure the distance of object distance, Infrared proximity transducer can convert the infra-red intensity measured to the measured value with its proportional, can be by the measurement Value is known as proximity values.In general, proximity values can be the analog-digital converter (Analog-to-Digital in infrared proximity transducer Converter, ADC) output valve, abbreviation ADC value or AD value.It is understood that proximity values are bigger, illustrate external object away from It is closer from infrared proximity transducer, it is possible to think that the proximity values of infrared proximity transducer and distance value are inversely proportional relationships 's.For infrared proximity transducer, the upper limit threshold of decision threshold is close to threshold value, and lower threshold is far from threshold value.When When proximity values are greater than close to threshold value, it can determine that as proximity state;When proximity values are less than far from threshold value, can determine that as far from shape State;When proximity values are in far from threshold value and close between threshold value, keep state when last judgement constant.
The specific opportunity of current proximity values for obtaining proximity sensor is not construed as limiting in this step, it illustratively, can be When detecting proximity sensor starting, the current proximity values of proximity sensor are obtained;Connecing for proximity sensor can also received Closely/far from Status Change interrupt after, obtain the current proximity values of proximity sensor;It can also be in the specified operation for detecting user When, obtain the current proximity values of proximity sensor.
Step 102 sets proximity values constant interval according to current proximity values, and two boundary values of constant interval are made respectively Proximity sensor is written for the upper limit threshold and lower threshold of first kind decision threshold.
Wherein, the current proximity values are in set proximity values constant interval.
Illustratively, the purpose of scheme of the present embodiment, then is opened when judging that current proximity values have greatly changed Dynamic preset threshold dynamic adjustment algorithm, and proximity values constant interval is exactly the variation degree in order to measure current proximity values, so, The setting of proximity values constant interval can current proximity values are changed utmostly to be determined according to allowing.It is understood that It is that the range of proximity values constant interval is smaller, easier starting preset threshold dynamic adjustment algorithm.
Proximity values constant interval can be regarded as a value range of proximity values, which includes upper boundary values under Boundary value, general upper boundary values are greater than lower border value, so upper boundary values correspond to the upper limit threshold of first kind decision threshold, below Dividing value corresponds to the lower threshold of first kind decision threshold.
Preferably, proximity values constant interval is set according to current proximity values can include: multiply on the basis of current proximity values With the first ratio value, the upper boundary values of proximity values constant interval are obtained, the first ratio value is greater than 1;On the basis of current proximity values On multiplied by the second ratio value, obtain the lower border value of proximity values constant interval, the second ratio value is less than 1.Further, the first ratio Example value is equal to the difference of 1 with the second ratio value with 1 difference, that is, the first ratio value of note is a, and the second ratio value of note is b, then a-1= 1-b=c.The value of c can freely be set, such as can utmostly be determined according to the current proximity values of permission are changed.Example Such as, current proximity values are 100, c=20%, then a=120%, b=80%, then set proximity values constant interval is [80,120], then upper boundary values are 120, lower border value 80, by the 120 upper limit threshold write-in as first kind decision threshold The threshold register of proximity sensor is written in proximity sensor, by the 80 lower threshold write-in as first kind decision threshold Proximity sensor.
Step 103 receives in close/separate Status Change that proximity sensor is generated based on first kind decision threshold When disconnected, enable preset threshold dynamic adjustment algorithm and dynamic tune is carried out to the upper limit threshold and lower threshold of first kind decision threshold It is whole, obtain the second class decision threshold.
Illustratively, when receive that proximity sensor generated based on first kind decision threshold close to/become far from state When more interrupting, it can illustrate that biggish variation has occurred in proximity values, preset threshold dynamic adjustment algorithm can be started at this time to the first kind The upper limit threshold and lower threshold of decision threshold carry out dynamic adjustment, obtain the second class decision threshold.Preset threshold dynamic adjusts Algorithm may include according to use state of environmental factor, the working condition of proximity sensor itself or user etc. come to decision threshold Value carries out the algorithm of dynamic adjustment.For example, environmental factor may include ambient light intensity etc. for infrared proximity transducer; The working condition of proximity sensor itself may include proximity sensor surface with the presence or absence of chaff interferents such as greasy dirts;User's uses shape State may include judging whether the distance between proximity sensor and user are less than pre-determined distance value etc..The present embodiment is to default threshold The specific calculation of value dynamic adjustment algorithm is not construed as limiting.It, can be very fast after preset threshold dynamic adjustment algorithm is activated Speed (such as 50ms) read proximity values, and calculate the upper limit threshold and lower threshold of the second class decision threshold.
Step 104, control proximity sensor are carried out based on the second class decision threshold close to the/judgement far from state.
It illustratively, is to consider a variety of influences according to the second class decision threshold that preset threshold dynamic adjustment algorithm obtains Decision threshold obtained from factor can more accurately determine close/separate state.
The control method for the proximity sensor that the embodiment of the present invention one provides, obtains the current proximity values of proximity sensor, Proximity values constant interval is set according to current proximity values, using two boundary values of constant interval as first kind decision threshold Upper limit threshold and lower threshold be written proximity sensor, receive proximity sensor and generated based on first kind decision threshold It when close/separate Status Change is interrupted, can illustrate that certain variation has occurred in proximity values, enable preset threshold dynamic again at this time and adjust Whole algorithm carries out dynamic adjustment to the upper limit threshold and lower threshold of first kind decision threshold, obtains the second class decision threshold, controls Proximity sensor processed is carried out based on the second class decision threshold close to the/judgement far from state.By using above-mentioned technical side Case enables preset threshold dynamic adjustment algorithm just when proximity values change a lot to determine decision threshold, avoids frequently fast Data are written into threshold register for fast ground, can reduce the burden of system, and then save mobile terminal power consumption, can also reduce close The loss of sensor chip.
Embodiment two
Fig. 2 is a kind of flow diagram of the control method of proximity sensor provided by Embodiment 2 of the present invention, this implementation Example generates close/separate Status Change based on each decision threshold based on above-described embodiment, to proximity sensor is received Mechanism is reported to be optimized when interruption.In the present embodiment, proximity sensor is being received based on first kind decision threshold And when close/separate Status Change interruption of generation, forbid reporting close/separate Status Change event to upper layer;It is connect in control It further include receiving close to sensing after nearly sensor carries out close/judgement far from state based on the second class decision threshold When close/separate Status Change that device is generated based on the second class decision threshold is interrupted, close/separate state change is reported to upper layer More event.
Correspondingly, the method for the present embodiment includes the following steps:
Step 201, the current proximity values for obtaining proximity sensor.
Step 202 sets proximity values constant interval according to current proximity values, and two boundary values of constant interval are made respectively Proximity sensor is written for the upper limit threshold and lower threshold of first kind decision threshold.
Step 203, receive that proximity sensor generated based on first kind decision threshold close to/far from Status Change When interruption, forbid reporting close/separate Status Change event to upper layer.
In existing scheme, mobile terminal receive that proximity sensor generated based on decision threshold close to/it is separate When Status Change is interrupted, need to report close/separate Status Change event to upper layer (such as application layer), so that mobile terminal execution Corresponding operation, such as put out screen or bright screen.Wherein, close to/far from Status Change event include two kinds of altering events, i.e., by Become the altering event of proximity state far from state and the altering event far from state is become from proximity state.The embodiment of the present invention In first kind decision threshold be not actually in order to determine close to/far from state, but in order to judge the variation of proximity values Whether certain range is had exceeded, so generating close/separate state when proximity sensor is based on first kind decision threshold and becoming When more interrupting, it can be shown that close/separate state does not change currently, be only possible to change in a short time, institute To need to forbid reporting close/separate Status Change event to upper layer, prevent mobile terminal execution corresponding with the change terminal It operates and causes close to/erroneous judgement the problem far from state.
Preferably, receive that proximity sensor generated based on first kind decision threshold close to/far from Status Change After interruption, it may also include control proximity sensor and nullify close/separate Status Change generated based on first kind decision threshold It interrupts.It for most proximity sensor chips, is alternately produced close to far from change interruption, i.e., if current generate (hereinafter referred to as close to interrupt) is interrupted in change from becoming proximity state far from state, then can only generate by approaching next time State becomes the change far from state and interrupts (hereinafter referred to as far from interruption), and vice versa.Assuming that being based on first kind decision threshold It producing close to interruption, can illustrate that proximity values increasing degree is larger, have close to trend, mobile terminal is likely to have close to movement, It is carried out based on the second class decision threshold close to when/judgement far from state in subsequent step, it is likely that need to generate again and connect It is close to interrupt, so eliminating this proximity state machine at this time close to interruption cancellation.The present embodiment is nullified specific Mode is not construed as limiting, and can be determined according to specific chip type.For example, can be infused by operating the enable bit of proximity sensor (reopen and close a proximity sensor) is interrupted in pin change, and the status register etc. for changing interruption also can be read Deng.
Step 204 enables preset threshold dynamic adjustment algorithm to the upper limit threshold and lower threshold of first kind decision threshold Dynamic adjustment is carried out, the second class decision threshold is obtained.
Step 205, control proximity sensor are carried out based on the second class decision threshold close to the/judgement far from state.
Step 206, receive that proximity sensor generated based on the second class decision threshold close to/far from Status Change When interruption, close/separate Status Change event is reported to upper layer.
In the embodiment of the present invention, the second class decision threshold is sentenced for what is determined really close/separate state Determine threshold value, so, it is interrupted receiving close/separate Status Change that proximity sensor is generated based on the second class decision threshold When, it needs to report close/separate Status Change event to upper layer, so that mobile terminal execution corresponding operation.
The control method of proximity sensor provided by Embodiment 2 of the present invention is generated and is connect according to different decision thresholds Closely/far from Status Change interrupt when, mechanism is reported using different altering events, mitigate system burden, reduce close to sensing While device chip is lost, guarantee to effectively prevent the mistake of mobile terminal to grasp close to/accurately reporting far from Status Change event Make.
Embodiment three
Fig. 3 is a kind of flow diagram of the control method for preferred proximity sensor that the embodiment of the present invention three provides, The present embodiment is optimized based on above-described embodiment, step " the current proximity values for obtaining proximity sensor " can include: When detecting proximity sensor starting, initial decision threshold is set;Determining that current state is remote based on initial decision threshold When from state, the current proximity values of proximity sensor are obtained.
Further, it controls the proximity sensor and close/separate state is carried out based on the second class decision threshold After judgement, it may also include that and receiving that proximity sensor generated based on the second class decision threshold by proximity state Become repeating the current proximity values for obtaining proximity sensor, and according to currently connecing after the change far from state interrupts The relevant operation of close values setting proximity values constant interval.
It will be interrupted referred to as from the change for becoming proximity state far from state close to interrupting, will be become from proximity state below Change far from state is interrupted referred to as far from interrupting, will be referred to as close from the altering event for becoming proximity state far from state Event will become the altering event far from state referred to as far from event from proximity state.
Correspondingly, the method for the present embodiment includes the following steps:
Step 301, detect proximity sensor starting when, initial decision threshold is set.
Illustratively, proximity sensor starting can be regarded as proximity sensor and be enabled, i.e., some application program is to close Sensor is called and opens proximity sensor.Initial decision threshold includes initial upper limit threshold value and initial lower threshold, It can be arranged by system default.
Step 302, when determining that current state is far from state based on initial decision threshold, obtain working as proximity sensor Preceding proximity values.
In general, user, during using mobile terminal, external object is in relative to proximity sensor far from shape The time of state is generally longer than the time in proximity state, so can obtain when current state is far from state close to sensing The current proximity values of device, the subsequent variation degree to proximity values is measured, if changing greatly, then is enabled preset threshold dynamic and is adjusted Whole algorithm.
Step 303 sets proximity values constant interval according to current proximity values, and two boundary values of constant interval are made respectively Proximity sensor is written for the upper limit threshold and lower threshold of first kind decision threshold.
Step 304, receive that proximity sensor generated based on first kind decision threshold close to/far from interrupting when, Forbid reporting close/separate event to upper layer, and controls proximity sensor and nullify based on first kind decision threshold connecing for generating Closely/far from interruption.
Step 305 enables preset threshold dynamic adjustment algorithm to the upper limit threshold and lower threshold of first kind decision threshold Dynamic adjustment is carried out, the second class decision threshold is obtained.
Step 306, control proximity sensor are carried out based on the second class decision threshold close to the/judgement far from state.
Step 307 is receiving that proximity sensor generated based on the second class decision threshold close to when interruption, to upper layer It reports close to event, and terminates the operation of preset threshold dynamic adjustment algorithm, continue control proximity sensor and sentenced based on the second class Determine threshold value to carry out close to/the judgement far from state.
It should be noted that the algorithm is real time execution after preset threshold dynamic adjustment algorithm is activated, so the Two class decision thresholds are constantly to obtain dynamically adjusting according to situations such as environment, device working condition and user's use state , namely receiving that proximity sensor generated based on the second class decision threshold close to before interruption, preset threshold dynamic Adjustment algorithm can dynamically calculate the second class decision threshold, be produced until receiving proximity sensor based on the second class decision threshold It is raw close to when interruption, terminate the operation of preset threshold dynamic adjustment algorithm.Then, keep the second class decision threshold constant, and Continue to control the judgement that proximity sensor carries out close/separate state based on the second class decision threshold.
Step 308, when receiving the separate interruption that proximity sensor is generated based on the second class decision threshold, to upper layer It reports far from event.
Step 309, the current proximity values for obtaining proximity sensor, and return to step 303.
Preferably, it can be opened at the time of receiving the separate interruption that proximity sensor is generated based on the second class decision threshold The current proximity values of proximity sensor are obtained after the waiting preset duration that begins.The advantages of this arrangement are as follows separate just generating When interruption, since proximity values have just reached far from threshold value, proximity values at this time compare with entirely without the proximity values under occlusion state For it is larger, proximity values may become smaller rapidly in a short time, thus wait preset duration after, can reach substantially entirely without Occlusion state, proximity values constant interval is set according to proximity values at this time can more reasonably judge that the variation of proximity values becomes Gesture also can more reasonably judge from the trend for becoming proximity state far from state.
In the present embodiment, only setting proximity values constant interval according to current proximity values under far from state is advantageous in that, For user during using mobile terminal, moving distance is longer when often becoming proximity state from separate state, it is easier to sentence Moving distance is shorter when breaking and the variation tendency of proximity values, and becoming from proximity state far from state, for judging that proximity values become The time of change trend is less, fast and accurately determines so the method for the present embodiment can guarantee far from event.
The control method for the proximity sensor that the embodiment of the present invention three provides, under far from state, when proximity values occur one Preset threshold dynamic adjustment algorithm is just enabled when changing surely and determines decision threshold, is avoided frequent rapidly into threshold register Data are written, can reduce the burden of system, and then save mobile terminal power consumption, can also reduce the loss of proximity sensor chip.
Example IV
Fig. 4 is the structural block diagram of the control device for the proximity sensor that the embodiment of the present invention four provides, which can be by soft Part and/or hardware realization, are typically integrated in mobile terminal, can be passed by executing the control method of proximity sensor to close Sensor is controlled.As shown in figure 4, the device includes: that proximity values obtain module 401, constant interval setting module 402, first Class decision threshold determining module 403, the second class decision threshold determining module 404 and state determine control module 405.
Wherein, proximity values obtain module 401, for obtaining the current proximity values of proximity sensor;Constant interval sets mould Block 402, for setting proximity values constant interval according to the current proximity values, wherein the current proximity values are in set Proximity values constant interval in;First kind decision threshold determining module 403, for dividing two boundary values of the constant interval The proximity sensor is not written as the upper limit threshold and lower threshold of first kind decision threshold;Second class decision threshold determines Module 404, for receive that the proximity sensor generated based on the first kind decision threshold close to/far from state When change is interrupted, enable preset threshold dynamic adjustment algorithm to the upper limit threshold of the first kind decision threshold and lower threshold into Mobile state adjustment, obtains the second class decision threshold;State determines control module 405, is based on for controlling the proximity sensor The second class decision threshold is carried out close to/the judgement far from state.
The control device for the proximity sensor that the embodiment of the present invention four provides just is enabled when proximity values change a lot Preset threshold dynamic adjustment algorithm determines decision threshold, avoids that data are rapidly frequently written into threshold register, can subtract The burden of light system, and then mobile terminal power consumption is saved, it can also reduce the loss of proximity sensor chip.
On the basis of the above embodiments, the proximity values obtain module and are specifically used for: detecting that proximity sensor opens When dynamic, initial decision threshold is set;When determining that current state is far from state based on the initial decision threshold, described in acquisition The current proximity values of proximity sensor.
On the basis of the above embodiments, the constant interval setting module is specifically used for: in the current proximity values On the basis of multiplied by the first ratio value, obtain the upper boundary values of proximity values constant interval, first ratio value is greater than 1;Described Multiplied by the second ratio value on the basis of current proximity values, the lower border value of proximity values constant interval, second ratio value are obtained Less than 1.
On the basis of the above embodiments, the device further include: altering event reporting module, for receiving described connect When close/separate Status Change that nearly sensor is generated based on the first kind decision threshold is interrupted, forbid reporting to upper layer Close to/far from Status Change event;And for controlling the proximity sensor based on the second class decision threshold progress After close/judgement far from state, generated receiving the proximity sensor based on the second class decision threshold When close/separate Status Change is interrupted, close/separate Status Change event is reported to upper layer.
On the basis of the above embodiments, device further include: control module is nullified, for receiving the close biography When close/separate Status Change that sensor is generated based on the first kind decision threshold is interrupted, the proximity sensor is controlled Close/separate Status Change generated based on the first kind decision threshold is nullified to interrupt.
On the basis of the above embodiments, device further include: control module is repeated, for controlling described approach After sensor carries out close/judgement far from state based on the second class decision threshold, if receiving described close to sensing What device was generated based on the second class decision threshold becomes the change interruption far from state from proximity state, then controls relevant mode Block repeats the current proximity values for obtaining proximity sensor, and sets proximity values constant interval according to the current proximity values Relevant operation.
Embodiment five
The present embodiment five provides a kind of mobile terminal, which includes described in the embodiment of the present invention close to biography The control device of sensor can control proximity sensor by executing the control method of proximity sensor.
Illustratively, the concretely mobile phone, smartwatch, tablet computer, game machine, a of the mobile terminal in the present embodiment Personal digital assistant and digital multimedia player etc. are configured with the various equipment of proximity sensor.
User is during using the mobile terminal in the present embodiment, the mobile terminal when proximity values change a lot It enables preset threshold dynamic adjustment algorithm just to determine decision threshold, avoids that number is frequently rapidly written into threshold register According to can reduce the burden of system, and then save mobile terminal power consumption, can also reduce the loss of proximity sensor chip.
The executable present invention of the control device and mobile terminal of the proximity sensor provided in above-described embodiment is any to be implemented The control method of proximity sensor provided by example has and executes the corresponding functional module of this method and beneficial effect.Not upper The technical detail of detailed description in embodiment is stated, reference can be made to the controlling party of proximity sensor provided by any embodiment of the invention Method.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (12)

1. a kind of control method of proximity sensor characterized by comprising
Obtain the current proximity values of proximity sensor;
Proximity values constant interval is set according to the current proximity values, using two boundary values of the constant interval as the The proximity sensor is written in the upper limit threshold and lower threshold of a kind of decision threshold, wherein the current proximity values are in institute In the proximity values constant interval of setting;
Close/separate Status Change that the proximity sensor is generated based on the first kind decision threshold is received to interrupt When, it enables preset threshold dynamic adjustment algorithm and dynamic tune is carried out to the upper limit threshold and lower threshold of the first kind decision threshold It is whole, obtain the second class decision threshold;
The proximity sensor is controlled to carry out based on the second class decision threshold close to the/judgement far from state;
Wherein, the preset threshold dynamic adjustment algorithm include: according to environmental factor, the working condition of proximity sensor itself or The use state of person user carries out dynamic adjustment to decision threshold.
2. the method according to claim 1, wherein the current proximity values for obtaining proximity sensor, comprising:
When detecting proximity sensor starting, initial decision threshold is set;
When determining that current state is far from state based on the initial decision threshold, currently connecing for the proximity sensor is obtained Close values.
3. the method according to claim 1, wherein described according to the current proximity values setting proximity values variation Section, comprising:
Multiplied by the first ratio value on the basis of the current proximity values, the upper boundary values of proximity values constant interval are obtained, it is described First ratio value is greater than 1;
Multiplied by the second ratio value on the basis of the current proximity values, the lower border value of proximity values constant interval is obtained, it is described Second ratio value is less than 1.
4. the method according to claim 1, wherein being based on the first kind receiving the proximity sensor Decision threshold and generate close to/interrupted far from Status Change when, forbid reporting to upper layer close to/far from Status Change event;
After the control proximity sensor carries out close/judgement far from state based on the second class decision threshold, also Include:
It is interrupted receiving close/separate Status Change that the proximity sensor is generated based on the second class decision threshold When, close/separate Status Change event is reported to upper layer.
5. according to the method described in claim 4, it is characterized in that, being based on the first kind receiving the proximity sensor Decision threshold and generate close to/far from Status Change interrupt after, further includes:
It controls the proximity sensor and nullifies close/separate Status Change generated based on the first kind decision threshold It interrupts.
6. the method according to claim 1, wherein being sentenced controlling the proximity sensor based on second class Determine threshold value carry out close to/far from state judgement after, further includes:
Become from proximity state far from shape receive that the proximity sensor generated based on the second class decision threshold After the change of state is interrupted, the current proximity values for obtaining proximity sensor are repeated, and set according to the current proximity values Determine the relevant operation of proximity values constant interval.
7. a kind of control device of proximity sensor characterized by comprising
Proximity values obtain module, for obtaining the current proximity values of proximity sensor;
Constant interval setting module, for setting proximity values constant interval according to the current proximity values, wherein described currently to connect Close values are in set proximity values constant interval;
First kind decision threshold determining module, for using two boundary values of the constant interval as first kind decision threshold The proximity sensor is written in the upper limit threshold and lower threshold of value;
Second class decision threshold determining module, for receive the proximity sensor be based on the first kind decision threshold and When close/separate Status Change generated is interrupted, preset threshold dynamic adjustment algorithm is enabled to the first kind decision threshold Upper limit threshold and lower threshold carry out dynamic adjustment, obtain the second class decision threshold;
State determines control module, for control the proximity sensor be based on the second class decision threshold carry out close to/it is remote Judgement from state;
Wherein, the preset threshold dynamic adjustment algorithm include: according to environmental factor, the working condition of proximity sensor itself or The use state of person user carries out dynamic adjustment to decision threshold.
8. device according to claim 7, which is characterized in that the proximity values obtain module and are specifically used for:
When detecting proximity sensor starting, initial decision threshold is set;
When determining that current state is far from state based on the initial decision threshold, currently connecing for the proximity sensor is obtained Close values.
9. device according to claim 7, which is characterized in that further include:
Altering event reporting module, for being generated based on the first kind decision threshold receiving the proximity sensor When close/separate Status Change is interrupted, forbid reporting close/separate Status Change event to upper layer;And in control institute After stating the judgement that proximity sensor carries out close/separate state based on the second class decision threshold, described connect is being received Nearly sensor generated based on the second class decision threshold close to/interrupted far from Status Change when, to upper layer report close to/ Far from Status Change event.
10. device according to claim 9, which is characterized in that further include:
Nullify control module, for receive the proximity sensor based on the first kind decision threshold connecing for generating Closely/when being interrupted far from Status Change, control the proximity sensor and nullify and described generated based on the first kind decision threshold Close to/far from Status Change interrupt.
11. device according to claim 7, which is characterized in that further include:
Repeat control module, for control the proximity sensor be based on the second class decision threshold carry out close to/ After judgement far from state, if receive that the proximity sensor generated based on the second class decision threshold by approaching State becomes the change far from state and interrupts, then controls correlation module and repeat the current proximity values for obtaining proximity sensor, And the relevant operation according to the current proximity values setting proximity values constant interval.
12. a kind of mobile terminal, which is characterized in that the mobile terminal is integrated with as described in claim 7-11 any one Proximity sensor control device.
CN201610555614.5A 2016-07-12 2016-07-12 A kind of control method of proximity sensor, device and mobile terminal Active CN106249872B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610555614.5A CN106249872B (en) 2016-07-12 2016-07-12 A kind of control method of proximity sensor, device and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610555614.5A CN106249872B (en) 2016-07-12 2016-07-12 A kind of control method of proximity sensor, device and mobile terminal

Publications (2)

Publication Number Publication Date
CN106249872A CN106249872A (en) 2016-12-21
CN106249872B true CN106249872B (en) 2019-04-05

Family

ID=57613181

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610555614.5A Active CN106249872B (en) 2016-07-12 2016-07-12 A kind of control method of proximity sensor, device and mobile terminal

Country Status (1)

Country Link
CN (1) CN106249872B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106873879B (en) * 2017-01-25 2019-10-29 维沃移动通信有限公司 A kind of electronic equipment and put out screen processing method, device
CN106851802B (en) * 2017-02-03 2019-09-17 Oppo广东移动通信有限公司 Adjust the method and mobile terminal of the poll rate of dynamic thresholding algorithm
CN106973163B (en) * 2017-03-30 2020-07-14 深圳市君利信达科技有限公司 Dynamic calibration method and device of infrared proximity sensor
KR20210048941A (en) 2019-10-24 2021-05-04 삼성전자주식회사 Electronic device and method of controlling display operation of electronic device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102265252A (en) * 2011-06-24 2011-11-30 华为终端有限公司 A method and a device for adjusting a sensing threshold value of an infrared proximity sensor
CN102917124A (en) * 2012-09-27 2013-02-06 东莞宇龙通信科技有限公司 Method for dynamically adjusting threshold of distance sensor, and mobile terminal
CN103837910A (en) * 2014-03-20 2014-06-04 深圳市金立通信设备有限公司 Method for determining threshold value of proximity sensor and terminal
US20140354567A1 (en) * 2013-05-30 2014-12-04 Samsung Electronics Co., Ltd. Apparatus and method for operating proximity sensing function in electronic device having touch screen
CN104407399A (en) * 2014-12-02 2015-03-11 三星半导体(中国)研究开发有限公司 Method for calibrating proximity sensor in portable terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102265252A (en) * 2011-06-24 2011-11-30 华为终端有限公司 A method and a device for adjusting a sensing threshold value of an infrared proximity sensor
CN102917124A (en) * 2012-09-27 2013-02-06 东莞宇龙通信科技有限公司 Method for dynamically adjusting threshold of distance sensor, and mobile terminal
US20140354567A1 (en) * 2013-05-30 2014-12-04 Samsung Electronics Co., Ltd. Apparatus and method for operating proximity sensing function in electronic device having touch screen
CN103837910A (en) * 2014-03-20 2014-06-04 深圳市金立通信设备有限公司 Method for determining threshold value of proximity sensor and terminal
CN104407399A (en) * 2014-12-02 2015-03-11 三星半导体(中国)研究开发有限公司 Method for calibrating proximity sensor in portable terminal

Also Published As

Publication number Publication date
CN106249872A (en) 2016-12-21

Similar Documents

Publication Publication Date Title
CN106249872B (en) A kind of control method of proximity sensor, device and mobile terminal
CN106775084B (en) A kind of false-touch prevention method, device and mobile terminal of touch screen
KR102343657B1 (en) Application processor for processing user input corresponding to movements of wrist muscles and devices including same
CN105025159B (en) proximity sensor adjusting method and device
CN105959492A (en) Control method and device for infrared proximity sensor and mobile terminal
US20160179265A1 (en) Detection Algorithm for an Infrared Proximity Sensor of a Touch Screen Mobile Phone
US9594446B2 (en) Information processing device that determines operational mode based on user's touch
US20120044150A1 (en) Touch Identification for Multi-Touch Technology
KR101698967B1 (en) Method of controlling touch panel
US9323385B2 (en) Noise detection for a capacitance sensing panel
US20130290761A1 (en) Method of and apparatus for processing touch signal by touch sensor controller
US9122351B2 (en) Apparatus for detecting proximity of object near a touchscreen
US10285616B2 (en) Myoelectric potential measurement device and myoelectric potential measurement method
TW201610797A (en) Scan method for a touch panel and touch device
CN105373315B (en) A kind of idle method of mobile terminal, device and mobile terminal
CN102929444A (en) Man-machine interaction method and device
TWI575429B (en) Operation mode switching method used in capacitive touch control panel module
CN105138173B (en) A kind of control method of touching display screen
US20230409163A1 (en) Input terminal device and operation input method
CN106339106B (en) A kind of proximity test method, device and mobile terminal of terminal
US10292591B2 (en) Electronic device for adjusting power to an earphone transmitter
US10203774B1 (en) Handheld device and control method thereof
CN103853467B (en) A kind of information processing method and electronic equipment
US20120313891A1 (en) Distance sensing circuit and touch-control electronic apparatus
CN106791047B (en) A kind of foreign matter detecting method of mobile terminal, device and mobile terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong

Applicant after: OPPO Guangdong Mobile Communications Co., Ltd.

Address before: 523860 No. 18, Wu Sha Beach Road, Changan Town, Dongguan, Guangdong

Applicant before: Guangdong OPPO Mobile Communications Co., Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant