From 47723d5b09a62eca278f085471adb5822f063140 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Mon, 21 Sep 2020 23:10:03 +0900 Subject: [PATCH 1/5] add OLED_UPDATE_INTERVAL_MS support --- drivers/oled/oled_driver.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index 9ae737ca2d39..0965c32fc6de 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c @@ -112,6 +112,9 @@ uint32_t oled_timeout; #if OLED_SCROLL_TIMEOUT > 0 uint32_t oled_scroll_timeout; #endif +#if OLED_UPDATE_INTERVAL_MS > 0 +uint16_t oled_update_timeout; +#endif // Internal variables to reduce math instructions @@ -619,6 +622,13 @@ void oled_task(void) { return; } +#if OLED_UPDATE_INTERVAL_MS > 0 + if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL_MS) { + return; + } + oled_update_timeout = timer_read(); +#endif + oled_set_cursor(0, 0); oled_task_user(); From b142c87acbfa77655294998bbcf3ea376f3c31fc Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Mon, 21 Sep 2020 23:40:10 +0900 Subject: [PATCH 2/5] update docs/feature_oled_driver.md --- docs/feature_oled_driver.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md index d106d3d13ee0..f8b22969dc94 100644 --- a/docs/feature_oled_driver.md +++ b/docs/feature_oled_driver.md @@ -149,6 +149,7 @@ void oled_task_user(void) { |`OLED_SCROLL_TIMEOUT_RIGHT`|*Not defined* |Scroll timeout direction is right when defined, left when undefined. | |`OLED_IC` |`OLED_IC_SSD1306`|Set to `OLED_IC_SH1106` if you're using the SH1106 OLED controller. | |`OLED_COLUMN_OFFSET` |`0` |(SH1106 only.) Shift output to the right this many pixels.
Useful for 128x64 displays centered on a 132x64 SH1106 IC.| +|`OLED_UPDATE_INTERVAL_MS` |`0` |Set the time interval for updating the OLED display in ms. This will improve the matrix scan rate. | ## 128x64 & Custom sized OLED Displays From 23ca0a9d2fc3c9f86adfcb3bf57dc3f3762d6f48 Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Wed, 23 Sep 2020 21:45:49 +0900 Subject: [PATCH 3/5] Update docs/feature_oled_driver.md Co-authored-by: Joel Challis --- docs/feature_oled_driver.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md index f8b22969dc94..f8135f38e345 100644 --- a/docs/feature_oled_driver.md +++ b/docs/feature_oled_driver.md @@ -149,7 +149,7 @@ void oled_task_user(void) { |`OLED_SCROLL_TIMEOUT_RIGHT`|*Not defined* |Scroll timeout direction is right when defined, left when undefined. | |`OLED_IC` |`OLED_IC_SSD1306`|Set to `OLED_IC_SH1106` if you're using the SH1106 OLED controller. | |`OLED_COLUMN_OFFSET` |`0` |(SH1106 only.) Shift output to the right this many pixels.
Useful for 128x64 displays centered on a 132x64 SH1106 IC.| -|`OLED_UPDATE_INTERVAL_MS` |`0` |Set the time interval for updating the OLED display in ms. This will improve the matrix scan rate. | +|`OLED_UPDATE_INTERVAL` |`0` |Set the time interval for updating the OLED display in ms. This will improve the matrix scan rate. | ## 128x64 & Custom sized OLED Displays From f7eabc222fd2451a1670c8f29706f1d41bf4a69f Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Wed, 23 Sep 2020 21:48:25 +0900 Subject: [PATCH 4/5] Update drivers/oled/oled_driver.c --- drivers/oled/oled_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index 0965c32fc6de..0bb7f8e8f2f9 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c @@ -112,7 +112,7 @@ uint32_t oled_timeout; #if OLED_SCROLL_TIMEOUT > 0 uint32_t oled_scroll_timeout; #endif -#if OLED_UPDATE_INTERVAL_MS > 0 +#if OLED_UPDATE_INTERVAL > 0 uint16_t oled_update_timeout; #endif From f94a24ef6c8199dc896b77f4a91db9ad7fb92edf Mon Sep 17 00:00:00 2001 From: Takeshi ISHII <2170248+mtei@users.noreply.github.com> Date: Wed, 23 Sep 2020 21:48:38 +0900 Subject: [PATCH 5/5] Update drivers/oled/oled_driver.c --- drivers/oled/oled_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index 0bb7f8e8f2f9..eac2a835fa61 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c @@ -622,8 +622,8 @@ void oled_task(void) { return; } -#if OLED_UPDATE_INTERVAL_MS > 0 - if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL_MS) { +#if OLED_UPDATE_INTERVAL > 0 + if (timer_elapsed(oled_update_timeout) < OLED_UPDATE_INTERVAL) { return; } oled_update_timeout = timer_read();