Skip to content

Commit ffa4fe3

Browse files
committed
Replace Arduino types boolean and byte with cpp bool and uint8_t
1 parent 670fa08 commit ffa4fe3

File tree

8 files changed

+89
-89
lines changed

8 files changed

+89
-89
lines changed

lib/ESP_WiFiManager_Lite/src/ESP_WiFiManager_Lite.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,7 @@ class ESP_WiFiManager_Lite
13921392
// updated_flags is an internal structure to keep track of which key-value pairs
13931393
// are already handled in handleRequest()
13941394
struct updated_flags_s {
1395-
byte number_items;
1395+
uint8_t number_items;
13961396
struct wificreds_s{
13971397
bool wfidn;
13981398
bool wfpwn;
@@ -1473,7 +1473,7 @@ class ESP_WiFiManager_Lite
14731473

14741474
for (uint16_t index = 0; index < (sizeof(ESP_WM_LITE_config) - sizeof(ESP_WM_LITE_config.checkSum)); index++)
14751475
{
1476-
checkSum += * ( ( (byte*) &ESP_WM_LITE_config ) + index);
1476+
checkSum += * ( ( (uint8_t*) &ESP_WM_LITE_config ) + index);
14771477
}
14781478

14791479
return checkSum;

lib/arduino-Max72xxPanel/Max72xxPanel.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@
3535
#define OP_SHUTDOWN 12
3636
#define OP_DISPLAYTEST 15
3737

38-
Max72xxPanel::Max72xxPanel(byte csPin, byte hDisplays, byte vDisplays) : Adafruit_GFX(hDisplays << 3, vDisplays << 3) {
38+
Max72xxPanel::Max72xxPanel(uint8_t csPin, uint8_t hDisplays, uint8_t vDisplays) : Adafruit_GFX(hDisplays << 3, vDisplays << 3) {
3939

4040
Max72xxPanel::SPI_CS = csPin;
4141

42-
byte displays = hDisplays * vDisplays;
42+
uint8_t displays = hDisplays * vDisplays;
4343
Max72xxPanel::hDisplays = hDisplays;
4444
Max72xxPanel::bitmapSize = displays << 3;
4545

46-
Max72xxPanel::bitmap = (byte*)malloc(bitmapSize);
47-
Max72xxPanel::matrixRotation = (byte*)malloc(displays);
48-
Max72xxPanel::matrixPosition = (byte*)malloc(displays);
46+
Max72xxPanel::bitmap = (uint8_t*)malloc(bitmapSize);
47+
Max72xxPanel::matrixRotation = (uint8_t*)malloc(displays);
48+
Max72xxPanel::matrixPosition = (uint8_t*)malloc(displays);
4949

50-
for ( byte display = 0; display < displays; display++ ) {
50+
for ( uint8_t display = 0; display < displays; display++ ) {
5151
matrixPosition[display] = display;
5252
matrixRotation[display] = 0;
5353
}
@@ -76,23 +76,23 @@ Max72xxPanel::Max72xxPanel(byte csPin, byte hDisplays, byte vDisplays) : Adafrui
7676
setIntensity(7);
7777
}
7878

79-
void Max72xxPanel::setPosition(byte display, byte x, byte y) {
79+
void Max72xxPanel::setPosition(uint8_t display, uint8_t x, uint8_t y) {
8080
matrixPosition[x + hDisplays * y] = display;
8181
}
8282

83-
void Max72xxPanel::setRotation(byte display, byte rotation) {
83+
void Max72xxPanel::setRotation(uint8_t display, uint8_t rotation) {
8484
matrixRotation[display] = rotation;
8585
}
8686

8787
void Max72xxPanel::setRotation(uint8_t rotation) {
8888
Adafruit_GFX::setRotation(rotation);
8989
}
9090

91-
void Max72xxPanel::shutdown(boolean b) {
91+
void Max72xxPanel::shutdown(bool b) {
9292
spiTransfer(OP_SHUTDOWN, b ? 0 : 1);
9393
}
9494

95-
void Max72xxPanel::setIntensity(byte intensity) {
95+
void Max72xxPanel::setIntensity(uint8_t intensity) {
9696
spiTransfer(OP_INTENSITY, intensity);
9797
}
9898

@@ -132,11 +132,11 @@ void Max72xxPanel::drawPixel(int16_t xx, int16_t yy, uint16_t color) {
132132
// Translate the x, y coordinate according to the layout of the
133133
// displays. They can be ordered and rotated (0, 90, 180, 270).
134134

135-
byte display = matrixPosition[(x >> 3) + hDisplays * (y >> 3)];
135+
uint8_t display = matrixPosition[(x >> 3) + hDisplays * (y >> 3)];
136136
x &= 0b111;
137137
y &= 0b111;
138138

139-
byte r = matrixRotation[display];
139+
uint8_t r = matrixRotation[display];
140140
if ( r >= 2 ) { // 180 or 270 degrees
141141
x = 7 - x;
142142
}
@@ -147,14 +147,14 @@ void Max72xxPanel::drawPixel(int16_t xx, int16_t yy, uint16_t color) {
147147
tmp = x; x = y; y = tmp;
148148
}
149149

150-
byte d = display / hDisplays;
150+
uint8_t d = display / hDisplays;
151151
x += (display - d * hDisplays) << 3; // x += (display % hDisplays) * 8
152152
y += d << 3; // y += (display / hDisplays) * 8
153153

154154
// Update the color bit in our bitmap buffer.
155155

156-
byte *ptr = bitmap + x + WIDTH * (y >> 3);
157-
byte val = 1 << (y & 0b111);
156+
uint8_t *ptr = bitmap + x + WIDTH * (y >> 3);
157+
uint8_t val = 1 << (y & 0b111);
158158

159159
if ( color ) {
160160
*ptr |= val;
@@ -167,12 +167,12 @@ void Max72xxPanel::drawPixel(int16_t xx, int16_t yy, uint16_t color) {
167167
void Max72xxPanel::write() {
168168
// Send the bitmap buffer to the displays.
169169

170-
for ( byte row = OP_DIGIT7; row >= OP_DIGIT0; row-- ) {
170+
for ( uint8_t row = OP_DIGIT7; row >= OP_DIGIT0; row-- ) {
171171
spiTransfer(row);
172172
}
173173
}
174174

175-
void Max72xxPanel::spiTransfer(byte opcode, byte data) {
175+
void Max72xxPanel::spiTransfer(uint8_t opcode, uint8_t data) {
176176
// If opcode > OP_DIGIT7, send the opcode and data to all displays.
177177
// If opcode <= OP_DIGIT7, display the column with data in our buffer for all displays.
178178
// We do not support (nor need) to use the OP_NOOP opcode.
@@ -182,8 +182,8 @@ void Max72xxPanel::spiTransfer(byte opcode, byte data) {
182182

183183
// Now shift out the data, two bytes per display. The first byte is the opcode,
184184
// the second byte the data.
185-
byte end = opcode - OP_DIGIT0;
186-
byte start = bitmapSize + end;
185+
uint8_t end = opcode - OP_DIGIT0;
186+
uint8_t start = bitmapSize + end;
187187
do {
188188
start -= 8;
189189
SPI.transfer(opcode);

lib/arduino-Max72xxPanel/Max72xxPanel.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ class Max72xxPanel : public Adafruit_GFX {
4040
* hDisplays number of displays horizontally
4141
* vDisplays number of displays vertically
4242
*/
43-
Max72xxPanel(byte csPin, byte hDisplays=1, byte vDisplays=1);
43+
Max72xxPanel(uint8_t csPin, uint8_t hDisplays=1, uint8_t vDisplays=1);
4444

4545
/*
4646
* Define how the displays are ordered. The first display (0)
4747
* is the one closest to the Arduino.
4848
*/
49-
void setPosition(byte display, byte x, byte y);
49+
void setPosition(uint8_t display, uint8_t x, uint8_t y);
5050

5151
/*
5252
* Define if and how the displays are rotated. The first display
@@ -56,14 +56,14 @@ class Max72xxPanel : public Adafruit_GFX {
5656
* 2: 180 degrees
5757
* 3: 90 degrees counter clockwise
5858
*/
59-
void setRotation(byte display, byte rotation);
59+
void setRotation(uint8_t display, uint8_t rotation);
6060

6161
/*
6262
* Implementation of Adafruit's setRotation(). Probably, you don't
6363
* need this function as you can achieve the same result by using
6464
* the previous two functions.
6565
*/
66-
void setRotation(byte rotation);
66+
void setRotation(uint8_t rotation);
6767

6868
/*
6969
* Draw a pixel on your canvas. Note that for performance reasons,
@@ -85,14 +85,14 @@ class Max72xxPanel : public Adafruit_GFX {
8585
* status If true the device goes into power-down mode. Set to false
8686
* for normal operation.
8787
*/
88-
void shutdown(boolean status);
88+
void shutdown(bool status);
8989

9090
/*
9191
* Set the brightness of the display.
9292
* Parameters:
9393
* intensity the brightness of the display. (0..15)
9494
*/
95-
void setIntensity(byte intensity);
95+
void setIntensity(uint8_t intensity);
9696

9797
/*
9898
* After you're done filling the bitmap buffer with your picture,
@@ -101,18 +101,18 @@ class Max72xxPanel : public Adafruit_GFX {
101101
void write();
102102

103103
private:
104-
byte SPI_CS; /* SPI chip selection */
104+
uint8_t SPI_CS; /* SPI chip selection */
105105

106106
/* Send out a single command to the device */
107-
void spiTransfer(byte opcode, byte data=0);
107+
void spiTransfer(uint8_t opcode, uint8_t data=0);
108108

109109
/* We keep track of the led-status for 8 devices in this array */
110-
byte *bitmap;
110+
uint8_t *bitmap;
111111
uint16_t bitmapSize; // [rob040] fix 32 display limit
112112

113-
byte hDisplays;
114-
byte *matrixPosition;
115-
byte *matrixRotation;
113+
uint8_t hDisplays;
114+
uint8_t *matrixPosition;
115+
uint8_t *matrixRotation;
116116
};
117117

118118
#endif // Max72xxPanel_h

marquee/MqttClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ String MqttClient::getError() {
6363

6464
void MqttClient::loop() {
6565
if (!client.connected()) {
66-
boolean connectstatus;
66+
bool connectstatus;
6767
if (strlen(authUser) > 0) {
6868
connectstatus = client.connect("marquee", authUser, authPass);
6969
} else {

marquee/Settings.h

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -88,31 +88,31 @@ String geoLocation = "Breda,NL";
8888
String marqueeMessage = "";
8989

9090
// Default Weather Settings
91-
boolean showTemperature = true;
92-
boolean showDate = false;
93-
boolean showCity = true;
94-
boolean showCondition = true;
95-
boolean showHumidity = true;
96-
boolean showWind = true;
97-
boolean showWindDir = true;
98-
boolean showPressure = false;
99-
boolean showHighLow = true;
91+
bool showTemperature = true;
92+
bool showDate = false;
93+
bool showCity = true;
94+
bool showCondition = true;
95+
bool showHumidity = true;
96+
bool showWind = true;
97+
bool showWindDir = true;
98+
bool showPressure = false;
99+
bool showHighLow = true;
100100

101101
const int staticDisplayTime = 5000; // static display time per item, in ms
102-
boolean isStaticDisplay = false; // static display above SHOW_* items
103-
boolean isMetric = true; // false = Imperial and true = Metric
104-
boolean is24hour = true; // 24 hour clock is displayed, false = 12 hour clock (for configuration, 24h time is always used)
105-
boolean isPmIndicator = true; // Show PM indicator on Clock when in AM/PM mode
106-
boolean isSysLed = true; // flash onboard LED on system actions
102+
bool isStaticDisplay = false; // static display above SHOW_* items
103+
bool isMetric = true; // false = Imperial and true = Metric
104+
bool is24hour = true; // 24 hour clock is displayed, false = 12 hour clock (for configuration, 24h time is always used)
105+
bool isPmIndicator = true; // Show PM indicator on Clock when in AM/PM mode
106+
bool isSysLed = true; // flash onboard LED on system actions
107107
const int WEBSERVER_PORT = 80; // The port you can access this device on over HTTP
108-
const boolean isWebserverEnabled = true; // Device will provide a web interface via http://[ip]:[port]/
109-
boolean isBasicAuth = false; // Use Basic Authorization for Configuration security on Web Interface
108+
const bool isWebserverEnabled = true; // Device will provide a web interface via http://[ip]:[port]/
109+
bool isBasicAuth = false; // Use Basic Authorization for Configuration security on Web Interface
110110
char www_username[32] = {"admin"}; // User account for the Web Interface
111111
char www_password[32] = {"password"}; // Password for the Web Interface
112112
int refreshDataInterval = 15; // Time in minutes between data refresh (default 15 minutes)
113113
int displayScrollingInterval = 1; // Time in minutes between scrolling data (default 1 minutes and max is 10)
114114
int displayScrollSpeed = 25; // In milliseconds -- Configurable by the web UI (slow = 35, normal = 25, fast = 15, very fast = 5)
115-
boolean flashOnSeconds = true; // when true the ':' character in the time will blink as a seconds indicator
115+
bool flashOnSeconds = true; // when true the ':' character in the time will blink as a seconds indicator
116116

117117
// New wide clock style config, different screen formats for 8+ tiles:
118118
int wideClockStyle = 1; // 1=HH:MM, 2=HH:MM:SS, 3=HH:MM *CF, 4=HH:MM %RH, 5=mm dd HH:MM, 6=HH:MM mmdd, 7=HH:MM ddmm, 8=HH:MM WwwDD (or HH:MM Www DD on >= 10 tile display)
@@ -142,14 +142,14 @@ int quietTimeDimlevel = 0;
142142

143143
#if COMPILE_MQTT
144144
// Mqtt add scrolling messages with Mqtt
145-
boolean isMqttEnabled = false; // Set true to display mqtt messages
145+
bool isMqttEnabled = false; // Set true to display mqtt messages
146146
String MqttServer = ""; // IP or Address only (DO NOT include http://)
147147
int MqttPort = 1883; // Port of your mqtt server (default 1883)
148148
String MqttTopic = "display/message"; // Topic on which to listen
149149
String MqttAuthUser, MqttAuthPass; // mqtt server authentication
150150
#endif
151151

152-
const boolean isOTAenabled = true; // this will allow you to load firmware to the device over WiFi (see OTA for ESP8266)
152+
const bool isOTAenabled = true; // this will allow you to load firmware to the device over WiFi (see OTA for ESP8266)
153153
String OTA_Password = ""; // Set an OTA password here -- leave blank if you don't want to be prompted for password
154154

155155
//blue-grey

0 commit comments

Comments
 (0)