Screen refresh method and system for mineral exploration equipment

By dividing the interface images into Class A and Class B images and using byte-based rendering operations, the problem of slow refresh rate of monochrome screens in mineral exploration equipment was solved, achieving a highly efficient screen refresh effect.

CN120429055BActive Publication Date: 2026-02-10CHINA UNIV OF GEOSCIENCES (BEIJING) +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510550546.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2026-02-10
Estimated Expiration
2045-04-29

AI Technical Summary

Technical Problem

Monochrome dot matrix screens in mineral exploration equipment suffer from high performance overhead and refresh stuttering during rapid full-screen refreshes, especially when used outdoors in strong sunlight, making it difficult to update screen content quickly.

Method used

The interface image is divided into multiple independently controlled primitives. Based on the nature and display position relationship of the primitives, they are preprocessed into Class A and Class B images. Different byte alignment methods are used for cropping and rendering. By operating on a byte-by-byte basis, bit-by-bit mask calculations are reduced, and refresh efficiency is improved.

Benefits of technology

It greatly improves the image refresh performance of monochrome screens, reduces the core execution time of microcontrollers, and enhances screen response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429055B_ABST
    Figure CN120429055B_ABST
Patent Text Reader

Abstract

The application discloses a screen refreshing method and system for mineral exploration equipment, and the method comprises the following steps: S1, preprocessing to obtain A type images and B type images; the preprocessing is specifically as follows: dividing an interface image into a plurality of independently controlled graphics elements and independently drawing the graphics elements into a bitmap image with the size of a screen, performing blank area cutting according to the graphics elements, if the rendering position of the graphics element on the screen is fixed and no position conflict with other simultaneously displayed graphics elements occurs, cutting the column coordinates by 8-pixel integer multiples to obtain an A type image; if the rendering position of the interface image on the screen is uncertain, and if cutting the column coordinates by 8-pixel integer multiples will cause a conflict with other graphics elements, cutting the blank area with 1-pixel precision to obtain a B type image; S2, obtaining an image to be displayed and judging the type of the image; S3, writing the image into a screen buffer according to the type of the image and refreshing the screen. The application can improve the image rendering efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of mineral exploration equipment, and more particularly to a screen refresh method and system for mineral exploration equipment. Background Technology

[0002] Compared to general consumer and commercial electronic devices, mineral exploration equipment is mostly used outdoors, thus requiring specific screen display technologies, particularly the ability to display normally both day and night. Transmissive color LCD screens, commonly used in computers and mobile phones, lack reflectors and do not reflect ambient light, requiring backlighting to see the image. However, in direct sunlight outdoors, the brightness of the sunlight far exceeds the screen's backlight, resulting in a very dark and difficult-to-read image. In contrast, reflective and semi-reflective LCD screens, as well as e-ink screens, reflect sunlight, becoming clearer in stronger ambient light, making them more suitable for outdoor environments. Furthermore, self-emissive OLED displays, which emit light from individual pixels rather than a backlight, offer even higher brightness and can also be used outdoors during daytime. In practice, to achieve both high contrast and flexible content display, monochrome dot-matrix screens based on the above technologies are often used, such as OLED displays based on the SH1107 driver and LCD displays based on the ST7571 driver.

[0003] Taking the SH1107 driver chip as an example, its maximum resolution is 128×128 pixels. Since each pixel on the screen only has two states—on and off—it only needs 2KB of SRAM space to store its pixel states; that is, each bit represents whether a pixel is on or off, unlike typical color LCD screens which require 3 bytes to represent a pixel's state. Therefore, it also requires an external microcontroller to write data to registers via SPI or I2C, using one bit to represent one pixel's state. However, precisely because its pixel control unit is "bit" rather than "byte," its image generation method differs significantly from that of a color screen.

[0004] Embedded screen driver libraries, such as Adafruit_SH110x and U8g2lib, typically abstract a random single-pixel drawing interface at the lower level, and then iteratively call this single-pixel drawing interface at the upper level to complete the drawing of the entire screen. However, since the smallest unit of data operation in the core of modern microcontrollers is the byte, if the state needs to be changed in "bit" units, it is necessary to first read the byte containing the bit, then create a bitmask, perform bitwise operations, and then write it back to the buffer. Traditional byte-based operations only require writing whole bytes directly to the buffer. Therefore, although monochrome screens have a smaller data volume compared to color screens, the operation of the screen buffer on the microcontroller side is more complex and time-consuming. This can cause noticeable screen refresh stuttering, especially when users need to quickly refresh the full screen.

[0005] Therefore, a new algorithm is needed to reduce the performance overhead when such screens undergo large-scale image updates, in order to improve screen update speed. Summary of the Invention

[0006] The main objective of this invention is to provide a screen refresh method and system for mineral exploration equipment that reduces the core execution time of microcontrollers and improves the response speed of monochrome screens.

[0007] The technical solution adopted in this invention is:

[0008] A screen refresh method for mineral exploration equipment is provided, comprising the following steps:

[0009] S1. Preprocess the interface image of the mineral exploration equipment to obtain Class A and Class B images. The preprocessing specifically involves: dividing the interface image into multiple independently controlled primitives and drawing them independently onto a bitmap image of screen size; cropping based on the blank area of ​​the primitives; if the primitive's rendering position on the screen is fixed and it will not conflict with other simultaneously displayed primitives, then the column coordinates are cropped in multiples of 8 pixels, and this is recorded as Class A image; if the interface image's rendering position on the screen is uncertain, and cropping in multiples of 8 pixels would conflict with other primitives, then the blank area is cropped with a precision of 1 pixel, and this is recorded as Class B image.

[0010] S2. Obtain the image to be displayed and determine the image category;

[0011] S3. Write the image to the screen buffer according to its category and refresh the screen, specifically:

[0012] If the image to be displayed is a Class A image, then the image is written to the screen buffer byte by byte and the screen is refreshed;

[0013] If the image to be displayed is a Class B image, the offset value of the column pixel is calculated. The offset value refers to the position number of the pixel in the byte when the first pixel of the Class B image column is copied to the corresponding position in the screen buffer. The image to be displayed is shifted according to the offset value, and then the shifted data is concatenated into bytes. Finally, the concatenated new byte is written to the screen buffer and the screen is refreshed.

[0014] Following the above technical solution, in step S3, if the image to be displayed is a type B image, the byte number of the corresponding column in the screen buffer is found according to the starting coordinates of the type B image, and a byte mask corresponding to the byte number is constructed according to the offset value offset. According to the byte mask, the first n bits of the first byte of the type B image column are written into the corresponding byte in the buffer. The remaining m bits of the first byte are re-concatenated with the subsequent bytes to form a new byte. The new byte is then written into the screen buffer in sequence, where n = 8 - offset and m = offset.

[0015] Following the above technical solution, in step S3, if the image to be displayed is a type A image, it is detected whether each column is tail-aligned. If the tail is aligned, the corresponding bytes are directly copied to the screen buffer according to the number of bytes in each column. If the tail is not aligned, all bytes except the tail byte are directly copied to the screen buffer, and the tail byte is combined with the corresponding content on the current screen through a byte mask before being written to the screen buffer.

[0016] Following the above technical solution, the A-type image serves as the main framework of the interface.

[0017] Following the above technical solution, Class B images are independently controlled status displays, including sensor name, battery status, positioning status, and Bluetooth status.

[0018] Following the above technical solution, step S3 also includes a step of pre-checking the boundary; if the boundary of the image to be displayed exceeds the screen area, then it is cropped.

[0019] The present invention also provides a screen refresh system for mineral exploration equipment, comprising:

[0020] The preprocessing module is used to preprocess the interface images of mineral exploration equipment to obtain Class A and Class B images. Specifically, the preprocessing involves dividing the interface image into multiple independently controllable primitives and drawing them independently onto a screen-sized bitmap image. The primitives are then cropped based on their blank areas. If a primitive's rendering position on the screen is fixed and it does not conflict with other simultaneously displayed primitives, the column coordinates are cropped in multiples of 8 pixels, resulting in a Class A image. If the interface image's rendering position on the screen is uncertain, and cropping in multiples of 8 pixels would conflict with other primitives, the blank area is cropped with a precision of 1 pixel, resulting in a Class B image.

[0021] The judgment module is used to obtain the image to be displayed and determine the image category;

[0022] The microcontroller is used to write images to the screen buffer and refresh the screen according to their category, specifically:

[0023] If the image to be displayed is a Class A image, then the image is written to the screen buffer byte by byte and the screen is refreshed;

[0024] If the image to be displayed is a Class B image, the offset value of the column pixel is calculated. The offset value refers to the position number of the pixel in the byte when the first pixel of the Class B image column is copied to the corresponding position in the screen buffer. The image to be displayed is shifted according to the offset value, and then the shifted data is concatenated into bytes. Finally, the concatenated new byte is written to the screen buffer and the screen is refreshed.

[0025] Following the above technical solution, the microcontroller is specifically used to: if the image to be displayed is a type A image, detect whether each column is tail-aligned; if the tail is aligned, directly copy the corresponding bytes to the screen buffer according to the number of bytes in each column; if the tail is not aligned, except for the byte at the tail, all other bytes are directly copied to the screen buffer, and the byte at the tail is combined with the corresponding content on the current screen through a byte mask before being written to the screen buffer.

[0026] Following the above technical solution, the microcontroller is also used to perform boundary checks before the rendering module processes the image. If the boundary of the image to be displayed exceeds the screen area, it will be cropped.

[0027] The present invention also provides a computer storage medium storing a computer program executable by a processor, the computer program executing the screen refresh method for mineral exploration equipment described in the above technical solution.

[0028] The beneficial effects of this invention are as follows: For monochrome dot matrix screens used in mineral exploration equipment, to maximize rendering efficiency, the interface image is divided into multiple independently controlled primitives. Based on the nature of the primitives and whether they will conflict with other primitives during display, they are cropped using different byte alignment methods, ultimately classifying the images corresponding to the primitives into Class A and Class B images. Then, for the cropped images, a byte-based rendering and compositing operation is implemented, eliminating the bit-by-bit mask calculation operation in traditional algorithms and greatly improving image refresh performance.

[0029] Furthermore, for Class B images, due to pixel offsets, the starting byte mask of the image column can be constructed based on the offset value. The first n bits of the first byte of the column are written to the corresponding bytes in the buffer. The remaining m bits of the first byte are then reassembled with the subsequent bytes to form a new byte. The new byte is then written to the screen buffer sequentially. The original bytes are split by offset and then reassembled into a new byte. This enables the rendering and compositing of Class B images on a byte-by-byte basis, further eliminating the bit-by-bit mask calculation operation in traditional algorithms and greatly improving image refresh performance.

[0030] Furthermore, based on the characteristics of the data displayed in the interface image of the mineral exploration equipment, the interface image is divided into partitions, with each partition corresponding to an independent graphic element. The main frame of the interface is rendered first, so its position is fixed and it will not conflict with other components. It is preprocessed and saved as a type A image. The status display graphic elements that need to be controlled independently, such as sensor name, battery status, positioning status, Bluetooth status, etc., are preprocessed and saved as type B images, thereby maximizing rendering efficiency.

[0031] Of course, any product implementing this invention does not necessarily need to achieve all of the advantages described above at the same time. Attached Figure Description

[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention 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 some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0033] Figure 1 This is a flowchart of a screen refresh method for mineral exploration equipment according to an embodiment of the present invention;

[0034] Figure 2 This is a schematic diagram of the image displayed on a screen of a preset size according to Embodiment 1 of the present invention;

[0035] Figure 3A It is Figure 2The image after preprocessing as a Class A image;

[0036] Figure 3B It is Figure 2 The image after preprocessing as a Class B image;

[0037] Figure 4 This is a schematic diagram of the writing process for a Class A image with no pixel offset;

[0038] Figure 5 This is a schematic diagram of the writing process for a Class B image with pixel offset;

[0039] Figure 6 This is a schematic diagram of a display interface according to an embodiment of the present invention;

[0040] Figure 7 yes Figure 6 A schematic diagram of Class A images in the diagram;

[0041] Figure 8 yes Figure 6 A schematic diagram of type B images in the diagram. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0043] It should be noted that the illustrations provided in the embodiments of the present invention are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the number, shape and size of the components in actual implementation. In actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0044] In this invention, it should also be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing this application and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on this application. Furthermore, the terms "first" and "second" are used only for descriptive and distinguishing purposes and should not be construed as indicating or implying relative importance.

[0045] Furthermore, it should be noted that the features of the various embodiments of the present invention can be combined or integrated in whole or in part, and as those skilled in the art will understand, they can interact and operate in different ways. Each embodiment can be implemented independently of each other or in association with one another.

[0046] This invention addresses the characteristics of data refresh on monochrome dot matrix screens used in mineral exploration equipment by designing and implementing a high-performance image screen refresh method that reduces core execution time and improves screen response speed.

[0047] Example 1

[0048] like Figure 1 As shown, the screen refresh method for mineral exploration equipment according to an embodiment of the present invention includes the following steps:

[0049] S1. Preprocess the interface image of the mineral exploration equipment to obtain Class A and Class B images. The preprocessing specifically involves: dividing the interface image into multiple independently controlled primitives and drawing them independently onto a bitmap image of screen size; cropping based on the blank area of ​​the primitives; if the primitive's rendering position on the screen is fixed and it will not conflict with other simultaneously displayed primitives, then the column coordinates are cropped in multiples of 8 pixels, and this is recorded as Class A image; if the interface image's rendering position on the screen is uncertain, and cropping in multiples of 8 pixels would conflict with other primitives, then the blank area is cropped with a precision of 1 pixel, and this is recorded as Class B image.

[0050] S2. Obtain the image to be displayed and determine the image category;

[0051] S3. Write the image to the screen buffer according to its category and refresh the screen, specifically:

[0052] If the image to be displayed is a Class A image, then the image is written to the screen buffer byte by byte and the screen is refreshed;

[0053] If the image to be displayed is a Class B image, the offset value of the column pixel is calculated. The offset value refers to the position number of the pixel in the byte when the first pixel of the Class B image column is copied to the corresponding position in the screen buffer. The image to be displayed is shifted according to the offset value, and then the shifted data is concatenated into bytes. Finally, the concatenated new byte is written to the screen buffer and the screen is refreshed.

[0054] Furthermore, step S3 also includes a pre-defined boundary check step. If the boundary of the image to be displayed exceeds the screen area, it is first cropped, and then written to the screen buffer according to the image category and the screen is refreshed.

[0055] Specifically, in step S3, if the image to be displayed is a Class B image, the byte number of the corresponding column in the screen buffer is found based on the starting coordinates of the Class B image. A byte mask corresponding to this byte number is constructed based on the offset value. The first n bits of the first byte of the Class B image column are written into the corresponding byte in the buffer according to the byte mask. The remaining m bits of the first byte are then concatenated with subsequent bytes to form a new byte. The new byte is then written into the screen buffer sequentially, where n = 8 - offset and m = offset. By splitting the original bytes by offset and then reassembling them into new bytes, the rendering and compositing operation of the Class B image on a byte-by-byte basis is achieved. This further eliminates the bit-by-bit mask calculation operation in traditional algorithms, greatly improving image refresh performance.

[0056] In step S3, if the image to be displayed is a type A image, it is detected whether each column is tail-aligned. If the tail is aligned, the corresponding bytes are directly copied to the screen buffer according to the number of bytes in each column. If the tail is not aligned, all bytes except the tail byte are directly copied to the screen buffer, and the tail byte is combined with the corresponding content on the current screen through a byte mask before being written to the screen buffer.

[0057] like Figure 6 The image shown is the screen display of a mineral exploration device, with an image resolution of 128×128. Generally, this display interface contains multiple independently controllable graphic elements, each of which can be saved as a separate file. Examples of files saved as Class A images include... Figure 7 As shown, this is the main framework of the interface. These types of images are rendered first, so their position is fixed and they won't conflict with other components. They can also be saved as type B images, such as... Figure 8 The independently controlled status display includes sensor name, battery status, positioning status, Bluetooth status, etc. Type A and Type B images can be cropped before saving and converted into C / C++ uint8 array code. This allows the images to be integrated into the display program during firmware compilation, improving rendering efficiency. For example, element 0 of the array can store row coordinates, element 1 can store column coordinates, element 2 can store width, element 3 can store height, and the remaining elements can store the image data itself.

[0058] For example Figure 2 The image shown is an example of a bounding box drawn on a 32×32 pixel screen. The bounding box has a width of 10 pixels and a height of 6 pixels, with the top-left corner at row coordinate 4 and column coordinate 7. When processed as a Class A image, because the column coordinates are cropped to multiples of 8, the top of the cropped image has a screen coordinate of 0 (i.e., retaining 7 pixels of blank space). The processing result is as follows... Figure 3AAs shown, its image description information is row coordinate 4, column coordinate 0, width 10, and height 13. When processed as a Class B image, due to precise cropping, the blank space at the top of the image is completely cropped, as shown below. Figure 3B As shown, its image description information is: row coordinate 4, column coordinate 7, width 10, and height 6.

[0059] Step S3 also includes a pre-defined boundary check step; if the boundary of the image to be displayed exceeds the screen area, it is cropped.

[0060] This embodiment targets monochrome dot matrix screens used in mineral exploration equipment. To maximize rendering efficiency, the interface image is divided into multiple independently controlled primitives. Based on the nature of the primitives and whether they will conflict with other primitives during display, they are cropped using different byte alignment methods. Finally, the images corresponding to the primitives are divided into Class A images and Class B images. Then, for the cropped images, a byte-based rendering and compositing operation is implemented, eliminating the bit-by-bit mask calculation operation in traditional algorithms and greatly improving image refresh performance.

[0061] Example 2

[0062] This embodiment is based on Embodiment 1 above, and provides a specific implementation process based on Embodiment 1.

[0063] Taking a monochrome dot matrix display screen with a width of WW and a height of HH as an example, the method is divided into two parts. The first part is the preprocessing of the image during the development stage to achieve efficient rendering. The second part is the efficient rendering algorithm for the preprocessed image on the microcontroller.

[0064] The first part describes the image preprocessing process on the development environment computer as follows:

[0065] 1. Using image processing software, create a bitmap image with a height of WW pixels and a width of HH pixels.

[0066] 2. Draw the various interfaces of the program on this image, and save each graphic element that needs to be controlled independently as multiple image files. To maximize efficiency during subsequent rendering, and considering the specific business requirements, these independent graphic element images can be divided into two categories based on the cropping method of the image blank area:

[0067] aA type refers to images whose rendering position on the screen is fixed and whose column coordinates are cropped in multiples of 8 pixels, so that they will not conflict with the position of other simultaneously displayed graphic elements.

[0068] Image of type bB, which is an image whose rendering position on the screen is not fixed, or whose rendering position is fixed, but whose column cropping in multiples of 8 pixels would conflict with other primitives, so it can only be precisely cropped in blank areas with a precision of 1 pixel.

[0069] User interface elements such as windows, borders, and status bar icons can belong to either category A or category B, while fonts typically belong to category B. Regardless of whether it is category A or B, if the rendering position of its primitives is fixed, the image file size must be WW and HH (i.e., retain blank areas without cropping) when saving as an image file, so that the row and column coordinates of the primitives can be calculated in the subsequent cropping step.

[0070] Write a cropping program to crop and convert the two types of images into an image data format that can be parsed by the microcontroller firmware. Store the cropped image description information (i.e., the row coordinates, column coordinates, height, and width of the top left corner of the image) in this data. The specific storage method is not limited, but each pixel should correspond to 1 bit in the storage format. Therefore, the height of the cropped image data is always an integer multiple of 8 (therefore, there may be some white space at the bottom in the column direction), while the actual height of the image is stored in the description information.

[0071] The second part implements rendering algorithms for class A and class B images in the microcontroller firmware. Assume the image description information stores row coordinates (x), column coordinates (y), pixel width (width), and pixel height (height), and the data type is a byte array. Process the image as follows:

[0072] 1. Position specification. For Class B images, when the rendering position needs to be specified in the program, the x and y coordinates can be redefined in the program.

[0073] 2. Boundary check. If the width is 0, or the height is 0, or x is greater than or equal to WW, or y is greater than or equal to HH, or x + width is less than 0, or y + height is less than 0, it means that the drawing area exceeds the screen range and no further calculation is needed.

[0074] 3. Buffer and image parameter calculations are performed to prepare for writing the image into the buffer later.

[0075] a. Image cropping. Take the largest value between x and 0 as the column start coordinate x0, the largest value between y and 0 as the row start coordinate y0, the smallest value between x + width - 1 and WW - 1 as the column end coordinate xN, and the largest value between y + height - 1 and HH - 1 as the row end coordinate yN. Simultaneously, calculate the image height h as yN - y0 + 1.

[0076] b. Calculate screen buffer parameters. Calculate the byte index fBlk0 corresponding to y0 in the screen buffer as y0 / 8, and the byte index fBlkN corresponding to yN as (y0+h-1) / 8. Additionally, calculate the byte index fBlkZ corresponding to the bottommost pixel of the image in the screen buffer as (y+height-1) / 8 when no image cropping is performed. When the image is not cropped, fBlkN should be equal to fBlkZ.

[0077] c. Calculate image-related parameters. Calculate the number of bytes in each column of the image, bBlkH. When the height is an integer multiple of 8, bBlkH is height / 8; otherwise, bBlkH is height / 8+1. Calculate the sequence number of the first byte in each column after image cropping, bBlk0, as fBlk0-y / 8. Calculate the sequence number of the last byte in each column before image cropping, bBlkN, as bBlkH-1.

[0078] d. Calculate the column pixel offset as (y%8+8)%8. This offset refers to the bit number of the pixel in the byte it belongs to when the first pixel (i.e., the first bit) of the image column is copied to the corresponding position in the screen buffer.

[0079] e. Calculate the column tail mask fMaskEnd as ~(0xff << ((height + offset) % 8)). If fMaskEnd is 0, then fMaskEnd should be reset to 0xff. This mask is needed because an RMW (Read-Modify-Write) operation is required for the last pixel of each column to achieve image compositing.

[0080] 4. Write the image to the buffer. This operation has two cases: if the offset is 0, proceed to step 5; otherwise, proceed to step 6.

[0081] 5. When the offset is 0, it is a simpler case (typical for Class A images), meaning that most bytes in the image can be directly copied to the screen buffer without bit-shifting operations. Figure 4 Check if each column of the image is end-aligned. If fMaskEnd is 0xff, the image is end-aligned; otherwise, it is not. Calculate the number of bytes that can be directly copied, fBlkLen. When the image is end-aligned, this is fBlkN - fBlk0 + 1; otherwise, it is fBlkN - fBlk0. Let i be x0, and perform the following write operation:

[0082] a. Let column i in the screen buffer be column, and the data format be a byte array.

[0083] b. The starting byte sequence number bBlk written in this column is bBlkH·(ix)+bBlk0.

[0084] c. Copy texture[bBlk:bBlk+fBlkLen] to column[fBlk0:fBlk0+fBlkLen].

[0085] d. If the image tail is misaligned, the existing data fBlock at that location in the screen buffer is column[fBlkN], and the data blk at that location in the image is texture[bBlk+fBlkLen]. If fBlk is equal to fBlkZ, then blk needs to be ANDed with fMaskEnd, and the result is written to blk. Finally, the data at column[fBlkN] is updated to (fBlock&~fMaskEnd)|blk.

[0086] Increment ei by 1. If i is greater than xN, the writing is complete; otherwise, return to step a in step 5.

[0087] 6. When offset is not 0, it means that all data in the image must be shifted before it can be written, which is a more complex situation. Figure 5 If y is less than 0, meaning the image starts outside the screen buffer, then bBlk0 needs to be incremented by 1.

[0088] 7. Calculate the high-order mask bMaskHi as (~0) << (8-offset); calculate the low-order mask bMaskLo as ~bMaskHi.

[0089] 8. Similar to fMaskEnd, because the image header cannot be aligned with the integer bytes of the buffer, the header also needs to undergo RMW compositing, i.e., fMaskBegin is calculated to be (~0)< <offset。

[0090] 9. Let i be x0.

[0091] 10. Let column i contain data in the screen buffer, and the data format be a byte array.

[0092] 11. Calculate the starting byte index bBlkBase of this column in the image as (i-x0)·bBlkH.

[0093] 12. Let j be fBlk0, and perform the following operations:

[0094] a. Let the currently processed screen buffer byte fBlock be column[j].

[0095] b. The byte bBlkLo that provides high and low bit data in the image is bBlk0+(j-fBlk0); the byte bBlkHi that provides high bit data is bBlkLo-1.

[0096] c. Set the single-byte data block to 0.

[0097] d. If fBlkLo is less than or equal to bBlkN, it indicates that the byte has low-order data, so write (texture[bBlkBase+bBlkLo]&bMaskLo) to the block. <offset。

[0098] e. If bBlkHi is less than bBlkLo, it means that the high-order data of this byte comes from the image. Then calculate (texture[bBlkBase+bBlkHi]&bMaskHi)>>(8-offset), and perform a bitwise AND operation with the block, and then write it to the block. Otherwise, it means that the high-order data of this byte comes from the screen buffer. Then write (block&fMaskBegin)|(fBlock&~fMaskBegin) to the block.

[0099] f. If j is greater than or equal to fBlkZ, it means that the byte is the last byte of the column and needs to be combined with the screen content. In this case, block is (block&fMaskEnd)|(fBlock&~fMaskEnd).

[0100] g. Write the block to column[j].

[0101] If hj increments by 1, and j is less than or equal to fBlkN, then return to step a in step 12.

[0102] 13. Increment i by 1. If i is less than or equal to xN, return to step 9.

[0103] Drawing complete.

[0104] Example 3

[0105] This embodiment is based on embodiment 2, the difference being that it is specifically based on the STM32F103ZGT microcontroller and implemented for a 128×128 OLED screen of the SH1107.

[0106] The processing flow is as follows:

[0107] First, draw the interface image file, such as... Figure 6 Its image resolution is 128×128.

[0108] Save each individual graphic element in the interface as a separate file, with the ones saved as type A being, for example... Figure 7(This interface is the main framework and is rendered first, therefore its position is fixed and it will not conflict with other components.) Save it as type B, such as... Figure 8 (These components are status displays that require independent control, such as sensor name, battery status, location status, Bluetooth status, etc.)

[0109] The images of types A and B are cropped and converted into C / C++ uint8 array code so that they can be integrated into the program during firmware compilation. Element 0 of this array stores the row coordinates, element 1 stores the column coordinates, element 2 stores the width, element 3 stores the height, and the remaining elements store the image data itself. Figure 7 The converted C / C++ code is as follows:

[0110] const uint8 __TEXTURE_PAGE_STATE[] = {0x04, 0x08, 0x78, 0x74, 0x80,0x80, 0x80, 0x80, 0x80, 0x80, …};

[0111] The row coordinate is 4, the column coordinate is 8, the width is 120, and the height is 116. Due to space limitations, elements from the 10th onwards have been omitted.

[0112] Next, the rendering algorithm was implemented using C / C++, and its code is as follows:

[0113] void _Draw(SH1107 ·device, int x, int y, uint width, uint height,const uint8 ·texture, bool inverted) {

[0114] / / One of the main problems to be solved here is bit alignment.

[0115] / / To place the top left corner of the passed-in texture at the XY position, the X coordinate is easy to solve because it only requires an offset of one coordinate.

[0116] / / But the Y coordinate is more complicated. Because when the SH1107 refreshes, it transmits 128 bits in a whole column, with each bit representing the state of the corresponding pixel.

[0117] / / To achieve Y alignment, BitShift must be performed.

[0118] / / The main problem to be solved here is how to implement 128-bit BitShift using uint8 units.

[0119] / / If the image size is 0, or the entire image is off-screen, then no drawing is required.

[0120] if (width == 0 || height == 0 || / /

[0121] x>= SH1107_WIDTH || x + (int)width<= 0 || / /

[0122] y>= SH1107_HEIGHT || y + (int)height<= 0) {

[0123] return;

[0124] }

[0125] / / Trim the XY coordinate range to the display range.

[0126] / / x0 is the index of the first pixel, and xN is the index of the last pixel.

[0127] uint x0 = UTILS_MAX(x, 0);

[0128] uint y0 = UTILS_MAX(y, 0);

[0129] uint xN = UTILS_MIN(x + width - 1, SH1107_WIDTH - 1);

[0130] uint yN = UTILS_MIN(y + height - 1, SH1107_HEIGHT - 1);

[0131] / / The pixel height within the display area.

[0132] uint h = yN - y0 + 1;

[0133] / /

[0134] / / Relevant parameters within the screen space.

[0135] / /

[0136] / / The sequence number of the starting block in each column of the screen (Frame).

[0137] uint fBlk0 = y0 / 8;

[0138] / / The sequence number of the last block in each column on the screen.

[0139] uint fBlkN = (y0 + h - 1) / 8;

[0140] / / If screen cropping is not performed, the sequence number of the last block in each column on the screen.

[0141] / / If the image is completely within the screen, then fBlkZ should be equal to fBlkN. However, when the image overflows the screen from the bottom, fBlkZ will be greater than fBlkN, and in this case, fBlkN should be equal to the screen height - 1.

[0142] uint fBlkZ = (y + height - 1) / 8;

[0143] / /

[0144] / / Relevant parameters within the texture space.

[0145] / /

[0146] / / How many blocks (i.e. 1 byte) are in each column of the texture.

[0147] uint bBlkH = height / 8 + (height % 8 ? 1 : 0);

[0148] / / The sequence number of the first block in each column of the texture that is on the screen.

[0149] uint bBlk0 = fBlk0 - y / 8;

[0150] / / The sequence number of the last block in each column of the texture. This block may not be on the screen.

[0151] uint bBlkN = bBlkH - 1;

[0152] / / How many pixels are there between the vertical starting point of the texture and the first pixel of the screen's block.

[0153] uint offset = (y % 8 + 8) % 8;

[0154] / / When the texture block is perfectly aligned with the screen block and its height is an integer number of blocks, the mask should be 0xff.

[0155] / / Otherwise, the last block must be composited with the existing content in the block on the screen, and MaskEnd is the "mask" that performs this composite.

[0156] uint8 fMaskEnd = ~(0xff<<((height + offset) % 8));

[0157] if (fMaskEnd == 0) {

[0158] fMaskEnd = 0xff;

[0159] }

[0160] / / The specific image pasting process is divided into two cases.

[0161] if (offset == 0) {

[0162] / / The first case is the simple one [head alignment], where the first pixel is aligned with the block. This means X is an integer multiple of 8, such as -8, 0, 7, 15, or 23.

[0163] / / In this case, BitShift is not required.

[0164] / / If the height is exactly an integer multiple of the Block, it is considered aligned.

[0165] bool aligned = fMaskEnd == 0xff;

[0166] / / Number of complete blocks.

[0167] uint fBlkLen = fBlkN - fBlk0 + (aligned ? 1 : 0);

[0168] for (uint i = x0; i<= xN; i++) {

[0169] SH1107_Column&column = device->__FrameBuffer[i];

[0170] / / Calculate the sequence number of the first block in this column.

[0171] / / When the texture is not screen-cropped, bBlk0 is 0, and the sequence number of the first block is always an integer multiple of bBlkH (the number of blocks per column of the texture).

[0172] int bBlk = bBlkH · (i - x) + bBlk0;

[0173] / / Copy the complete block directly.

[0174] if (texture != nullptr&&!inverted) {

[0175] memcpy(column.Blocks + fBlk0, texture + bBlk, fBlkLen);

[0176] } else if (texture) {

[0177] for (uint j = 0; j <fBlkLen; j++) {

[0178] (column.Blocks + fBlk0)[j] = ~(texture + bBlk)[j];

[0179] }

[0180] } else {

[0181] uint8 blk = inverted ? ~0 : 0;

[0182] for (uint j = 0; j <fBlkLen; j++) {

[0183] (column.Blocks + fBlk0)[j] = blk;

[0184] }

[0185] }

[0186] In the case of alignment, the last block is also a complete block and no special processing is required.

[0187] if (!aligned) {

[0188] / / Otherwise, the last block needs to be synthesized.

[0189] / / First, read the existing content on the screen, mask it, synthesize it, and then write it.

[0190] uint8&fBlock = column.Blocks[fBlkN];

[0191] bBlk += fBlkLen;

[0192] uint8 blk = texture != nullptr ? texture[bBlk] : 0;

[0193] if (inverted) {

[0194] blk = ~blk;

[0195] }

[0196] if (fBlkN == fBlkZ) {

[0197] blk&= fMaskEnd;

[0198] }

[0199] fBlock = (fBlock&~fMaskEnd) | blk;

[0200] }

[0201] }

[0202] } else {

[0203] / / The second case, [head misalignment], is more complicated and requires masking and bitshifting for each block.

[0204] / / This involves the concept of a high-order block and a low-order block.

[0205] / / During the processing of each screen block, the high-order block refers to the high-order bits of the [texture block] being copied to the low-order bits of the current [screen block];

[0206] / / Low-order Block refers to the fact that the low-order bits of the [Texture Block] will be copied to the high-order bits of the current [Screen Block].

[0207] / / In other words, the high and low bits here are relative to the texture, not relative to the screen.

[0208] if (y<0) {

[0209] / / bBlk0 should be the first high-order block.

[0210] / / The bBlk0 calculated earlier is the first texture block that overlaps with the screen block.

[0211] / / When the texture header is not clipped, the first overlapping block will necessarily be the first high-order block, and this algorithm is correct.

[0212] / / However, when the head is truncated, the first block calculated in this way is actually the low-order block.

[0213] / / Therefore, we need to add 1 to the result of the previous calculation so that bBlk0 points to the first high-order block.

[0214] bBlk0 += 1;

[0215] }

[0216] / / Because each block needs to be reassembled, more masks are needed.

[0217] / / bMaskHi is used to extract the high bits of the texture block.

[0218] uint8 bMaskHi = uint(~0)<<(8 - offset);

[0219] / / bMaskLo is used to extract the low bits of the texture, and is complementary to bMaskHi.

[0220] uint8 bMaskLo = ~bMaskHi;

[0221] / / Similar to fMaskEnd, but due to the [header misalignment], the header also needs to be composited with the screen.

[0222] / / fMaskBegin is used to create a mask for this kind of compositing.

[0223] uint8 fMaskBegin = uint(~0)< <offset;

[0224] / / Traverse the column.

[0225] for (uint i = x0; i<= xN; i++) {

[0226] SH1107_Column&column = device->__FrameBuffer[i];

[0227] / / The offset of this column in the texture cache.

[0228] uint bBlkBase = (i - x0) · bBlkH;

[0229] / / Iterate through the Blocks in this column.

[0230] for (uint j = fBlk0; j<= fBlkN; j++) {

[0231] uint8&fBlock = column.Blocks[j];

[0232] / / Because the texture block and the screen block are not aligned, there must be two texture blocks for every screen block.

[0233] / / So bBlkLo is a texture block that copies the [lower bit] to the [higher bit] of the screen block;

[0234] / / bBlkHi is a texture block that copies the [high bit] to the screen block and the [low bit] of the texture block.

[0235] / / bBlkHi must be the one preceding bBlkLo.

[0236] uint bBlkLo = bBlk0 + (j - fBlk0);

[0237] uint bBlkHi = bBlkLo - 1;

[0238] uint8 block = 0;

[0239] / / First step, retrieve the low-order block.

[0240] / / But first, we need to check if there is any low-order data in the current screen block.

[0241] / / For example, when y=6 and height=11, the screen Block-2 is the last Block (0-base).

[0242] / / However, the lower-order block corresponding to screen Block-2 does not exist, so it cannot be retrieved, otherwise the pointer will go out of bounds.

[0243] if (bBlkLo<= bBlkN) {

[0244] uint8 blk = texture != nullptr ? texture[bBlkBase + bBlkLo] : 0;

[0245] if (inverted) {

[0246] blk = ~blk;

[0247] }

[0248] block = (blk&bMaskLo)< <offset;

[0249] }

[0250] / / Step 2: Take the high-order Block.

[0251] / / When there is no head clipping, the first screen block does not have a corresponding high-order block, so we need to check if there is a high-order block first.

[0252] / / If there is no high-order block, then bBlkLo must be 0, and bBlkHi will overflow and roll back to 255, causing bBlkHi to be larger than bBlkLo.

[0253] if (bBlkHi <bBlkLo) {

[0254] / / bBlkHi is smaller than bBlkLo, indicating that it is not the first texture block.

[0255] uint8 blk = texture != nullptr ? texture[bBlkBase + bBlkHi] : 0;

[0256] if (inverted) {

[0257] blk = ~blk;

[0258] }

[0259] block |= (blk&bMaskHi)>>(8 - offset);

[0260] } else {

[0261] / / Otherwise, since this is the first texture block, the higher-order block is actually the lower-order block of the screen block. You need to use fMaskBegin to extract and composite it.

[0262] block = (block&fMaskBegin) | (fBlock&~fMaskBegin);

[0263] }

[0264] / / Third step, if the current screen block is the last screen block, fMaskEnd should be used to merge it with the screen block.

[0265] if (j>= fBlkZ) {

[0266] block = (block&fMaskEnd) | (fBlock&~fMaskEnd);

[0267] }

[0268] / / Write to the screen to complete the processing of one column.

[0269] fBlock = block;

[0270] }

[0271] }

[0272] }

[0273] }

[0274] When rendering the texture array __TEXTURE_PAGE_STATE, the pointer variable of the SH1107 underlying driver context is set to device, and its calling method is as follows:

[0275] _Draw(device, __TEXTURE_PAGE_STATE[0], __TEXTURE_PAGE_STATE[1], __TEXTURE_PAGE_STATE[2],

[0276] __TEXTURE_PAGE_STATE[3], __TEXTURE_PAGE_STATE+4,false).

[0277] By comparing the half-screen refresh rate under non-byte alignment with Adafruit_SH110x on an STM32F103ZGT6 microcontroller (24MHz main frequency), the algorithm can achieve a refresh rate of over 60Hz, while Adafruit_SH110x can only achieve a refresh rate of 20Hz.

[0278] Example 4

[0279] This embodiment is a system for implementing the above method embodiment. The screen refresh system for mineral exploration equipment mainly includes:

[0280] The preprocessing module is used to preprocess the interface images of mineral exploration equipment to obtain Class A and Class B images. Specifically, the preprocessing involves dividing the interface image into multiple independently controllable primitives and drawing them independently onto a screen-sized bitmap image. The primitives are then cropped based on their blank areas. If a primitive's rendering position on the screen is fixed and it does not conflict with other simultaneously displayed primitives, the column coordinates are cropped in multiples of 8 pixels, resulting in a Class A image. If the interface image's rendering position on the screen is uncertain, and cropping in multiples of 8 pixels would conflict with other primitives, the blank area is cropped with a precision of 1 pixel, resulting in a Class B image.

[0281] The judgment module is used to obtain the image to be displayed and determine the image category;

[0282] The microcontroller is used to write images to the screen buffer and refresh the screen according to their category, specifically:

[0283] If the image to be displayed is a Class A image, then the image is written to the screen buffer byte by byte and the screen is refreshed;

[0284] If the image to be displayed is a Class B image, the offset value of the column pixel is calculated. The offset value refers to the position number of the pixel in the byte when the first pixel of the Class B image column is copied to the corresponding position in the screen buffer. The image to be displayed is shifted according to the offset value, and then the shifted data is concatenated into bytes. Finally, the concatenated new byte is written to the screen buffer and the screen is refreshed.

[0285] Specifically, the microcontroller is used to: if the image to be displayed is a type A image, detect whether each column is tail-aligned; if the tail is aligned, directly copy the corresponding bytes to the screen buffer according to the number of bytes in each column; if the tail is not aligned, except for the byte at the tail, all other bytes are directly copied to the screen buffer, and the byte at the tail is combined with the corresponding content on the current screen through a byte mask before being written to the screen buffer.

[0286] The microcontroller is also used to perform boundary checks before the rendering module processes the image; if the boundaries of the image to be displayed exceed the screen limits, it is cropped.

[0287] Each module or structure is mainly for implementing the methods of the above embodiments, and will not be described in detail here.

[0288] Example 5

[0289] This application also provides a computer-readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, server, App application store, etc., which stores a computer program, and the program implements corresponding functions when executed by a processor. When executed by a processor, the computer-readable storage medium of this embodiment implements the screen refresh method for mineral exploration equipment described in the above method embodiment.

[0290] It should be noted that, depending on the implementation needs, the various steps / components described in this application can be broken down into more steps / components, or two or more steps / components or parts of the operation of steps / components can be combined into new steps / components to achieve the purpose of this invention.

[0291] The order of the steps in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0292] It should be understood that those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.

Claims

1. A screen refresh method for mineral exploration equipment, characterized in that, Includes the following steps: S1. Preprocess the interface image of the mineral exploration equipment to obtain Class A and Class B images. Specifically, the preprocessing involves dividing the interface image into multiple independently controlled graphic elements and drawing them independently into a bitmap image of screen size. The graphic elements are cropped according to their blank areas. If the graphic element has a fixed rendering position on the screen and does not conflict with other graphic elements displayed at the same time, the column coordinates are cropped in multiples of 8 pixels, and this is recorded as Class A image. If the rendering position of the interface image on the screen is uncertain or fixed, and if column cropping in multiples of 8 pixels would conflict with other graphic elements, then the blank area is cropped with a precision of 1 pixel, and this is denoted as a Class B image. S2. Obtain the image to be displayed and determine the image category; S3. Write the image to the screen buffer according to its category and refresh the screen, specifically: If the image to be displayed is a Class A image, then the image is written to the screen buffer byte by byte and the screen is refreshed; If the image to be displayed is a Class B image, the offset value of the column pixel is calculated. The offset value refers to the position number of the pixel in the byte when the first pixel of the Class B image column is copied to the corresponding position in the screen buffer. The image to be displayed is shifted according to the offset value, and then the shifted data is concatenated into bytes. Finally, the concatenated new byte is written to the screen buffer and the screen is refreshed.

2. The screen refresh method for mineral exploration equipment according to claim 1, characterized in that, In step S3, if the image to be displayed is a type B image, the byte number of the corresponding column in the screen buffer is found according to the starting coordinates of the type B image, and a byte mask corresponding to the byte number is constructed according to the offset value. According to the byte mask, the first n bits of the first byte of the type B image column are written into the corresponding byte in the buffer. The remaining m bits of the first byte are re-concatenated with the subsequent bytes to form a new byte. The new byte is then written into the screen buffer in sequence, where n = 8 - offset and m = offset.

3. The screen refresh method for mineral exploration equipment according to claim 1, characterized in that, In step S3, if the image to be displayed is a type A image, it is detected whether each column is tail-aligned. If the tail is aligned, the corresponding bytes are directly copied to the screen buffer according to the number of bytes in each column. If the tail is not aligned, all bytes except the tail byte are directly copied to the screen buffer, and the tail byte is combined with the corresponding content on the current screen through a byte mask before being written to the screen buffer.

4. The screen refresh method for mineral exploration equipment according to claim 1, characterized in that, Image type A serves as the main framework of the interface.

5. The screen refresh method for mineral exploration equipment according to claim 1, characterized in that, Category B images are independently controlled status displays, including sensor name, battery status, positioning status, and Bluetooth status.

6. The screen refresh method for mineral exploration equipment according to claim 1, characterized in that, Step S3 also includes a pre-defined boundary check step; if the boundary of the image to be displayed exceeds the screen area, it is cropped.

7. A screen refresh system for mineral exploration equipment, characterized in that, include: The preprocessing module is used to preprocess the interface images of mineral exploration equipment to obtain Class A and Class B images. Specifically, the preprocessing involves dividing the interface image into multiple independently controllable primitives and drawing them independently onto a screen-sized bitmap image. The primitives are then cropped based on their blank areas. If a primitive's rendering position on the screen is fixed and it does not conflict with other simultaneously displayed primitives, the column coordinates are cropped in multiples of 8 pixels, resulting in a Class A image. If the interface image's rendering position on the screen is uncertain, and cropping in multiples of 8 pixels would conflict with other primitives, the blank area is cropped with a precision of 1 pixel, resulting in a Class B image. The judgment module is used to obtain the image to be displayed and determine the image category; The microcontroller is used to write images to the screen buffer and refresh the screen according to their category, specifically: If the image to be displayed is a Class A image, then the image is written to the screen buffer byte by byte and the screen is refreshed; If the image to be displayed is a Class B image, the offset value of the column pixel is calculated. The offset value refers to the position number of the pixel in the byte when the first pixel of the Class B image column is copied to the corresponding position in the screen buffer. The image to be displayed is shifted according to the offset value, and then the shifted data is concatenated into bytes. Finally, the concatenated new byte is written to the screen buffer and the screen is refreshed.

8. The screen refresh system for mineral exploration equipment according to claim 7, characterized in that, Specifically, the microcontroller is used to: if the image to be displayed is a type A image, detect whether each column is tail-aligned. If the tail is aligned, copy the corresponding bytes directly to the screen buffer according to the number of bytes in each column; if the tail is not aligned, copy all bytes except the tail byte directly to the screen buffer, and then combine the tail byte with the corresponding content on the current screen through a byte mask before writing it to the screen buffer.

9. The screen refresh system for mineral exploration equipment according to claim 7, characterized in that, The microcontroller is also used to perform boundary checks before the rendering module processes the image; if the boundaries of the image to be displayed exceed the screen limits, it is cropped.

10. A computer storage medium, characterized in that, It contains a computer program that can be executed by a processor, which performs the screen refresh method for a mineral exploration equipment as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Screen display method and device, computer readable storage medium and electronic equipment

    CN115202787A

  • Minimal artifact image sequence depth enhancement system and method

    US20120063681A1