meshtastic/docs/development/firmware/oled-guide.mdx
rcarteraz 4c0b8a95ad Squashed commit of the following:
commit 86bc3c93e5
Merge: 6cabd5fe cfec3e8e
Author: rcarteraz <robert.l.carter2@gmail.com>
Date:   Wed Jun 19 18:48:14 2024 -0700

    Merge pull request #1301 from rcarteraz/1200bps-reset-button

    Add mention of 1200bps reset button in web flasher

commit cfec3e8eac
Merge: 59d71321 6cabd5fe
Author: rcarteraz <robert.l.carter2@gmail.com>
Date:   Wed Jun 19 17:59:09 2024 -0700

    Merge branch 'master' into 1200bps-reset-button

commit 6cabd5fe95
Merge: f6a97b28 6c40c2e5
Author: rcarteraz <robert.l.carter2@gmail.com>
Date:   Wed Jun 19 17:58:54 2024 -0700

    Merge pull request #1295 from geeksville/pr-nrf52-guide

    Add basic nrf52 guide

commit 6c40c2e555
Merge: 9cbea09e f6a97b28
Author: rcarteraz <robert.l.carter2@gmail.com>
Date:   Wed Jun 19 17:56:57 2024 -0700

    Merge branch 'master' into pr-nrf52-guide

commit 59d71321e3
Author: rcarteraz <robert.l.carter2@gmail.com>
Date:   Wed Jun 19 17:52:06 2024 -0700

    Add mention of 1200bps reset button in web flasher

commit 9cbea09e5c
Author: rcarteraz <robert.l.carter2@gmail.com>
Date:   Tue Jun 18 13:53:25 2024 -0700

    formatting and minor changes

commit fad3a940d1
Merge: f3523b72 f95a398c
Author: rcarteraz <robert.l.carter2@gmail.com>
Date:   Tue Jun 18 13:01:01 2024 -0700

    Merge branch 'master' into pr-nrf52-guide

commit f3523b72f5
Merge: b2fcaa55 70638582
Author: geeksville <kevinh@geeksville.com>
Date:   Sun Jun 16 21:11:52 2024 -0700

    Merge branch 'master' into pr-nrf52-guide

commit b2fcaa5530
Author: geeksville <kevinh@geeksville.com>
Date:   Sun Jun 16 15:16:37 2024 -0700

    Add basic nrf52 guide
2024-06-19 18:50:33 -07:00

40 lines
1.5 KiB
Plaintext

---
id: oled-guide
title: OLED Localization Guide
sidebar_label: OLED Localization
sidebar_position: 3
---
1. Create an extended ASCII custom font. Use a glyph editor to create a new font file. The easiest way is to use the online [glyph editor](https://rawgit.com/ThingPulse/esp8266-oled-ssd1306/master/resources/glyphEditor.html) from the OLED library. ([glyph editor source code](https://github.com/ThingPulse/esp8266-oled-ssd1306/tree/master/resources))
1. Copy and paste the existing font.
2. Modify it according desired codepage and save the new font file in `graphics/font` folder.
Please note that the used font file format differs from common Adafruit GFX.
2. Update the `customFontTableLookup` function in `Screen.h`
1. To map the double-byte UTF-8 code to the corresponding extended ASCII character of the desired codepage update the `customFontTableLookup` function in the `Screen.h` file.
2. Modify the `switch (last)` statement: use left byte from UTF-8 code in the `case` label to map character's right byte to its extended ASCII code by specifying an offset.
3. Define language and font in `Screen.cpp`
```c
#ifdef OLED_{LANG_NAME}
#include "fonts/OLEDDisplayFonts{LANG_NAME}.h"
#endif
...
#ifdef OLED_{LANG_NAME}
#define FONT_SMALL ArialMT_Plain_10_{LANG_NAME}
#else
#define FONT_SMALL ArialMT_Plain_10
#endif
```
4. Define language in `variant/*/platformio.ini`
```text
build_flags =
${esp32_base.build_flags}
-D xxxxx
-D OLED_{LANG_NAME}
-I variants/xxxxx
```