Disclosure of Invention
The technical problem to be solved by the present invention is that when the NFC firmware of the mobile terminal is upgraded, the actions of the reset pin and the download pin generally require a certain time, so that the overall time for upgrading the firmware is slow.
The technical scheme adopted by the invention for solving the technical problem is as follows: a mobile terminal NFC firmware upgrading method comprises the following steps:
A. in the upgrading process of the NFC firmware of the mobile terminal, if the voltage of an NFC reset pin is detected to be higher than a first detection threshold value V1, the NFC firmware is obtained and copied into a memory;
B. if the voltage of the NFC download pin is detected to be higher than a second detection threshold value V2, firmware upgrading is started;
C. and if the firmware is upgraded overtime, judging that the NFC is not in the upgrading state, and returning to the step A.
Further, the method for upgrading the NFC firmware of the mobile terminal further includes the steps of:
D. and setting a third detection threshold V3 of the voltage of the NFC reset pin, judging that the NFC is not in an upgrading state if the voltage of the NFC reset pin is detected to be lower than the third detection threshold V3, deleting the copied NFC firmware in the memory, releasing the memory, and returning to the step A.
Further, in the method for upgrading an NFC firmware of a mobile terminal, step a further includes:
a1, when the NFC is not in the upgrade state, setting the NFC reset pin to be a first detection threshold V1.
Further, in the method for upgrading an NFC firmware of a mobile terminal, step B specifically includes:
b1, setting the NFC reset pin as a second detection threshold V2;
b2, setting the overtime time as a timer of a first set time T1, resetting and starting the timer;
b3, if the NFC download pin voltage is detected to be higher than the second detection threshold V2, starting firmware upgrade, and stopping the timer.
Further, in the method for upgrading an NFC firmware of a mobile terminal, step C specifically includes:
c1, when detecting that the NFC download pin voltage is higher than the second detection threshold V2 within the first set time T1, and detecting whether the firmware upgrade is completed within the time T1;
and C2, if the firmware upgrade is detected to be completed within the time T1, the upgrade is successful, if the firmware upgrade is overtime, the firmware upgrade is failed, the NFC is judged not to be in the upgrade state, the copied NFC firmware in the memory is deleted, the memory is released, and the step A is returned.
Further, according to the method for upgrading the NFC firmware of the mobile terminal, the first detection threshold V1 is 0.2 to 0.4V, and the second detection threshold V2 is 1.5 to 1.7V; the third detection threshold V3 is 1.5 to 1.7V.
A mobile terminal comprising a processor, a memory and a communication bus, the memory storing a computer readable program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
the processor, when executing the computer readable program, implements the steps of:
s1, in the process of upgrading the NFC firmware of the mobile terminal, if the voltage of the NFC reset pin is detected to be higher than a first detection threshold value V1, the NFC firmware is obtained and copied into a memory;
s2, if the voltage of the NFC download pin is detected to be higher than a second detection threshold value V2, firmware upgrading is started;
s3, if the firmware is overtime, judging that the NFC is not in the upgrading state, and returning to the step A;
the step S1 further includes:
s11, when the NFC is not in the upgrading state, setting the NFC reset pin as a first detection threshold V1;
the step S2 specifically includes:
s21, setting the NFC reset pin as a second detection threshold V2;
s22, setting the overtime time as a timer of a first set time T1, resetting and starting the timer;
s23, if the voltage of the NFC download pin is detected to be higher than the second detection threshold V2 within the first set time T1, starting firmware upgrade, and stopping the timer;
the step S3 specifically includes:
s31, when the NFC download pin voltage is detected to be higher than the second detection threshold V2, detecting whether the firmware upgrade is completed within T1 time;
and S32, if the firmware upgrade is detected to be completed within the time T1, the upgrade is successful, if the firmware upgrade is overtime, the firmware upgrade is failed, the NFC is judged not to be in the upgrade state, the copied NFC firmware in the memory is deleted, the memory is released, and the step A is returned.
Further, in the mobile terminal, when the processor executes the computer readable program, the following steps are further implemented:
and S4, setting a third detection threshold V3 of the voltage of the NFC reset pin, if the voltage of the NFC download pin is not detected to be higher than the second detection threshold V2 within the first set time T1 and the voltage of the NFC reset pin is detected to be lower than the third detection threshold V3, judging that the NFC is not in an upgrading state, deleting the copied NFC firmware in the memory, and releasing the memory.
Further, in the mobile terminal, the first detection threshold V1 is 0.2 to 0.4V, and the second detection threshold V2 is 1.5 to 1.7V; the third detection threshold V3 is 1.5 to 1.7V.
A computer readable storage medium storing one or more programs, the one or more programs being executable by one or more processors to perform the steps of a mobile terminal NFC firmware upgrade method as claimed in any one of claims 1 to 6.
The invention provides a mobile terminal NFC firmware upgrading method, a mobile terminal and a storage medium, when NFC is not in an upgrading state, an NFC reset pin is set as a first detection threshold value V1, when the voltage of the NFC reset pin is detected to be higher than the first detection threshold value V1, NFC firmware is obtained and copied into a memory, the NFC reset pin is set as a second detection threshold value V2, a timer with the overtime time being a first set time T1 is set, the timer is reset and started, if the voltage of an NFC download pin is detected to be higher than the second detection threshold value V2, firmware upgrading is started, the timer is stopped, when the timer is overtime, the NFC is not in the upgrading state, the copied NFC firmware in the memory is deleted, the memory is released, and the previous steps are returned. When the NFC firmware in the mobile terminal is upgraded, the action time of the reset pin and the download pin can be reduced, so that the total time consumed by upgrading the NFC firmware is reduced on the whole, the purpose of improving the speed of upgrading the NFC firmware is achieved, and convenience is provided for a user.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer and clearer, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for upgrading NFC firmware of a mobile terminal according to a preferred embodiment of the present invention, and as shown in fig. 1, the method includes the following steps:
s10, when the NFC is not in the upgrading state, setting the NFC reset pin as a first detection threshold V1;
s20, when the voltage of the NFC reset pin is detected to be higher than the first detection threshold V1, obtaining NFC firmware and copying the NFC firmware into a memory;
s30, setting an NFC reset pin as a second detection threshold V2, setting a timer with timeout time as first set time T1, and resetting and starting the timer;
s40, if the voltage of the NFC download pin is detected to be higher than the second detection threshold V2, executing a step S50, and if the voltage is overtime, executing a step S70;
in this step, step S50 is executed if the NFC download pin voltage is detected to be higher than the second detection threshold V2 within the first set time T1, and step S70 is executed if the NFC download pin voltage is not detected to be higher than the second detection threshold V2 within the first set time T1.
S50, if the NFC download pin voltage is detected to be higher than the second detection threshold V2 within the first set time T1, firmware upgrading is started, and a timer is stopped;
in this step, if the firmware upgrade is completed within the first set time T1, it indicates that the firmware upgrade is successful, otherwise, step S60 is executed.
S60, if the timer is overtime, the NFC is judged not to be in the upgrading state, the copied NFC firmware in the memory is deleted, the memory is released, and the step S10 is returned;
in this step, a further determination is made after the firmware upgrade is started, at this time, it is determined whether the firmware upgrade is completed within the first set time T1, and if the firmware upgrade is not completed, it is determined that the NFC is not in the upgrade state, the copied NFC firmware in the memory is deleted, the memory is released, and the process returns to step S10.
S70, setting a third detection threshold V3 of the voltage of the NFC reset pin, if the voltage of the NFC reset pin is detected to be lower than the third detection threshold V3, judging that the NFC is not in an upgrading state, deleting the copied NFC firmware in the memory, releasing the memory, and returning to the step S10;
in this step, if it is not detected that the voltage of the NFC download pin is higher than the second detection threshold V2 within the first set time T1, it is further determined whether the voltage of the NFC reset pin is lower than the third detection threshold V3, and if so, it is determined that the NFC is not in the upgrade state, the copied NFC firmware in the memory is deleted, the memory is released, and the process returns to step S10.
Wherein the first detection threshold V1 is 0.2 to 0.4V, preferably 0.3V; the second detection threshold V2 is 1.5 to 1.7V, preferably 1.6V; the third detection threshold V3 is 1.5 to 1.7V, preferably 1.6V; the first set time T1 is preferably 2 seconds.
That is, in the embodiment of the present invention, if it is detected that the voltage of the NFC download pin is higher than the second detection threshold V2 within the first set time T1 and the firmware upgrade is completed within the first set time T1, the firmware upgrade is successful, and if the firmware upgrade is not completed within the first set time T1, it is indicated that the firmware upgrade fails, the copied NFC firmware in the memory is deleted, and the memory is released; if the voltage of the NFC download pin is not detected to be higher than the second detection threshold V2 within the first set time T1, it is further determined whether the voltage of the NFC reset pin is lower than the third detection threshold V3, and if so, it is determined that the NFC is not in the upgrade state, the copied NFC firmware in the memory is deleted, and the memory is released.
Based on the foregoing embodiment, the present invention further provides a system for upgrading an NFC firmware of a mobile terminal, as shown in fig. 2, where the system includes:
a detection threshold setting module 10, configured to set a detection threshold of the NFC reset pin, and a detection mode, where the detection mode includes being higher than the detection threshold and being lower than the detection threshold; the detection threshold setting includes: a first setting, a second setting, and a third setting;
when the NFC is not in an upgrading state, setting an NFC reset pin as a first setting;
when the NFC reset pin voltage is detected to be higher than a first detection threshold value V1, setting the NFC reset pin to be in a second setting;
when the voltage of the NFC download pin is detected to be higher than a second detection threshold value V2, setting the NFC reset pin to be a third setting;
the first setting includes: setting the detection threshold value of the NFC reset pin as a first detection threshold value V1, and setting the detection mode to be higher than the detection threshold value;
the second setting includes: setting the detection threshold value of the NFC reset pin as a second detection threshold value V2, wherein the detection mode is higher than the detection threshold value;
the third setting includes: setting the detection threshold value of the NFC reset pin as a third detection threshold value V3, wherein the detection mode is lower than the detection threshold value;
the detection module 20 is connected with the NFC reset pin, and is configured to detect the NFC reset pin according to the detection threshold and the detection mode set by the detection threshold setting module, and trigger the detection processing module to process when the voltage of the NFC reset pin meets the detection threshold and the detection mode;
a detection processing module 30, configured to perform processing according to detection of the detection module; the method specifically comprises the following steps: when the NFC is not in the upgrading state, setting an NFC reset pin as a first detection threshold V1;
when the voltage of the NFC reset pin is detected to be higher than the first detection threshold value V1, acquiring NFC firmware and copying the NFC firmware into a memory;
setting an NFC reset pin as a second detection threshold V2, setting a timer with timeout time as first set time T1, and resetting and starting the timer;
if the voltage of the NFC download pin is detected to be higher than the second detection threshold value V2, the firmware upgrade is started, and the timer is stopped;
setting an NFC reset pin as a third detection threshold V3, if the voltage of the NFC reset pin is detected to be lower than the third detection threshold V3, indicating that the NFC is not in an upgrading state, deleting the copied NFC firmware in the memory, releasing the memory, and setting the NFC reset pin as the first detection threshold V1;
a timer timeout processing module 40, configured to perform processing after the timer is timed out; the method specifically comprises the following steps: when the timer is overtime, it is indicated that the NFC is not in the upgrade state, the copied NFC firmware in the memory is deleted, the memory is released, and the NFC reset pin is set to the first detection threshold V1.
A timer 50;
the invention also provides a mobile terminal, comprising a processor, a memory and a communication bus, wherein the memory stores a computer readable program which can be executed by the processor;
the communication bus realizes connection communication between the processor and the memory;
the processor, when executing the computer readable program, implements the steps of:
s1, in the process of upgrading the NFC firmware of the mobile terminal, if the voltage of the NFC reset pin is detected to be higher than a first detection threshold value V1, the NFC firmware is obtained and copied into a memory;
s2, if the voltage of the NFC download pin is detected to be higher than a second detection threshold value V2, firmware upgrading is started;
s3, if the firmware is overtime, judging that the NFC is not in the upgrading state, and returning to the step A;
the step S1 further includes:
s11, when the NFC is not in the upgrading state, setting the NFC reset pin as a first detection threshold V1;
the step S2 specifically includes:
s21, setting the NFC reset pin as a second detection threshold V2;
s22, setting the overtime time as a timer of a first set time T1, resetting and starting the timer;
s23, if the voltage of the NFC download pin is detected to be higher than the second detection threshold V2 within the first set time T1, starting firmware upgrade, and stopping the timer;
the step S3 specifically includes:
s31, when the NFC download pin voltage is detected to be higher than the second detection threshold V2, detecting whether the firmware upgrade is completed within T1 time;
and S32, if the firmware upgrade is detected to be completed within the time T1, the upgrade is successful, if the firmware upgrade is overtime, the firmware upgrade is failed, the NFC is judged not to be in the upgrade state, the copied NFC firmware in the memory is deleted, the memory is released, and the step A is returned.
Preferably, the processor, when executing the computer readable program, further performs the steps of:
and S4, setting a third detection threshold V3 of the voltage of the NFC reset pin, if the voltage of the NFC download pin is not detected to be higher than the second detection threshold V2 within the first set time T1 and the voltage of the NFC reset pin is detected to be lower than the third detection threshold V3, judging that the NFC is not in an upgrading state, deleting the copied NFC firmware in the memory, and releasing the memory.
Preferably, the first detection threshold V1 is 0.2 to 0.4V, the second detection threshold V2 is 1.5 to 1.7V; the third detection threshold V3 is 1.5 to 1.7V.
In summary, according to the method for upgrading the NFC firmware of the mobile terminal, the mobile terminal and the storage medium, when the NFC is not in the upgrade state, setting the NFC reset pin as the first detection threshold V1, when detecting that the voltage of the NFC reset pin is higher than the first detection threshold V1, acquiring the NFC firmware and copying the NFC firmware into the memory, setting the NFC reset pin as the second detection threshold V2, and setting the timer with the timeout time being the first set time T1, resetting and starting the timer, if detecting that the voltage of the NFC download pin is higher than the second detection threshold V2, it is indicated that firmware upgrade is started, the timer is stopped, when the timer is overtime, it is indicated that the NFC is not in the upgrade state, the copied NFC firmware in the memory is deleted, the memory is released, and the previous step is returned; and setting a third detection threshold V3 of the voltage of the NFC reset pin, if the voltage of the NFC download pin is not detected to be higher than the second detection threshold V2 within the first set time T1 and the voltage of the NFC reset pin is detected to be lower than the third detection threshold V3, judging that the NFC is not in an upgrading state, deleting the copied NFC firmware in the memory, releasing the memory, and returning to the previous step. When the NFC firmware in the mobile terminal is upgraded, the action time of the reset pin and the download pin can be reduced, so that the total time consumed by upgrading the NFC firmware is reduced on the whole, the purpose of improving the speed of upgrading the NFC firmware is achieved, and convenience is provided for a user.
Of course, it will be understood by those skilled in the art that all or part of the processes of the methods of the above embodiments may be implemented by a computer program instructing relevant hardware (such as a processor, a controller, etc.), and the program may be stored in a computer readable storage medium, and when executed, the program may include the processes of the above method embodiments. The storage medium may be a memory, a magnetic disk, an optical disk, etc.
It is to be understood that the invention is not limited to the examples described above, but that modifications and variations may be effected thereto by those of ordinary skill in the art in light of the foregoing description, and that all such modifications and variations are intended to be within the scope of the invention as defined by the appended claims.