better display of values
This commit is contained in:
parent
6981eda34f
commit
ef9bb53274
13
M2/M2.ino
13
M2/M2.ino
|
@ -212,10 +212,21 @@ void writeScreenData(dataMode DATA_MODE, screenMode COLOR_MODE, int data[4]){
|
|||
} else {
|
||||
M5.Lcd.fillRect(132,116,64,64,COLORS[DARK]);
|
||||
}
|
||||
M5.Lcd.drawString(String(data[DATA_MODE]), 132, 128, 4);
|
||||
M5.Lcd.drawString(String(data[DATA_MODE]), 148 - ((countDigit(data[DATA_MODE]) - 1) * 5), 128, 4);
|
||||
}
|
||||
}
|
||||
|
||||
int countDigit(int n) {
|
||||
if (n == 0)
|
||||
return 1;
|
||||
int count = 0;
|
||||
while (n != 0) {
|
||||
n = n / 10;
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
String stringReceived = "";
|
||||
int valuesReceived[4]/* = {0,0,0,0}*/;
|
||||
|
||||
|
|
Loading…
Reference in a new issue