This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGEMProxy.hpp
46 lines (41 loc) · 1.96 KB
/
GEMProxy.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
GEMProxy.hpp
Copyright (C) 2022 shezik
This program is licensed under GNU General Public License version 3, and
is part of project Lorim.
Please refer to Lorim.ino and LICENSE for details.
*/
#pragma once
#include <GEM_u8g2.h>
#include "SpicedU8g2.hpp"
class GEMProxy : public GEM_u8g2 {
public:
using GEM_u8g2::GEM_u8g2;
//GEMProxy(U8G2& u8g2_, byte menuPointerType_ = GEM_POINTER_ROW, byte menuItemsPerScreen_ = 5, byte menuItemHeight_ = 10, byte menuPageScreenTopOffset_ = 10, byte menuValuesLeftOffset_ = 86) : GEM_u8g2(u8g2_, menuPointerType_, menuItemsPerScreen_, menuItemHeight_, menuPageScreenTopOffset_, menuValuesLeftOffset_), _u8g2(u8g2_) {};
// I changed access control of GEM_u8g2 private members to protected, and declared drawMenu as virtual, for that I had no other choices;
// nasty enough, this is the slightest change I could possibly think of.
// Other attempts failed miserably, including attempting to wrap U8G2::sendBuffer() and U8G2::nextPage()
void drawMenu() override {
Serial.printf("GEMProxy: drawMenu() called!\n"); // debug
#if 0 // ram shortage on neither ESP8266 nor ESP32
_u8g2.firstPage();
do {
drawTitleBar();
printMenuItems();
drawMenuPointer();
drawScrollbar();
static_cast<SpicedU8g2&>(_u8g2).drawElements(MsgCount, false);
_u8g2.setDrawColor(1); // revert back
} while (_u8g2.nextPage());
#else
_u8g2.clearBuffer();
drawTitleBar();
printMenuItems();
drawMenuPointer();
drawScrollbar();
static_cast<SpicedU8g2&>(_u8g2).drawElements(MsgCount, true);
_u8g2.setDrawColor(1); // revert back
_u8g2.sendBuffer();
#endif
}
};