FreeRTOS-based display system and smart watch
By setting a timer in the FreeRTOS operating system to control the display thread and refresh rate of the smart watch, the problem of insufficient battery life of the smart watch is solved, achieving longer battery life and a better user experience.
Patent Information
- Application Number
- CN202410880444.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-10-15
AI Technical Summary
The battery capacity of smart watches is limited, resulting in insufficient battery life and affecting the user experience.
Set the first timer in the FreeRTOS operating system to shut down the display thread, and use the second timer to extend the refresh interval of the graphical interface and reduce the refresh rate, thereby reducing the power consumption of the smart watch and improving battery life.
It implements simple and easy-to-implement screen-off operation logic, reduces the computing power consumption of smart watches, extends battery life, and improves user experience.
Smart Images

Figure CN118778792A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of smart watches, and specifically to a display system and a smart watch based on FreeRTOS. Background Art
[0002] With the continuous advancement of technology, wearable devices such as smart watches are increasingly favored by consumers due to their portability and versatility. However, due to the small size of smart watches, their built-in battery capacity is relatively limited. This limitation leads to serious battery life issues for smart watches in actual use, which in turn affects the user experience.
[0003] Therefore, how to improve the battery life of smart watches has become a technical problem that needs to be solved urgently. Summary of the invention
[0004] In view of the above problems, the embodiments of the present application provide a display system and a smart watch based on FreeRTOS, which are used to solve the problem of poor battery life of smart watches in the prior art.
[0005] According to one aspect of an embodiment of the present application, a display system based on FreeRTOS is provided, which is applied to a smart watch, and the system includes a FreeRTOS operating system and multiple graphical interfaces; the FreeRTOS operating system includes a first thread and a first timer, the first thread is used to execute the display task of the graphical interface, and the first timer is used to trigger the FreeRTOS operating system to close the first thread after the timing ends; the first thread also includes a second timer, and the second timer is used to trigger the first thread to obtain updated data of the graphical interface at a timed interval; wherein the first thread executes the display task of the graphical interface, including the following steps: receiving the display task of the first interface; obtaining a first interface identifier corresponding to the first interface, first interface data corresponding to the first interface identifier, and a preset time interval corresponding to the first interface identifier, the preset time interval being greater than a preset interval threshold; setting the preset time interval as the timing interval of the second timer; displaying the first interface according to the first interface data, and refreshing the first interface according to the updated data.
[0006] In an optional manner, the FreeRTOS operating system also includes a second thread and a message queue; the second thread is used to receive the first task, and the first task includes a display task of the second interface; the second thread is also used to send the display task of the second interface to the message queue; the message queue is used to receive the display task of the second interface sent by the second thread, and transmit the display task of the second interface to the first thread, so that the first thread executes the display task of the second interface.
[0007] In an optional manner, the first thread is also used to receive the display task of the second interface sent by the message queue, and compare the display priority of the first interface and the second interface, where the first interface is the graphical interface currently displayed by the smart watch; if the display priority of the second interface is higher than that of the first interface, the display task of the first interface is terminated and the display task of the second interface is executed.
[0008] In an optional manner, the FreeRTOS operating system also includes an interface stack; the interface stack is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread; the first thread is also used to read the first interface identifier from the interface stack after completing the display task of the second interface, and establish a display task of the first interface based on the first interface identifier to display the first interface again.
[0009] In an optional manner, the FreeRTOS operating system also includes an interface stack; the interface stack is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread; the FreeRTOS operating system is used to start the first thread in response to a screen wake-up event of the smart watch; the first thread is also used to read the first interface identifier of the interface stack from the interface stack after being started, and establish a display task of the first interface based on the first interface identifier to display the first interface again.
[0010] In an optional manner, the interface identifiers of multiple graphical interfaces are all enumerated data; the first thread is also used to compare the enumeration values of the first interface identifier and the second interface identifier. If the enumeration value of the second interface identifier is larger than the enumeration value of the first interface identifier, it is determined that the display priority of the second interface is higher than that of the first interface.
[0011] In an optional manner, the FreeRTOS operating system is further used to allocate cache space, and the cache space is used to store interface data and update data of the graphical interface acquired by the first thread; the FreeRTOS operating system is also used to clear the cache space after closing the first thread.
[0012] In an optional manner, the FreeRTOS operating system also includes a lock array, which is used to store interface identifiers of graphical interfaces that need to be locked; the FreeRTOS operating system is also used to search the cache space for lock interface data and lock update data corresponding to the interface identifiers stored in the lock array after closing the first thread, and retain the lock interface data and lock update data in the cache space when clearing the cache space.
[0013] In an optional manner, the FreeRTOS operating system includes an interface stack, a hierarchical relationship table, and multiple instruction functions; the interface stack is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread; the hierarchical relationship table is used to store the hierarchical relationship between multiple graphical interfaces; the FreeRTOS operating system is also used to respond to user operation events of the smart watch and determine the instruction function corresponding to the user operation event; wherein the user operation event includes a return to the previous interface operation event, an entry to the previous level interface operation event, an entry to the next level interface operation event, and a return to the main interface operation event; the instruction function corresponding to the return to the previous interface operation event is used to read the interface of the last stored graphical interface from the interface stack. Identifier, and establish the display task of the last stored graphical interface based on the read interface identifier to display the last stored graphical interface; the instruction function corresponding to the operation event of entering the previous level interface is used to determine the current interface being displayed by the first thread, determine the previous level interface of the current interface based on the upper and lower hierarchical relationship table, and establish the display task of the previous level interface to display the previous level interface; the instruction function corresponding to the operation event of entering the next level interface is used to determine the current interface being displayed by the first thread, determine the next level interface of the current interface based on the upper and lower hierarchical relationship table, and establish the display task of the next level interface to display the next level interface; the instruction function corresponding to the operation event of returning to the main interface is used to establish the display task of the main interface to display the main interface.
[0014] According to another aspect of an embodiment of the present application, a smart watch is provided, and the smart watch includes a FreeRTOS-based display system as described in any of the above embodiments.
[0015] The embodiment of the present application sets a first timer in the FreeRTOS operating system, and after the timing is over, triggers the FreeRTOS operating system to close the first thread through the first timer, so that the operation logic of turning off the screen of the smart watch is simple and easy to implement, thereby reducing the operation power consumption of the smart watch and improving the battery life of the smart watch; by setting a second timer in the first thread of the FreeRTOS operating system, and periodically triggering the first thread through the second timer to obtain updated data of the graphical interface being displayed, the refresh rate of the smart watch can be reduced by extending the timing interval of the second timer, thereby improving the battery life of the smart watch.
[0016] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present application. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:
[0018] Figure 1 The structure diagram of the display system based on FreeRTOS provided in the embodiment of the present application is shown;
[0019] Figure 2 A schematic diagram showing a process of a first thread performing a task of displaying a graphical interface provided by an embodiment of the present application is shown;
[0020] Figure 3 The structure diagram of the smart watch provided in the embodiment of the present application is shown.
[0021] The reference numerals in the specific implementation manner are as follows:
[0022] 1. Smart watch; 10. Display system; 100. FreeRTOS operating system;
[0023] 110, first thread; 111, second timer; 120, first timer; 130, second thread; 140, message queue; 150, interface stack; 160, cache space; 170, lock array; 181-183, multiple graphical interfaces. DETAILED DESCRIPTION
[0024] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein.
[0025] Smartwatches usually use AMOLED (Active-Matrix Organic Light-Emitting Diode) or LCD (Liquid Crystal Display) technology, which consumes a lot of power when displaying images. In addition, smartwatches need to refresh their screens regularly to display new content. High refresh rates (such as 60Hz or 120Hz) can provide a smoother display experience, but they also increase power consumption.
[0026] In order to reduce the power consumption of smart watches when displaying, researchers and manufacturers have been exploring new display technologies and ways to optimize display settings. For example, by optimizing the screen brightness adjustment algorithm, dynamically adjusting the screen brightness and refresh rate, and reducing the screen brightness and refresh rate when high brightness or high refresh rate is not required, the power consumption of smart watches can be effectively reduced and the battery life of smart watches can be improved.
[0027] However, the hardware configuration of a smartwatch may not be sufficient to run complex algorithms efficiently, or its software system may not be sufficient to support the real-time execution of the algorithm. In addition, the battery capacity of a smartwatch is limited, and running the algorithm may further aggravate its power consumption problem. Therefore, although algorithm optimization may help reduce the display power consumption of a smartwatch, the actual application needs to take into account the hardware and software limitations to ensure the feasibility of the algorithm and the overall performance of the watch.
[0028] Based on this, the inventor of the present application discovered that a display system for a smart watch can be provided, which display system includes a FreeRTOS operating system and multiple graphical interfaces. By setting a first timer in the FreeRTOS operating system, and after the timing is over, triggering the FreeRTOS operating system to shut down the display thread through the first timer, the operation logic of turning off the screen of the smart watch can be made simple and easy to implement, thereby reducing the computing power consumption of the smart watch and improving the battery life of the smart watch; by setting a second timer in the display thread of the FreeRTOS operating system, and periodically triggering the display thread through the second timer to obtain update data of the graphical interface being displayed, the refresh rate of the smart watch can be reduced by extending the timing interval of the second timer, thereby improving the battery life of the smart watch.
[0029] Figure 1 The structure diagram of the display system based on FreeRTOS provided in the embodiment of the present application is shown, and the system is applied to a smart watch. Among them, a smart watch is a watch device with an integrated display screen and information processing capabilities. Figure 1 As shown, the display system 10 includes a FreeRTOS operating system 100 and multiple graphical interfaces 181~183; the FreeRTOS operating system 100 includes a first thread 110 and a first timer 120, the first thread 110 is used to execute the display task of the graphical interface, and the first timer 120 is used to trigger the FreeRTOS operating system 100 to close the first thread 110 after the timing ends; the first thread 110 also includes a second timer 111, and the second timer 111 is used to trigger the first thread 110 to obtain updated data of the graphical interface at a timed interval.
[0030] Among them, the FreeRTOS operating system 100 is an open source real-time operating system (RTOS) developed by Richard Barry. It was originally developed as an open source alternative to the VxWorks operating system and is designed to provide scalability and reliability for resource-constrained embedded systems such as microcontroller units and smart watches.
[0031] Among them, a graphical user interface (GUI) is a computer user interface that uses graphical elements (such as windows, icons, buttons, and menus) to replace the traditional text command interface. The graphical interface allows users to interact with the computer system through visual elements and user interaction, rather than relying on keyboard input commands.
[0032] GUI can be made by embedded graphics library. In an optional way, LVGL is used to make multiple GUIs, where LVGL (Light and Versatile Graphical Library) is an open source GUI library designed specifically for embedded systems. It aims to provide high performance, low memory consumption and easy-to-use graphical interface, which is very suitable for resource-constrained devices such as microcontroller units and smart watches.
[0033] In the FreeRTOS operating system 100, a timer is a task scheduler that allows a user to define a time interval and execute a task after the time interval ends. The first timer 120 is set to trigger the FreeRTOS operating system 100 to execute the task of shutting down the first thread 110 after the timing ends; the second timer 111 is set to trigger the first thread 110 to execute the task of obtaining the updated data of the graphical interface according to the timed interval.
[0034] Among them, the first thread 110 is a thread for executing display tasks in the FreeRTOS operating system 100. The first thread 110 is responsible for regularly updating the GUI interface, including redrawing graphic elements, processing animation effects, etc., to maintain the real-time and smoothness of the interface; the first thread 110 is also used to respond to user interactions such as touch events and button clicks, and perform corresponding operations, such as navigating menus, switching views, etc.; the first thread 110 is also used to manage GUI-related resources, such as images, fonts, and animations, to ensure that they can be quickly loaded and rendered when needed.
[0035] Specifically, Figure 2 FIG. 1 is a flow chart showing a first thread executing a task of displaying a graphical interface provided by an embodiment of the present application. Figure 2 As shown, the first thread 110 performs the following steps:
[0036] S210, receiving a display task of a first interface.
[0037] For example, the first thread 110 needs to return the view to the main interface in response to a touch event on the smart watch, and the first thread 110 receives a display task of the main interface.
[0038] S220, obtaining a first interface identifier corresponding to the first interface, first interface data corresponding to the first interface identifier, and a preset time interval corresponding to the first interface identifier, wherein the preset time interval is greater than a preset interval threshold.
[0039] After receiving the display task of the main interface, the first thread 110 obtains the interface identifier corresponding to the main interface, and obtains the corresponding interface data according to the interface identifier. The interface data is the initial interface data, and the interface data and the interface identifier are stored in the smart watch in a one-to-one correspondence. Furthermore, the interface identifier can also be used as a stored index to improve the acquisition efficiency of the interface data based on the interface identifier.
[0040] Generally, common smart watches on the market refresh once every 200ms, so the preset interval threshold can be set to 200ms. Therefore, in an optional manner, the preset time intervals of the multiple graphical interfaces 181-183 can all be set to 500ms, so that the smart watch refreshes once every 500ms, so as to extend the timing interval of the second timer 111 and reduce the refresh rate of the smart watch, thereby improving the battery life of the smart watch. In addition, the method of reducing the refresh rate of the smart watch by extending the timing interval of the second timer 111 has a simple operation logic and is easy to implement.
[0041] In another optional embodiment, the preset time intervals between multiple graphical interfaces 181 to 183 are different. For example, the album interface is a static interface, and its preset time interval can be set to 2000ms to further reduce display power consumption, while the clock interface is a dynamic interface, and its preset time interval can be set to 500ms to meet the needs of dynamic display.
[0042] S230 , setting the preset time interval as the timing interval of the second timer 111 .
[0043] S240, displaying the first interface according to the first interface data, and refreshing the first interface according to the updated data.
[0044] The first thread 110 displays the graphical interface according to the acquired interface data, obtains the update data of the graphical interface according to the timing interval of the second timer 111, refreshes the graphical interface according to the updated data, and completes the refresh of the graphical interface until the first timer 120 expires, the FreeRTOS operating system 100 closes the first thread 110, and the screen of the smart watch goes off.
[0045] The embodiment of the present application sets a first timer 120 in the FreeRTOS operating system 100, and after the timing is over, triggers the FreeRTOS operating system 100 to close the first thread 110 through the first timer 120, so that the operation logic of turning off the screen of the smart watch can be simple and easy to implement, thereby reducing the operation power consumption of the smart watch and improving the battery life of the smart watch; by setting a second timer 111 in the first thread 110 of the FreeRTOS operating system 100, and periodically triggering the first thread 110 through the second timer 111 to obtain the update data of the graphical interface being displayed, the refresh rate of the smart watch can be reduced by extending the timing interval of the second timer 111, thereby improving the battery life of the smart watch.
[0046] It should be noted that the native threads directly managed by the FreeRTOS kernel in the FreeRTOS operating system 100 do not include the first thread 110 for executing the display task, and the first thread 110 needs to be created via an external library or application code. For example, the first thread 110 is a thread created in the FreeRTOS operating system 100 by calling the LVGL external library.
[0047] Therefore, after the first thread 110 is additionally set in the FreeRTOS operating system 100, the developer needs to consider how to coordinate the interaction and synchronization between the newly added first thread 110 for executing the display task and other threads in the FreeRTOS operating system 100. This may include processing the communication between tasks, synchronization mechanisms (such as semaphores, mutexes, event flag groups), and priority management to ensure that the display system 10 can run efficiently while meeting the real-time and responsiveness requirements of the GUI display.
[0048] For details, please continue to see Figure 1 , the FreeRTOS operating system 100 also includes a second thread 130 and a message queue 140; the second thread 130 is used to receive the first task, and the first task includes a display task of the second interface; the second thread 130 is also used to send the display task of the second interface to the message queue 140; the message queue 140 is used to receive the display task of the second interface sent by the second thread 130, and transmit the display task of the second interface to the first thread 110, so that the first thread 110 executes the display task of the second interface.
[0049] Among them, the second thread 130 can be a native thread directly managed by the FreeRTOS kernel in the FreeRTOS operating system 100, such as an interrupt service routine management thread, or it can be a newly added thread. For example, the second thread 130 can be a newly added Bluetooth thread.
[0050] Take the second thread 130 as an example, where the second thread 130 is a Bluetooth thread. When a call comes in, the second thread 130 receives an incoming call task, wherein the call task includes a Bluetooth task and a display task, wherein the Bluetooth task is used to play an incoming call ringtone to remind the user of the incoming call, and the display task is used to display an incoming call interface so that the user of the smart watch can answer or hang up the call based on the interactive operation.
[0051] If a call comes in suddenly while the user is viewing the photo album, the display interface of the smart watch needs to switch from the photo album interface to the incoming call interface. After receiving the incoming call task, the second thread 130 in the FreeRTOS operating system 100 needs to send the display task of the incoming call interface to the message queue 140, and then transmit the display task of the incoming call interface to the first thread 110 through the message queue 140. The first thread 110 executes the display task of the incoming call interface, thereby realizing the display of the incoming call interface.
[0052] The message queue 140 is a queue, in which a queue is a special data structure that operates according to the principle of First In First Out (FIFO). In a queue, the position where a new element is inserted is called the tail of the queue, and the position where an existing element is deleted is called the head of the queue. When an element is inserted into a queue, it can only be inserted from the tail of the queue; when an element is deleted, it can only be deleted from the head of the queue. Queues can be used to simulate queuing, task scheduling and other scenarios, and commonly used queue operations include enqueue and dequeue.
[0053] If the message queue 140 is not set between the first thread 110 and the second thread 130 , the display task of the second interface received by the second thread 130 can only be executed in the second thread 130 . Executing the display task in a non-display thread is likely to cause the display system 10 to crash.
[0054] The embodiment of the present application sets a message queue 140 between a first thread 110 for executing a display task and a second thread 130 that receives the display task, and when the second thread 130 receives the display task, transmits the display task to the first thread 110 through the message queue 140, so that the display task can be executed by the first thread 110, thereby avoiding the crash of the display system 10 caused by the execution of the display task by the second thread 130.
[0055] When the first thread 110 receives the display task of the second interface transmitted from the message queue 140, the first thread 110 will immediately close the display task of the first interface and execute the display task of the second interface instead. If the first interface is more important than the second interface, the display task of the first interface is switched to the display task of the second interface before the display task of the first interface is completed, which will result in a poor user experience. Therefore, in order to improve the user experience, in an optional manner, the first thread 110 is also used to receive the display task of the second interface sent by the message queue 140, and compare the display priority of the first interface and the second interface, the first interface is the graphical interface currently displayed by the smart watch; if the display priority of the second interface is higher than that of the first interface, the display task of the first interface is terminated and the display task of the second interface is executed.
[0056] For example, when the smart watch is displaying the call interface, it receives a conversation message from the chat software, that is, when the first thread 110 is executing the task of displaying the call interface, it receives the task of displaying the conversation interface. At this time, the smart watch should still keep displaying the call interface instead of switching from the call interface to the conversation interface, so that the user can hang up the call at any time through the interactive operation of the call interface.
[0057] Therefore, when other threads transmit display tasks to the first thread 110 through the message queue 140, the first thread 110 can determine which graphical interface 181 to 183 should be executed by comparing the priorities of the multiple graphical interfaces 181 to 183 to be displayed, thereby improving the intelligence of the smart watch and optimizing the user experience.
[0058] Among them, for the priority judgment between multiple graphical interfaces 181~183, in an optional manner, the interface identifiers of the multiple graphical interfaces 181~183 are all enumerated data; the first thread 110 is also used to compare the enumeration values of the first interface identifier and the second interface identifier. If the enumeration value of the second interface identifier is larger than the enumeration value of the first interface identifier, it is determined that the display priority of the second interface is higher than that of the first interface.
[0059] Among them, enumeration data is a special data type that is used to define a fixed set of values. Each value in this value set is called an enumeration constant, and each enumeration constant has an associated name and a unique integer value.
[0060] When setting the interface identifier of a graphical interface, the developer needs to consider the user's usage habits. For example, if the priority of the call interface is higher than that of the dialogue interface, the enumeration value of the interface identifier of the call interface is set to be greater than the enumeration value of the dialogue interface, so that the first thread 110 can directly compare the priorities of multiple graphical interfaces 181 to 183 based on the enumeration value of the interface identifier.
[0061] By setting the interface identifier to enumerated data, duplication of the interface identifier can be avoided, thereby ensuring the uniqueness of the interface identifier; based on the characteristic that enumerated data can directly compare data sizes, the priority of the interface can be determined by comparing the size of the enumerated value of the interface identifier, and the priority comparison of multiple display interfaces can be completed quickly and conveniently.
[0062] The embodiment of the present application compares the priority between the first interface being displayed and the second interface to be displayed before the first thread 110 executes the display task of the second interface, thereby achieving the priority display of the high-priority graphical interface, thereby improving the intelligence of the smart watch and optimizing the user experience.
[0063] If the priority of the first interface being displayed is higher than that of the second interface to be displayed, the first interface continues to be displayed until the display task of the first interface is completed, and then the first thread 110 executes the display task of the second interface.
[0064] If the priority of the second interface is higher than that of the first interface, the first thread 110 switches to executing the display task of the second interface. At this time, the display task of the first interface has not been completed. Therefore, in order to further improve the user experience, in an optional manner, the FreeRTOS operating system 100 also includes an interface stack 150; the interface stack 150 is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread 110; the first thread 110 is also used to read the first interface identifier from the interface stack 150 after completing the display task of the second interface, and establish the display task of the first interface based on the first interface identifier to display the first interface again.
[0065] The interface stack 150 is a stack for storing interface identifiers. A stack is a special abstract data type in the form of a serial sequence in computer science. The special feature of the stack is that it can only allow operations of adding and outputting data at one end of a linked list or array. In addition, the stack can also be completed in the form of a one-dimensional array or linked list. The elements in the stack follow the last-in-first-out (LIFO) rule. Therefore, a single read can directly read the element that was last stored in the interface stack 110.
[0066] After the display task of the second interface is completed, the last element stored in the interface stack 150 is the second interface identifier, and the penultimate element stored is the first interface identifier. Therefore, the second element read by the first thread 110 is the first interface identifier. That is, after the display task of the second interface is completed, based on LIFO, the first thread 110 can quickly read the first interface identifier from the interface stack 150.
[0067] In a preferred embodiment, the FreeRTOS operating system 100 is further used to allocate a cache space 160, and the cache space 160 is used to store the interface data and update data of the graphical interface acquired by the first thread 110. Specifically, the cache space 160 establishes an index of the interface data and the update data according to the interface identifier of the graphical interface, so that the interface data and the update data correspond to the interface identifier.
[0068] Based on the cache space 160, in an optional manner, after reading the first interface identifier, the first thread 110 reads the interface data and update data corresponding to the first interface identifier from the cache space 160 according to the first interface identifier, and displays the first interface based on the interface data and the update data, so that the first interface displayed again is consistent with the first interface displayed before displaying the second interface, so as to optimize the user experience.
[0069] In order to improve the operating efficiency of the display system 10 , in an optional manner, the FreeRTOS operating system 100 is also used to clear the cache space 160 after closing the first thread 110 .
[0070] If the operating efficiency of the FreeRTOS operating system 100 is considered, the cache space 160 may be cleared after closing the first thread 110 to avoid the situation where the FreeRTOS operating system 100 is slow to respond due to data accumulation in the cache space 160 .
[0071] If it is necessary to take into account both user experience and operating efficiency, the cleaning range of the cache space 160 can be further set. For example, after closing the first thread 110 to end the display of the first interface, the data corresponding to the first interface is retained when the cache space 160 is cleaned. Specifically, in an optional manner, the FreeRTOS operating system 100 also includes a lock array 170, which is used to store the interface identifier of the graphical interface that needs to be locked; the FreeRTOS operating system 100 is also used to search the cache space 160 for the lock interface data and lock update data corresponding to the interface identifier stored in the lock array 170 after closing the first thread 110, and retain the lock interface data and lock update data in the cache space 160 when the cache space 160 is cleared.
[0072] Among them, an array is a data structure that consists of a group of consecutive memory cells and is used to store data of the same type. An array can store multiple elements, and these elements can be accessed through indexes. The elements in an array are stored consecutively in memory, so that the computer's cache mechanism can be used to improve data reading efficiency.
[0073] Among them, the interface identifier stored in the lock array 170 is the lock interface identifier of the lock interface, the lock interface data is the initial data of the lock interface; the lock update data is the update data of the lock interface obtained when the first thread 110 executes the display task of the lock interface.
[0074] By storing the interface identifier in the lock array 170, the storage pressure of the lock array 170 can be reduced; by storing the interface identifier in the lock array 170, the lock array 170 can be quickly traversed before the cache space 160 is cleared, so as to clear the cache space 160 in time; by using the interface identifier as an index to search for the lock interface data and the lock update data, the lock interface data and the lock update data to be retained can be quickly found from the cache space 160; by retaining the lock interface data and the lock update data when clearing the cache space 160, the display delay caused by the first thread 110 re-acquiring data when the lock interface is redisplayed can be avoided, thereby maintaining the operating efficiency of the FreeRTOS operating system 100 while taking into account the user experience.
[0075] After the first timer 120 ends, the FreeRTOS operating system 100 executes the task of shutting down the first thread 110 to turn off the screen of the smart watch. However, when the user wakes up the screen again, he hopes that the smart watch can continue to display the graphical interface before the screen is turned off, that is, the first thread 110 is restarted to continue to execute the display task of the first interface.
[0076] Therefore, in order to improve the user experience, in an optional manner, the FreeRTOS operating system 100 is used to start the first thread 110 in response to a screen wake-up event of a smart watch; the first thread 110 is also used to read the first interface identifier of the interface stack 150 from the interface stack 150 after being started, and establish a display task of the first interface based on the first interface identifier to display the first interface again.
[0077] If the screen of the smart watch displays the first interface before it turns off, the first interface identifier of the first interface is always the last data stored in the interface stack 150 from the time the first interface is displayed on the screen to the time the smart watch is awakened again after the screen is turned off. Therefore, when calling the data in the interface stack 150, the first data read by the first thread 110 from the interface stack 150 is the first interface identifier. That is, based on LIFO, the first thread 110 can quickly and easily obtain the first interface identifier.
[0078] Among them, after the screen is awakened, the display task of the first interface can also be implemented based on the cache space 160. After reading the first interface identifier, the first thread 110 reads the interface data and update data corresponding to the first interface identifier from the cache space 160 according to the first interface identifier, and displays the first interface based on the interface data and update data, so that the first interface displayed again is consistent with the first interface displayed before the screen is turned off, so as to optimize the user experience.
[0079] The embodiment of the present application can turn off the screen by ending the display task of the first thread 110 after the timing of the first timer 120 ends, thereby reducing the power consumption of the smart watch in executing the display task; after waking up the smart watch, the graphical interface identifier displayed before the screen is turned off is read from the interface stack 150, so as to improve the search efficiency of the graphical interface before the screen is turned off; after reading the interface identifier of the first interface, the display task of the first interface is established based on the first interface identifier to display the first interface again, so that the smart watch can redisplay the interface before the screen is turned off, thereby optimizing the user experience.
[0080] In an optional manner, the FreeRTOS operating system 100 establishes a display task through multiple instruction functions. Figure 1 The FreeRTOS operating system 100 includes an interface stack 150, a hierarchical relationship table and multiple instruction functions; the interface stack 150 is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread 110; the hierarchical relationship table is used to store the hierarchical relationship between multiple graphical interfaces 181~183; the FreeRTOS operating system 100 is also used to respond to user operation events of the smart watch and determine the instruction function corresponding to the user operation events; wherein the user operation events include returning to the previous interface operation event, entering the previous level interface operation event, entering the next level interface operation event and returning to the main interface operation event.
[0081] The hierarchical relationship table is a table established based on the hierarchical relationship of multiple GUI interfaces. For example, the next-level interface of the main interface can be the first view interface or the menu bar interface. The main interface is the parent interface of the first view interface and the menu bar interface.
[0082] Multiple instruction functions are functions running in the first thread 110, for example, an instruction function corresponding to an operation event of returning to the previous interface, an instruction function corresponding to an operation event of entering the previous level interface, an instruction function corresponding to an operation event of entering the next level interface, an instruction function corresponding to an operation event of returning to the main interface...
[0083] The FreeRTOS operating system 100 responds to the user operation event of the smart watch and determines the instruction function corresponding to the user operation event. For example, when the user slides down on the main interface of the smart watch, the FreeRTOS operating system 100 calls the instruction function corresponding to the operation event of entering the next level interface.
[0084] Among them, the instruction function corresponding to the operation event of returning to the previous interface is used to read the interface identifier of the last stored graphical interface from the interface stack 150, and establish the display task of the last stored graphical interface based on the read interface identifier to display the last stored graphical interface; the instruction function corresponding to the operation event of entering the previous level interface is used to determine the current interface being displayed by the first thread 110, determine the previous level interface of the current interface based on the upper and lower hierarchical relationship table, and establish the display task of the previous level interface to display the previous level interface; the instruction function corresponding to the operation event of entering the next level interface is used to determine the current interface being displayed by the first thread 110, determine the next level interface of the current interface based on the upper and lower hierarchical relationship table, and establish the display task of the next level interface to display the next level interface; the instruction function corresponding to the operation event of returning to the main interface is used to establish the display task of the main interface to display the main interface.
[0085] In the embodiment of the present application, the FreeRTOS operating system 100 responds to user operation events, and establishes display tasks corresponding to the user operation events through instruction functions, and then the first thread 110 executes the display tasks, so that the FreeRTOS-based display system 10 can smoothly perform page interaction.
[0086] Figure 3 The structure diagram of the smart watch provided by the embodiment of the present application is shown in FIG. Figure 3 The smart watch 1 includes a FreeRTOS-based display system 10 as described in any of the above embodiments.
[0087] The algorithm or display provided here are not inherently related to any specific computer, virtual system or other equipment. Various general systems can also be used together with the teaching based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the present application embodiment is not directed to any specific programming language yet. It should be understood that various programming languages can be utilized to realize the content of the present application described here, and the above description of specific languages is to disclose the best mode of implementation of the present application.
[0088] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0089] Similarly, it should be understood that in order to streamline the present application and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the embodiments of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed application requires more features than those explicitly recited in each claim.
[0090] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0091] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be constructed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
Claims
1. A display system based on FreeRTOS, characterized in that: The system is applied to a smart watch, and the system includes a FreeRTOS operating system and multiple graphical interfaces; The FreeRTOS operating system includes a first thread and a first timer, the first thread is used to execute a display task of a graphical interface, and the first timer is used to trigger the FreeRTOS operating system to close the first thread after timing ends; The first thread further includes a second timer, and the second timer is used to trigger the first thread to obtain update data of the graphical interface at a timed interval; The first thread executes the display task of the graphical interface, including the following steps: Receiving a display task of the first interface; Acquire a first interface identifier corresponding to the first interface, first interface data corresponding to the first interface identifier, and a preset time interval corresponding to the first interface identifier, wherein the preset time interval is greater than a preset interval threshold; Setting the preset duration interval as the timing interval of the second timer; The first interface is displayed according to the first interface data, and the first interface is refreshed according to the updated data.
2. The system according to claim 1, characterized in that The FreeRTOS operating system also includes a second thread and a message queue; The second thread is used to receive a first task, where the first task includes a display task of a second interface; The second thread is further used to send the display task of the second interface to the message queue; The message queue is used to receive the display task of the second interface sent by the second thread, and transmit the display task of the second interface to the first thread, so that the first thread executes the display task of the second interface.
3. The system according to claim 2, characterized in that The first thread is further used to receive a display task of the second interface sent by the message queue, and compare the display priorities of the first interface and the second interface, where the first interface is a graphical interface currently displayed by the smart watch; If the display priority of the second interface is higher than that of the first interface, the display task of the first interface is terminated and the display task of the second interface is executed.
4. The system according to claim 3, characterized in that The FreeRTOS operating system also includes an interface stack; The interface stack is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread; The first thread is further used to read the first interface identifier from the interface stack after completing the display task of the second interface, and establish the display task of the first interface based on the first interface identifier to display the first interface again.
5. The system according to claim 3, characterized in that The interface identifiers of the multiple graphical interfaces are all enumerated data; the first thread is also used to compare the enumeration values of the first interface identifier and the second interface identifier. If the second interface identifier is larger than the enumeration value of the first interface identifier, it is determined that the display priority of the second interface is higher than that of the first interface.
6. The system according to claim 1, characterized in that The FreeRTOS operating system also includes an interface stack; The interface stack is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread; The FreeRTOS operating system is used to start the first thread in response to a screen wake-up event of the smart watch; The first thread is further used for reading the first interface identifier of the interface stack from the interface stack after being started, and establishing a display task of the first interface based on the first interface identifier to display the first interface again.
7. The system according to claim 1, characterized in that The FreeRTOS operating system is further used to allocate a cache space, and the cache space is used to store the interface data and update data of the graphical interface acquired by the first thread; The FreeRTOS operating system is also used to clear the cache space after closing the first thread.
8. The system according to claim 7, characterized in that The FreeRTOS operating system also includes a lock array, which is used to store interface identifiers of graphical interfaces that need to be locked; The FreeRTOS operating system is also used to search the cache space for lock interface data and lock update data corresponding to the interface identifier stored in the lock array after closing the first thread, and retain the lock interface data and the lock update data in the cache space when clearing the cache space.
9. The system according to claim 1, characterized in that The FreeRTOS operating system includes an interface stack, an upper and lower level relationship table and a plurality of instruction functions; The interface stack is used to record the interface identifier of the graphical interface corresponding to the display task executed by the first thread; The upper and lower hierarchical relationship table is used to store the upper and lower hierarchical relationships between the multiple graphical interfaces; The FreeRTOS operating system is further used to respond to a user operation event of the smart watch and determine an instruction function corresponding to the user operation event; The user operation events include a return to the previous interface operation event, an entry to the previous level interface operation event, an entry to the next level interface operation event, and a return to the main interface operation event; The instruction function corresponding to the return to the previous interface operation event is used to read the interface identifier of the last stored graphical interface from the interface stack, and establish a display task of the last stored graphical interface based on the read interface identifier to display the last stored graphical interface; The instruction function corresponding to the operation event of entering the upper-level interface is used to determine the current interface being displayed by the first thread, determine the upper-level interface of the current interface based on the upper-lower level relationship table, and establish a display task of the upper-level interface to display the upper-level interface; The instruction function corresponding to the operation event of entering the next-level interface is used to determine the current interface being displayed by the first thread, determine the next-level interface of the current interface based on the upper-lower level relationship table, and establish a display task of the next-level interface to display the next-level interface; The instruction function corresponding to the return to main interface operation event is used to establish the display task of the main interface to display the main interface.
10. A smart watch, characterized in that: The smart watch comprises a FreeRTOS-based display system as described in any one of claims 1 to 9.
