Skip to content

Commit f152d1a

Browse files
authored
Merge pull request #186 from Rotzbua/change_fct
change setContrast to fix type missmatch
2 parents f8a4ff2 + 2d3352a commit f152d1a

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

OLEDDisplay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ void OLEDDisplay::normalDisplay(void) {
563563
sendCommand(NORMALDISPLAY);
564564
}
565565

566-
void OLEDDisplay::setContrast(char contrast, char precharge, char comdetect) {
566+
void OLEDDisplay::setContrast(uint8_t contrast, uint8_t precharge, uint8_t comdetect) {
567567
sendCommand(SETPRECHARGE); //0xD9
568568
sendCommand(precharge); //0xF1 default, to lower the contrast, put 1-1F
569569
sendCommand(SETCONTRAST);

OLEDDisplay.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class OLEDDisplay : public Print {
217217
// Set display contrast
218218
// really low brightness & contrast: contrast = 10, precharge = 5, comdetect = 0
219219
// normal brightness & contrast: contrast = 100
220-
void setContrast(char contrast, char precharge = 241, char comdetect = 64);
220+
void setContrast(uint8_t contrast, uint8_t precharge = 241, uint8_t comdetect = 64);
221221

222222
// Reset display rotation or mirroring
223223
void resetOrientation();

UPGRADE-4.0.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
11
# Upgrade from 3.x to 4.0
22

3-
There is one change that breaks compatibility with older versions. You'll have to change data type for all your binary resources such as images and fonts from
3+
There are changes that breaks compatibility with older versions.
44

5-
```c
6-
const char MySymbol[] PROGMEM = {
7-
```
5+
1. You'll have to change data type for all your binary resources such as images and fonts from
6+
7+
```c
8+
const char MySymbol[] PROGMEM = {
9+
```
10+
11+
to
12+
13+
```c
14+
const uint8_t MySymbol[] PROGMEM = {
15+
```
816

9-
to
10-
11-
```c
12-
const uint8_t MySymbol[] PROGMEM = {
13-
```
17+
1. Arguments of `setContrast` from `char` to `uint8_t`
18+
19+
```c++
20+
void OLEDDisplay::setContrast(char contrast, char precharge, char comdetect);
21+
```
22+
23+
to
24+
25+
```c++
26+
void OLEDDisplay::setContrast(uint8_t contrast, uint8_t precharge, uint8_t comdetect);
27+
```

0 commit comments

Comments
 (0)