[go: up one dir, main page]

CN117076340B - Data management method for flash memory device of beauty instrument and beauty instrument - Google Patents

Data management method for flash memory device of beauty instrument and beauty instrument Download PDF

Info

Publication number
CN117076340B
CN117076340B CN202311046126.8A CN202311046126A CN117076340B CN 117076340 B CN117076340 B CN 117076340B CN 202311046126 A CN202311046126 A CN 202311046126A CN 117076340 B CN117076340 B CN 117076340B
Authority
CN
China
Prior art keywords
sector
data
target
data packet
state
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
CN202311046126.8A
Other languages
Chinese (zh)
Other versions
CN117076340A (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.)
Shenzhen Accompany Technology Co Ltd
Original Assignee
Shenzhen Accompany Technology Co 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 Shenzhen Accompany Technology Co Ltd filed Critical Shenzhen Accompany Technology Co Ltd
Priority to CN202311046126.8A priority Critical patent/CN117076340B/en
Publication of CN117076340A publication Critical patent/CN117076340A/en
Application granted granted Critical
Publication of CN117076340B publication Critical patent/CN117076340B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • G06F11/1008Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices
    • G06F11/1068Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's in individual solid state devices in sector programmable memories, e.g. flash disk

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The embodiment of the disclosure provides a data management method for a flash memory device of a beauty instrument and the beauty instrument. The data management method of the flash memory device includes reading a sector status flag bit to select a target sector from a plurality of sectors of the cosmetic instrument flash memory device; searching valid data packets in the target sector according to a first sequence, wherein the first sequence comprises the sequence from low to high or from high to low of addresses in the sector; under the condition that a valid data packet is obtained, determining a reading position of the valid data packet; in response to a data write request, the write locations are looked up from the read locations in a second order, the second order being opposite the first order.

Description

Data management method for flash memory device of beauty instrument and beauty instrument
Technical Field
The present disclosure relates to the field of data storage technologies, and in particular, to a data management method for a flash memory device of a cosmetic instrument and a cosmetic instrument.
Background
Many home-use beauty instruments in the market at present have a data storage function, and are generally used for storing data such as user usage data and device configuration parameters. The general single chip microcomputer is used as a common control unit, and the internal flash memory device can be used for storing the data. The flash memory is erased for a plurality of times, and after the maximum service life is reached, the flash memory is damaged and cannot be used, so that data are lost, and the normal use risk of the beauty instrument is affected.
Disclosure of Invention
To solve the problems in the related art, embodiments of the present disclosure provide a data management method for a flash memory device of a cosmetic instrument and an electronic device cosmetic instrument.
An aspect of the disclosed embodiments provides a data management method for a flash memory device of a cosmetic instrument, including reading a sector status flag bit to select a target sector from a plurality of sectors of the flash memory device of the cosmetic instrument, searching for valid data packets in the target sector in a first order, the first order including an order of addresses in the sectors from low to high or from high to low, determining a read position of the valid data packets if the valid data packets are obtained, searching for a write position from the read position in a second order in response to a data write request, the second order being opposite to the first order.
According to an embodiment of the present disclosure, a sector status flag bit is used to identify an unused state, a used state, or a full state.
According to an embodiment of the present disclosure, reading the sector status flag bit to select a target sector from the plurality of sectors includes, in the case where there is a sector in use, selecting one sector in use as the target sector.
According to an embodiment of the present disclosure, reading the sector status flag bit to select a target sector from the plurality of sectors includes, in a case where there is no sector in the use state and there is a sector in the full state, selecting one sector in the full state as the target sector.
According to an embodiment of the present disclosure, reading the sector status flag to select a target sector from a plurality of sectors includes, in the case where there is no used state and a full state stored sector and there is an unused state sector, selecting one unused state sector as the target sector and modifying the sector status flag of the target sector to the used state.
According to the embodiment of the disclosure, reading the sector status flag bit so as to select a target sector from a plurality of sectors includes, in the case where there is no sector in a used state, a full state stored, and an unused state, selecting any one sector to erase as the target sector, and modifying the sector status flag bit of the target sector to the used state.
According to the embodiment of the disclosure, the data packet comprises a frame header, target data and check data, wherein searching for the valid data packet according to the first order in the target sector comprises reading the frame header of the data packet according to the first order in the target sector; determining target data and check data of the data packet according to the length of the data packet; and checking the check data based on the frame header and the target data of the data packet, if the check is successful, determining that the data packet is a valid data packet, otherwise, reading the next frame header.
According to an embodiment of the present disclosure, the data management method of the flash memory device further includes, when the target sector does not find a valid data packet, continuing to find the valid data packet from the next sector until the valid data packet is found or the finding of all the sectors is completed.
According to an embodiment of the disclosure, in response to a data write request, searching for a write location from a read location in a second order includes moving a length of a data packet from the read location in the second order, determining the moved location as a candidate location; and determining the candidate position as a writing position when the address of the candidate position does not exceed the address range of the target sector and the candidate position is not written with data.
According to an embodiment of the present disclosure, the method for managing data of the flash memory device further includes, in a case where an address of the candidate location does not exceed an address range of the target sector and the candidate location has data written therein, moving a length of the data packet from the current candidate location in the second order, and taking the moved location as the updated candidate location.
According to an embodiment of the present disclosure, the data management method of the flash memory device further includes, in a case where an address of the candidate location exceeds an address range of the target sector, selecting another sector from the plurality of sectors as the updated target sector; and erasing the updated target sector and determining the writing position from the updated target sector.
According to an embodiment of the present disclosure, the data management method of the flash memory device further includes stopping responding to the data write request in a case where the target data in the data packet of the read location is consistent with the data requested to be written by the data write request.
Another aspect of an embodiment of the present disclosure provides a cosmetic instrument comprising a processor and a flash memory device having a plurality of sectors, wherein the processor is configured to implement a method as described above.
According to an embodiment of the present disclosure, a flash memory device includes two sectors, a first byte of each of the sectors being used to store a sector status flag bit.
According to the technical scheme of the embodiment of the disclosure, the sector status flag bit is used for selecting the target sector from the multiple sectors of the flash memory device of the beauty instrument, the effective data packet is searched in the target sector according to the first sequence, and the writing position is searched from the reading position according to the reading position of the effective data packet according to the second sequence opposite to the first sequence, so that the data can be written in the sectors in sequence until the sectors are full, the erasing times are reduced, the stability of the data is improved, and the service life of the flash memory of the beauty instrument is prolonged.
Drawings
Other features, objects and advantages of the present disclosure will become more apparent from the following detailed description of non-limiting embodiments, taken in conjunction with the accompanying drawings. In the drawings:
fig. 1 schematically illustrates a flowchart of a data management method for a cosmetic instrument flash memory device of an embodiment of the present disclosure;
FIG. 2 schematically illustrates a schematic diagram of a plurality of sectors included in a flash memory device of an embodiment of the present disclosure;
FIG. 3 schematically illustrates a schematic diagram of a data packet according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart for finding valid data packets according to an embodiment of the disclosure;
FIG. 5 schematically illustrates a flow chart for finding valid data packets according to another embodiment of the present disclosure;
FIG. 6 schematically illustrates a flow chart for locating a write location according to an embodiment of the disclosure;
FIG. 7 schematically illustrates a flow chart of finding a write location in accordance with another embodiment of the present disclosure;
fig. 8 schematically illustrates a schematic view of a cosmetic apparatus of an embodiment of the present disclosure.
Detailed Description
Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so as to be more easily implemented by those skilled in the art. In addition, for the sake of clarity, portions irrelevant to description of the exemplary embodiments are omitted in the drawings.
In this disclosure, it should be understood that terms such as "comprises" or "comprising," etc., are intended to indicate the presence of features, numbers, steps, acts, components, portions, or combinations thereof disclosed in this specification, and are not intended to exclude the possibility that one or more other features, numbers, steps, acts, components, portions, or combinations thereof are present or added.
In addition, it should be noted that, without conflict, the embodiments of the present disclosure and features of the embodiments may be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
It should be noted that the acquisition or presentation of data in this disclosure is either authorized, confirmed, or actively selected by the user.
Fig. 1 schematically illustrates a flowchart of a data management method for a cosmetic instrument flash memory device according to an embodiment of the present disclosure.
As shown in fig. 1, the data management method for a cosmetic instrument flash memory device includes operations S110 to S140.
In operation S110, a sector status flag bit is read to select a target sector from a plurality of sectors of the cosmetic instrument flash memory device.
In operation S120, valid data packets are searched for in the first order in the target sector. The first order includes an order of addresses within the sector from low to high or high to low.
In operation S130, in case of obtaining a valid data packet, a read position of the valid data packet is determined.
In operation S140, in response to the data write request, the write locations are searched for from the read locations in a second order, the second order being opposite to the first order.
According to the technical scheme, the data can be sequentially written into the sectors until the sectors are fully written, so that the erasing times are reduced, the stability of the data is improved, and the service lives of the flash memory device and the beauty instrument are prolonged.
According to the embodiment of the disclosure, the flash memory device may be, for example, a flash memory device or a flash memory card inside a single chip microcomputer, and the like, and includes at least two sectors.
Fig. 2 schematically illustrates a schematic diagram of a plurality of sectors included in a flash memory device of an embodiment of the present disclosure.
As shown in fig. 2, a flash memory device may include a plurality of sectors. The sector status flag bit may be set at the lowest address of each sector, or may be set at the highest address or at a specific address in between. The sector status flag bit may have a length of 1 byte, for example, or may have another length. In this embodiment, the sector status flag bit may be used to identify an unused state, a used state, or a full state. When the flash memory device is powered on for use for the first time, sector status flag bits of all sectors are in an unused state.
Fig. 3 schematically illustrates a structure diagram of a data packet according to an embodiment of the present disclosure.
As shown in fig. 3, the target data is stored in the sector in the form of a data packet. The target data may include, for example, configuration information of the cosmetic instrument, usage information of the user, and the like, which are integrated into one piece of target data, and stored in a sector in the form of a data packet. When any information in the target data changes, a new data packet can be constructed for storage again, so that the latest data packet can be read when the data packet is read, and the latest whole data can be obtained without paying attention to the data stored before. The length of the target data may be, for example, 5 bytes, or may be defined as other lengths. Obviously, the target data may be any other data that can be stored in the flash memory device.
According to embodiments of the present disclosure, a data packet may include, for example, a frame header, target data, and check data. The frame header, which is an identification of a data packet, has a fixed value, and the length of the frame header may be one byte, for example. The frame header may be, for example, 0xA5, 10100101. The check data may be generated by a CRC16 algorithm or the like based on the frame header and the target data, and the length of the check data may be 2 bytes, for example, or may be defined as other lengths. The verification data may also be calculated based on the target data only, without the frame header participating in the calculation.
According to the embodiment of the disclosure, various reasons such as misoperation of a program, unstable power supply and the like may cause data loss or error, and normal use of the instrument is affected. The error data read can be identified by checking the data, so that the error data used by the instrument is prevented from running, and the safety and reliability of the beauty instrument are improved.
According to the embodiment of the present disclosure, in operation S110, a target sector may be selected according to the sector status flag bit so as to perform a read/write operation.
According to an embodiment of the present disclosure, reading the sector status flag bit to select a target sector from the plurality of sectors includes, in the case where there is a sector in use, selecting one sector in use as the target sector. For example, the sector status flag bits of each sector may be read sequentially: if the sector is in the unused state or the full state, continuing to read sector state flag bits of other sectors; if the sector is in the use state, the sector is determined to be the target sector, and the sector state flag bits of other sectors are not read continuously. In this way, in the case where there is a sector in use, a sector in use is selected as the target sector, facilitating continuity of the data writing location, and facilitating reading of the latest target data.
According to an embodiment of the present disclosure, reading the sector status flag bit to select a target sector from the plurality of sectors includes, in a case where there is no sector in the use state and there is a sector in the full state, selecting one sector in the full state as the target sector. For example, if all sectors are traversed and no sectors in the use state are found, it is determined whether or not there is a sector in which the full state is stored, and if so, the sector in which the full state is stored is selected as the target sector. Because the beauty instrument needs to read the target data firstly after the beauty instrument is started to finish the initialization action after the beauty instrument is started, under the condition that the sectors in the full state are not used, the sectors in the full state are preferentially selected to be used as the target sectors, and the sectors which are not used, so that the latest target data can be read.
According to an embodiment of the present disclosure, reading the sector status flag to select a target sector from a plurality of sectors includes, in the case where there is no used state and a full state stored sector and there is an unused state sector, selecting one unused state sector as the target sector and modifying the sector status flag of the target sector to the used state. At this point, it may be that the device is first powered on, does not store any data, or that other sectors than the unused sectors have been in error. In any event, in this case no sector stores a valid data packet, an unused sector may be selected as the target sector and its sector status flag bit modified to the used status for writing the data packet.
According to the embodiment of the disclosure, reading the sector status flag bit so as to select a target sector from a plurality of sectors includes, in the case where there is no sector in a used state, a full state stored, and an unused state, selecting any one sector to erase as the target sector, and modifying the sector status flag bit of the target sector to the used state. At this time, the sector status flag bit of each sector in the plurality of sectors is wrong, and one sector is selected for erasure, so that the sector can be recovered to an unused state, and the use requirement is met. For example, a first sector erasure may be selected as the target sector and the status flag bit for that sector set to the use state.
By the method, after the flash memory device is powered on and used, a proper sector can be selected as a target sector for reading and writing target data.
Fig. 4 schematically illustrates a flow chart for finding valid data packets according to an embodiment of the disclosure.
As shown in fig. 4, operation S120 may include operations S410-S430. The flowchart may be used as a sub-flowchart of operation S120.
In operation S410, in the target sector, frame headers of data packets are read in a first order.
In operation S420, the target data and the check data of the data packet are determined according to the length of the data packet.
In operation S430, the verification data is verified based on the header and the target data of the data packet, and if the verification is successful, the data packet is determined to be a valid data packet, otherwise, the next header is read.
According to the embodiment of the disclosure, the first sequence can be the sequence of addresses in the sector from low to high or from high to low, so that the possibility of erasing in advance due to missing storage resources and wasting can be reduced. As shown in fig. 2, the first order may be a data read direction from a high address to a low address. The first order is opposite to the direction of data writing so that the most recently written data packet can be found preferentially.
According to the embodiment of the disclosure, the frame header has the determined content and length, and the target data and the check data have the determined length, so that the addresses of the target data and the check data can be determined by looking up the frame header so as to obtain the target data and the check data. The verification data may then be verified using at least the target data, for example, the frame header and target data may be processed by a verification algorithm, and the calculated new verification data compared to the read verification data. If the data packets are consistent, the content of the target data can be considered to be correct, the verification is successful, and the read data packets are valid data packets and can be provided for an application program; if the data packets are inconsistent, the error occurs in at least one of the target data and the check data, the check fails, the read data packets are not valid data packets, and the valid data packets need to be searched continuously according to the first sequence. Therefore, the latest effective data packet can be found, and the data packet with error is abandoned, so that the reliability of the system is improved.
According to an embodiment of the present disclosure, the data management method further includes, when the target sector does not find a valid data packet, continuing to find a valid data packet from a next sector until the valid data packet is found or the finding of all sectors is completed.
Fig. 5 schematically illustrates a flow chart for finding valid data packets according to another embodiment of the present disclosure.
As shown in FIG. 5, the method includes operations S510-S590. The flowchart may be used as a sub-flowchart of operation S120.
In operation S510, similarly to operation S410, in the target sector, the frame header of the data packet is read in the first order.
In operation S520, whether a frame header is identified. If a frame header is identified, operation S530 is continued, otherwise operation S570 is performed.
In operation S530, the target data and the check data of the data packet are determined according to the length of the data packet, similar to operation S420.
In operation S540, the check data is checked based on the header of the data packet and the target data, similar to operation S430.
In operation S550, whether the pass is checked. If the verification passes, operation S560 is performed, otherwise operation S570 is performed.
In operation S560, the data packet is determined to be a valid data packet. At this time, the valid data packet has been read, and the flow ends.
In operation S570, whether the target sector is found. If the target sector is not found, the operation returns to the execution of operation S510 to continue to find the frame header. If the target sector has been found, operation S580 is performed.
In operation S580, whether all sectors are found. If all sectors have not been found, operation S590 is performed. If all the sectors have been searched, it is indicated that there is no valid data packet in all the sectors, the search fails, and the process ends.
In operation S590, the handover sector continues the search. For example, the plurality of sectors includes sector 1 and sector 2, wherein sector 1 is the target sector and is active, and sector 2 is not the target sector and is inactive. When the sector 1 does not find the valid data packet after finding, the sector can be switched, and the target sector is switched from the sector 1 to the sector 2, at this time, the sector 1 is in an inactive state, and the sector 2 is in an active state. Thus, operation S510 may be performed back to continue searching for valid data packets in sector 2 until valid data packets are found or all sector searches are completed.
According to the technical scheme of the embodiment of the disclosure, even if one sector is in error, the relatively latest effective data packet can be searched from other sectors, so that the reliability of the flash memory device and the beauty instrument is improved.
FIG. 6 schematically illustrates a flow chart for locating a write location according to an embodiment of the disclosure.
As shown in fig. 6, in response to the data write request, finding the write location in the second order from the read location may include operations S610 and S620.
In operation S610, the length of the data packet is moved from the read position in the second order, and the moved position is determined as a candidate position.
In operation S620, in case that the address of the candidate location does not exceed the address range of the target sector and the candidate location has no data written therein, the candidate location is determined as a writing location.
According to an embodiment of the present disclosure, as shown in fig. 2, the second order is a data writing direction, which may be a direction from a low address to a high address, for example, opposite to the first order.
According to the embodiment of the disclosure, since the latest valid data packet has been read, the available writing positions can be searched for in the second order on the basis of the reading positions. In the embodiment of the present disclosure, the length of the data packet is fixed, and the position of the next data packet, that is, the candidate position, may be determined based on the length. For example, the address of the read location is a, the second order is the direction from the low address to the high address, the length of the packet is L, and the location of the next packet is a+l, i.e., the candidate location is a+l. If the candidate location does not exceed the address range of the target sector and the candidate location is not written with data, the candidate location may be determined to be a write location for writing a new data packet. Thus, the writing sequence of the data packets can be maintained, and the storage resources of the flash memory are fully utilized.
According to an embodiment of the present disclosure, if the candidate location a+l has exceeded the address range of the target sector, the candidate location does not actually exist, cannot be used for writing, and cannot be used as a write address. At this time, the target sector may be marked as a memory full state, and then the operation S590 similar to the above is performed, the target sector is switched to another sector, and the candidate location is also jumped to the new target sector. If the new target sector is in an unused state, it can be modified to a used state and the writing position is determined; if the new target sector is in another state, such as a use state, a full memory state, or other error state, the target sector may be erased and the write location determined and the sector state modified to the use state. That is, in the case where the address of the candidate position exceeds the address range of the target sector, another sector is selected from the plurality of sectors as an updated target sector; the updated target sector may be erased and a write location determined from the updated target sector.
According to the embodiment of the disclosure, if the candidate location a+l does not exceed the address range of the target sector, but the data has been written in the location, it may be an invalid data packet or other error occurs, and the search for the next candidate location, i.e., a+2l, needs to be continued. Flash memory has a characteristic that each byte becomes 0xFF entirely after being erased, and data can be written only when the data is 0 xFF. On the other hand, flash memories can only be erased in sector units, cannot be locally erased, and cannot be overwritten. If the data of the candidate address is 0xff, the data which is not written in can be used as a writing position, at the moment, the data which needs to be stored can be checked, the data are spliced into a complete data packet, and the data packet is written in the position. If the packet is not all 0xff, this indicates that the location has already been written with data and cannot be written again. If the sector is not immediately erased and the data is written after the sector is not continuously searched for other positions, the erasing times are wasted and the service life of the flash memory is possibly influenced because other available writing positions exist. That is, the data management method further includes, when the address of the candidate location does not exceed the address range of the target sector and the candidate location has data written therein, moving the length of the packet from the current candidate location in the second order, and taking the moved location as an updated candidate location.
According to an embodiment of the present disclosure, the data management method further includes stopping responding to the data write request if the target data in the data packet of the read position is consistent with the data requested to be written by the data write request. That is, before data storage is performed, it is necessary to determine whether the stored data matches the data to be stored, and if so, the data does not need to be stored, and if not, the data needs to be stored. Thus, repeated data writing can be avoided, the erasing times can be reduced, and the service life of the flash memory can be prolonged.
FIG. 7 schematically illustrates a flow chart for locating a write location according to another embodiment of the present disclosure.
As shown in FIG. 7, the method includes operations S710-S790. The flowchart may also be used as a sub-flowchart of operation S140.
In operation S710, if the data stored in the read location is consistent with the data to be written, operation S720 is performed if not, otherwise operation S790 is performed.
In operation S720, the lengths of the data packets are moved in the second order, and candidate positions are determined.
In operation S730, if the address of the candidate location exceeds the address range of the sector, then operation S740 is performed, otherwise operation S770 is performed.
In operation S740, if the candidate location is written with data, if not, operation S750 is performed, otherwise, operation S720 is performed.
In operation S750, the candidate location is determined as the writing location.
In operation S760, the data to be saved is verified to generate a complete data packet and written, and the process ends.
In operation S770, another sector is selected from the plurality of sectors as a new target sector.
In operation S780, the target sector is erased and the writing position is determined. It should be noted that if the new target sector is an unused sector, the writing position may be directly determined by skipping the erasing operation.
In operation S790, the response to the data write request is stopped, and the flow ends.
The embodiment of the disclosure adopts modes of multi-sector storage, balanced erasure and the like, thereby improving the data reliability and the service life of the flash memory. Specifically, the data is written into the sectors in turn, and then erased until the data is fully written, so that the number of times of sector erasure is reduced, and the service life of the flash memory is prolonged. When some data packet is wrong, the data packet stored before can be searched for standby, and even if the whole sector is wrong during erasure, other sectors can provide standby data.
Fig. 8 schematically illustrates a schematic view of a cosmetic apparatus of an embodiment of the present disclosure.
As shown in fig. 8, the cosmetic apparatus 800 includes a processor 810 and a flash memory device 820 having a plurality of sectors, and the processor 810 can implement various data management methods as described in fig. 1 to 7 after reading executable instructions. The number of sectors is at least two, but may be three or more. The first byte of each of the sectors may be used, for example, to store the sector status flag bits described above.
According to an embodiment of the present disclosure, the processor 810 of the cosmetic apparatus 800 may be, for example, a single-chip microcomputer, and the flash memory device 820 may be a flash memory on the single-chip microcomputer. After the cosmetic apparatus 800 is started, the processor 810 may first read the target data from the flash memory device 820 to complete initialization. When the cosmetic apparatus 800 receives new configuration data, or new user data is generated during use by a user, etc., the processor 810 may write to the flash memory device 820 by the method described above.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention referred to in this disclosure is not limited to the specific combination of features described above, but encompasses other embodiments in which any combination of features described above or their equivalents is contemplated without departing from the inventive concepts described. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).

Claims (10)

1. A data management method for a flash memory device of a beauty treatment instrument, comprising:
Reading a sector status flag bit to select a target sector from a plurality of sectors of the cosmetic instrument flash memory device, wherein the sector status flag bit is used to identify an unused state, a used state, or a full-stored state, the reading a sector status flag bit to select a target sector from a plurality of sectors of the cosmetic instrument flash memory device, including, in a case where a sector of the used state does not exist and a sector of the full-stored state exists, selecting a sector of the full-stored state as the target sector;
Searching for valid data packets in the target sector according to a first sequence, wherein the first sequence comprises a sequence from low to high or from high to low of addresses in the sector, target data stored in the sector in a data packet form comprises configuration information of a beauty instrument and/or use information of a user, when any one of the target data changes, a new data packet is constructed for re-storage, and the beauty instrument reads the target data after starting up so as to complete initialization actions after starting up;
under the condition that a valid data packet is obtained, determining a reading position of the valid data packet;
In response to a data write request, the write locations are looked up from the read locations in a second order, the second order being opposite the first order.
2. The method of claim 1, wherein the sector status flag is used to identify an unused state, a used state, or a full state, the reading of the sector status flag to select a target sector from a plurality of sectors of a cosmetic instrument flash device, further comprising at least one of:
in the case that a sector in a use state exists, selecting one sector in the use state as a target sector;
Selecting a sector in an unused state as a target sector and modifying a sector state flag bit of the target sector into a used state when no sectors in a used state and a full state are stored and the sectors in the unused state exist;
And under the condition that the sectors in the use state, the storage full state and the unused state do not exist, any one sector is selected to be erased as a target sector, and the sector state flag bit of the target sector is modified into the use state.
3. The method of claim 1, wherein the data packet includes a frame header, target data, and check data, and wherein the searching for valid data packets in the target sector in the first order comprises:
Reading frame heads of data packets according to a first sequence in the target sector;
determining target data and check data of the data packet according to the length of the data packet;
and checking the check data based on the frame header and the target data of the data packet, if the check is successful, determining that the data packet is a valid data packet, otherwise, reading the next frame header.
4. The method as recited in claim 1, further comprising:
And under the condition that the target sector does not find the valid data packet, continuing to find the valid data packet from the next sector until the valid data packet is found or the finding of all the sectors is completed.
5. The method of claim 1, wherein said looking up write locations from said read locations in a second order in response to a data write request comprises:
Moving the length of the data packet from the reading position according to the second sequence, and determining the moved position as a candidate position;
And determining the candidate position as a writing position when the address of the candidate position does not exceed the address range of the target sector and the candidate position is not written with data.
6. The method as recited in claim 5, further comprising:
And when the address of the candidate position does not exceed the address range of the target sector and the candidate position is written with data, moving the length of the data packet from the current candidate position according to the second sequence, and taking the moved position as an updated candidate position.
7. The method as recited in claim 5, further comprising:
selecting another sector from the plurality of sectors as an updated target sector if the address of the candidate location exceeds the address range of the target sector;
and erasing the updated target sector and determining the writing position from the updated target sector.
8. The method as recited in claim 1, further comprising:
And stopping responding to the data writing request when the target data in the data packet of the reading position is consistent with the data requested to be written by the data writing request.
9. A cosmetic apparatus comprising a processor and a flash memory device having a plurality of sectors, the processor being configured to implement the method of any one of claims 1-8.
10. The cosmetic apparatus of claim 9, wherein the flash memory device comprises two sectors, a first byte of each of the sectors for storing a sector status flag.
CN202311046126.8A 2023-08-18 2023-08-18 Data management method for flash memory device of beauty instrument and beauty instrument Active CN117076340B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311046126.8A CN117076340B (en) 2023-08-18 2023-08-18 Data management method for flash memory device of beauty instrument and beauty instrument

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311046126.8A CN117076340B (en) 2023-08-18 2023-08-18 Data management method for flash memory device of beauty instrument and beauty instrument

Publications (2)

Publication Number Publication Date
CN117076340A CN117076340A (en) 2023-11-17
CN117076340B true CN117076340B (en) 2024-08-13

Family

ID=88711063

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311046126.8A Active CN117076340B (en) 2023-08-18 2023-08-18 Data management method for flash memory device of beauty instrument and beauty instrument

Country Status (1)

Country Link
CN (1) CN117076340B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102339254A (en) * 2011-06-17 2012-02-01 杭州炬华科技股份有限公司 Flash data storage method for intelligent electric energy meter
CN112463020A (en) * 2019-09-09 2021-03-09 杭州海康威视数字技术股份有限公司 Data access method, device and equipment based on Flash

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101324862B (en) * 2008-05-05 2010-06-02 青岛海信电器股份有限公司 Flash memory storage management method
CN101853212B (en) * 2009-03-30 2012-11-14 芯邦科技(深圳)有限公司 Data write-in method, data read method and data storage
FR2997208B1 (en) * 2012-10-19 2016-01-15 Continental Automotive France METHOD FOR MANAGING A FLASH MEMORY
JP6869103B2 (en) * 2017-05-22 2021-05-12 マクセルホールディングス株式会社 Light irradiation type beauty equipment
CN109947369A (en) * 2019-03-22 2019-06-28 河南卓正电子科技有限公司 Date storage method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102339254A (en) * 2011-06-17 2012-02-01 杭州炬华科技股份有限公司 Flash data storage method for intelligent electric energy meter
CN112463020A (en) * 2019-09-09 2021-03-09 杭州海康威视数字技术股份有限公司 Data access method, device and equipment based on Flash

Also Published As

Publication number Publication date
CN117076340A (en) 2023-11-17

Similar Documents

Publication Publication Date Title
US6865658B2 (en) Nonvolatile data management system using data segments and link information
CN1900919B (en) Flash memory consisting of multiple blocks
US7984231B2 (en) Information recording medium access device, and data recording method
KR970008188B1 (en) Flash memory control method and information processing device using the same
US7480760B2 (en) Rotational use of memory to minimize write cycles
EP2329360B1 (en) Managing cache data and metadata
CN102216899B (en) Managing cache data and metadata
US7441085B2 (en) Memory control method for restoring data in a cache memory
US8381018B2 (en) Method for data recovery for flash devices
JP2000182381A (en) Batch erasable non-volatile memory
US7840749B2 (en) Data area managing method in information recording medium and information processor employing data area managing
US9870826B2 (en) Memory apparatus and data access method thereof by using multiple memories for lifetime extension
CN117076340B (en) Data management method for flash memory device of beauty instrument and beauty instrument
JPH11249968A (en) File recording method and file system
CN113190182B (en) Management method for data storage in Flash
JP2001051883A (en) Method for self-restoration by nonvolatile memory and novolatile memory device
WO2019062147A1 (en) Reading and writing method and apparatus for counter, device, and storage medium
CN113918485B (en) Method, device, equipment and storage medium for preventing flash memory data from being lost
US8984218B2 (en) Drive indicating mechanism for removable media
CN111258498B (en) FLASH memory management method
US20100217923A1 (en) Storage device with flash memory
JP2006099802A (en) Storage controller and cache memory control method
CN119597215A (en) Storage wear leveling method and device
US11803443B2 (en) Storage system, data copy control method, and recording medium
CN118298881A (en) Analog electrically erasable memory, control method and micro-processing chip

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