|
|
_Almost perfect example:_ https://edugit.org/egorguslyan/dashboard/-/commit/ab3dcddb9cda710771afb9087baa7866ad63c8eb
|
|
|
|
|
|
# 1. Create screen and screenPrepare functions
|
|
|
|
|
|
Every **screen** function has `Arg *arg` argument and every **screenPrepare** has `mData *buffer`.
|
|
|
|
|
|
## 1.1 screen
|
|
|
|
|
|
Please avoid delays and complicated math in **screen** functions. Use `const uint8_t delayMap[]`, `TIMER` and `switch(globalVars.currentState)`.
|
|
|
|
|
|
## 1.2 screenPrepare
|
|
|
|
|
|
**screenPrepare** have to be able to draw in both buffers. Use `setPixel`, `getPixel`, `clearBuffer`, `drawSmallNumber` and functions from `bitmaps.h`.
|
|
|
|
|
|
# 2. Resources
|
|
|
|
|
|
## 2.1 Bitmaps
|
|
|
|
|
|
Bitmap functions are located in `bitmaps.h`. They have to be able to draw in both buffers. Use `setPixel`, `getPixel`, `clearBuffer`.
|
|
|
|
|
|
## 2.2 Strings
|
|
|
|
|
|
Strings are stored in `strings.h`. Add the text for each language with langmasks or as a shared string. Then add it into `strings[]`.
|
|
|
|
|
|
## 2.3 Textboxes
|
|
|
|
|
|
Before rendering textbox, it needs to be initializes. Follow the declaration.
|
|
|
```
|
|
|
void setup(char _text[], uint64_t _langMask,
|
|
|
mData _color,
|
|
|
TB_MODE _mode,
|
|
|
uint8_t _x, uint8_t _y, uint8_t _w,
|
|
|
uint8_t _reciprocal_speed = 0, uint16_t _delay = 0);
|
|
|
```
|
|
|
For **_langmask** use `LANGMASK()` macro. For **_color** use **COLOR1** or **COLOR2**. For _mode use one of `TB_MODE`s. For **_reciprocal_speed** use TB_FRAMES_DELAY.
|
|
|
|
|
|
`tb.render()` function returns 0 if it skips the frame, 1 if it rendered the frame and 2 if the rendered frame was the last in the cycle.
|
|
|
|
|
|
# 3 Adding new screen's address
|
|
|
|
|
|
Finally adding new `SCREEN` and `screens[]` entities. Notice, that screens[SCREEN] should point on the new screen. For example in the default config
|
|
|
|
|
|
`screens[SCREEN_SERVICEMAIL].func = serviceMail`
|
|
|
|
|
|
and
|
|
|
|
|
|
`screens[SCREEN_SETTINGS].nextScreen2 = SCREEN_BRIGHTNESS`.
|
|
|
|
|
|
Edit existing screens to make fully defined menu. |
|
|
\ No newline at end of file |