Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1e4bf14

Browse filesBrowse files
yoursunnyme-no-dev
authored andcommitted
cores: replace max, min, round macros with imports from std (espressif#1783)
fixes espressif#1734
1 parent f9f995b commit 1e4bf14
Copy full SHA for 1e4bf14

File tree

4 files changed

+12
-17
lines changed
Filter options

4 files changed

+12
-17
lines changed

‎cores/esp32/Arduino.h

Copy file name to clipboardExpand all lines: cores/esp32/Arduino.h
+9-7Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575

7676
#define abs(x) ((x)>0?(x):-(x))
7777
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
78-
#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))
7978
#define radians(deg) ((deg)*DEG_TO_RAD)
8079
#define degrees(rad) ((rad)*RAD_TO_DEG)
8180
#define sq(x) ((x)*(x))
@@ -146,6 +145,9 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
146145
#ifdef __cplusplus
147146
}
148147

148+
#include <algorithm>
149+
#include <cmath>
150+
149151
#include "WCharacter.h"
150152
#include "WString.h"
151153
#include "Stream.h"
@@ -158,6 +160,12 @@ void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
158160
#include "HardwareSerial.h"
159161
#include "Esp.h"
160162

163+
using std::isinf;
164+
using std::isnan;
165+
using std::max;
166+
using std::min;
167+
using ::round;
168+
161169
uint16_t makeWord(uint16_t w);
162170
uint16_t makeWord(byte h, byte l);
163171

@@ -176,12 +184,6 @@ extern "C" void configTzTime(const char* tz,
176184
long random(long);
177185
#endif /* __cplusplus */
178186

179-
#ifndef _GLIBCXX_VECTOR
180-
// arduino is not compatible with std::vector
181-
#define min(a,b) ((a)<(b)?(a):(b))
182-
#define max(a,b) ((a)>(b)?(a):(b))
183-
#endif
184-
185187
#define _min(a,b) ((a)<(b)?(a):(b))
186188
#define _max(a,b) ((a)>(b)?(a):(b))
187189

‎libraries/WiFi/src/WiFiClient.h

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiClient.h
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
#include "Arduino.h"
2525
#include "Client.h"
26-
#undef min
27-
#undef max
2826
#include <memory>
2927

3028
class WiFiClientSocketHandle;

‎libraries/WiFi/src/WiFiGeneric.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiGeneric.cpp
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ extern "C" {
4646
} //extern "C"
4747

4848
#include "esp32-hal-log.h"
49-
50-
#undef min
51-
#undef max
5249
#include <vector>
5350

5451
#include "sdkconfig.h"
@@ -156,8 +153,8 @@ static bool espWiFiStart(bool persistent){
156153
return false;
157154
}
158155
_esp_wifi_started = true;
159-
system_event_t event;
160-
event.event_id = SYSTEM_EVENT_WIFI_READY;
156+
system_event_t event;
157+
event.event_id = SYSTEM_EVENT_WIFI_READY;
161158
WiFiGenericClass::_eventCallback(nullptr, &event);
162159

163160
return true;
@@ -496,7 +493,7 @@ bool WiFiGenericClass::mode(wifi_mode_t m)
496493
} else if(cm && !m){
497494
return espWiFiStop();
498495
}
499-
496+
500497
esp_err_t err;
501498
err = esp_wifi_set_mode(m);
502499
if(err){

‎libraries/WiFi/src/WiFiMulti.h

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiMulti.h
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
#define WIFICLIENTMULTI_H_
2828

2929
#include "WiFi.h"
30-
#undef min
31-
#undef max
3230
#include <vector>
3331

3432
typedef struct {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.