CN117559977A - Method and device for determining key positions, electronic equipment and storage medium - Google Patents

Method and device for determining key positions, electronic equipment and storage medium Download PDF

Info

Publication number
CN117559977A
CN117559977A CN202311512523.XA CN202311512523A CN117559977A CN 117559977 A CN117559977 A CN 117559977A CN 202311512523 A CN202311512523 A CN 202311512523A CN 117559977 A CN117559977 A CN 117559977A
Authority
CN
China
Prior art keywords
hall
current
interference
amount
determining
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.)
Pending
Application number
CN202311512523.XA
Other languages
Chinese (zh)
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 CN202311512523.XA priority Critical patent/CN117559977A/en
Publication of CN117559977A publication Critical patent/CN117559977A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K17/00Electronic switching or gating, i.e. not by contact-making and –breaking
    • H03K17/16Modifications for eliminating interference voltages or currents
    • 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/033Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor
    • G06F3/0338Pointing devices displaced or positioned by the user, e.g. mice, trackballs, pens or joysticks; Accessories therefor with detection of limited linear or angular displacement of an operating part of the device from a neutral position, e.g. isotonic or isometric joysticks
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K17/00Electronic switching or gating, i.e. not by contact-making and –breaking
    • H03K17/51Electronic switching or gating, i.e. not by contact-making and –breaking characterised by the components used
    • H03K17/90Electronic switching or gating, i.e. not by contact-making and –breaking characterised by the components used by the use, as active elements, of galvano-magnetic devices, e.g. Hall-effect devices
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K17/00Electronic switching or gating, i.e. not by contact-making and –breaking
    • H03K17/94Electronic switching or gating, i.e. not by contact-making and –breaking characterised by the way in which the control signals are generated
    • H03K17/965Switches controlled by moving an element forming part of the switch
    • H03K17/97Switches controlled by moving an element forming part of the switch using a magnetic movable element
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03KPULSE TECHNIQUE
    • H03K17/00Electronic switching or gating, i.e. not by contact-making and –breaking
    • H03K17/94Electronic switching or gating, i.e. not by contact-making and –breaking characterised by the way in which the control signals are generated
    • H03K17/965Switches controlled by moving an element forming part of the switch
    • H03K17/97Switches controlled by moving an element forming part of the switch using a magnetic movable element
    • H03K2017/9713Multiposition, e.g. involving comparison with different thresholds

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)

Abstract

The application discloses a method and device for determining key positions, electronic equipment and a storage medium. The method is applied to electronic equipment, a control key is arranged on a middle frame of the electronic equipment, a first Hall sensor, a second Hall sensor and a magnet are arranged in the middle frame, and the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first Hall sensor and the second Hall sensor. The method comprises the steps of obtaining a current first Hall amount collected by a first Hall sensor, obtaining a current second Hall amount collected by a second Hall sensor, determining an interference result based on the current first Hall amount and the current second Hall amount, and determining a target control position corresponding to a control key from a plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount. According to the method and the device, the double Hall sensors are subjected to interference detection, and the key positions are identified according to the detected interference results, so that the accuracy of identification can be improved.

Description

Method and device for determining key positions, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of electronic devices, and in particular, to a method and an apparatus for determining a key position, an electronic device, and a storage medium.
Background
With the development of science and technology, electronic devices are increasingly widely used, and have more and more functions, and become one of the necessities in daily life. At present, an electronic device is generally provided with a control key, and different control positions can be switched by the control key to realize a plurality of different control functions, however, the identification of the control position of the control key by the electronic device is not accurate enough.
Disclosure of Invention
In view of the above, the present application proposes a method, an apparatus, an electronic device, and a storage medium for determining a key position, so as to solve the above problem.
In a first aspect, an embodiment of the present application provides a method for determining a key position, which is applied to an electronic device, a center of the electronic device is provided with a control key, a first hall sensor, a second hall sensor and a magnet are disposed in the center, and the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor; the method comprises the following steps: acquiring a current first Hall amount acquired by the first Hall sensor, and acquiring a current second Hall amount acquired by the second Hall sensor; determining an interference result based on the current first hall amount and the current second hall amount, wherein the interference result comprises the presence or absence of external magnetic field interference; and determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount.
In a second aspect, an embodiment of the present application provides a key position determining device, which is applied to an electronic device, a center of the electronic device is provided with a control key, a first hall sensor, a second hall sensor and a magnet are disposed in the center, and the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor; the device comprises: the Hall quantity acquisition module is used for acquiring the current first Hall quantity acquired by the first Hall sensor and acquiring the current second Hall quantity acquired by the second Hall sensor; the interference result determining module is used for determining an interference result based on the current first Hall quantity and the current second Hall quantity, wherein the interference result comprises the presence or absence of external magnetic field interference; and the position determining module is used for determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount.
In a third aspect, embodiments of the present application provide an electronic device comprising a memory coupled to a processor and a processor, the memory storing instructions that when executed by the processor perform the above-described method.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium having program code stored therein, the program code being callable by a processor to perform the above method.
According to the key position determining method, device, electronic equipment and storage medium, the control key is arranged on the middle frame of the electronic equipment, the first Hall sensor, the second Hall sensor and the magnet are arranged in the middle frame, and the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first Hall sensor and the second Hall sensor. Based on the structure of the electronic equipment, the current first Hall amount acquired by the first Hall sensor can be acquired, the current second Hall amount acquired by the second Hall sensor can be acquired, an interference result including the existence of external magnetic field interference or the absence of external magnetic field interference is determined based on the current first Hall amount and the current second Hall amount, and the target control position corresponding to the control key is determined from a plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount, so that the interference detection is carried out on the double Hall sensors, the key position is identified according to the detected interference result, and the accuracy of identification can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 shows a schematic structural diagram of a center of an electronic device;
FIG. 2 shows a schematic diagram of the principle of the Hall effect;
FIG. 3 shows a schematic diagram of the motion relationship of a Hall sensor and a magnet;
FIG. 4 shows a schematic diagram of a control key of an electronic device;
FIG. 5 shows a hardware block diagram of the operation of a Hall sensor;
FIG. 6 is a flowchart illustrating a method for determining a key position according to an embodiment of the present disclosure;
fig. 7 is a flowchart illustrating a method for determining a key position according to an embodiment of the present application;
fig. 8 is a flowchart illustrating step S240 of the method for determining a key position shown in fig. 7;
fig. 9 is a flowchart illustrating a method for determining a key position according to an embodiment of the present disclosure;
fig. 10 is a flowchart illustrating a method for determining a key position according to an embodiment of the present disclosure;
Fig. 11 is a flowchart illustrating step S430 of the method for determining a key position shown in fig. 10;
fig. 12 is a flowchart illustrating step S440 of the key position determination method shown in fig. 10 of the present application;
fig. 13 is a flowchart illustrating step S444 of the determination method of the key position shown in fig. 12 in the present application;
fig. 14 is a flowchart of step S4443 of the key position determination method shown in fig. 13 of the present application;
fig. 15 is a flowchart illustrating a method for determining a key position according to an embodiment of the present disclosure;
FIG. 16 is a block diagram of a key position determining device according to an embodiment of the present application;
FIG. 17 shows a block diagram of an electronic device for performing a method of determining a key position according to an embodiment of the present application;
fig. 18 shows a storage unit for storing or carrying program codes for implementing the key position determination method according to the embodiment of the present application.
Detailed Description
In order to enable those skilled in the art to better understand the present application, the following description will make clear and complete descriptions of the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application.
Currently, electronic devices are generally provided with control keys, and most of the electronic devices adopt a control key in a physical spring mode, and meanwhile, some electronic devices also adopt a control key in a hall sensor mode. As shown in fig. 1, in an electronic device integrated with an audio function, a plurality of different control positions may be switched by a control key to perform different audio control, for example, the control of mute, vibration, and ringing may be implemented by switching the control key to the different control positions. Alternatively, the control key for realizing the mute, vibration, and response switching control may be referred to as a "three-stage key", which can realize the function switching of three gear positions of the upper, middle, and lower three control positions.
The three-section type key adopts the same mechanical key to realize three key functions. The mechanical key is simple to realize, can not be interfered by the outside and is stable, but the mechanical key is large in structure, occupies a large structural space and is poor in waterproofness. The Hall sensor type key structure is smaller, the waterproof performance of the whole machine can be enhanced, but if the Hall sensor type key is adopted, the calculation is easy to deviate when being interfered, and the identification result is inaccurate.
In order to solve the problems, the inventor discovers through long-term research and proposes a method, a device, an electronic device and a storage medium for determining the key positions, which are provided by an embodiment of the application, by performing interference detection on the double Hall sensors and performing key position identification according to the detected interference result, the accuracy of identification can be improved. The specific method for determining the key position is described in detail in the following embodiments.
The working principle of the hall sensor will be described below.
The hall sensor is a magnetic field sensor made according to the hall effect. Hall effect is one of the magnetoelectric effects, which was found in 1879 when investigating the conductive mechanism of metals. It was found that semiconductors, conductive fluids, and the like have such effects, and that the hall effect of semiconductors is much stronger than that of metals, and various hall elements made by using such phenomena are widely used in industrial automation technology, detection technology, information processing, and the like. Hall effect is a fundamental approach to study the performance of semiconductor materials. The important parameters such as the conductivity type, the carrier concentration and the carrier mobility of the semiconductor material can be judged through the Hall coefficient measured by a Hall effect experiment.
As is known from the principle of the hall effect, the magnitude of the hall potential depends on: rh is a Hall constant, which is related to the semiconductor material; i is the bias current of the Hall element; b is the magnetic field intensity; d is the thickness of the semiconductor material.
For a given hall device, UH will depend entirely on the measured magnetic field strength B when the bias current I is fixed.
One hall element generally has four lead-out terminals, two of which are input terminals for the bias current I of the hall element, and the other two are output terminals for the hall voltage. If the two output terminals form an outer loop, a hall current is generated. In general, the setting of the bias current is usually given by an external reference voltage source; if the precision requirement is high, the reference voltage source is replaced by a constant current source. In order to achieve high sensitivity, some Hall elements are provided with a coating alloy with high magnetic permeability on a sensing surface; the Hall potential of the sensor is larger, but saturation occurs at about 0.05T, and the sensor is only suitable for being used under low-limit and small-range conditions.
As shown in fig. 2, when a control current I is applied across the semiconductor sheet and a uniform magnetic field of magnetic induction B is applied in the vertical direction of the sheet, a hall voltage of potential difference UH is generated in the direction perpendicular to the current and magnetic field.
The magnetic field has a Hall semiconductor chip through which a constant current I is passed from A to B. Under the action of lorentz force, the electron current of I is shifted to one side when passing through the hall semiconductor, and the sheet generates a potential difference in the CD direction, which is a so-called hall voltage.
The hall voltage varies with the intensity of the magnetic field, the stronger the magnetic field, the higher the voltage, the weaker the magnetic field, the lower the voltage, the smaller the hall voltage value, usually only a few millivolts, but the voltage can be amplified by an amplifier in the integrated circuit to be enough to output a stronger signal. If the hall ic is made to perform sensing, mechanical means are required to change the magnetic induction. For example, a rotating impeller may be used as a switch for controlling the magnetic flux, and when the impeller blades are in the air gap between the magnet and the hall ic, the magnetic field deviates from the integrated chip and the hall voltage is extinguished. Thus, the change of the output voltage of the Hall integrated circuit can indicate a certain position of the impeller driving shaft, and the Hall integrated circuit chip can be used as an ignition timing sensor by utilizing the working principle. The Hall effect sensor belongs to a passive sensor, and can work only by an external power supply, so that the Hall effect sensor can detect the running condition of low rotating speed.
As shown in fig. 3 and 4, in the embodiment of the present application, a control key (not shown) may be disposed on a middle frame of the electronic device, and a first hall sensor, a second hall sensor, and a magnet may be disposed in the middle frame of the electronic device, where the control key is used to switch between a plurality of control positions to drive the magnet to move between the first hall sensor and the second hall sensor. It can be understood that, the above-mentioned button structure of electronic equipment through the control position of switching control button, can drive the position of change magnet between first hall sensor and second hall sensor, and the change of magnet position can change the magnetic flux between magnet and the first hall sensor and the magnetic flux between magnet and the second hall sensor to can confirm the control position that the control button was switched according to the size of the magnetic flux that first hall sensor sensed and the size of the magnetic flux that the second sensor sensed, in order to carry out the control adjustment of electronic equipment's corresponding function.
As an implementation manner, a sliding block can be further arranged in the middle frame of the electronic device, the magnet is arranged on the sliding block, and the sliding block is connected with the control key. Based on the above, when the control buttons are switched to move in a plurality of control positions, the sliding block can be enabled to move along with the movement, and accordingly, the sliding block can drive the magnet to move, so that the magnet is driven to move between the first Hall sensor and the second Hall sensor.
As an example, the plurality of control positions may include an upper, middle, and lower three control positions, corresponding to the "upper" control position for controlling silence, corresponding to the "middle" control position for controlling vibration, corresponding to the lower control position for controlling ringing, the control key may be switched in the upper, middle, and lower three control positions in response to a toggle operation triggered by a user, and accordingly, the magnet may be moved up and down back and forth between the first hall sensor and the second hall sensor based on the switching of the control key, staying in the fixed three positions to achieve the control of silence, vibration, or implementation of the ringing function.
As shown in fig. 5, in the electronic device, the first hall sensor and the second hall sensor are connected to the AP end of the access point through an IIC protocol (IIC is a synchronous half duplex communication mode, and is composed of two communication signal lines, namely, a data line SDA and a clock line SCL), so as to realize data transmission, and meanwhile, each of the first hall sensor and the second hall sensor has an interrupt output port connected to the AP, so that the switch control key wakes up the AP to perform state detection under the standby condition. Alternatively, the first hall sensor and the second hall sensor may be linear hall sensors.
Referring to fig. 6, fig. 6 is a flowchart illustrating a method for determining a key position according to an embodiment of the present application. The method is used for carrying out interference detection on the double Hall sensors and carrying out recognition of the key positions according to the detected interference results, so that the recognition accuracy can be improved. In a specific embodiment, the key position determining method is applied to the key position determining apparatus 200 shown in fig. 16 and the electronic device 100 (fig. 17) provided with the key position determining apparatus 200. The specific flow of the present embodiment will be described below by taking an electronic device as an example, and it will be understood that the electronic device applied in the present embodiment may include a smart phone, a tablet computer, a wearable electronic device, and the like, which is not limited herein. In this embodiment, a control key is provided on a middle frame of the electronic device, where a first hall sensor, a second hall sensor and a magnet are provided in the middle frame, the control key is used to switch between a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor, and the method for determining the key position specifically includes the following steps:
Step S110: the current first Hall quantity acquired by the first Hall sensor is acquired, and the current second Hall quantity acquired by the second Hall sensor is acquired.
It can be understood that when the control key is located at a certain control position among the plurality of control positions, the magnet is correspondingly located at a certain position between the first hall sensor and the second hall sensor, and then the magnet can generate a hall effect with the first hall sensor and the second hall sensor respectively at the position, and then the first hall sensor can acquire the hall quantity of the first hall sensor and the magnet, which is used as the current first hall quantity, and the second hall sensor can acquire the hall quantity of the second hall sensor and the magnet, which is used as the current second hall quantity. Alternatively, the hall quantity may include a hall voltage or a hall potential.
In this embodiment, the electronic device may acquire the current first hall amount acquired by the first hall sensor, and acquire the current second hall amount acquired by the second hall sensor. The current first hall amount acquisition parameter and the current second hall amount acquisition parameter should be the same, for example, the current first hall amount acquisition time and the current second hall amount acquisition time should be the same, the current first hall amount acquisition temperature and the current second hall amount acquisition temperature should be the same, and the present first hall amount acquisition temperature and the present second hall amount acquisition temperature should be the same, which is not limited herein.
Step S120: and determining an interference result based on the current first Hall amount and the current second Hall amount, wherein the interference result comprises the presence or absence of external magnetic field interference.
In this embodiment, in the case where the current first hall amount and the current second hall amount are obtained, the interference result may be determined based on the current first hall amount and the current second hall amount, where the interference result includes the presence or absence of external magnetic field interference.
In some embodiments, the electronic device may obtain and store in advance a preset first hall amount in the case where the control key is the same as the control position where the control key is currently located and there is no external magnetic field interference (the first hall sensor collects in the case where there is no external magnetic field interference), and may obtain and store in advance a preset second hall amount in the case where the control key is the same as the control position where the control key is currently located and there is no external magnetic field interference (the second hall sensor collects in the case where there is no external magnetic field interference). Based on the above, under the condition that the current first Hall amount and the current second Hall amount are obtained, the current first Hall amount and the preset first Hall amount can be compared, the current second Hall amount and the preset second Hall amount are compared, if the comparison result represents that the current first Hall amount is matched with the preset first Hall amount, and the current second Hall amount is matched with the preset second Hall amount, the interference result can be determined to be that no external magnetic field interference exists; if the comparison result indicates that the current first Hall quantity is not matched with the preset first Hall quantity, and/or the current second Hall quantity is not matched with the preset second Hall quantity, the interference result can be determined to be that the external magnetic field interference exists.
In some embodiments, under the condition that the current first hall amount and the second current hall amount are obtained, difference calculation can be performed on the current first hall amount and the current second hall amount to obtain a current hall amount difference value, sum calculation is performed on the current first hall amount and the current second hall amount to obtain a current hall amount sum value, and whether the interference result is external magnetic field interference or not is determined based on the current hall amount difference value and the current hall amount sum value.
Step S130: and determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount.
In this embodiment, in the case of obtaining the interference result, the target control position corresponding to the control key may be determined from a plurality of control positions based on the interference result, the current first hall amount, and the current second hall amount.
As an example, assuming that the plurality of control positions includes three control positions of up (up), middle (middle), down (down), a target control position corresponding to the control key may be determined from among the control position up, the control position middle, and the control position down based on the interference result, the current first hall amount, and the current second hall amount, for example, the control position up is determined as a target control position, the control position down is determined as a target control position, and the like, without limitation.
In some embodiments, in the case of obtaining the interference result, a position calculation manner corresponding to the interference result may be determined, and the current first hall amount and the current second hall amount are calculated based on the position calculation manner corresponding to the interference result, so as to determine a target control position corresponding to the control key from the plurality of control positions. Optionally, if the disturbance result is that there is no external magnetic field disturbance, a first position calculation mode with which there is no external magnetic field disturbance may be determined, and the current first hall amount and the current second hall amount are calculated based on the first position calculation mode, so as to determine a target control position corresponding to the control key from the plurality of control positions. The disturbance results are that the external magnetic field disturbance exists, a second position calculation mode with the external magnetic field disturbance exists can be determined, and the current first Hall quantity and the current second Hall quantity are calculated based on the second position calculation mode, so that a target control position corresponding to the control key is determined from a plurality of control positions.
According to the method for determining the key position, the current first Hall quantity acquired by the first Hall sensor is acquired, the current second Hall quantity acquired by the second Hall sensor is acquired, the interference result including the existence of external magnetic field interference or the absence of external magnetic field interference is determined based on the current first Hall quantity and the current second Hall quantity, and the target control position corresponding to the control key is determined from a plurality of control positions based on the interference result, the current first Hall quantity and the current second Hall quantity, so that interference detection is carried out on the double Hall sensors, key position identification is carried out according to the detected interference result, and the accuracy of identification can be improved.
Referring to fig. 7, fig. 7 is a flowchart illustrating a method for determining a key position according to an embodiment of the present application. The method is applied to the electronic device, a control key is arranged on a middle frame of the electronic device, a first hall sensor, a second hall sensor and a magnet are arranged in the middle frame, the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor, a flow shown in fig. 7 is described in detail, and the method for determining the key position specifically comprises the following steps:
step S210: the current first Hall quantity acquired by the first Hall sensor is acquired, and the current second Hall quantity acquired by the second Hall sensor is acquired.
The specific description of step S210 is referred to step S110, and will not be repeated here.
Step S220: and calculating the difference value of the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity difference value.
In this embodiment, under the condition that the current first hall amount and the current second hall amount are obtained, the difference value calculation can be performed on the current first hall amount and the current second hall amount, so as to obtain a current hall amount difference value.
In some embodiments, under the condition that the current first hall amount and the current second hall amount are obtained, calculating a difference value by subtracting the current second hall amount from the current first hall amount to obtain a current hall amount difference value; or, the difference value may be calculated by subtracting the current first hall value from the current second hall value, to obtain the current hall value difference, which is not limited herein.
Step S230: and performing sum value calculation on the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity and value.
In this embodiment, under the condition that the current first hall amount and the current second hall amount are obtained, the sum value of the current first hall amount and the current second hall amount may be calculated, so as to obtain the current hall amount sum value.
In some embodiments, in the case of obtaining the current first hall amount and the current second hall amount, the sum value may be calculated by adding the current first hall amount to the current second hall amount, to obtain the current hall amount sum value.
Step S240: and determining the interference result based on the current Hall amount difference value and the current Hall amount sum value, wherein the interference result comprises the presence or absence of external magnetic field interference.
In this embodiment, in the case where the current hall amount difference value and the current hall amount sum value are obtained, the interference result may be determined based on the current hall amount difference value and the current hall amount sum value, that is, the presence of the external magnetic field interference or the absence of the external magnetic field interference may be determined based on the current hall amount difference value and the current hall amount sum value.
In some embodiments, the electronic device may acquire and store a preset hall amount difference value (a difference value between a hall amount acquired by the first hall sensor in the absence of the external magnetic field interference and a hall amount acquired by the second hall sensor in the absence of the external magnetic field interference) in which the control key is the same as the control position in which the control key is currently located, and in the absence of the external magnetic field interference, and may acquire and store a preset hall amount sum value (a sum value of a hall amount acquired by the first hall sensor in the absence of the external magnetic field interference and a hall amount acquired by the second hall sensor in the absence of the external magnetic field interference) in which the control key is the same as the control position in which the control key is currently located. Based on the above, under the condition that the current Hall quantity difference value and the current Hall quantity sum value are obtained, the current Hall quantity difference value and the preset Hall quantity difference value can be compared, the current Hall quantity sum value and the preset Hall quantity sum value are compared, if the comparison result represents that the current Hall quantity difference value is matched with the preset Hall quantity difference value, and the current Hall quantity sum value is matched with the preset Hall quantity sum value, the interference result can be determined to be that no external magnetic field interference exists; if the comparison result indicates that the current Hall quantity difference value is not matched with the preset Hall quantity difference value, and/or the current Hall quantity sum value is not matched with the preset Hall quantity sum value, the interference result can be determined to be that the external magnetic field interference exists.
Referring to fig. 8, fig. 8 is a flowchart illustrating step S240 of the method for determining a key position shown in fig. 7. The following details the flow shown in fig. 8, and the method may specifically include the following steps:
step S241: and determining a relation between the current Hall quantity difference value and a calibrated Hall quantity difference value range corresponding to each of the plurality of control positions as a first relation, wherein the calibrated Hall quantity difference value range is determined based on a difference value and an interference difference margin between calibrated Hall quantities acquired by the first Hall sensor and the second Hall sensor respectively at the same control position of the plurality of control positions.
Optionally, the electronic device may preset and store a calibrated hall difference value range corresponding to each of the plurality of control positions, where the calibrated hall difference value range is determined based on a difference value between calibrated hall amounts acquired by the first hall sensor and the second hall sensor at the same control position of the plurality of control positions and an interference difference margin. Alternatively, the interference difference margin may be determined based on empirical values.
In some embodiments, as shown in table 1, it is assumed that the plurality of control positions include three control positions of up (up), middle (middle), and down (down), and in the context of electronic device production or post calibration, the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position up are a (the unit may be voltage mv) and d, the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position middle are b and e, and the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position down are c and f. Then, the difference between the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position up is a-d, the difference between the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position middle is b-e, and the difference between the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position down is c-f.
TABLE 1
Up (up) Middle (middle) Lower (Down)
First Hall sensor a b c
Second Hall sensor d e f
Hall difference a-d b-e c-f
Further, as shown in the following table 2, assuming that the interference difference margin is n1, the calibrated hall difference value range corresponding to the control position up is a-d-n1 to a-d+n1, wherein a-d-n1 is the calibrated hall difference value minimum corresponding to the control position up, and a-d+n1 is the calibrated hall difference value maximum corresponding to the control position up; the range of the calibrated Hall difference value corresponding to the control position middle is from b-e-n1 to b-e+n1, wherein b-e-n1 is the minimum difference value of the calibrated Hall quantity corresponding to the control position middle, and b-e+n1 is the maximum difference value of the calibrated Hall quantity corresponding to the control position middle; the range of the calibrated Hall difference value corresponding to the control position down is from c-f-n1 to c-f+n1, wherein c-f-n1 is the minimum difference value of the calibrated Hall quantity corresponding to the control position down, and c-f+n1 is the maximum difference value of the calibrated Hall quantity corresponding to the control position down. Based on this, the calibrated hall difference value range corresponding to each of the plurality of control positions includes: a-d-n 1-a-d+n1, b-e-n 1-b-e+n1, and c-f-n 1-c-f+n1.
TABLE 2
Interference difference margin Hall difference Minimum value of difference range Maximum value of difference range
Up (up) n1 a-d a-d-n1 a-d+n1
Middle (middle) n1 b-e b-e-n1 b-e+n1
Lower (Down) n1 c-f c-f-n1 c-f+n1
As an example, assume a=127, b=94, c=52, d=50, e=86, f=127, n1=15. Then, the difference between the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position up is a-d=127-50=77, the difference between the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position middle is b-e=94-86=8, and the difference between the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position down is c-f=52-127= -75. The range of the calibrated Hall difference corresponding to the control position up is a-d-n 1-a-d+n1=77-15-77+15=62-92, the range of the calibrated Hall difference corresponding to the control position middle is b-e-n 1-b-e+n1=8-15-8+15= -7-23, and the range of the calibrated Hall difference corresponding to the control position down is c-f-n 1-c-f+n1= -75-15 to-75+15= -90 to-60. At this time, the calibrated hall difference value ranges corresponding to the respective control positions include: 62-92, -7-23 and-90 to-60.
In this embodiment, when the current hall amount difference value is obtained, the current hall amount difference value may be compared with the calibrated hall amount difference value ranges corresponding to the plurality of control positions, respectively, so as to determine a relationship between the current hall amount difference value and the calibrated hall amount difference value ranges corresponding to the plurality of control positions, and use the relationship as the first relationship. Alternatively, the first relationship may include that the current hall amount difference is within the corresponding calibrated hall amount difference range, or that the current hall amount difference is not within the corresponding calibrated hall amount difference range.
In some embodiments, when the current hall amount difference is obtained, the current hall amount difference may be simultaneously compared with the calibrated hall amount difference ranges corresponding to the plurality of control positions, respectively, or the current hall amount difference may be sequentially compared with the calibrated hall amount difference ranges corresponding to the plurality of control positions, respectively, and the like, which is not limited herein.
In some embodiments, comparing the current hall quantity difference value to the calibrated hall quantity difference value range may include: comparing the current Hall quantity difference value with the calibrated Hall quantity minimum difference value in the calibrated Hall quantity difference value range to judge whether the current Hall quantity difference value is equal to or larger than the calibrated Hall quantity minimum difference value in the calibrated Hall quantity difference value range, and comparing the current Hall quantity difference value with the calibrated Hall quantity maximum difference value in the calibrated Hall quantity difference value range to judge whether the current Hall quantity difference value is smaller than or equal to the calibrated Hall quantity maximum difference value in the calibrated Hall quantity difference value range.
Step S242: determining a relationship between the current hall amount and value and the calibrated hall amount and value range corresponding to each of the plurality of control positions as a second relationship, wherein, the calibrated hall amount and value range is determined based on a sum value and an interference sum value margin between calibrated hall amounts respectively acquired by the first hall sensor and the second hall sensor at a same control position of the plurality of control positions.
Alternatively, the electronic device may preset and store a calibrated hall amount and a value range corresponding to each of the plurality of control positions, where the calibrated hall amount and the value range are determined based on a sum value and an interference sum value margin between the calibrated hall amounts acquired by the first hall sensor and the second hall sensor at the same control position among the plurality of control positions. Alternatively, the interference and value margin may be determined based on empirical values.
In some embodiments, as shown in table 3, it is assumed that the plurality of control positions include three control positions of up (up), middle (middle), and down (down), and in the context of electronic device production or post calibration, the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position up are a (the unit may be voltage mv) and d, the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position middle are b and e, and the calibrated hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position down are c and f. Then, the sum value between the calibration hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position up is a+d, the sum value between the calibration hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position middle is b+e, and the sum value between the calibration hall amounts respectively collected by the first hall sensor and the second hall sensor at the control position down is c+f.
TABLE 3 Table 3
Up (up) Middle (middle) Lower (Down)
First Hall sensor a b c
Second Hall sensor d e f
Hall quantity and value a+d b+e c+f
Further, as shown in the following table 4, assuming that the interference sum value margin is n2, the calibrated hall amount sum value range corresponding to the control position up is a+d-n2 to a+d+n2, where a+d-n2 is the calibrated hall amount minimum sum value corresponding to the control position up, and a+d+n2 is the calibrated hall amount maximum sum value corresponding to the control position up; the range of the sum value of the calibrated Hall quantity corresponding to the control position middle is from b+e-n2 to b+e+n2, wherein b+e-n2 is the minimum sum value of the calibrated Hall quantity corresponding to the control position middle, and b+e+n2 is the maximum sum value of the calibrated Hall quantity corresponding to the control position middle; the sum of the calibrated Hall amounts corresponding to the control position down is in the range of c+f-n 2-c+f+n 2, wherein c+f-n2 is the minimum sum of the calibrated Hall amounts corresponding to the control position down, and c+f+n2 is the maximum sum of the calibrated Hall amounts corresponding to the control position down. Based on this, the calibrated hall amount and value ranges corresponding to each of the plurality of control positions include: a-d-n 2-a-d+n2, b-e-n 2-b-e+n2, and c-f-n 2-c-f+n2.
TABLE 4 Table 4
Interference and margin Hall quantity and value Sum value range minimum value Sum value range maximum value
Up (up) n2 a+d a+d-n2 a+d+n2
Middle (middle) n2 b+e b+e-n2 b+e+n2
Lower (Down) n2 c+f c+-f-n2 c+f+n2
As an example, assume a=127, b=94, c=52, d=50, e=86, f=127, n2=20. Then, the sum value between the calibrated hall amounts respectively acquired by the first hall sensor and the second hall sensor at the control position up is a+d=127+50=177, the sum value between the calibrated hall amounts respectively acquired by the first hall sensor and the second hall sensor at the control position middle is b+e=94+86=180, and the sum value between the calibrated hall amounts respectively acquired by the first hall sensor and the second hall sensor at the control position down is c+f=52+127=179. The range of the calibrated hall quantity and the value corresponding to the control position up is a+d-n 2-a+d+n2=177-20-177+20=157-197, the range of the calibrated hall quantity and the value corresponding to the control position middle is b+e-n 2-b+e+n2=180-20-180+20=160-200, and the range of the calibrated hall quantity and the value corresponding to the control position down is c+f-n 2-c+f+n2=179-20-179+20=159-199. At this time, the calibrated hall amount and value ranges corresponding to the respective control positions include: 157-197, 160-200 and 159-199.
In this embodiment, in the case where the current hall amount and value are obtained, the current hall amount and value may be compared with the calibrated hall amount and value ranges respectively corresponding to the plurality of control positions, respectively, to determine the relationship between the current hall amount and value and the calibrated hall amount and value ranges respectively corresponding to the plurality of control positions, and take the relationship as the second relationship. Alternatively, the second relationship may include that the current hall amount and value is within the corresponding calibrated hall amount and value range, or that the current hall amount and value is not within the corresponding calibrated hall amount and value range.
In some embodiments, in the case of obtaining the current hall amount and value, the current hall amount and value may be simultaneously compared with the calibrated hall amount and value ranges respectively corresponding to the plurality of control positions, or the current hall amount and value may be sequentially compared with the calibrated hall amount and value ranges respectively corresponding to the plurality of control positions, or the like, which is not limited herein.
In some embodiments, comparing the current hall quantity and value to the calibrated hall quantity and value range may include: comparing the current hall amount and value with the minimum sum value of the calibrated hall amounts in the calibrated hall amount and value range to determine whether the current hall amount and value is equal to or greater than the minimum sum value of the calibrated hall amounts in the calibrated hall amount and value range, and comparing the current hall amount and value with the maximum sum value of the calibrated hall amounts in the calibrated hall amount and value range to determine whether the current hall amount and value is less than or equal to the maximum sum value of the calibrated hall amounts in the calibrated hall amount and value range.
Step S243: the interference result is determined based on the first relationship and the second relationship.
In the present embodiment, in the case where the first relationship and the second relationship are obtained, the interference result may be determined based on the first relationship and the second relationship, that is, it may be determined whether there is external magnetic field interference or no external magnetic field interference based on the first relationship and the second relationship.
In some embodiments, if it is determined that the current hall amount difference satisfies any one of the calibrated hall amount difference ranges corresponding to the respective plurality of control positions based on the first relationship, and it is determined that the current hall amount sum value satisfies any one of the calibrated hall amount sum value ranges corresponding to the respective plurality of control positions based on the second relationship, it may be determined that the interference result is that no external magnetic field interference exists. Or if the current Hall quantity difference value does not meet the respective corresponding calibration Hall quantity difference value range of the plurality of control positions based on the first relation, and/or if the current Hall quantity sum value does not meet the respective corresponding calibration Hall quantity sum value range of the plurality of control positions based on the second relation, determining that the interference result is external magnetic field interference.
As an example, assuming that the current first hall amount is 120 and the current second hall amount is 55, the current hall amount difference is 120-55=65, the current hall amount sum is 120+55=175, wherein the current hall amount difference 65 is in the range of the calibrated hall difference value range 62-92 corresponding to the control position up, the current hall amount sum 175 is in the range of the calibrated hall difference value range 157-197 corresponding to the control position up, and the interference result is determined to be that no external magnetic field interference exists. Assuming that the current first hall quantity is 137 and the current second hall quantity is 60, the current hall quantity difference value is 137-60=77, and the current hall quantity sum value is 137+60=237, wherein the current hall quantity difference value 77 is in the range of the calibrated hall quantity difference value range 62-92 corresponding to the control position up, the current hall quantity sum value 237 is not in any calibrated hall quantity sum value range, and the interference result is determined to be that the external magnetic field interference exists.
Step S250: and determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount.
The specific description of step S250 is referred to step S130, and will not be repeated here.
Compared with the method for determining the key position shown in fig. 6, the method for determining the key position further performs difference calculation on the current first hall amount and the current second hall amount to obtain a current hall amount difference value, performs sum calculation on the current first hall amount and the current second hall amount to obtain a current hall amount sum value, and determines an interference result based on the current hall amount difference value and the current hall amount sum value, so that accuracy of the determined interference result can be improved.
Referring to fig. 9, fig. 9 is a flowchart illustrating a method for determining a key position according to an embodiment of the present application. The method is applied to the electronic device, a control key is arranged on a middle frame of the electronic device, a first hall sensor, a second hall sensor and a magnet are arranged in the middle frame, the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor, a flow shown in fig. 9 is described in detail, and the method for determining the key position specifically comprises the following steps:
Step S310: the current first Hall quantity acquired by the first Hall sensor is acquired, and the current second Hall quantity acquired by the second Hall sensor is acquired.
Step S320: and determining an interference result based on the current first Hall amount and the current second Hall amount, wherein the interference result comprises the presence or absence of external magnetic field interference.
The specific description of step S310 to step S320 refer to step S110 to step S120, and are not described herein.
Step S330: if the interference result is that no external magnetic field interference exists, calculating a difference value between the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity difference value.
In this embodiment, if it is determined that the interference result is that no external magnetic field interference exists, a difference value between the current first hall amount and the current second hall amount may be calculated, so as to obtain a current hall amount difference value.
In some embodiments, under the condition that the current first hall amount and the current second hall amount are obtained, calculating a difference value by subtracting the current second hall amount from the current first hall amount to obtain a current hall amount difference value; or, the difference value may be calculated by subtracting the current first hall value from the current second hall value, to obtain the current hall value difference, which is not limited herein.
Step S340: and determining a calibration Hall difference value range where the current Hall difference value is located from calibration Hall difference value ranges corresponding to the control positions respectively as a target calibration Hall difference value range, wherein the calibration Hall difference value range is determined based on the difference value and the interference difference margin between the calibration Hall quantities acquired by the first Hall sensor and the second Hall sensor at the same control position in the control positions respectively.
In some embodiments, the electronic device may preset and store a calibrated hall difference value range corresponding to each of the plurality of control positions, where the calibrated hall difference value range is used as a criterion of the current hall difference value. Therefore, in this embodiment, when the current hall amount difference is obtained, the current hall amount difference may be compared with the calibrated hall amount difference ranges corresponding to the plurality of control positions, respectively, the calibrated hall amount difference range in which the current hall amount difference is located may be determined from the calibrated hall amount difference ranges corresponding to the plurality of control positions, and the calibrated hall amount difference range in which the current hall amount difference is located may be determined as the target calibrated hall amount difference range.
As an example, assume that the calibrated hall difference value ranges corresponding to the respective plurality of control positions include: 62-92, -7-23 and-90-60, wherein the current first Hall amount is 120, the current second Hall amount is 55, the current Hall amount difference is 120-55=65, and 62-92 can be determined from 62-92, -7-23 and-90-60 as a target calibration Hall difference value range.
Step S350: and determining a control position corresponding to the target calibration Hall difference value range from the plurality of control positions as the target control position.
In this embodiment, in the case of determining the target calibration hall difference value range, it is possible to determine the control position corresponding to the target calibration hall difference value range from among the plurality of control positions, and determine the control position corresponding to the target calibration hall difference value range as the target control position.
In some embodiments, in the case of determining the target calibration hall amount difference range, the target control position corresponding to the target calibration hall amount difference range may be determined based on a correspondence relationship between the plurality of control positions and the plurality of calibration hall amount differences, where the plurality of control positions have a one-to-one correspondence relationship with the plurality of calibration hall amount differences.
As an example, assume that the plurality of control positions includes three control positions of up (up), middle (middle), down (down), and that the control position up corresponds to the calibrated hall-difference value range 62 to 92, the control position middle corresponds to the calibrated hall-difference value range-7 to 23, and the control position down corresponds to the calibrated hall-difference value range-90 to-60. If the current first Hall quantity is 120 and the current second Hall quantity is 55, the current Hall quantity difference value is 120-55=65, the target calibration Hall quantity difference value range is 62-92, and the target control position is the control position up.
It can be understood that when the target control position is determined, the target control position is obtained by subtracting two hall amounts, and is not easily influenced by an external magnetic field, in other words, when the external magnetic field of the electronic device is close to the magnet, the external magnetic field can simultaneously generate a hall effect with the first hall sensor and the second hall sensor, so that the difference value of the hall amounts acquired by the first hall sensor and the second hall sensor at the current moment is approximate to the hall difference value acquired when no magnet is interfered at the current moment, even if the external magnetic field is interfered, the target control position can still be accurately determined, and the anti-interference performance is improved.
Compared with the method for determining the key position shown in fig. 6, in the method for determining the key position, in this embodiment, when the interference result is determined that there is no magnet interference, difference calculation is performed on the current first current hall amount and the current second hall amount, a current hall amount difference value is obtained, a calibrated hall difference value range in which the current hall amount difference value is located is determined as a target calibrated hall difference value range from calibrated hall difference value ranges corresponding to a plurality of control positions, wherein the calibrated hall difference value range is determined based on difference values and interference difference margins between calibrated hall amounts acquired by the same control positions of the first hall sensor and the second hall sensor in the plurality of control positions, and a control position corresponding to the target calibrated hall difference value range is determined as a target control position from the plurality of control positions, so that the final target control position can be determined by a difference value calculation mode of double hall sensors under the condition that no interference is determined, and the anti-interference performance of the determined target control position is improved.
Referring to fig. 10, fig. 10 is a flowchart illustrating a method for determining a key position according to an embodiment of the present application. The method is applied to the electronic device, a control key is arranged on a middle frame of the electronic device, a first hall sensor, a second hall sensor and a magnet are arranged in the middle frame, the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor, a flow shown in fig. 10 is described in detail, and the method for determining the key position specifically comprises the following steps:
Step S410: the current first Hall quantity acquired by the first Hall sensor is acquired, and the current second Hall quantity acquired by the second Hall sensor is acquired.
Step S420: and determining an interference result based on the current first Hall amount and the current second Hall amount, wherein the interference result comprises the presence or absence of external magnetic field interference.
The specific description of step S410 to step S420 refer to step S110 to step S120, and are not described herein.
Step S430: and if the interference result is that the external magnetic field interference exists, determining an interference form corresponding to the external magnetic field interference, wherein the interference form comprises stable interference or unstable interference.
In this embodiment, if it is determined that the external magnetic field interference exists as a result of the interference, an interference form corresponding to the external magnetic field interference may be determined, where the interference form includes stable interference or unstable interference, that is, it may be determined whether the interfering magnetic interference is stable interference or unstable interference.
In some embodiments, the electronic device may be preset with preset state information corresponding to the stable interference in the interference form, and if it is determined that the external magnetic field interference exists as the interference result, the current state information of the electronic device may be determined, and the current state information may be compared with the preset state information to determine whether the current state information matches the preset state information, if so, the stable interference in the interference form may be determined, and if not, the unstable interference in the interference form may be determined.
Referring to fig. 11, fig. 11 is a flowchart illustrating step S430 of the method for determining a key position shown in fig. 10. The following details about the flow shown in fig. 11, the method may specifically include the following steps:
step S431: and if the interference result is that the external magnetic field interference exists, acquiring a plurality of reference Hall quantities acquired by a reference Hall sensor according to a preset time interval, wherein the reference Hall sensor is the first Hall sensor or the second Hall sensor.
In this embodiment, if it is determined that the interference result is that there is external magnetic field interference, a plurality of reference hall amounts acquired by a reference hall sensor according to a preset time interval may be acquired, where the reference hall sensor may be a first hall sensor hall second hall sensor.
In some embodiments, the first hall sensor or the second hall sensor may be determined as the reference hall sensor at random, or the first hall sensor or the second hall sensor may be determined as the reference hall sensor by polling, or the first hall sensor or the second hall sensor may be determined as the reference hall sensor by fixing, etc., without limitation.
In some embodiments, the electronic device may preset a time interval as a preset time interval, and preset a target number of reference hall amounts required, based on which, in a case that it is determined that the interference result is that there is external magnetic field interference, the reference hall sensor may be controlled to acquire the reference hall amounts according to the preset time interval based on the target number, so as to obtain a plurality of reference hall amounts.
Step S432: and calculating the average value of the reference Hall quantities to obtain the average value of the reference Hall quantities.
In the present embodiment, in the case where a plurality of reference hall amounts are obtained, an average value calculation may be performed on the plurality of reference hall amounts to obtain a reference hall amount average value.
As an embodiment, in the case of obtaining a plurality of reference hall amounts, a sum value may be calculated for the plurality of reference hall amounts to obtain a reference hall amount sum value, and then the reference hall amount sum value is divided by a target number corresponding to the plurality of reference hall amounts to obtain a reference hall amount average value.
As an example, assuming that the plurality of reference hall amounts includes 50, 51, the reference hall amount average value is 50.5.
Step S433: and calculating the difference value between the reference Hall quantity average value and the reference Hall quantity acquired last time to obtain a reference Hall quantity difference value.
In this embodiment, in the case of obtaining the reference hall amount average value, the reference hall amount average value and the reference hall amount obtained last time may be subjected to difference calculation to obtain the reference hall amount difference value. Alternatively, the reference hall amount difference may be an absolute value of a difference between the reference hall amount average value and the reference hall amount acquired last time.
In some embodiments, in the case of obtaining the reference hall quantity average value, the difference value may be calculated by subtracting the reference hall quantity obtained last time from the reference hall quantity average value, to obtain the reference hall quantity difference value; alternatively, the reference hall amount difference may be obtained by subtracting the reference hall amount average value from the reference hall amount obtained last time, which is not limited herein.
In some embodiments, it may be based onAnd calculating the average value of the reference Hall quantity and the reference Hall quantity acquired last time to obtain a reference Hall quantity difference value, wherein diff is the reference Hall quantity difference value.
As an example, assuming that the plurality of reference hall amounts includes 50, 51, then the reference hall amount average is 50.5, and the reference hall amount difference may be 51-50.5=0.5
Step S434: and determining the interference form based on the reference Hall quantity difference value and a stable interference threshold value.
In some embodiments, the electronic device may preset and store a stable interference threshold, where the stable interference threshold is used as a basis for determining the reference hall amount difference. Therefore, in the present embodiment, in the case of obtaining the reference hall amount difference value, the reference hall amount difference value may be compared with the stable interference threshold value to obtain a magnitude relation between the reference hall amount difference value and the stable interference threshold value, and based on the magnitude relation, it is determined whether the interference is in the form of stable interference or unstable interference.
As an implementation manner, if the reference hall quantity difference is smaller than the stable interference threshold, the interference form can be determined to be stable interference; if the reference hall amount difference is equal to or greater than the stable interference threshold, it may be determined that the interference is in the form of unstable interference.
As an example, assume that the plurality of reference hall amounts includes 50, 51, and the stable interference threshold is 1. Then the reference hall quantity average is 50.5, the reference hall quantity difference may be 51-50.5=0.5, and since 0.5 < 1, it may be determined that the interference is in the form of stable interference.
Step S440: if it is determined that the disturbance is in the form of the stable disturbance, the target control position is determined from the plurality of control positions based on the first hall amount and the second hall amount.
In the present embodiment, if it is determined that the external magnetic field interference exists as a result of the interference, the target control position may be determined from the plurality of control positions based on the first hall amount and the second hall amount.
In some embodiments, if it is determined that the disturbance result is that there is an external magnetic field disturbance, a position calculation manner corresponding to the presence of the external magnetic field disturbance may be determined, and the first hall amount and the second hall amount are calculated by the position calculation manner corresponding to the presence of the external magnetic field disturbance, so as to determine the target control position from the plurality of control positions.
Referring to fig. 12, fig. 12 is a flowchart illustrating a step S440 of the method for determining a key position shown in fig. 10 of the present application. The following details the flow shown in fig. 12, and the method may specifically include the following steps:
step S441: if the interference form is the stable interference, acquiring a first Hall amount, acquired by the first Hall sensor, of the current first Hall amount, and acquiring a second Hall amount, acquired by the second Hall sensor, of the current second Hall amount.
In this embodiment, if it is determined that the interference form is stable interference, a first hall amount, which is a last of a current first hall amount and is acquired by the first hall sensor, may be acquired, and a second hall amount, which is a last of a current second hall amount and is acquired by the second hall sensor, may be acquired. Optionally, the control position of the control key corresponding to the current hall sensor when collecting the current hall amount may be the same as or different from the control position of the control key corresponding to the previous hall amount, which is not limited herein.
The collection parameters of the previous first hall amount and the collection parameters of the previous second hall amount should be the same, for example, the collection time of the previous first hall amount and the collection time of the previous second hall amount should be the same, the collection temperature of the previous first hall amount and the collection temperature of the previous second hall amount should be the same, and the invention is not limited herein.
Step S442: and calculating the difference value between the current first Hall quantity and the last first Hall quantity to obtain a first adjacent Hall quantity difference value.
In this embodiment, under the condition that the current first hall amount and the last first hall amount are obtained, the difference value calculation may be performed on the current first hall amount and the last first hall amount, so as to obtain a first adjacent hall amount difference value.
In some embodiments, under the condition that the current first hall amount and the last first hall amount are obtained, calculating a difference value by subtracting the last first hall amount from the current first hall amount to obtain a first adjacent hall amount difference value; or, the difference value may be calculated by subtracting the current first hall value from the previous first hall value, to obtain a difference value of the first adjacent hall values, which is not limited herein.
Step S443: and calculating the difference value between the current second Hall quantity and the last second Hall quantity to obtain a second adjacent Hall quantity difference value.
In this embodiment, under the condition that the current second hall amount and the last second hall amount are obtained, the difference value between the current second hall amount and the last second hall amount may be calculated, so as to obtain a second adjacent hall amount difference value.
In some embodiments, under the condition that the current second hall amount and the last second hall amount are obtained, calculating a difference value by subtracting the last second hall amount from the current second hall amount to obtain a second adjacent hall amount difference value; or, the difference value may be calculated by subtracting the current second hall value from the previous second hall value, to obtain a second adjacent hall value difference, which is not limited herein.
Step S444: and determining the target control position based on the first adjacent hall amount difference and the second adjacent hall amount difference.
In the present embodiment, in the case where the first adjacent hall amount difference value and the second adjacent hall amount difference value are obtained, the target control position may be determined from among the plurality of control positions based on the first adjacent hall amount difference value and the second adjacent hall amount difference value.
In some embodiments, the electronic device may be preset with a preset first adjacent hall amount difference value and a preset second adjacent hall amount difference value corresponding to each of the plurality of control positions, and then, in a case where the first adjacent hall amount difference value and the second adjacent hall amount difference value are obtained, the first adjacent hall amount difference value may be compared with a preset first adjacent hall amount difference value corresponding to each of the plurality of control positions, and the second adjacent hall amount difference value may be compared with a preset second adjacent hall amount difference value corresponding to each of the plurality of control positions, so as to determine the target control position from the plurality of control positions.
Referring to fig. 13, fig. 13 is a flowchart illustrating step S444 of the method for determining the key position shown in fig. 12 according to the present application. The following will describe the flow shown in fig. 13 in detail, and the method specifically may include the following steps:
Step S4441: and determining a relation between the first adjacent Hall quantity difference value and a first adjacent Hall range corresponding to each of the plurality of control positions as a third relation, wherein the first adjacent Hall range is determined based on a difference value between calibration Hall quantities acquired by the first Hall sensor at each two control positions in the plurality of control positions and a stable interference difference margin.
Optionally, the electronic device may preset and store a first adjacent hall range corresponding to each of the plurality of control positions, where the first adjacent hall range is determined based on a difference between calibrated hall amounts acquired by the first hall sensor at each two of the plurality of control positions and a stable interference difference margin. Optionally, the stable interference difference margin is determined based on an empirical value.
In some embodiments, as shown in table 5, assume that the plurality of control positions includes three control positions of up (up), middle (middle), and down (down), the first hall sensor has a calibrated hall amount a collected at the control position up, b collected at the control position middle, and c collected at the control position down in the context of electronic device production or post calibration. Then, the difference between the calibrated hall amounts acquired by the first hall sensor at the control position up and the control position middle is a-b (corresponding to the control position up), the difference between the calibrated hall amounts acquired by the first hall sensor at the control position middle and the control position down is b-c (corresponding to the control position middle), and the difference between the calibrated hall amounts acquired by the first hall sensor at the control position up and the control position down is a-c (corresponding to the control position down).
TABLE 5
Hall difference between every two control positions
First Hall sensor-up (up) a-b
First Hall sensor (middle) b-c
First Hall sensor-Down a-c
Further, as shown in fig. 6, assuming that the stable interference difference margin is n3, the first adjacent hall range corresponding to the control position up is a-b-n3 to a-b+n3, where a-b-n3 is the minimum value of the first adjacent hall range corresponding to the control position up, and a-b+n3 is the maximum value of the first adjacent hall range corresponding to the control position up; the first adjacent Hall range corresponding to the control position middle is b-c-n 3-b-c+n3, wherein b-c-n3 is the minimum value of the first adjacent Hall range corresponding to the control position middle, and b-c+n3 is the maximum value of the first adjacent Hall range corresponding to the control position middle; the first adjacent Hall range corresponding to the control position down is a-c-n3 to a-c+n3, wherein a-c-n3 is the minimum value of the first adjacent Hall range corresponding to the control position down, and a-c+n3 is the maximum value of the first adjacent Hall range corresponding to the control position down. Based on this, the first adjacent hall ranges corresponding to the respective plurality of control positions include: a-b-n 3-a-b+n3, b-c-n 3-b-c+n3, and a-c-n 3-a-c+n3.
TABLE 6
As an example, assume a=127, b=94, c=52, n3=15. Then, the difference between the calibrated hall amounts acquired by the first hall sensor at the control position up and the control position middle is a-b (corresponding to the control position up) =127-94=33, the difference between the calibrated hall amounts acquired by the first hall sensor at the control position middle and the control position down is b-c (corresponding to the control position middle) =94-52=42, and the difference between the calibrated hall amounts acquired by the first hall sensor at the control position up and the control position down is a-c (corresponding to the control position down) =127-52=75. The first adjacent Hall ranges corresponding to the control positions up are a-b-n 3-a-b+n3=33-15-33+15=18-48; the first adjacent Hall range corresponding to the control position middle is b-c-n 3-b-c+n3=42-15-42+15=27-57; the first adjacent hall ranges corresponding to the control positions down are a-c-n 3-a-c+n3=75-15-75+15=60-90.
In this embodiment, in the case where the first adjacent hall amount difference value is obtained, the first adjacent hall amount difference value may be compared with the first adjacent hall ranges respectively corresponding to the plurality of control positions, respectively, to determine the relationship of the first adjacent hall amount difference value and the first adjacent hall range respectively corresponding to the plurality of control positions, and the relationship may be regarded as the third relationship. Alternatively, the third relationship may include the first adjacent hall amount difference being within the corresponding first adjacent hall range, or the first adjacent hall amount difference not being within the corresponding first adjacent hall range.
In some embodiments, in the case of obtaining the first adjacent hall amount difference value, the first adjacent hall amount difference value may be simultaneously compared with the first adjacent hall ranges respectively corresponding to the plurality of control positions, or the first adjacent hall amount difference value may be sequentially compared with the first adjacent hall ranges respectively corresponding to the plurality of control positions, or the like, which is not limited herein.
In some embodiments, comparing the first adjacent hall quantity difference value to the first adjacent hall range may include: the first adjacent hall amount difference is compared with a minimum value in the first adjacent hall range to determine whether the first adjacent hall amount difference is equal to or greater than the minimum value in the first adjacent hall range, and the first adjacent hall amount difference is compared with a maximum value in the first adjacent hall range to determine whether the first adjacent hall amount difference is less than or equal to the minimum value in the first adjacent hall range.
Step S4442: and determining a relation between the second adjacent Hall quantity difference value and a second adjacent Hall range corresponding to each of the plurality of control positions as a fourth relation, wherein the second adjacent Hall range is determined based on a difference value between calibrated Hall quantities acquired by the second Hall sensor at each two of the plurality of control positions and a stable interference difference margin.
Optionally, the electronic device may preset and store a second adjacent hall range corresponding to each of the plurality of control positions, where the second adjacent hall range is determined based on a difference between calibrated hall amounts acquired by the second hall sensor at each two of the plurality of control positions and a stable interference difference margin. Optionally, the stable interference difference margin is determined based on an empirical value.
In some embodiments, as shown in table 7, it is assumed that the plurality of control positions includes three control positions of up (up), middle (middle), and down (down), the calibrated hall amount acquired by the second hall sensor at the control position up is d, the calibrated hall amount acquired at the control position middle is e, and the calibrated hall amount acquired at the control position down is f in the context of electronic device production or post calibration. Then, the difference between the calibrated hall amounts acquired by the second hall sensor at the control position up and the control position middle is d-e (corresponding to the control position up), the difference between the calibrated hall amounts acquired by the second hall sensor at the control position middle and the control position down is e-f (corresponding to the control position middle), and the difference between the calibrated hall amounts acquired by the second hall sensor at the control position up and the control position down is d-f (corresponding to the control position down).
TABLE 7
Hall difference between every two control positions
Second Hall sensor-up (up) d-e
Second Hall sensor (middle) e-f
Second Hall sensor-Down d-f
Further, as shown in table 8, assuming that the stable interference difference margin is n3, the second adjacent hall range corresponding to the control position up is d-e-n3 to d-e+n3, where d-e-n3 is the minimum value of the second adjacent hall range corresponding to the control position up, and d-e+n3 is the maximum value of the second adjacent hall range corresponding to the control position up; the second adjacent Hall range corresponding to the control position middle is e-f-n 3-e-f+n3, wherein e-f-n3 is the minimum value of the second adjacent Hall range corresponding to the control position middle, and e-f+n3 is the maximum value of the second adjacent Hall range corresponding to the control position middle; the second adjacent Hall range corresponding to the control position down is d-f-n 3-d-f+n3, wherein d-f-n3 is the minimum value of the second adjacent Hall range corresponding to the control position down, and d-f+n3 is the maximum value of the second adjacent Hall range corresponding to the control position down. Based on this, the second adjacent hall ranges corresponding to the respective plurality of control positions include: d-e-n 3-d-e+n3, e-f-n 3-e-f+n3, and d-f-n 3-d-f+n3.
TABLE 8
As an example, let d=50, e=86, f=127, n3=15. Then, the difference between the calibrated hall amounts acquired by the second hall sensor at the control position up and the control position middle is a-e (corresponding to the control position up) =50-86= -36, the difference between the calibrated hall amounts acquired by the second hall sensor at the control position middle and the control position down is e-f (corresponding to the control position middle) =86-127= -41, and the difference between the calibrated hall amounts acquired by the second hall sensor at the control position up and the control position down is d-f (corresponding to the control position down) =50-127= -77. The second adjacent Hall range corresponding to the control position up is d-e-n 3-d-e+n3= -36-15 to-36+15= -51 to-21; the second adjacent Hall range corresponding to the control position middle is e-f-n 3-e-f+n3= -41-15 to-41+15= -55 to-26; the second adjacent Hall range corresponding to the control position down is d-f-n 3-d-f+n3= -77-15 to-77+15= -92 to-62.
In this embodiment, when the second adjacent hall amount difference value is obtained, the second adjacent hall amount difference value may be compared with the second adjacent hall ranges corresponding to the respective control positions, respectively, to determine the relationship between the second adjacent hall amount difference value and the second adjacent hall range corresponding to the respective control positions, and use the relationship as the fourth relationship. Optionally, the fourth relationship may include that the second adjacent hall amount difference is within the corresponding second adjacent hall range, or that the second adjacent hall amount difference is not within the corresponding second adjacent hall range.
In some embodiments, in the case of obtaining the second adjacent hall amount difference value, the second adjacent hall amount difference value may be simultaneously compared with the second adjacent hall ranges respectively corresponding to the plurality of control positions, or the second adjacent hall amount difference value may be sequentially compared with the second adjacent hall ranges respectively corresponding to the plurality of control positions, or the like, which is not limited herein.
In some embodiments, comparing the second adjacent hall quantity difference value to the second adjacent hall range may include: and comparing the second adjacent Hall amount difference with the minimum value in the second adjacent Hall range to judge whether the second adjacent Hall amount difference is equal to or larger than the minimum value in the second adjacent Hall range, and comparing the second adjacent Hall amount difference with the maximum value in the second adjacent Hall range to judge whether the second adjacent Hall amount difference is smaller than or equal to the minimum value in the second adjacent Hall range.
Step S4443: the target control position is determined based on the third relationship and the fourth relationship.
In the present embodiment, in the case where the third relationship and the fourth relationship are obtained, the target control position may be determined from among the plurality of control positions based on the third relationship and the fourth relationship.
Referring to fig. 14, fig. 14 is a flowchart illustrating step S4443 of the method for determining a key position shown in fig. 13 of the present application. The following will describe the flow shown in fig. 14 in detail, and the method specifically may include the following steps:
step S44431: and determining a first adjacent Hall range in which the first adjacent Hall difference value is located from first adjacent Hall ranges corresponding to the control positions based on the third relation as a target first adjacent Hall range.
The third relationship may be used to characterize a relationship between the first adjacent hall amount difference and the first adjacent hall ranges corresponding to the plurality of control positions, so that, in a case where the third relationship is obtained, the first adjacent hall range in which the first adjacent difference is located may be determined as the target first adjacent hall range from the first adjacent hall ranges corresponding to the plurality of control positions based on the third relationship.
As an example, assume that a first adjacent hall range corresponding to each of a plurality of control positions includes: 18-48, 27-57 and 60-90, the current first hall amount is 137, the last first hall amount is 104, the first adjacent hall amount difference is 137-104=33, wherein 33 is located between 18-48 and 27-57, and 18-48 and 27-57 can be determined as the target first adjacent hall range.
Step S44432: and determining a second adjacent Hall range in which the second adjacent Hall quantity difference value is positioned from second adjacent Hall ranges corresponding to the control positions based on the fourth relation as a target second adjacent Hall range.
The fourth relationship may be used to characterize a relationship between the second adjacent hall amount difference and the second adjacent hall ranges corresponding to the plurality of control positions, so that, when the fourth relationship is obtained, the second adjacent hall range in which the second adjacent difference is located may be determined as the target first adjacent hall range from the second adjacent hall ranges corresponding to the plurality of control positions based on the fourth relationship.
As an example, assume that the second adjacent hall ranges corresponding to the respective plurality of control positions include: -51 to-48, -55 to-26 and-92 to-62, wherein the current second hall amount is 75, the last second hall amount is 96, and the second adjacent hall amount difference is 75-96= -21, wherein, -21 is located between 18 to 48 and-51 to-21, and the target second adjacent hall range can be determined by-51 to-21.
Step S44433: and determining control positions corresponding to the target first adjacent Hall range and the target second adjacent Hall range from the plurality of control positions as target control positions.
In some embodiments, in the case of determining the target first adjacent hall range and the target second adjacent hall range, the control positions corresponding to the target first adjacent hall range and the target second adjacent hall range may be determined from among the plurality of control positions, and the control positions corresponding to the target first adjacent hall range and the target second adjacent hall range may be determined as the target control positions.
For example, if the target first adjacent hall ranges are 18 to 48 (corresponding to the control position up) and 27 to 57 (corresponding to the control position middle), and the target second adjacent hall ranges are-51 to-21 (corresponding to the control position middle), the control position up may be determined as the target control position.
Step S450: and if the interference form is determined to be the unstable interference, outputting abnormal prompt information.
In this embodiment, if it is determined that the interference form is unstable, abnormal prompt information may be output, and no key event is reported.
In some embodiments, outputting the exception prompt may include: one or a combination of several of outputting abnormal prompt information in the form of voice, outputting abnormal prompt information in the form of vibration, outputting abnormal prompt information in the form of text, outputting abnormal prompt information in the form of image and outputting abnormal prompt information in the form of flashing lamp.
Compared with the method for determining the key position shown in fig. 6, in the method for determining the key position, in this embodiment, the interference form corresponding to the external magnetic field interference is determined when the interference result is that the external magnetic field interference exists, if the interference form is determined to be stable interference, the target control position is determined from the plurality of control positions based on the first hall amount and the second hall amount, and if the interference form is determined to be unstable interference, abnormal prompt information is output, so that different processes can be performed according to different interference forms when the interference exists, and the interference processing effect can be improved.
Referring to fig. 15, fig. 15 is a flowchart illustrating a method for determining a key position according to an embodiment of the present application. The method is applied to the electronic device, a control key is arranged on a middle frame of the electronic device, a first hall sensor, a second hall sensor and a magnet are arranged in the middle frame, the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor, a flow shown in fig. 15 is described in detail, and the method for determining the key position specifically comprises the following steps:
Step S510: the current first Hall quantity acquired by the first Hall sensor is acquired, and the current second Hall quantity acquired by the second Hall sensor is acquired.
Step S520: and determining an interference result based on the current first Hall amount and the current second Hall amount, wherein the interference result comprises the presence or absence of external magnetic field interference.
Step S530: and determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount.
The specific description of step S510 to step S530 refers to step S110 to step S130, and will not be repeated here.
Step S540: and executing a response corresponding to the target control position.
In the present embodiment, in the case where the target control position is determined, then a response corresponding to the target control position may be performed.
In some embodiments, it is assumed that the plurality of control positions includes three control positions up (up), middle (middle), down (down), and the control position up is used to control the electronic device to mute, the control position middle is used to control the electronic device to vibrate, and the control position down is used to control the electronic device to ring. Then, if the target control position is determined to be the control position up, a response of controlling the muting of the electronic apparatus may be performed; if the target control position is determined to be the control position middle, executing response of controlling the vibration of the electronic equipment; if the target control position is determined to be the control position down, a response to control the electronic device to ring may be performed.
Compared with the method for determining the key position shown in fig. 6, the method for determining the key position further performs a response corresponding to the target control position under the condition of determining the target control position, so that response accuracy and efficiency of the electronic device can be improved.
Referring to fig. 16, fig. 16 is a block diagram illustrating a key position determining apparatus according to an embodiment of the present application. The key position determining apparatus 200 is applied to the above electronic device, a control key is disposed on a middle frame of the electronic device, a first hall sensor, a second hall sensor and a magnet are disposed in the middle frame, the control key is used for switching between a plurality of control positions to drive the magnet to move between the first hall sensor and the second hall sensor, the block diagram shown in fig. 16 will be described below, the key position determining apparatus 200 includes: a hall amount acquisition module 210, an interference result determination module 220, and a position determination module 230, wherein:
the hall amount obtaining module 210 is configured to obtain a current first hall amount collected by the first hall sensor, and obtain a current second hall amount collected by the second hall sensor.
The interference result determining module 220 is configured to determine an interference result based on the current first hall amount and the current second hall amount, where the interference result includes the presence or absence of an external magnetic field interference.
Further, the interference result determining module 220 includes: the current Hall quantity difference value obtaining sub-module, the current Hall quantity sum value obtaining sub-module and the interference result determining sub-module, wherein:
the current Hall quantity difference value obtaining sub-module is used for carrying out difference value calculation on the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity difference value.
And the current Hall quantity and value obtaining sub-module is used for calculating the sum value of the current first Hall quantity and the current second Hall quantity to obtain the current Hall quantity and value.
And the interference result determining submodule is used for determining the interference result based on the current Hall quantity difference value and the current Hall quantity sum value.
Further, the interference result determining submodule includes: a first relationship determination unit, a second relationship determination unit, and an interference result determination unit, wherein:
a first relation determining unit, configured to determine, as a first relation, a relation between the current hall amount difference and a calibrated hall amount difference range corresponding to each of the plurality of control positions, where the calibrated hall amount difference range is determined based on a difference between calibrated hall amounts acquired by the first hall sensor and the second hall sensor at the same control position among the plurality of control positions and an interference difference margin.
A second relation determining unit configured to determine, as a second relation, a relation between the current hall amount and value and a calibrated hall amount and value range corresponding to each of the plurality of control positions, wherein the calibrated hall amount and value range is determined based on a sum value and an interference and value margin between the calibrated hall amounts respectively acquired by the first hall sensor and the second hall sensor at the same control position among the plurality of control positions.
And an interference result determining unit configured to determine the interference result based on the first relationship and the second relationship.
Further, the interference result determining unit includes: a first interference result determination subunit and a second interference result determination subunit, wherein:
and the first interference result determining subunit is configured to determine that the interference result is that no external magnetic field interference exists if it is determined, based on the first relationship, that the current hall amount and the current hall amount satisfy any one of the calibrated hall amount and the value range corresponding to each of the plurality of control positions, and it is determined, based on the second relationship, that the current hall amount and the current hall amount satisfy any one of the calibrated hall amount and the value range corresponding to each of the plurality of control positions.
And the second interference result determining subunit is configured to determine that the interference result is external magnetic field interference if the current hall amount difference value does not satisfy the calibrated hall amount difference value range corresponding to each of the plurality of control positions based on the first relationship, and/or the current hall amount sum value does not satisfy the calibrated hall amount sum value range corresponding to each of the plurality of control positions based on the second relationship.
The position determining module 230 is configured to determine, from the plurality of control positions, a target control position corresponding to the control key based on the interference result, the current first hall amount, and the current second hall amount.
Further, the location determining module 230 includes: the current hall quantity difference value obtaining sub-module, the calibration hall quantity difference value range determining sub-module and the first target control position determining sub-module, wherein:
and the current Hall quantity difference value obtaining submodule is used for carrying out difference value calculation on the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity difference value if the interference result is that no external magnetic field interference exists.
And the calibration Hall difference value range determination submodule is used for determining the calibration Hall difference value range where the current Hall difference value is located from the calibration Hall difference value ranges corresponding to the control positions as a target calibration Hall difference value range, wherein the calibration Hall difference value range is determined based on the difference value and the interference difference margin between the calibration Hall quantities acquired by the first Hall sensor and the second Hall sensor at the same control positions in the control positions.
And the first target control position determining submodule is used for determining a control position corresponding to the target calibration Hall difference value range from the plurality of control positions as the target control position.
Further, the location determining module 230 includes: an interference pattern determination sub-module and a second target control position determination sub-module, wherein:
and the interference form determining submodule is used for determining an interference form corresponding to the external magnetic field interference if the external magnetic field interference exists as a result of the interference, wherein the interference form comprises stable interference or unstable interference.
Further, the interference form determination submodule includes: a reference hall amount acquisition unit, a reference hall amount average value acquisition unit, a reference hall amount difference value acquisition unit, and an interference form determination unit, wherein:
and the reference Hall quantity acquisition unit is used for acquiring a plurality of reference Hall quantities acquired by a reference Hall sensor according to a preset time interval if the interference result is that the external magnetic field interference exists, wherein the reference Hall sensor is the first Hall sensor or the second Hall sensor.
And the reference Hall quantity average value obtaining unit is used for carrying out average value calculation on the plurality of reference Hall quantities to obtain a reference Hall quantity average value.
And the reference Hall quantity difference value obtaining unit is used for carrying out difference value calculation on the reference Hall quantity average value and the reference Hall quantity acquired last time to obtain a reference Hall quantity difference value.
And the interference form determining unit is used for determining the interference form based on the reference Hall quantity difference value and a stable interference threshold value.
Further, the interference form determining unit includes: a stable interference pattern determining subunit and an unstable interference pattern determining subunit, wherein:
and the stable interference form determining subunit is used for determining that the interference form is the stable interference if the reference Hall quantity difference value is smaller than the stable interference threshold value.
And the unstable interference form determining subunit is used for determining that the interference form is the unstable interference if the reference Hall difference value is equal to or greater than the stable interference threshold value.
And a second target control position determining sub-module configured to determine the target control position from the plurality of control positions based on the first hall amount and the second hall amount if it is determined that the disturbance is in the form of the stable disturbance.
Further, the second target control position determining submodule includes: the device comprises a last Hall quantity acquisition unit, a first adjacent Hall quantity difference value acquisition unit, a second adjacent Hall quantity difference value acquisition unit and a target control position determination unit, wherein:
And the last Hall quantity acquisition unit is used for acquiring a first Hall quantity acquired by the first Hall sensor and a second Hall quantity acquired by the second Hall sensor and used for acquiring the first Hall quantity of the current first Hall quantity if the interference form is the stable interference.
The first adjacent Hall quantity difference value obtaining unit is used for carrying out difference value calculation on the current first Hall quantity and the last first Hall quantity to obtain a first adjacent Hall quantity difference value.
And the second adjacent Hall quantity difference value obtaining unit is used for carrying out difference value calculation on the current second Hall quantity and the last second Hall quantity to obtain a second adjacent Hall quantity difference value.
And a target control position determining unit configured to determine the target control position based on the first adjacent hall amount difference and the second adjacent hall amount difference.
Further, the target control position determining unit includes: a third relationship determination subunit, a fourth relationship determination subunit, and a target control position determination subunit, wherein:
and a third relation determining subunit, configured to determine, as a third relation, a relation between the first adjacent hall amount difference and a first adjacent hall range corresponding to each of the plurality of control positions, where the first adjacent hall range is determined based on a difference between calibrated hall amounts acquired by the first hall sensor at each two of the plurality of control positions and a stable interference difference margin.
A fourth relationship determining subunit, configured to determine, as a fourth relationship, a relationship between the second adjacent hall amount difference and a second adjacent hall range corresponding to each of the plurality of control positions, where the second adjacent hall range is determined based on a difference between calibrated hall amounts acquired by the second hall sensor at each two of the plurality of control positions and a stable interference difference margin.
And a target control position determining subunit configured to determine the target control position based on the third relationship and the fourth relationship.
Further, the target control position determining subunit includes: a first adjacent hall range determination subunit, a second adjacent hall range determination subunit, and a target control position determination subunit, wherein:
and the first adjacent Hall range determining subunit is used for determining a first adjacent Hall range where the first adjacent Hall difference value is located from the first adjacent Hall ranges corresponding to the control positions based on the third relation as a target first adjacent Hall range.
And the second adjacent Hall range determining subunit is used for determining a second adjacent Hall range in which the second adjacent Hall quantity difference value is located from the second adjacent Hall ranges corresponding to the control positions based on the fourth relation as a target second adjacent Hall range.
And the target control position determining subunit is used for determining the control positions corresponding to the target first adjacent Hall range and the target second adjacent Hall range from the plurality of control positions as the target control positions.
Further, the location determining module 230 includes: an abnormality prompt information output sub-module, wherein:
and the abnormal prompt information output sub-module is used for outputting abnormal prompt information if the interference form is determined to be the unstable interference.
Further, the key position determining device 200 further includes: a response execution module, wherein:
and the response execution module is used for executing the response corresponding to the target control position.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the apparatus and modules described above may refer to the corresponding process in the foregoing method embodiment, which is not repeated herein.
In several embodiments provided herein, the coupling of the modules to each other may be electrical, mechanical, or other.
In addition, each functional module in each embodiment of the present application may be integrated into one processing module, or each module may exist alone physically, or two or more modules may be integrated into one module. The integrated modules may be implemented in hardware or in software functional modules.
Referring to fig. 17, a block diagram of an electronic device 100 according to an embodiment of the present application is shown. The electronic device 100 may be a smart phone, a tablet computer, an electronic book, or the like capable of running an application program. The electronic device 100 in this application may include one or more of the following components: a processor 110, a memory 120, and one or more application programs, wherein the one or more application programs may be stored in the memory 120 and configured to be executed by the one or more processors 110, the one or more program(s) configured to perform the method as described in the foregoing method embodiments.
Wherein the processor 110 may include one or more processing cores. The processor 110 utilizes various interfaces and lines to connect various portions of the overall electronic device 100, perform various functions of the electronic device 100, and process data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120, and invoking data stored in the memory 120. Alternatively, the processor 110 may be implemented in hardware in at least one of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), programmable logic array (Programmable Logic Array, PLA). The processor 110 may integrate one or a combination of several of a central processing unit (Central Processing Unit, CPU), a graphics processor (Graphics Processing Unit, GPU), and a modem, etc. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for being responsible for rendering and drawing the content to be displayed; the modem is used to handle wireless communications. It will be appreciated that the modem may not be integrated into the processor 110 and may be implemented solely by a single communication chip.
The Memory 120 may include a random access Memory (Random Access Memory, RAM) or a Read-Only Memory (Read-Only Memory). Memory 120 may be used to store instructions, programs, code, sets of codes, or sets of instructions. The memory 120 may include a stored program area and a stored data area, wherein the stored program area may store instructions for implementing an operating system, instructions for implementing functions (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described below, and the like. The storage data area may also store data created by the electronic device 100 in use (e.g., phonebook, audiovisual data, chat log data), and the like.
Referring to fig. 18, a block diagram of a computer readable storage medium according to an embodiment of the present application is shown. The computer readable medium 300 has stored therein program code which can be invoked by a processor to perform the methods described in the method embodiments described above.
The computer readable storage medium 300 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 300 comprises a non-volatile computer readable medium (non-transitory computer-readable storage medium). The computer readable storage medium 300 has storage space for program code 310 that performs any of the method steps described above. The program code can be read from or written to one or more computer program products. Program code 310 may be compressed, for example, in a suitable form.
In summary, according to the method, the device, the electronic device and the storage medium for determining the key positions provided by the embodiments of the present application, the control key is disposed on the middle frame of the electronic device, and the first hall sensor, the second hall sensor and the magnet are disposed in the middle frame, where the control key is used for switching between a plurality of control positions so as to drive the magnet to move between the first hall sensor and the second hall sensor. Based on the structure of the electronic equipment, the current first Hall amount acquired by the first Hall sensor can be acquired, the current second Hall amount acquired by the second Hall sensor can be acquired, an interference result including the existence of external magnetic field interference or the absence of external magnetic field interference is determined based on the current first Hall amount and the current second Hall amount, and the target control position corresponding to the control key is determined from a plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount, so that the interference detection is carried out on the double Hall sensors, the key position is identified according to the detected interference result, and the accuracy of identification can be improved.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and are not limiting thereof; although the present application has been described in detail with reference to the foregoing embodiments, one of ordinary skill in the art will appreciate that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not drive the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (16)

1. The method for determining the key positions is characterized by being applied to electronic equipment, wherein a control key is arranged on a middle frame of the electronic equipment, a first Hall sensor, a second Hall sensor and a magnet are arranged in the middle frame, and the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first Hall sensor and the second Hall sensor; the method comprises the following steps:
acquiring a current first Hall amount acquired by the first Hall sensor, and acquiring a current second Hall amount acquired by the second Hall sensor;
determining an interference result based on the current first hall amount and the current second hall amount, wherein the interference result comprises the presence or absence of external magnetic field interference;
and determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount.
2. The method of claim 1, wherein the determining an interference result based on the current first hall amount and the current second hall amount comprises:
Calculating the difference value of the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity difference value;
performing sum value calculation on the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity sum value;
and determining the interference result based on the current Hall quantity difference value and the current Hall quantity sum value.
3. The method of claim 2, wherein the determining the interference result based on the current hall quantity difference and the current hall quantity sum value comprises:
determining a relation between the current hall quantity difference value and a calibrated hall quantity difference value range corresponding to each of the plurality of control positions as a first relation, wherein the calibrated hall quantity difference value range is determined based on a difference value and an interference difference margin between calibrated hall quantities acquired by the first hall sensor and the second hall sensor respectively at the same control position in the plurality of control positions;
determining a relationship between the current hall amount and value and a calibrated hall amount and value range corresponding to each of the plurality of control positions as a second relationship, wherein the calibrated hall amount and value range is determined based on a sum value and an interference sum value margin between the calibrated hall amounts respectively acquired by the first hall sensor and the second hall sensor at the same control position among the plurality of control positions;
The interference result is determined based on the first relationship and the second relationship.
4. A method according to claim 3, wherein said determining said interference result based on said first relationship and said second relationship comprises:
if it is determined that the current hall quantity and the current hall quantity meet any one of the calibrated hall quantity and the calibrated hall quantity corresponding to each of the plurality of control positions based on the first relation, and if it is determined that the current hall quantity and the current hall quantity meet any one of the calibrated hall quantity and the calibrated hall quantity corresponding to each of the plurality of control positions based on the second relation, determining that the interference result is that no external magnetic field interference exists; or alternatively
And if the current Hall quantity difference value does not meet the calibrated Hall quantity difference value range corresponding to each of the plurality of control positions based on the first relation, and/or if the current Hall quantity sum value does not meet the calibrated Hall quantity sum value range corresponding to each of the plurality of control positions based on the second relation, determining that the interference result is external magnetic field interference.
5. The method of any of claims 1-4, wherein the determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first hall amount, and the current second hall amount comprises:
If the interference result is that no external magnetic field interference exists, calculating a difference value between the current first Hall quantity and the current second Hall quantity to obtain a current Hall quantity difference value;
determining a calibrated hall difference value range in which the current hall difference value is located from calibrated hall difference value ranges corresponding to the control positions respectively as a target calibrated hall difference value range, wherein the calibrated hall difference value range is determined based on a difference value and an interference difference value allowance between calibrated hall amounts acquired by the first hall sensor and the second hall sensor respectively at the same control position in the control positions;
and determining a control position corresponding to the target calibration Hall difference value range from the plurality of control positions as the target control position.
6. The method of any of claims 1-4, wherein the determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first hall amount, and the current second hall amount comprises:
if the interference result is that the external magnetic field interference exists, determining an interference form corresponding to the external magnetic field interference, wherein the interference form comprises stable interference or unstable interference;
If it is determined that the disturbance is in the form of the stable disturbance, the target control position is determined from the plurality of control positions based on the first hall amount and the second hall amount.
7. The method of claim 6, wherein the method further comprises:
and if the interference form is determined to be the unstable interference, outputting abnormal prompt information.
8. The method of claim 6, wherein determining a form of interference corresponding to the external magnetic field interference if the interference results in the external magnetic field interference, comprises:
if the interference result is that the external magnetic field interference exists, acquiring a plurality of reference Hall quantities acquired by a reference Hall sensor according to a preset time interval, wherein the reference Hall sensor is the first Hall sensor or the second Hall sensor;
calculating the average value of the reference Hall quantities to obtain an average value of the reference Hall quantities;
calculating the difference value between the reference Hall quantity average value and the reference Hall quantity acquired last time to obtain a reference Hall quantity difference value;
and determining the interference form based on the reference Hall quantity difference value and a stable interference threshold value.
9. The method of claim 8, wherein the determining the interference pattern based on the reference hall quantity difference and a stable interference threshold comprises:
if the reference Hall quantity difference value is smaller than the stable interference threshold value, determining that the interference form is the stable interference; or alternatively
And if the reference Hall difference value is equal to or larger than the stable interference threshold value, determining that the interference form is the unstable interference.
10. The method of claim 6, wherein the determining the target control position from the plurality of control positions based on the first hall amount and the second hall amount if the disturbance is determined to be the stable disturbance comprises:
if the interference form is the stable interference, acquiring a first Hall amount, acquired by the first Hall sensor, of the current first Hall amount, and acquiring a second Hall amount, acquired by the second Hall sensor, of the current second Hall amount;
calculating the difference value between the current first Hall quantity and the last first Hall quantity to obtain a first adjacent Hall quantity difference value;
calculating the difference value between the current second Hall quantity and the last second Hall quantity to obtain a second adjacent Hall quantity difference value;
And determining the target control position based on the first adjacent hall amount difference and the second adjacent hall amount difference.
11. The method of claim 10, wherein the determining the target control position based on the first adjacent hall amount difference and the second adjacent hall amount difference comprises:
determining a relation between the first adjacent hall quantity difference value and a first adjacent hall range corresponding to each of the plurality of control positions as a third relation, wherein the first adjacent hall range is determined based on a difference value between calibration hall quantities acquired by the first hall sensor at each two of the plurality of control positions and a stable interference difference margin;
determining a relationship between the second adjacent hall quantity difference value and a second adjacent hall range corresponding to each of the plurality of control positions as a fourth relationship, wherein the second adjacent hall range is determined based on a difference value between calibrated hall quantities acquired by the second hall sensor at each two of the plurality of control positions and a stable interference difference margin;
the target control position is determined based on the third relationship and the fourth relationship.
12. The method of claim 11, wherein the determining the target location based on the third relationship and the fourth relationship comprises:
determining a first adjacent Hall range in which the first adjacent Hall difference value is located from first adjacent Hall ranges corresponding to the control positions based on the third relation as a target first adjacent Hall range;
determining a second adjacent Hall range in which the second adjacent Hall quantity difference value is located from second adjacent Hall ranges corresponding to the control positions based on the fourth relation as a target second adjacent Hall range;
and determining control positions corresponding to the target first adjacent Hall range and the target second adjacent Hall range from the plurality of control positions as target control positions.
13. The method of any one of claims 1-4, further comprising, after the determining the target control position corresponding to the control key from the plurality of control positions:
and executing a response corresponding to the target control position.
14. The key position determining device is characterized by being applied to electronic equipment, wherein a control key is arranged on a middle frame of the electronic equipment, a first Hall sensor, a second Hall sensor and a magnet are arranged in the middle frame, and the control key is used for switching among a plurality of control positions so as to drive the magnet to move between the first Hall sensor and the second Hall sensor; the device comprises:
The Hall quantity acquisition module is used for acquiring the current first Hall quantity acquired by the first Hall sensor and acquiring the current second Hall quantity acquired by the second Hall sensor;
the interference result determining module is used for determining an interference result based on the current first Hall quantity and the current second Hall quantity, wherein the interference result comprises the presence or absence of external magnetic field interference;
and the position determining module is used for determining a target control position corresponding to the control key from the plurality of control positions based on the interference result, the current first Hall amount and the current second Hall amount.
15. An electronic device comprising a memory and a processor, the memory coupled to the processor, the memory storing instructions that when executed by the processor perform the method of any of claims 1-13.
16. A computer readable storage medium having stored therein program code which is callable by a processor to perform the method according to any one of claims 1-13.
CN202311512523.XA 2023-11-13 2023-11-13 Method and device for determining key positions, electronic equipment and storage medium Pending CN117559977A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311512523.XA CN117559977A (en) 2023-11-13 2023-11-13 Method and device for determining key positions, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311512523.XA CN117559977A (en) 2023-11-13 2023-11-13 Method and device for determining key positions, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117559977A true CN117559977A (en) 2024-02-13

Family

ID=89819849

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311512523.XA Pending CN117559977A (en) 2023-11-13 2023-11-13 Method and device for determining key positions, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117559977A (en)

Similar Documents

Publication Publication Date Title
US9606681B2 (en) Finger detection on touch screens for mobile devices
CN104620189B (en) Mobile device hardware attitude detection implementation with MEMS motion sensors
US20160239138A1 (en) Mobile device, press detection method and computer-readable recording medium
CN100483278C (en) Process measurement apparatus featuring extended hardware failure recognition
CN106225806B (en) Calibrate the method, device and mobile terminal of Magnetic Sensor
US9529201B1 (en) Magnetically coupled waterproof hinge with integrated multi-stage button and state detection
CN104640184A (en) Screen wake-up method and device
US20210103345A1 (en) Double-tap event detection device, system and method
US9454208B2 (en) Preventing sleep mode for devices based on sensor inputs
US20190101578A1 (en) Resolution adjustment for capacitive touch sensor
CN107037965A (en) A kind of information displaying method based on input, device and mobile terminal
US11775167B2 (en) Gesture recognition on watch bezel using strain gauges
US20150153807A1 (en) Method for reducing power consumption and sensor management system for the same
CN105338167B (en) Automatic execution method and device for mobile terminal operation and mobile terminal
CN103927101A (en) Method and device for controlling ActiveX
CN102981671A (en) Multi-class object touch point detection method
CN110495892B (en) Motion data detection method and intelligent wearable device
CN117559977A (en) Method and device for determining key positions, electronic equipment and storage medium
US8305240B2 (en) Input inducing device and inducing keyboard
KR101279779B1 (en) Method for sensing proximity of object and apparatus thereof
CN104951203A (en) Device control method and device and electronic device
CN103108078A (en) Mobile terminal with call reminding control system and call reminding control method
CN114690250B (en) Detection method of lifting pen based on pure magnetic induction
CN106293006B (en) Run the method, device and mobile terminal in Magnetic Sensor calibration algorithm library
US20140033231A1 (en) Electronic device with a function of alerting running applications and method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination