aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/feature_oled_driver.md2
-rw-r--r--drivers/oled/oled_driver.c4
-rw-r--r--drivers/oled/oled_driver.h4
3 files changed, 6 insertions, 4 deletions
diff --git a/docs/feature_oled_driver.md b/docs/feature_oled_driver.md
index 29548cb82..ebabc314f 100644
--- a/docs/feature_oled_driver.md
+++ b/docs/feature_oled_driver.md
@@ -104,7 +104,7 @@ void oled_task_user(void) {
104|`OLED_DISPLAY_ADDRESS` |`0x3C` |The i2c address of the OLED Display | 104|`OLED_DISPLAY_ADDRESS` |`0x3C` |The i2c address of the OLED Display |
105|`OLED_FONT_H` |`"glcdfont.c"` |The font code file to use for custom fonts | 105|`OLED_FONT_H` |`"glcdfont.c"` |The font code file to use for custom fonts |
106|`OLED_FONT_START` |`0` |The starting characer index for custom fonts | 106|`OLED_FONT_START` |`0` |The starting characer index for custom fonts |
107|`OLED_FONT_END` |`224` |The ending characer index for custom fonts | 107|`OLED_FONT_END` |`223` |The ending characer index for custom fonts |
108|`OLED_FONT_WIDTH` |`6` |The font width | 108|`OLED_FONT_WIDTH` |`6` |The font width |
109|`OLED_FONT_HEIGHT` |`8` |The font height (untested) | 109|`OLED_FONT_HEIGHT` |`8` |The font height (untested) |
110|`OLED_TIMEOUT` |`60000` |Turns off the OLED screen after 60000ms of keyboard inactivity. Helps reduce OLED Burn-in. Set to 0 to disable. | 110|`OLED_TIMEOUT` |`60000` |Turns off the OLED screen after 60000ms of keyboard inactivity. Helps reduce OLED Burn-in. Set to 0 to disable. |
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c
index f20f4629a..e541228ea 100644
--- a/drivers/oled/oled_driver.c
+++ b/drivers/oled/oled_driver.c
@@ -392,6 +392,8 @@ void oled_write_char(const char data, bool invert) {
392 static uint8_t oled_temp_buffer[OLED_FONT_WIDTH]; 392 static uint8_t oled_temp_buffer[OLED_FONT_WIDTH];
393 memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH); 393 memcpy(&oled_temp_buffer, oled_cursor, OLED_FONT_WIDTH);
394 394
395 _Static_assert(sizeof(font) >= ((OLED_FONT_END + 1 - OLED_FONT_START) * OLED_FONT_WIDTH), "OLED_FONT_END references outside array");
396
395 // set the reder buffer data 397 // set the reder buffer data
396 uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index 398 uint8_t cast_data = (uint8_t)data; // font based on unsigned type for index
397 if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) { 399 if (cast_data < OLED_FONT_START || cast_data > OLED_FONT_END) {
@@ -585,4 +587,4 @@ void oled_task(void) {
585#endif 587#endif
586} 588}
587 589
588__attribute__((weak)) void oled_task_user(void) {} \ No newline at end of file 590__attribute__((weak)) void oled_task_user(void) {}
diff --git a/drivers/oled/oled_driver.h b/drivers/oled/oled_driver.h
index f490f367a..e8a718857 100644
--- a/drivers/oled/oled_driver.h
+++ b/drivers/oled/oled_driver.h
@@ -131,7 +131,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
131#endif 131#endif
132// unsigned char value of the last character in the font file 132// unsigned char value of the last character in the font file
133#if !defined(OLED_FONT_END) 133#if !defined(OLED_FONT_END)
134# define OLED_FONT_END 224 134# define OLED_FONT_END 223
135#endif 135#endif
136// Font render width 136// Font render width
137#if !defined(OLED_FONT_WIDTH) 137#if !defined(OLED_FONT_WIDTH)
@@ -260,4 +260,4 @@ bool oled_scroll_off(void);
260uint8_t oled_max_chars(void); 260uint8_t oled_max_chars(void);
261 261
262// Returns the maximum number of lines that will fit on the oled 262// Returns the maximum number of lines that will fit on the oled
263uint8_t oled_max_lines(void); \ No newline at end of file 263uint8_t oled_max_lines(void);