Flash-based data storage method, device, apparatus and door lock system

By detecting the data type of the stored data and synchronously processing and erasing the FLASH storage space in the door lock system, the problem of frame loss caused by data not being stored in time is solved, achieving fast storage and smooth video, and extending the lifespan of FLASH.

CN115686360BActive Publication Date: 2026-05-15SHENZHEN ORBBEC CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN ORBBEC CO LTD
Filing Date
2022-10-10
Publication Date
2026-05-15

AI Technical Summary

Technical Problem

In embedded systems, especially door lock systems, the inability to store data to FLASH storage media in a timely manner leads to problems such as video frame loss and playback stuttering.

Method used

By detecting the data type and determining the FLASH storage space, if the data processing mode is pending and the space is occupied, data processing and erasure operations are performed simultaneously, and then the processed data is stored in the erased space.

Benefits of technology

It enables fast and timely data storage, avoids data frame loss, improves the smoothness and integrity of video streams, and extends the lifespan of FLASH.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115686360B_ABST
    Figure CN115686360B_ABST
Patent Text Reader

Abstract

The application provides a FLASH-based data storage method, device, apparatus and lock system. The target storage data is received, the target FLASH storage space and the data processing mode are determined, if the data processing mode is a to-be-processed mode and the target FLASH storage space is in an occupied state, the target storage data is controlled to be processed and the target FLASH storage space is controlled to be erased, and the target storage data processed is stored in the erased target FLASH storage space. That is, in the implementation, the state of the target FLASH storage space is modified to an unoccupied state in the data processing process through the mechanism that the processing process and the erasing process are synchronously performed, and when the target storage data is completed, the blocks involved are all in the erased state, so that the target storage data processed can be quickly and timely written into the target FLASH storage space, and the phenomenon of data frame loss caused by untimely storage and writing is avoided through the quick and timely storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of embedded system technology, and more specifically to data storage methods, devices, apparatuses, and door lock systems based on FLASH (Flash Memory). Background Technology

[0002] Currently, FLASH memory is frequently used as a storage medium in embedded systems to store non-volatile data. For systems with large amounts of memory, file systems can be created on the FLASH memory, such as FATFS, JFFS2 (Journaling Flash File System Version 2), YAFFS (Yet Another FlashFiling System, the first embedded file system specifically designed for NAND flash memory), and EXT4 (Fourth extended file system). However, for systems with limited memory (such as door lock systems), since file systems cannot be used, different types of data are directly assigned storage addresses for storage. If an address is occupied, it must be erased before writing can begin.

[0003] The above storage method has drawbacks: erasure and writing to FLASH can only be performed after data processing is complete, which is time-consuming and can lead to data frame loss due to delayed storage and writing. For video frames, if they are not written to FLASH in time, the data production rate of the video stream may exceed the data consumption rate of the storage process, resulting in frame loss during storage and potentially causing stuttering during playback.

[0004] Therefore, existing technologies need to be improved. Summary of the Invention

[0005] The main objective of this invention is to propose a data storage method, device, apparatus, and door lock system based on FLASH, so as to at least solve the technical problem of frame loss due to failure to store data in time in existing storage methods.

[0006] In a first aspect, the present invention provides a FLASH-based data storage method, comprising: receiving target storage data and detecting the target storage data corresponding to the target storage data; determining a target FLASH storage space and a data processing mode according to the target storage data type; if the data processing mode is a pending mode and the target FLASH storage space is occupied, controlling the processing of the target storage data and erasing the target FLASH storage space, and using the erased target FLASH storage space to store the processed target storage data.

[0007] In a second aspect, the present invention provides an electronic device, including a memory, a processor, and a bus; the bus is used to realize the connection and communication between the memory and the processor; the processor is used to execute a computer program stored in the memory; when the processor executes the computer program, it implements the steps of the FLASH-based data storage method of the first aspect.

[0008] In a third aspect, the present invention provides a data storage device, comprising a control unit, a service processing unit, and a FLASH storage unit; the control unit is configured to receive target stored data and detect the corresponding target stored data type, and determine the FLASH storage space and data processing mode according to the target stored data type; if the data processing mode is a pending mode and the target FLASH storage space is occupied, the service processing unit is configured to perform service processing on the target stored data, and the control unit is also configured to erase the target FLASH storage space; the FLASH storage unit is configured to store the processed target stored data in the erased target FLASH storage space.

[0009] In a fourth aspect, the present invention provides a door lock system communicatively connected to a terminal, comprising a camera module, a door lock main controller, and a data storage device as described in the third aspect; the camera module is used to acquire target stored data; the data storage device is used to store the target stored data and transmit the target stored data to the terminal according to a read data request issued by the terminal; the door lock main controller is used to control the lock body to open or close according to the biometric recognition result of the image received by the camera module.

[0010] This invention discloses a FLASH-based data storage method, device, apparatus, and door lock system. It receives target storage data and detects the corresponding target storage data type. Based on the target storage data type, it determines the target FLASH storage space and data processing mode. If the data processing mode is "pending processing" and the target FLASH storage space is occupied, it controls the processing of the target storage data and the erasure of the target FLASH storage space. The erased target FLASH storage space is then used to store the processed target storage data. Specifically, during implementation, when the data processing mode is identified as "pending processing" and the target FLASH storage space is occupied, it controls the processing of the target storage data and the erasure of the target FLASH storage space. Through a mechanism that synchronizes the processing and erasure processes, the state of the target FLASH storage space is simultaneously changed to an unoccupied state (freeing up the storage space) during data processing. Therefore, after the target storage data is processed, since all involved blocks are erased, the processed target storage data can be quickly and promptly written into the target FLASH storage space. This rapid and timely storage solves the technical problem of data frame loss caused by untimely storage and writing. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0012] Figure 1 This is a schematic diagram of the structure of a door lock system provided in an embodiment of the present invention;

[0013] Figure 2 This is a schematic diagram of module connections for an electronic device provided in an embodiment of the present invention;

[0014] Figure 3 This is a flowchart illustrating a FLASH-based data storage method according to an embodiment of the present invention.

[0015] Figure 4 This is a flowchart illustrating a FLASH-based data storage method according to an embodiment of the present invention.

[0016] Figure 5 This is a schematic diagram illustrating the traversal of the BLOCK set in one embodiment of the present invention.

[0017] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0018] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0019] It should be noted that related terms such as "first" and "second" can be used to describe various components, but these terms do not limit the component. These terms are only used to distinguish one component from another. For example, without departing from the scope of the invention, the first component can be referred to as the second component, and the second component can similarly be referred to as the first component. The term "and / or" refers to any one or more combinations of related and descriptive terms.

[0020] In related technologies, FLASH memory is often used as the storage medium to store encoded data, which can be video frames or audio data. When the amount of encoded video frame data is large, it occupies multiple FLASH blocks. Furthermore, due to the characteristics of FLASH, the transition from a data-containing state to a writable state requires an erasure process to put the FLASH blocks in an erased state (at which point the data on the blocks is all 0xFF). On one hand, erasing and writing to FLASH can only be performed after data processing is complete, which is time-consuming. This can lead to data loss due to delayed storage and writing. On the other hand, because the data production speed of the video stream may exceed the data consumption speed of the storage process, frame loss during storage can occur, resulting in video stuttering during playback.

[0021] There are three solutions to the above problems: First, although a data buffer queue can be added between the video stream production data and the stored procedure consumption data, the buffer queue has limited capacity. It can reduce the number of dropped frames in the stored procedure, but it is still difficult to avoid dropped frames. Second, a multi-level indexing method similar to m3u8 (a video playback standard introduced by Apple, an index file) can be added to store or retrieve data in segments. This method has high software complexity and high system requirements, and is not suitable for small-scale door lock systems. Third, reduce the time consumed by the stored procedure so that its consumption time is less than that of the video stream production time.

[0022] Among these issues, due to the fragile nature of FLASH, if the correctness of the data is not guaranteed, some parts of the video stream may become corrupted and unplayable or lost, resulting in stuttering. In addition, the uneven frequency of writing or deleting each block in FLASH may lead to some blocks being written or deleted at high frequency, thus forming bad blocks.

[0023] To address the technical issue of data frame loss caused by untimely write operations in the aforementioned storage methods, please refer to [link to relevant documentation]. Figure 1, Figure 1 This invention illustrates a door lock system, which includes a camera module, a door lock main controller, and a data storage device.

[0024] Specifically, a camera module refers to a device that can perform photo and video recording functions, such as a camera, which is mainly used to acquire target stored data (a video of a visitor's message or a photo of a visitor).

[0025] Specifically, a data storage device refers to a device with storage function, which is used to store target stored data and transmit the target stored data in the data storage device to the terminal according to the read data request issued by the terminal.

[0026] Specifically, the door lock main controller is a device with control functions, which is mainly used to control the lock body to open or close based on the biometric recognition results of the images received by the camera module.

[0027] The door lock system may also include a terminal that matches the data storage device, such as a device (mobile phone, iPad, etc.) capable of communicating with the data storage device. Typically, the user (owner) of the door lock system uses this terminal to send data read requests and receive target stored data read from the data storage device, thereby viewing a visitor message video or a visitor's photo.

[0028] Please refer to it again. Figure 1 The data storage device of the present invention specifically includes a control unit, a business processing unit, and a FLASH storage unit;

[0029] Specifically, the control unit is a device with processing capabilities, such as a CPU (Central Processing Unit). It receives target stored data, detects the corresponding target stored data type, and determines the FLASH storage space and data processing mode based on the target stored data type. If the data processing mode is pending and the target FLASH storage space is already occupied, the business processing unit performs business processing on the target stored data, and the control unit also erases the target FLASH storage space.

[0030] The final storage unit FLASH is used to store the processed target storage data in the erased target FLASH storage space.

[0031] The service processing unit may include a video module VENC and an algorithm unit NPU. The video module VENC is a video encoder used for video compression encoding and decoding; and the algorithm unit NPU is used for algorithm inference or other calculation processes. The service processing unit in this application is not limited to the above two services, but may also be other services.

[0032] Therefore, through the aforementioned data storage device, during implementation, when the data processing mode is identified as pending mode and the target FLASH storage space address is in an occupied state, the processing of the target storage data and the erasure of the target FLASH storage space can be controlled. Through the mechanism of simultaneous processing and erasure, the state of the target FLASH storage space is changed to an unoccupied state (freeing up the storage space) during the data processing. Then, when the target storage data is processed, based on the fact that all the involved blocks are in an erased state, the processed target storage data can be quickly and timely written to the target FLASH storage space. This fast and timely storage solves the technical problem of data frame loss caused by failure to store and write in a timely manner.

[0033] Please see Figure 2 , Figure 2 An electronic device according to an embodiment of the present invention is shown. The electronic device includes a memory 201, a processor 202, a bus 203, and a computer program stored in the memory 201 and executable on the processor 202. The memory 201 and the processor 202 are connected via the bus 203. When the processor 202 executes the computer program, it can implement the FLASH-based data storage method described in later embodiments. The number of processors can be one or more. The memory 201 can be a high-speed random access memory (RAM) or a non-volatile memory, such as a disk storage device. The memory 201 is used to store executable program code, and the processor 202 is coupled to the memory 201. The electronic device in this embodiment can be a depth camera, etc.

[0034] Furthermore, this application embodiment also provides a computer-readable storage medium, which may be disposed in the aforementioned device or electronic device. The computer-readable storage medium may also be a memory, or various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), RAM, magnetic disk, or optical disk. This computer-readable storage medium generally stores a computer program, which, when executed by a processor, implements the FLASH-based data storage method described in later embodiments.

[0035] Please see Figure 3 This application provides a FLASH-based data storage method applied to a control unit. Taking a CPU as an example, the data storage method includes the following steps:

[0036] Step S10: Receive the target storage data and detect the corresponding target storage data type;

[0037] Specifically, the target storage data can include video, audio, images, and control commands, etc. When the CPU receives the target storage data to be stored, it can detect the data type of the target storage data to obtain the target storage data type. For example, when the target storage data includes video, the detected target storage data type is video.

[0038] Step S20: Determine the target FLASH storage space and data processing mode based on the target storage data type;

[0039] Specifically, the CPU pre-assigns different target FLASH storage spaces for different target storage data types. This means that the FLASH memory will have different target FLASH storage space addresses, and the storage space or block corresponding to each target FLASH storage address will be responsible for storing the corresponding data. For example, BLOCK1 to BLOCK3 (the first to third blocks in the block set) in the FLASH memory are used to store video stream data, while BLOCK4 is used to store text content. Therefore, once the target storage data type is obtained, the target FLASH storage space and data processing mode can be determined based on the target storage data type. Here, BLOCK represents a block area in the FLASH memory, which provides storage space for storing data.

[0040] Step S30: If the data processing mode is pending mode and the target FLASH storage space is occupied, control the processing of the target storage data and the erasure of the target FLASH storage space, and use the erased target FLASH storage space to store the processed target storage data.

[0041] The erased target FLASH storage space is used to store the processed target data. Specifically, when the data processing mode is pending and the target FLASH storage space is occupied, indicating that historical data was stored in the target FLASH storage space before storage, the CPU can send control signals to the FLASH to control the processing of the target data and the erasure of the target FLASH storage space. In other words, the control signals control the processing and erasure processes to proceed synchronously, thereby changing the state of the target FLASH storage space to an unoccupied state, quickly and promptly storing the target data.

[0042] In a real-world scenario, when a visitor arrives while the homeowner is not home, they can select the message option through the interactive interface to start a video recording mode and record a short video message. The recorded video is then stored in the designated video storage space of the Flash application. Before storage, historical data may occupy part of the current storage space. Furthermore, because Flash uses an erase-then-write mechanism, it takes time to erase the data in the designated storage space in blocks before writing the video data. This erase-to-write process takes time, especially if the video data requires compression, encoding / decoding, NPU (neural-network process units) algorithm inference, or other computational processes, such as face detection, face recognition, or video encoding algorithms (this process is time-consuming). After these processing steps, the Flash erasure and storage will take even longer. Although a buffer is set between the encoder and the transmission channel, and the encoder rate can be controlled by CBR (Constant Bit Rate) / VBR (Variable Bit Rate), the buffer capacity is limited. If the processing time of the previous video stream segment is too long or causes the backlog of the subsequent video stream segments, data overflow or loss will occur, resulting in dropped frames when writing video and stuttering when playing video.

[0043] Therefore, in this embodiment, when the data processing mode is in pending mode and the target FLASH storage space is occupied, the system controls the processing of the target storage data and the erasure of the target FLASH storage space. Through a mechanism that synchronizes the processing and erasure processes, the state of the target FLASH storage space is simultaneously changed to an unoccupied state (freeing up the storage space) during processing. Thus, after the target storage data is processed, since all involved blocks are already erased, the processed target storage data can be quickly and promptly written to the target FLASH storage space. This rapid and timely storage solves the technical problem of data frame loss caused by delayed storage. Furthermore, by reducing storage time, it is made less time-consuming than video stream production time, avoiding video data stream stuttering and improving the smoothness and integrity of the video stream.

[0044] In this embodiment, after obtaining the target storage data type, the time required to store the target storage data is calculated. If the storage time exceeds a preset time threshold, the step of determining the target FLASH storage space and data processing mode based on the target storage data type is executed. That is, after obtaining the target storage data type, the CPU will first evaluate whether the operation of storing the target storage data is a time-consuming operation. If it is a time-consuming operation, step S20 should be executed to reduce storage time.

[0045] In this embodiment, the target FLASH storage space includes a primary partition and a secondary partition; the step of storing the processed target storage data in the erased target FLASH storage space specifically includes:

[0046] According to the preset master-slave backup rules, the processed target storage data is stored in the master partition and slave partition respectively.

[0047] Specifically, the CPU stores the target data in the primary and secondary partitions of the target FLASH storage space according to a preset master-slave backup rule, ensuring that the data stored in the primary partition is identical to the data stored in the secondary partition. However, due to the inherent vulnerability of FLASH memory (e.g., during a random power outage, only a portion of the primary or secondary partition might be written, leading to data corruption), failure to guarantee data integrity could affect the normal operation of the business system, potentially causing partial video corruption or loss. Therefore, by introducing a master-slave backup mechanism, since the data stored in the primary and secondary partitions is identical, if data in either partition is corrupted due to a power outage or other reasons, data can be synchronized from the other partition with correct data or read directly. The probability of both partitions being corrupted simultaneously is very low; generally, at least one partition will have correct data (either the primary or secondary partition), supporting normal business operations. As can be seen, using a master-slave partition storage method when storing target data improves the integrity of the video data stream.

[0048] In this embodiment, the target storage data includes visitor record data and corresponding visitor record control instructions. Before the step of storing the processed target storage data in the primary and secondary partitions according to the preset master-slave backup rules, the method further includes: detecting whether the level corresponding to the visitor record data reaches a preset legal access level according to the visitor record control instructions; if the legal access level is reached, then the step of storing the processed target storage data in the primary and secondary partitions according to the preset master-slave backup rules is executed. That is, the preset legal access level corresponding to the visitor record data is determined by the visitor record control instructions. When the preset legal access level is reached, it indicates that the target storage data has a high priority and is considered important information that needs to be stored immediately. Therefore, the visitor record data is treated as important information and subjected to a more secure and protective master-slave backup operation.

[0049] In this embodiment, the step of storing the processed target storage data in the primary partition and the secondary partition respectively according to the preset master-slave backup rules specifically includes:

[0050] During the process of writing the processed target storage data to the primary and secondary partitions respectively, the system checks whether the data in the primary and secondary partitions has been corrupted.

[0051] If data corruption is detected on the primary partition, data written to the secondary partition that has never been corrupted will be synchronized to the primary partition.

[0052] If data corruption is detected on the secondary partition, the data written to the primary partition that has never been corrupted will be synchronized to the secondary partition.

[0053] Specifically, in the event of a sudden power outage, the primary or secondary partition may be partially written, leading to data corruption. To address this, the system detects data corruption in both the primary and secondary partitions during storage to determine whether the uncorrupted partitions need to be synchronized. That is, when a primary or secondary partition contains corrupted data, data is synchronized with the data written to a partition that has not experienced corruption, restoring consistency between the primary and secondary partitions. This ensures that at least one of the primary or secondary partitions contains correct data, supporting normal read operations. Regardless of when data corruption occurs during write operations, at least one of the primary or secondary partitions will remain in a healthy state, ensuring system functionality.

[0054] In this embodiment, after determining the target FLASH storage space and data processing mode based on the target storage data type, the method further includes: if the target FLASH storage space is partially occupied, then obtaining the data size of the target storage data; when the remaining storage space in the target FLASH storage space is greater than the data size of the target storage data, storing the target storage data using a preset block polling storage method.

[0055] Specifically, when the target FLASH storage space is in a partially occupied state, the size of the target storage data is obtained and compared with the remaining storage space of the target FLASH storage space. By comparison, it is determined whether the remaining storage space in the target FLASH storage space is greater than the size of the target storage data. Obviously, if the remaining storage space in the target FLASH storage space is greater than the size of the target storage data (indicating that the target FLASH storage space can accommodate the target storage data), then the preset BLOCK polling storage method is used to store the target storage data.

[0056] Please see Figure 4 In this embodiment, the step of storing the target data using a preset BLOCK polling storage method specifically includes:

[0057] Step S401: Obtain the storage status of all blocks in the target FLASH storage space;

[0058] Step S402: Select the target BLOCK that has the longest time interval from the current time and is in an unoccupied state according to the storage status of all BLOCKs;

[0059] Step S403: Store the target storage data in the target BLOCK and record the storage status of the target BLOCK as occupied.

[0060] Specifically, all blocks in the target FLASH storage space can be traversed to obtain the storage status of each block. The storage time corresponding to the storage status can then be obtained. Among all the obtained storage statuses of blocks, the target block with the longest time interval from the current time and in an unoccupied state can be selected. The target storage data can then be stored in the target block, and the storage status of the target block can be recorded as occupied (i.e., the status of the target block as occupied can be persistently recorded).

[0061] It should be understood that although there are predetermined block storage allocations for different types of data, the usage of each block is variable. The frequency of writing or deleting data in each FLASH block is uneven, which may lead to some blocks being written to or deleted at high frequencies, resulting in bad blocks. For example, if bad blocks exist during video data writing, this portion of the video may be corrupted or lost, leading to an incomplete data stream. Therefore, the aforementioned block rotation mechanism can be used to extend the lifespan of each block; that is, when data is stored in a target block, the target block's status is set to occupied.

[0062] Please see Figure 5 The steps to obtain the storage status of all blocks in the target FLASH storage space include: starting from the block whose most recent status is recorded as occupied, sequentially traversing all blocks in the block set in the target FLASH storage space to obtain the storage status of all blocks.

[0063] Specifically, starting with the block whose most recent state was "occupied," the block set in the target FLASH storage space is traversed sequentially. When the traversal reaches the last block in the block set (i.e., the end of the block set), the process jumps to the first block in the block set and continues traversing (i.e., the beginning of the block set), until all blocks in the block set have been traversed, thus obtaining the storage state corresponding to all blocks in the target FLASH storage space during the entire traversal process. That is, when obtaining the storage state corresponding to all blocks, the traversal order in the block set starts from the block whose most recent state was "occupied" (let's assume it's defined as BLOCK-M) and continues until it returns to BLOCK-M, completing one traversal process, thereby obtaining the storage state corresponding to all blocks.

[0064] As can be seen from the above, the traversal termination condition is that all BLOCKs in the BLOCK set have been traversed (i.e., each BLOCK has been traversed once). For a given number of BLOCK sets, the strategy of applying the strategy of Round Robin to BLOCKs, as described above, achieves wear leveling of the BLOCKs used in the FLASH, extends the lifespan of the FLASH, ensures the stability of data storage, and improves the integrity of the video data stream.

[0065] In this embodiment, after the step of storing the target data, the method further includes: receiving a data retrieval instruction, determining the corresponding BLOCK to be retrieved based on the data retrieval instruction, detecting whether the corresponding data to be retrieved exists in the BLOCK, and if it exists, outputting the corresponding data to be retrieved (after outputting, deleting the corresponding data to be retrieved from the BLOCK), and persistently recording the storage status of the BLOCK to be retrieved as unoccupied. The record can be made using tags, and the tags are removed or changed to empty after the BLOCK to be retrieved becomes vacant (its status is unoccupied).

[0066] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0067] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0068] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0069] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned readable storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0070] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0071] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0072] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A data storage method based on FLASH, characterized in that, Applied to door lock systems, the method includes: Receive target storage data and detect the target storage data corresponding to the target storage data; The target FLASH storage space and data processing mode are determined based on the target storage data type; wherein, the target FLASH storage space includes a primary partition and a secondary partition; If the data processing mode is pending and the target FLASH storage space is occupied, the target storage data is processed while the target FLASH storage space is erased, and the processed target storage data is stored in the primary partition and the secondary partition respectively according to the preset master-slave backup rules.

2. The FLASH-based data storage method as described in claim 1, characterized in that, The data stored in the primary partition is the same as the data stored in the secondary partition.

3. The FLASH-based data storage method as described in claim 2, characterized in that, The target stored data includes visitor record data and corresponding visitor record control instructions; Before the step of storing the processed target storage data in the primary partition and the secondary partition respectively according to the preset master-slave backup rules, the method further includes: The visitor record control command is used to detect whether the level corresponding to the visitor record data has reached the preset legal access level. If the legal access level is reached, then the step of storing the processed target storage data in the primary partition and the secondary partition respectively according to the preset master-slave backup rules is executed.

4. The FLASH-based data storage method as described in claim 2, characterized in that, The step of storing the processed target storage data in the primary partition and the secondary partition respectively according to the preset master-slave backup rules specifically includes: During the process of writing the processed target storage data to the primary partition and the secondary partition respectively, it is detected whether the data in the primary partition and the secondary partition is corrupted; If data corruption is detected in the primary partition, the data written to the secondary partition that has never been corrupted will be synchronized to the primary partition. If data corruption is detected in the slave partition, the data written to the primary partition that has never been corrupted will be synchronized to the slave partition.

5. The FLASH-based data storage method as described in claim 1, characterized in that, After the step of determining the target FLASH storage space and data processing mode based on the target storage data type, the method further includes: If the target FLASH storage space is partially occupied, then obtain the data size of the target storage data; When the remaining storage space in the target FLASH storage space is greater than the data size of the target storage data, the target storage data is stored using a preset block polling storage method.

6. The FLASH-based data storage method as described in claim 5, characterized in that, The step of storing the target data using a preset block polling storage method specifically includes: Obtain the storage status of all blocks in the target FLASH storage space; Based on the storage status of all the BLOCKs, select the target BLOCK that has the longest time interval from the current moment and is in an unoccupied state; The target storage data is stored in the target BLOCK, and the storage status of the target BLOCK is recorded as occupied.

7. The FLASH-based data storage method as described in claim 6, characterized in that, The step of obtaining the storage status of all blocks in the target FLASH storage space specifically includes: Starting with the BLOCK whose most recent status record is "occupied", traverse all BLOCKs in the BLOCK set in the target FLASH storage space in turn to obtain the storage status corresponding to each BLOCK.

8. An electronic device, characterized in that, Includes memory, processor, and bus; The bus is used to enable communication between the memory and the processor; The processor is used to execute a computer program stored on the memory to implement the FLASH-based data storage method according to any one of claims 1 to 7.

9. A data storage device, characterized in that, Applied to access control systems, the data storage device includes a control unit, a business processing unit, and a FLASH storage unit; The control unit is used to receive target storage data and detect the corresponding target storage data type, and determine the target FLASH storage space and data processing mode according to the target storage data type; wherein, the target FLASH storage space includes a primary partition and a secondary partition; If the data processing mode is pending mode and the target FLASH storage space is occupied, the business processing unit is used to perform business processing on the target stored data, while the control unit is used to erase the target FLASH storage space. The FLASH storage unit is used to store the processed target storage data in the primary partition and the secondary partition respectively according to the preset master-slave backup rules.

10. A door lock system, communicatively connected to a terminal, characterized in that, Includes a camera module, a door lock main controller, and a data storage device as described in claim 9; The camera module is used to acquire target stored data; The data storage device is used to store the target stored data and to transmit the target stored data to the terminal according to the read data request issued by the terminal; The main controller of the door lock is used to control the opening or closing of the lock body based on the biometric recognition results of the images received by the camera module.