CN114413441B - Key control method, key control device, computer equipment, storage medium and program product - Google Patents

Key control method, key control device, computer equipment, storage medium and program product Download PDF

Info

Publication number
CN114413441B
CN114413441B CN202210004264.9A CN202210004264A CN114413441B CN 114413441 B CN114413441 B CN 114413441B CN 202210004264 A CN202210004264 A CN 202210004264A CN 114413441 B CN114413441 B CN 114413441B
Authority
CN
China
Prior art keywords
key
time
current key
current
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210004264.9A
Other languages
Chinese (zh)
Other versions
CN114413441A (en
Inventor
李俊泽
刘健军
郑文成
王子
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gree Electric Appliances Inc of Zhuhai
Original Assignee
Gree Electric Appliances Inc of Zhuhai
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 Gree Electric Appliances Inc of Zhuhai filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN202210004264.9A priority Critical patent/CN114413441B/en
Publication of CN114413441A publication Critical patent/CN114413441A/en
Application granted granted Critical
Publication of CN114413441B publication Critical patent/CN114413441B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • FMECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
    • F24HEATING; RANGES; VENTILATING
    • F24FAIR-CONDITIONING; AIR-HUMIDIFICATION; VENTILATION; USE OF AIR CURRENTS FOR SCREENING
    • F24F11/00Control or safety arrangements
    • F24F11/62Control or safety arrangements characterised by the type of control or by internal processing, e.g. using fuzzy logic, adaptive control or estimation of values
    • F24F11/63Electronic processing
    • F24F11/64Electronic processing using pre-stored data
    • FMECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
    • F24HEATING; RANGES; VENTILATING
    • F24FAIR-CONDITIONING; AIR-HUMIDIFICATION; VENTILATION; USE OF AIR CURRENTS FOR SCREENING
    • F24F11/00Control or safety arrangements
    • F24F11/50Control or safety arrangements characterised by user interfaces or communication
    • F24F11/61Control or safety arrangements characterised by user interfaces or communication using timers
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Chemical & Material Sciences (AREA)
  • Combustion & Propulsion (AREA)
  • Mechanical Engineering (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Input From Keyboards Or The Like (AREA)
  • Safety Devices In Control Systems (AREA)

Abstract

The application relates to a key control method, a key control device, a computer device, a storage medium and a computer program product. The method comprises the following steps: acquiring a current key value corresponding to a pressed current key and a current key time corresponding to the current key value in the target electronic equipment; if the interval time of the current key continuously pressed is smaller than the first threshold value according to the current key value and the current key time, and the time length of the current key is larger than the second threshold value, the target electronic equipment is controlled to stop sending the instruction. By adopting the method, abnormal control of the electronic equipment can be avoided, the running stability of the electronic equipment is ensured, and the service life of the electronic equipment is prolonged.

Description

Key control method, key control device, computer equipment, storage medium and program product
Technical Field
The present disclosure relates to the field of electronic devices, and in particular, to a key control method, apparatus, computer device, computer readable storage medium, and computer program product.
Background
Currently, in order to facilitate a user to control an electronic device to implement function state switching, a key is generally set for the electronic device, or a remote controller is configured. For example, in the case of an air conditioner, a corresponding remote controller is provided, and when a key of the remote controller is pressed, the function state of the air conditioner is switched according to the pressed key or key combination. More specifically, when a logical right key of the remote controller is pressed, the air conditioner wind speed will be changed. However, in an actual application scenario, the remote controller may be pressed by a heavy object, so that the key is continuously pressed, and at this time, the air conditioner is continuously controlled, for example, the air speed of the air conditioner is circularly changed. Thus, the long-time circulation change of the functional state of the air conditioner can lead to low operation stability of the air conditioner and reduce the service life of the air conditioner.
Therefore, how to avoid abnormal control of the electronic equipment, ensure the running stability of the electronic equipment and improve the service life of the electronic equipment.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a key control method, apparatus, computer device, computer readable storage medium, and computer program product that can avoid abnormal control of an electronic device, ensure operation stability of the electronic device, and improve service life of the electronic device.
In a first aspect, the present application provides a key control method. The method comprises the following steps:
acquiring a current key value corresponding to a current key of which the key state is pressed in target electronic equipment and a current key time corresponding to the current key value;
and if the interval time of the current key continuously pressed is determined to be smaller than a first threshold value according to the current key value and the current key time, and the time length of the current key is larger than a second threshold value, controlling the target electronic equipment to stop sending instructions.
In one embodiment, the determining manner of the interval time when the current key is continuously pressed includes:
if the current key value is the same as the historical key value, determining the interval time when the current key is continuously pressed according to the difference value between the current key time and the historical key time; the historical key value is a key value corresponding to a historical key which is scanned to be pressed in the last time, and the historical key time is a key time corresponding to the historical key value.
In one embodiment, the determining manner of the long time of the current key includes:
determining the long time of the current key according to the difference value between the current key time and the initial time; the initial time is the historical key time when the current key value is the same as the historical key value.
In one embodiment, the determining manner of the long time of the current key includes:
determining the long time of the current key according to the interval time of the current key and the history interval time corresponding to the history key; the historical interval time is the interval time between the historical key time when the current key value is the same as the historical key value and the historical key time when the current key value is the same as the historical key value.
In one embodiment, before the stopping controlling the target electronic device, the method further comprises:
controlling the target electronic equipment to be switched to an initial state; and the initial state is a state before the target electronic equipment performs state switching according to the current key value when the current key value is determined to be the same as the historical key value for the first time.
In one embodiment, the method further comprises:
and controlling the target electronic equipment to switch to a low-power consumption mode.
In one embodiment, the obtaining the current key value corresponding to the pressed current key and the current key time corresponding to the current key value in the target electronic device includes:
scanning all keys of the target electronic equipment according to a preset period, and acquiring a current key value corresponding to the current key which is pressed by the key state in the target electronic equipment and a current key time corresponding to the current key value.
In a second aspect, the present application further provides a key control device. The device comprises:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a current key value corresponding to a current key which is pressed in a key state in target electronic equipment and a current key time corresponding to the current key value;
and the control module is used for controlling the target electronic equipment to stop sending the instruction if the interval time of the current key continuously pressed is determined to be smaller than a first threshold value according to the current key value and the current key time and the time of the current key is longer than a second threshold value.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring a current key value corresponding to a current key of which the key state is pressed in target electronic equipment and a current key time corresponding to the current key value;
and if the interval time of the current key continuously pressed is determined to be smaller than a first threshold value according to the current key value and the current key time, and the time length of the current key is larger than a second threshold value, controlling the target electronic equipment to stop sending instructions.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a current key value corresponding to a current key of which the key state is pressed in target electronic equipment and a current key time corresponding to the current key value;
and if the interval time of the current key continuously pressed is determined to be smaller than a first threshold value according to the current key value and the current key time, and the time length of the current key is larger than a second threshold value, controlling the target electronic equipment to stop sending instructions.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
acquiring a current key value corresponding to a current key of which the key state is pressed in target electronic equipment and a current key time corresponding to the current key value;
and if the interval time of the current key continuously pressed is determined to be smaller than a first threshold value according to the current key value and the current key time, and the time length of the current key is larger than a second threshold value, controlling the target electronic equipment to stop sending instructions.
According to the key control method, the key control device, the computer equipment, the computer readable storage medium and the computer program product, whether the abnormal long-pressing condition of the key exists or not is determined according to whether the interval time of continuously pressing the current key is smaller than the first threshold value and whether the long time of the current key is longer than the second threshold value, when the abnormal long-pressing condition of the key exists, the target electronic equipment is controlled to stop sending instructions, continuous control of the target electronic equipment caused by the abnormal long-pressing of the key is avoided, therefore, the operation stability of the target electronic equipment is guaranteed, and the service life of the target electronic equipment is prolonged.
Drawings
FIG. 1 is a diagram of an application environment of a key control method in one embodiment;
FIG. 2 is a flow chart of a key control method according to another embodiment;
FIG. 3 is a block diagram of a key control device according to an embodiment;
fig. 4 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In one embodiment, as shown in fig. 1, a key control method is provided, and this embodiment is described by taking the application of the method to a terminal as an example. The terminal may be a device integrally provided with the target electronic device, or may be a device communicatively connected to the target electronic device, which is not limited in this embodiment. A key control method comprises the following steps:
step 202, obtaining a current key value corresponding to a current key of which the key state is pressed in the target electronic device and a current key time corresponding to the current key value.
Specifically, in actual operation, the current key with the pressed key state in the current target electronic device can be determined according to different signals corresponding to the pressed or lifted key state; or performing key detection by using an edge signal generated by key pressing, and determining that the key state in the current target electronic equipment is the pressed current key. And determining a corresponding current key value according to the detected key state as the pressed current key, and determining the current key time corresponding to the current key with the pressed key state, namely determining the current key time corresponding to the current key value.
It should be noted that, at the same time, a single key may be pressed, or a plurality of key combinations may be pressed, so the obtained current key value may be a key value corresponding to a single key, or a key value corresponding to a plurality of key combinations, which is not limited in this embodiment.
The target electronic device refers to a device that needs to perform key control, and the specific type of the target electronic device is not limited in this embodiment.
And 204, if the interval time of the current key continuously pressed is less than the first threshold value and the time of the current key is greater than the second threshold value according to the current key value and the current key time, controlling the target electronic device to stop sending the instruction.
Wherein, the interval time of the current key being continuously pressed refers to the difference value between the key time of continuously detecting the current key being pressed twice; if the key a is detected to be pressed at the time T1 and the key a is detected to be pressed again at the time T2, the interval time between the continuous pressing of the key a is the difference (T2-T1) between the time of the continuous pressing of the key a.
The long time of the current key refers to the time corresponding to the continuous long pressing (without lifting operation in the middle) of the current key, namely the time elapsed from the time when the current key is pressed to the time when the current key time is detected.
In this embodiment, a first threshold value and a second threshold value are preset, where the first threshold value is used to determine whether the key is continuously pressed, and the second threshold value is used to determine whether the key is long pressed. After determining the interval time of the current key being continuously pressed, judging whether the determined interval is smaller than a first threshold value; if the time interval is smaller than the first threshold value, the current key is continuously pressed, and no lifting operation is performed in the pressing process; if the time interval is greater than the first threshold, the time interval for the current key to be pressed is longer, and a lifting operation may exist in the middle, namely, a continuous short pressing operation is performed on the current key.
On the basis of determining that the current key is continuously pressed, determining the long time of the current key, and judging whether the determined long time is larger than a second threshold value or not; if the time is longer than the second threshold value, the time for continuously pressing the current key reaches the judging condition of abnormal long-pressing of the key, and the current key is determined to be operated by abnormal long-pressing of the key; otherwise, the time for continuously pressing the current key does not reach the judging condition of abnormal long-time pressing of the key, so that the key state of each key of the target electronic device is continuously monitored.
Specifically, when the current key is determined to be abnormally long pressed, the target electronic equipment is controlled to stop sending the instruction, namely, the target electronic equipment is limited to switch the functional state according to the current key. In actual operation, the pressed state of the current key can be invalidated by changing the signal corresponding to the pressed current key, so that the control target electronic equipment stops sending instructions.
It should be noted that, in this embodiment, the target electronic device may be an electronic device configured with a remote controller, where the function state of the corresponding electronic device, such as an air conditioner, is switched by a key of the remote controller, and if it is determined that the key of the remote controller is in an abnormal long-press state of the key, the remote controller is controlled to stop sending an instruction, so that the remote controller stops switching the function state of the air conditioner and other devices; the target electronic device in this embodiment may also be a device provided with a key, such as a water dispenser or a fan heater, and if it is determined that the key of the water dispenser or the fan heater is in an abnormal long-press state of the key, the water dispenser or the fan heater is controlled to stop sending the instruction, so that the water dispenser or the fan heater stops executing the corresponding function.
According to the key control method, whether the abnormal long-press condition of the key exists or not is determined according to whether the interval time of continuously pressing the current key is smaller than the first threshold value and whether the long time of the current key is longer than the second threshold value, and when the abnormal long-press condition of the key exists, the target electronic equipment is controlled to stop sending instructions, continuous control of the target electronic equipment caused by the abnormal long-press of the key is avoided, so that the operation stability of the target electronic equipment is guaranteed, and the service life of the target electronic equipment is prolonged.
On the basis of the above embodiment, the present embodiment further describes and optimizes a technical solution, and specifically, in this embodiment, a determining manner of an interval time during which a current key is continuously pressed includes:
if the current key value is the same as the historical key value, determining the interval time when the current key is continuously pressed according to the difference value between the current key time and the historical key time; the historical key value is the key value corresponding to the last time the key state is scanned and the pressed historical key, and the historical key time is the key time corresponding to the historical key value.
It should be noted that, the last time the historical key is pressed, that is, the last time the key is scanned, the key state is pressed, and the historical key value is the key value corresponding to the historical key. Specifically, in actual operation, after the current key value and the current key time are obtained, whether the current key value is the same as the historical key value or not is firstly judged; if the current key value is the same as the historical key value, the current key pressed at present is the same as the historical key pressed at last time, the historical key time corresponding to the historical key value is obtained, and the interval time of the current key pressed continuously is determined according to the difference value of the current key time and the historical key time.
Therefore, according to the method of the embodiment, the interval time when the current key is continuously pressed can be conveniently and accurately determined.
On the basis of the above embodiment, the technical solution is further described and optimized in this embodiment, and specifically, in this embodiment, the method for determining the current key in time includes:
determining the long time of the current key according to the difference value between the current key time and the initial time; the initial time is the historical key time when the current key value is the same as the historical key value.
Specifically, in actual operation, when the current key value is the same as the historical key value, the historical key time corresponding to the historical key value is obtained, and the historical key time is determined as the initial time. And on the basis of determining that the current key is continuously pressed, acquiring the current key time and the initial time, calculating the difference value between the current key time and the initial time, and determining the calculated difference value as the long time of the current key.
Therefore, according to the mode of the embodiment, the long time of the current key can be conveniently and accurately determined.
On the basis of the above embodiment, the technical solution is further described and optimized in this embodiment, and specifically, in this embodiment, the method for determining the current key in time includes:
determining the long time of the current key according to the interval time of the current key and the history interval time corresponding to the history key; the historical interval time is the interval time between the historical key time when the current key value is the same as the historical key value and the historical key time when the current key value is the same as the historical key value.
In actual operation, under the condition that the current key is continuously pressed, the long time of the current key is determined by accumulating the interval time corresponding to the current key determined each time, and the long time is the sum of the interval time of the current key and the history interval time corresponding to the history key. Specifically, in this embodiment, a variable storage history interval time is preset, where the history interval time is an interval time between when the current key value is the same as the history key value and when the last time the history key time is the same as the history key value.
For example, assuming that the key a is detected to be pressed at time T1, the key a is detected to be pressed again at time T2, that is, the current key value is determined to be the same as the historical key value for the first time at time T2, and the corresponding time length at time T2 is (T2-T1); if the key a is detected to be pressed again at the time T3, the interval time corresponding to the current key is (T3-T2), and the history interval time corresponding to the history key is the interval time corresponding to the time T2, that is, (T2-T1), so that the length of time T3 is the sum of the interval time corresponding to the time T3 and the history interval time, that is, (T3-T2) + (T2-T1) = (T3-T1); if the key a is detected to be pressed again at the time T4, the interval time corresponding to the current key is (T4-T3), the history interval time corresponding to the history key is the sum of the interval time corresponding to the time T3 and the interval time corresponding to the time T2, that is, (T3-T2) + (T2-T1) = (T3-T1), so that the length of time at the time T4 is the sum of the interval time at the time T4 and the history interval time, that is, (T4-T3) + (T3-T1) = (T4-T1); if it is detected that the key a is pressed again at time T5, the interval time corresponding to the current key is (T5-T4), the history interval time corresponding to the history key is the sum of the interval time corresponding to time T4 and the history interval time corresponding to time T3, that is, (T4-T3) + (T3-T1) = (T4-T1), so that the length of time T5 is the sum of the interval time of time T5 and the history interval time, that is, (T5-T4) + (T4-T1) = (T5-T1). And so on, each time the current key is determined to be continuously pressed, determining the long time of the current key according to the interval time of the current case and the historical interval time of the historical key.
Therefore, according to the method of the embodiment, the time duration of the current key can be conveniently and accurately determined by gradually iterating and updating the historical interval time and then determining the time duration of the current key by utilizing the interval time of the current key and the historical interval time of the historical key.
On the basis of the above embodiment, the technical solution is further described and optimized in this embodiment, and specifically, in this embodiment, obtaining a current key value corresponding to a current key whose key state is pressed in the target electronic device and a current key time corresponding to the current key value includes:
and scanning all keys of the target electronic equipment according to a preset period, and acquiring a current key value corresponding to the current key which is pressed by the key state in the target electronic equipment and a current key time corresponding to the current key value.
In this embodiment, a preset period is set first, then a scanning program is controlled to scan each key of a target electronic device according to the preset period, and when the key state of the target electronic device is scanned to be pressed, a current key value corresponding to a current pressed key whose key state is pressed is obtained; and determining the current key time corresponding to the current key value according to the current scanning time.
It should be noted that, in this embodiment, the specific period duration of the preset period is not limited, and the preset period is preferably set to 50ms according to the actual requirement, that is, each key of the target electronic device is scanned every 50ms, so as to determine whether there is a corresponding current key value.
Therefore, in the embodiment, the current key value and the current key time are determined by scanning all keys of the target electronic device according to the preset period, and the determination mode is more convenient and easy to implement.
On the basis of the above embodiment, the technical solution is further described and optimized in this embodiment, and in this embodiment, before stopping controlling the target electronic device, the method further includes:
the target electronic equipment is controlled to be switched to an initial state; the initial state is a state before the target electronic equipment performs state switching according to the current key value when the current key value is the same as the historical key value.
Specifically, in actual operation, when the current key of the target electronic device is pressed, a corresponding instruction is generated according to the pressed current key, and the function state of the target electronic device or other electronic devices is switched by sending the instruction. If the target electronic device has an abnormal long-press condition of the key, the controlled functional state is always in a switching state. For example, it is assumed that after a user sets a certain air conditioning function state, such as low air speed, the remote controller changes the air conditioning air speed cyclically when the logic right key is abnormally pressed for a long time due to heavy object pressing, namely, the air conditioning air speed is continuously changed cyclically in a low-medium-high mode due to the abnormal long-time pressing of the key of the remote controller; if the air conditioner is at the high air speed, determining that the remote controller is in abnormal long-time pressing of the keys, stopping sending an instruction by the remote controller, stopping changing the air speed of the air conditioner, and at the moment, the final air speed of the air conditioner is at the high air speed. According to the situation, the user is required to manually operate the remote controller again to adjust the air speed of the air conditioner to be low, so that the operation process is complicated, and the user experience is reduced.
In this embodiment, when it is determined for the first time that the current key value is the same as the historical key value, when the functional state of the target electronic device is switched according to the instruction corresponding to the current key value, the state before the state is switched according to the current key value is obtained, and after it is determined that the key is abnormally pressed for a long time, before the control target electronic device stops sending the instruction, the control target electronic device is switched to the initial state. That is, in the process of abnormal switching of the functional state caused by the abnormal long-press operation of the current key, the initial state of the target electronic device is obtained, and then the functional state of the target electronic device is switched to the initial state before the target electronic device is controlled to stop switching the functional state.
Therefore, according to the method of the embodiment, the functional state of the target electronic device can be switched to the initial state between abnormal long-time presses of the keys, manual adjustment of a user is avoided, and the use experience of the user is improved.
On the basis of the above embodiment, the technical solution is further described and optimized in this embodiment, and specifically, in this embodiment, the method further includes:
the control target electronic device switches to the low power consumption mode.
It should be noted that, in actual operation, the target electronic device will be in a working state all the time due to being abnormally pressed for a long time; when the target electronic equipment is in a working state, the key backlight of the target electronic equipment is in a long-light state, the display screen price is in an awakening state, and electric quantity consumption is caused. In this embodiment, when it is determined that the target electronic device is in the key abnormal long-press state, the target electronic device is controlled to switch to the low power consumption mode. Specifically, the corresponding functional module can be closed by sending a closing signal to the corresponding functional module, and the target electronic device can enter a low power consumption mode by using the closing signal. For example, a turn-off signal is sent to a key backlight module of the remote controller, and when the key backlight module receives the turn-off signal, the key backlight module stops providing backlight for keys on the key backlight device, and the remote controller enters a low power consumption mode.
Therefore, the embodiment can further save the electric quantity of the target electronic device by controlling the target electronic device to switch to the low-power mode.
In order to enable those skilled in the art to better understand the technical solutions in the present application, the following details are provided for the technical solutions in the embodiments of the present application in conjunction with a practical application scenario. In the embodiment of the present application, an air conditioner with a remote controller is taken as an example of a target electronic device, and the function state of the air conditioner is switched by the remote controller, as shown in fig. 2, which specifically includes the following steps:
based on normal control of the remote controller, scanning the key state of the remote controller every 50ms, and acquiring a current key value corresponding to a pressed current key and a current key time HAL_GetTick ();
presetting variable history key time interval_time and initial time dim_last_time;
the preset variable current key value key_val stores the key value currently pressed in the remote controller, namely the current key value of the current key; before each scanning detection, the key_val value of the current key value is set to 0, and then the key state is recorded as the pressed key value;
presetting a variable history key value key_val_sto, and storing a key value corresponding to a history key which is scanned to be pressed in a key state last time, namely a history key value of the history key;
when the current key value is obtained, comparing the current key value key_val with the historical key value key_val_sto, and judging whether the current key value key_val is consistent with the historical key value key_val_sto;
if the current key value key_val is inconsistent with the historical key value key_val_sto, the currently pressed key is inconsistent with the last pressed key, and the historical key value key_val_sto is updated by using the current key value key_val, namely key_val_sto=key_val; simultaneously updating a historical key time interval_time and an initial time dim_last_time by using the current key time, namely interval_time=hal_getTick (), dim_last_time=hal_getTick ();
if the current key value key_val is consistent with the historical key value key_val_sto, the currently pressed key is consistent with the last pressed key, a time interval corresponding to the current key time and the historical key time interval is calculated, and whether the time interval is greater than 1 second is judged, namely' HAL_GetTick () -interval_time >1000ms? ";
if the interval time is greater than 1 second, determining that the remote controller is in continuous short-press operation at the moment, and updating the historical key time by using the current key time HAL_GetTick (), namely interval_time=HAL_GetTick (), and updating the initial time dim_last_time=HAL_GetTick ();
if the interval time is less than 1 second, acquiring an initial state before the remote controller controls the air conditioner to switch the state by utilizing an instruction corresponding to the current key value; updating the historical key time interval_time=HAL_GetTick (), and calculating the difference between the current key time and the initial time to obtain long time; judging whether the long time is longer than 20 seconds, i.e. "hal_gettime () -dim_last_time >20000ms? "; if the time is longer than 20 seconds, determining that the remote controller is in a key abnormal long-press state, so that an instruction is sent to the air conditioner to control the air conditioner to switch to an initial state, then the remote controller is controlled to stop sending the instruction, control over the air conditioner is stopped, then the remote controller is controlled to switch to a low-power consumption mode, and a display screen of the remote controller is closed; if the subsequent remote controller exits the low power consumption mode, restarting to detect the key state of the remote controller, continuing to detect the abnormal long-press of the key, and performing key control.
According to the key control method provided by the embodiment, whether the abnormal long-press condition of the key exists or not is determined according to whether the interval time of continuously pressing the current key is smaller than the first threshold value and whether the long time of the current key is longer than the second threshold value, when the abnormal long-press condition of the key exists in the remote controller is determined, the target electronic equipment is controlled to stop sending instructions, continuous control of the target electronic equipment caused by the abnormal long-press of the key is avoided, therefore, the operation stability of the target electronic equipment is guaranteed, and the service life of the target electronic equipment is prolonged; in the method, the interval time of continuously pressing the current key is determined, and the method is convenient and easy to implement in a long-time determination mode of the current key; in addition, the method can control the target electronic equipment to be switched to the initial state before the abnormal long-time press of the key, avoids the need of manual operation again by a user, and improves the use experience of the user.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a key control device for realizing the key control method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in the embodiments of one or more key control devices provided below may refer to the limitation of the key control method hereinabove, and will not be repeated here.
In one embodiment, as shown in fig. 3, there is provided a key control device including: an acquisition module 302 and a control module 304, wherein:
the obtaining module 302 is configured to obtain a current key value corresponding to a current key whose key state is pressed in the target electronic device and a current key time corresponding to the current key value;
and the control module 304 is configured to control the target electronic device to stop sending the instruction if it is determined that the interval time during which the current key is continuously pressed is less than the first threshold according to the current key value and the current key time, and the time duration of the current key is greater than the second threshold.
The key control device provided by the embodiment of the application has the same beneficial effects as the key control method.
As a preferred embodiment, the control module includes:
the first control sub-module is used for determining the interval time when the current key is continuously pressed according to the difference value between the current key time and the historical key time if the current key value is the same as the historical key value; the historical key value is the key value corresponding to the last time the key state is scanned and the pressed historical key, and the historical key time is the key time corresponding to the historical key value.
As a preferred embodiment, the control module includes:
the second control sub-module is used for determining the long time of the current key according to the difference value between the current key time and the initial time; the initial time is the historical key time when the current key value is the same as the historical key value.
As a preferred embodiment, the control module includes:
the third control sub-module is used for determining the long time of the current key according to the interval time of the current key and the history interval time corresponding to the history key; the historical interval time is the interval time between the historical key time when the current key value is the same as the historical key value and the historical key time when the current key value is the same as the historical key value.
As a preferred embodiment, a key control device further includes:
the initial state switching module is used for controlling the target electronic equipment to be switched into an initial state; the initial state is a state before the target electronic equipment performs state switching according to the current key value when the current key value is the same as the historical key value.
As a preferred embodiment, a key control device further includes:
and the low-power-consumption switching module is used for controlling the target electronic equipment to be switched into a low-power-consumption mode.
As a preferred embodiment, the acquisition module includes:
the acquisition sub-module is used for scanning all keys of the target electronic equipment according to a preset period and acquiring a current key value corresponding to the current key which is pressed by the key state in the target electronic equipment and a current key time corresponding to the current key value.
The above-described respective modules in the key control device may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a key control method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the structures shown in FIG. 4 are block diagrams only and do not constitute a limitation of the computer device on which the present aspects apply, and that a particular computer device may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring a current key value corresponding to a pressed current key and a current key time corresponding to the current key value in the target electronic equipment;
if the interval time of the current key continuously pressed is smaller than the first threshold value according to the current key value and the current key time, and the time length of the current key is larger than the second threshold value, the target electronic equipment is controlled to stop sending the instruction.
The computer equipment provided by the embodiment of the application has the same beneficial effects as the key control method.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring a current key value corresponding to a pressed current key and a current key time corresponding to the current key value in the target electronic equipment;
if the interval time of the current key continuously pressed is smaller than the first threshold value according to the current key value and the current key time, and the time length of the current key is larger than the second threshold value, the target electronic equipment is controlled to stop sending the instruction.
The computer readable storage medium provided by the embodiment of the application has the same beneficial effects as the key control method.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of:
acquiring a current key value corresponding to a pressed current key and a current key time corresponding to the current key value in the target electronic equipment;
if the interval time of the current key continuously pressed is smaller than the first threshold value according to the current key value and the current key time, and the time length of the current key is larger than the second threshold value, the target electronic equipment is controlled to stop sending the instruction.
The computer program product provided by the embodiment of the application has the same beneficial effects as the key control method.
It should be noted that, user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A key control method, the method comprising:
acquiring a current key value corresponding to a current key of which the key state is pressed in target electronic equipment and a current key time corresponding to the current key value;
if the interval time of the current key continuously pressed is determined to be smaller than a first threshold value according to the current key value and the current key time, and the time length of the current key is larger than a second threshold value, controlling the target electronic equipment to stop sending instructions; the first threshold is used for judging whether the current key is continuously pressed or not, and the second threshold is used for judging whether the current key is continuously pressed or not;
the determining manner of the interval time when the current key is continuously pressed comprises the following steps:
if the current key value is the same as the historical key value, determining the interval time when the current key is continuously pressed according to the difference value between the current key time and the historical key time; the historical key value is a key value corresponding to a historical key which is scanned to be pressed in the last time, and the historical key time is a key time corresponding to the historical key value.
2. The method of claim 1, wherein the long-time-wise determination of the current key comprises:
determining the long time of the current key according to the difference value between the current key time and the initial time; the initial time is the historical key time when the current key value is the same as the historical key value.
3. The method of claim 1, wherein the long-time-wise determination of the current key comprises:
when the current key is continuously pressed every time, determining the long time of the current key according to the sum of the interval time of the current key and the history interval time corresponding to the history key; the historical interval time is the interval time between the historical key time when the current key value is the same as the historical key value and the historical key time when the current key value is the same as the historical key value.
4. A method according to any one of claims 1 to 3, wherein prior to said controlling said target electronic device to cease sending instructions, the method further comprises:
controlling the target electronic equipment to be switched to an initial state; and the initial state is a state before the target electronic equipment performs state switching according to the current key value when the current key value is determined to be the same as the historical key value for the first time.
5. The method according to claim 4, wherein the method further comprises:
and controlling the target electronic equipment to switch to a low-power consumption mode.
6. The method of claim 4, wherein the obtaining a current key value corresponding to a current key of the target electronic device for which the key status is pressed and a current key time corresponding to the current key value includes:
scanning all keys of the target electronic equipment according to a preset period, and acquiring a current key value corresponding to the current key which is pressed by the key state in the target electronic equipment and a current key time corresponding to the current key value.
7. A key control device, the device comprising:
the device comprises an acquisition module, a display module and a display module, wherein the acquisition module is used for acquiring a current key value corresponding to a current key which is pressed in a key state in target electronic equipment and a current key time corresponding to the current key value;
the control module is used for controlling the target electronic equipment to stop sending instructions if the interval time of the current key continuously pressed is determined to be smaller than a first threshold value according to the current key value and the current key time and the time of the current key is longer than a second threshold value; the first threshold is used for judging whether the current key is continuously pressed or not, and the second threshold is used for judging whether the current key is continuously pressed or not;
the control module comprises a first control sub-module, a second control sub-module and a third control sub-module, wherein the first control sub-module is used for determining the interval time when the current key is continuously pressed according to the difference value between the current key time and the historical key time if the current key value is the same as the historical key value; the historical key value is a key value corresponding to a historical key which is scanned to be pressed in the last time, and the historical key time is a key time corresponding to the historical key value.
8. The apparatus of claim 7, wherein the control module comprises a second control sub-module for determining the long time of the current key based on a difference between the current key time and an initial time; the initial time is the historical key time when the current key value is the same as the historical key value.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202210004264.9A 2022-01-04 2022-01-04 Key control method, key control device, computer equipment, storage medium and program product Active CN114413441B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210004264.9A CN114413441B (en) 2022-01-04 2022-01-04 Key control method, key control device, computer equipment, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210004264.9A CN114413441B (en) 2022-01-04 2022-01-04 Key control method, key control device, computer equipment, storage medium and program product

Publications (2)

Publication Number Publication Date
CN114413441A CN114413441A (en) 2022-04-29
CN114413441B true CN114413441B (en) 2023-05-12

Family

ID=81271389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210004264.9A Active CN114413441B (en) 2022-01-04 2022-01-04 Key control method, key control device, computer equipment, storage medium and program product

Country Status (1)

Country Link
CN (1) CN114413441B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115793869B (en) * 2022-10-27 2023-08-25 广芯微电子(广州)股份有限公司 Key state identification method and device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625174A (en) * 2020-05-06 2020-09-04 Oppo(重庆)智能科技有限公司 Touch screen control method and device, electronic equipment and storage medium
CN112882850A (en) * 2021-03-09 2021-06-01 北京字节跳动网络技术有限公司 Key event processing method, device, equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5272932B2 (en) * 2009-07-06 2013-08-28 富士通株式会社 Mobile device
CN112509183A (en) * 2020-11-20 2021-03-16 蔚来汽车科技(安徽)有限公司 Control method for preventing false triggering of automobile remote control key and automobile
CN112684906B (en) * 2020-12-23 2024-06-18 联想(北京)有限公司 Input control method and electronic equipment
CN113054979A (en) * 2021-02-26 2021-06-29 深圳前海云充科技有限公司 Control method and device for key fool-proofing, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111625174A (en) * 2020-05-06 2020-09-04 Oppo(重庆)智能科技有限公司 Touch screen control method and device, electronic equipment and storage medium
CN112882850A (en) * 2021-03-09 2021-06-01 北京字节跳动网络技术有限公司 Key event processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN114413441A (en) 2022-04-29

Similar Documents

Publication Publication Date Title
US10496151B2 (en) Method and apparatus for controlling display of electronic device
CN106527664B (en) Self-service terminal energy-saving control method and device
CN107566624B (en) Display method for power consumption and temperature of terminal, terminal and computer readable storage medium
WO2014012517A1 (en) Method and device for controlling terminal and terminal thereof
CN114413441B (en) Key control method, key control device, computer equipment, storage medium and program product
US11500555B2 (en) Volatile memory to non-volatile memory interface for power management
US9395785B2 (en) Method and device for controlling terminal and terminal thereof
CN105824493B (en) A kind of control method and mobile terminal of mobile terminal
CN106154853A (en) A kind of control method and mobile terminal
JP2022048146A5 (en)
WO2015184822A1 (en) Power saving method and apparatus for mobile terminal
CN113050783B (en) Terminal control method and device, mobile terminal and storage medium
CN109669528B (en) Terminal processing component control method and device, computer equipment and storage medium
CN110737320B (en) Power consumption detection method and device, electronic equipment and storage medium
CN110418198B (en) Video information processing method, electronic equipment and storage medium
US9846478B1 (en) Adaptive power manipulation of federated storage systems
KR101406840B1 (en) System for managing power on display panel for portable electronic device
CN108874253B (en) Awakening method and device based on self-contained touch screen
CN110716759B (en) Electronic device, computer-readable storage medium, and operation parameter configuration method
CN112486683A (en) Processor control method, control device, and computer-readable storage medium
CN106775089B (en) Equipment control method and device
CN111782494A (en) Application software control method and device, computer equipment and storage medium
US20180004542A1 (en) Electronic device and half-suspend controlling method applied therein
CN117850256A (en) Smart home control method, smart home control device, computer equipment and storage medium
CN117134366B (en) Load control method, device, equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant