Skip to content

Commit 571a9ad

Browse files
valuecolor update from master branch
1 parent a362a0f commit 571a9ad

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/menuU8G.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ www.r-site.net
2525
unsigned char bgColor;
2626
unsigned char enabledColor;
2727
unsigned char disabledColor;
28-
unsigned char enabledColorHi;
29-
unsigned char disabledColorHi;
3028

3129
U8GLIB& gfx;
3230
menuU8G(
@@ -36,15 +34,13 @@ www.r-site.net
3634
unsigned char enabledColor=2,
3735
unsigned char disabledColor=1,
3836
uint8_t resX = 7,//6 font width
39-
uint8_t resY = 9 //9 font height + 2 pixels of spacing
37+
uint8_t resY = 8 //9 font height + 2 pixels of spacing
4038
)
4139
:gfx(gfx),
4240
bgColor(bgColor),
4341
enabledColor(enabledColor),
4442
disabledColor(disabledColor),
4543
hiliteColor(hiliteColor),
46-
enabledColorHi(bgColor),
47-
disabledColorHi(bgColor),
4844
menuOut(gfx.getWidth()/resX,gfx.getHeight()/resY,resX,resY)
4945
{
5046
// Small typefaces used to draw the menu, do not forget to report resX and resY
@@ -65,8 +61,9 @@ www.r-site.net
6561
// No need to clear, the U8Glib display loop clear screen on each refresh
6662
}
6763
virtual void setCursor(int x,int y) {
68-
unsigned char xPxTextOffset = 4; // offset in pixels on text on x againt hightlight bar
69-
gfx.setPrintPos(x*resX+xPxTextOffset,y*resY); // +4px Left font offset - optionnal
64+
signed char xPxTextOffset = 2; // x offset in pixels on text
65+
signed char yPxTextOffset = -1; // y offset in pixels on text
66+
gfx.setPrintPos(x*resX+xPxTextOffset,y*resY+yPxTextOffset);
7067
}
7168
virtual size_t write(uint8_t ch) {
7269
gfx.write(ch); // print the ASCII correspoding char instead of print which display the decimal value of the char.
@@ -77,7 +74,11 @@ www.r-site.net
7774
gfx.drawBox(posX*resX,posY*resY,maxX*resX,resY);
7875
gfx.setColorIndex(selected?(o.enabled?enabledColorHi:disabledColorHi):(o.enabled?enabledColor:disabledColor));
7976
setCursor(posX,posY+1); //+1 compensate the height of the font and the way how U8Glib works
80-
o.printTo(*this);
77+
//o.printTo(*this);
78+
o.printName(*this);
79+
gfx.setColorIndex(o.enabled?hiliteColor:selected?disabledColor:bgColor);
80+
o.printValue(*this);
81+
o.printUnit(*this);
8182
}
8283
virtual void printMenu(menu& m,bool drawExit) {
8384
//Serial<<"printing menu "<<m<<" top:"<<top<<endl;

0 commit comments

Comments
 (0)