Add default limit to OLED dirty processing (#19068)
This commit is contained in:
parent
a42ab90220
commit
0719d68b20
|
@ -170,6 +170,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
# define OLED_UPDATE_INTERVAL 50
|
# define OLED_UPDATE_INTERVAL 50
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(OLED_UPDATE_PROCESS_LIMIT)
|
||||||
|
# define OLED_UPDATE_PROCESS_LIMIT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct __attribute__((__packed__)) {
|
typedef struct __attribute__((__packed__)) {
|
||||||
uint8_t *current_element;
|
uint8_t *current_element;
|
||||||
uint16_t remaining_element_count;
|
uint16_t remaining_element_count;
|
||||||
|
|
|
@ -301,7 +301,8 @@ void oled_render(void) {
|
||||||
oled_on();
|
oled_on();
|
||||||
|
|
||||||
uint8_t update_start = 0;
|
uint8_t update_start = 0;
|
||||||
while (oled_dirty) { // render all dirty blocks
|
uint8_t num_processed = 0;
|
||||||
|
while (oled_dirty && num_processed++ < OLED_UPDATE_PROCESS_LIMIT) { // render all dirty blocks (up to the configured limit)
|
||||||
// Find next dirty block
|
// Find next dirty block
|
||||||
while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
|
while (!(oled_dirty & ((OLED_BLOCK_TYPE)1 << update_start))) {
|
||||||
++update_start;
|
++update_start;
|
||||||
|
|
Loading…
Reference in New Issue