Skip to content

Commit da5c6ab

Browse files
lucasssvazpre-commit-ci-lite[bot]SuGlider
authored
Refactor repository with pre-commit hooks (#9515)
* Add Config * Add Cache and remove pre-commit action * [pre-commit.ci lite] apply automatic fixes * Remove freeze * Fix * Update action * Use latest stable Python 3 version * Improve caching * Improve cache tag * Improve bot message * fix(typos): Fix typos * fix(typos): Fix more typos * refactor(udp_server): Convert script from Python 2 to 3 * Fix whitespace * Clang-format fixes * Prettier fixes * Black formatting * Manual fixes * Line endings * Fix flake and make Vale manual * Fix flake and reformat --------- Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Co-authored-by: Rodrigo Garcia <[email protected]>
1 parent 4909dec commit da5c6ab

File tree

999 files changed

+60033
-61179
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

999 files changed

+60033
-61179
lines changed

CMakeLists.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,16 @@ set(ARDUINO_LIBRARY_EEPROM_SRCS libraries/EEPROM/src/EEPROM.cpp)
129129

130130
set(ARDUINO_LIBRARY_ESP_I2S_SRCS libraries/ESP_I2S/src/ESP_I2S.cpp)
131131

132-
set(ARDUINO_LIBRARY_ESP_NOW_SRCS
132+
set(ARDUINO_LIBRARY_ESP_NOW_SRCS
133133
libraries/ESP_NOW/src/ESP32_NOW.cpp
134134
libraries/ESP_NOW/src/ESP32_NOW_Serial.cpp)
135-
136-
set(ARDUINO_LIBRARY_ESP_SR_SRCS
135+
136+
set(ARDUINO_LIBRARY_ESP_SR_SRCS
137137
libraries/ESP_SR/src/ESP_SR.cpp
138138
libraries/ESP_SR/src/esp32-hal-sr.c)
139-
139+
140140
set(ARDUINO_LIBRARY_ESPmDNS_SRCS libraries/ESPmDNS/src/ESPmDNS.cpp)
141-
141+
142142
set(ARDUINO_LIBRARY_Ethernet_SRCS libraries/Ethernet/src/ETH.cpp)
143143

144144
set(ARDUINO_LIBRARY_FFat_SRCS libraries/FFat/src/FFat.cpp)
@@ -187,7 +187,7 @@ set(ARDUINO_LIBRARY_Ticker_SRCS libraries/Ticker/src/Ticker.cpp)
187187
set(ARDUINO_LIBRARY_Update_SRCS
188188
libraries/Update/src/Updater.cpp
189189
libraries/Update/src/HttpsOTAUpdate.cpp)
190-
190+
191191
set(ARDUINO_LIBRARY_USB_SRCS
192192
libraries/USB/src/USBHID.cpp
193193
libraries/USB/src/USBMIDI.cpp

Kconfig.projbuild

+1-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ config ARDUHAL_ESP_LOG
209209
default "n"
210210
help
211211
This option will redefine the ESP_LOGx macros to Arduino's log_x macros.
212-
To enable for your application, add the follwing after your includes:
212+
To enable for your application, add the following after your includes:
213213
#ifdef ARDUINO_ARCH_ESP32
214214
#include "esp32-hal-log.h"
215215
#endif
@@ -390,4 +390,3 @@ config ARDUINO_SELECTIVE_SimpleBLE
390390
default y
391391

392392
endmenu
393-

LICENSE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Version 2.1, February 1999
44

55
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
66
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
7-
7+
88
Everyone is permitted to copy and distribute verbatim copies
99
of this license document, but changing it is not allowed.
1010

@@ -500,4 +500,4 @@ if necessary. Here is a sample; alter the names:
500500
signature of Ty Coon, 1 April 1990
501501
Ty Coon, President of Vice
502502

503-
That's all there is to it!
503+
That's all there is to it!

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You can use [EspExceptionDecoder](https://github.com/me-no-dev/EspExceptionDecod
6868

6969
### Issue/Bug report template
7070

71-
Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labelled as [Type: For reference](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue+label%3A%22Type%3A+For+reference%22+).
71+
Before reporting an issue, make sure you've searched for similar one that was already created. Also make sure to go through all the issues labeled as [Type: For reference](https://github.com/espressif/arduino-esp32/issues?q=is%3Aissue+label%3A%22Type%3A+For+reference%22+).
7272

7373
Finally, if you are sure no one else had the issue, follow the **Issue template** or **Feature request template** while reporting any [new Issue](https://github.com/espressif/arduino-esp32/issues/new/choose).
7474

boards.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -16309,7 +16309,7 @@ esp32s3-devkitlipo.menu.EraseFlash.none=Disabled
1630916309
esp32s3-devkitlipo.menu.EraseFlash.none.upload.erase_cmd=
1631016310
esp32s3-devkitlipo.menu.EraseFlash.all=Enabled
1631116311
esp32s3-devkitlipo.menu.EraseFlash.all.upload.erase_cmd=-e
16312-
16312+
1631316313
##############################################################
1631416314

1631516315
esp32c3-devkitlipo.name=OLIMEX ESP32-C3-DevKit-Lipo
@@ -22487,7 +22487,7 @@ heltec_capsule_sensor_V3.menu.LORAWAN_PREAMBLE_LENGTH.1.build.LORAWAN_PREAMBLE_L
2248722487

2248822488
heltec_capsule_sensor_V3.menu.SLOW_CLK_TPYE.0=External 32K (default)
2248922489
heltec_capsule_sensor_V3.menu.SLOW_CLK_TPYE.0.build.SLOW_CLK_TPYE=1
22490-
heltec_capsule_sensor_V3.menu.SLOW_CLK_TPYE.1=Internal
22490+
heltec_capsule_sensor_V3.menu.SLOW_CLK_TPYE.1=Internal
2249122491
heltec_capsule_sensor_V3.menu.SLOW_CLK_TPYE.1.build.SLOW_CLK_TPYE=0
2249222492

2249322493
heltec_capsule_sensor_V3.menu.NetworkLogLevel.0=NONE
@@ -22499,7 +22499,7 @@ heltec_capsule_sensor_V3.menu.NetworkLogLevel.2.build.NetworkLogLevel=2
2249922499
heltec_capsule_sensor_V3.menu.NetworkLogLevel.3=INFO
2250022500
heltec_capsule_sensor_V3.menu.NetworkLogLevel.3.build.NetworkLogLevel=3
2250122501

22502-
heltec_capsule_sensor_V3.build.defines=-D{build.band} -DMCU_ESP32_S3 -DHELTEC_BOARD=50 -DCAPSULE_SENSOR_V3 -DSLOW_CLK_TPYE={build.SLOW_CLK_TPYE} -DRADIO_CHIP_SX1262 -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_PREAMBLE_LENGTH={build.LORAWAN_PREAMBLE_LENGTH} -DLORAWAN_DEVEUI_AUTO={build.LORAWAN_DEVEUI_AUTO} -D{build.board} -DNLOG_LOCAL_LEVEL={build.NetworkLogLevel}
22502+
heltec_capsule_sensor_V3.build.defines=-D{build.band} -DMCU_ESP32_S3 -DHELTEC_BOARD=50 -DCAPSULE_SENSOR_V3 -DSLOW_CLK_TPYE={build.SLOW_CLK_TPYE} -DRADIO_CHIP_SX1262 -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_PREAMBLE_LENGTH={build.LORAWAN_PREAMBLE_LENGTH} -DLORAWAN_DEVEUI_AUTO={build.LORAWAN_DEVEUI_AUTO} -D{build.board} -DNLOG_LOCAL_LEVEL={build.NetworkLogLevel}
2250322503

2250422504
heltec_capsule_sensor_V3.menu.EraseFlash.none=Disabled
2250522505
heltec_capsule_sensor_V3.menu.EraseFlash.none.upload.erase_cmd=

cores/esp32/Arduino.h

+59-52
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@
4848
#define RAD_TO_DEG 57.295779513082320876798154814105
4949
#define EULER 2.718281828459045235360287471352
5050

51-
#define SERIAL 0x0
51+
#define SERIAL 0x0
5252
#define DISPLAY 0x1
5353

5454
#define LSBFIRST 0
5555
#define MSBFIRST 1
5656

5757
//Interrupt Modes
58-
#define RISING 0x01
59-
#define FALLING 0x02
60-
#define CHANGE 0x03
61-
#define ONLOW 0x04
62-
#define ONHIGH 0x05
63-
#define ONLOW_WE 0x0C
58+
#define RISING 0x01
59+
#define FALLING 0x02
60+
#define CHANGE 0x03
61+
#define ONLOW 0x04
62+
#define ONHIGH 0x05
63+
#define ONLOW_WE 0x0C
6464
#define ONHIGH_WE 0x0D
6565

6666
#define DEFAULT 1
@@ -71,27 +71,27 @@
7171
#endif
7272

7373
// can't define max() / min() because of conflicts with C++
74-
#define _min(a,b) ((a)<(b)?(a):(b))
75-
#define _max(a,b) ((a)>(b)?(a):(b))
76-
#define _abs(x) ((x)>0?(x):-(x)) // abs() comes from STL
77-
#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)) // round() comes from STL
74+
#define _min(a, b) ((a) < (b) ? (a) : (b))
75+
#define _max(a, b) ((a) > (b) ? (a) : (b))
76+
#define _abs(x) ((x) > 0 ? (x) : -(x)) // abs() comes from STL
77+
#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)) // round() comes from STL
7979
#define radians(deg) ((deg)*DEG_TO_RAD)
8080
#define degrees(rad) ((rad)*RAD_TO_DEG)
81-
#define sq(x) ((x)*(x))
81+
#define sq(x) ((x) * (x))
8282

8383
// ESP32xx runs FreeRTOS... disabling interrupts can lead to issues, such as Watchdog Timeout
8484
#define sei() portENABLE_INTERRUPTS()
8585
#define cli() portDISABLE_INTERRUPTS()
8686
#define interrupts() sei()
8787
#define noInterrupts() cli()
8888

89-
#define clockCyclesPerMicrosecond() ( (long int)getCpuFrequencyMhz() )
90-
#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() )
91-
#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() )
89+
#define clockCyclesPerMicrosecond() ((long int)getCpuFrequencyMhz())
90+
#define clockCyclesToMicroseconds(a) ((a) / clockCyclesPerMicrosecond())
91+
#define microsecondsToClockCycles(a) ((a)*clockCyclesPerMicrosecond())
9292

93-
#define lowByte(w) ((uint8_t) ((w) & 0xff))
94-
#define highByte(w) ((uint8_t) ((w) >> 8))
93+
#define lowByte(w) ((uint8_t)((w)&0xff))
94+
#define highByte(w) ((uint8_t)((w) >> 8))
9595

9696
#define bitRead(value, bit) (((value) >> (bit)) & 0x01)
9797
#define bitSet(value, bit) ((value) |= (1UL << (bit)))
@@ -101,26 +101,27 @@
101101

102102
// avr-libc defines _NOP() since 1.6.2
103103
#ifndef _NOP
104-
#define _NOP() do { __asm__ volatile ("nop"); } while (0)
104+
#define _NOP() \
105+
do { __asm__ volatile("nop"); } while (0)
105106
#endif
106107

107108
#define bit(b) (1UL << (b))
108109
#define _BV(b) (1UL << (b))
109110

110-
#define digitalPinToTimer(pin) (0)
111-
#define analogInPinToBit(P) (P)
111+
#define digitalPinToTimer(pin) (0)
112+
#define analogInPinToBit(P) (P)
112113
#if SOC_GPIO_PIN_COUNT <= 32
113-
#define digitalPinToPort(pin) (0)
114-
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
115-
#define portOutputRegister(port) ((volatile uint32_t*)GPIO_OUT_REG)
116-
#define portInputRegister(port) ((volatile uint32_t*)GPIO_IN_REG)
117-
#define portModeRegister(port) ((volatile uint32_t*)GPIO_ENABLE_REG)
114+
#define digitalPinToPort(pin) (0)
115+
#define digitalPinToBitMask(pin) (1UL << digitalPinToGPIONumber(pin))
116+
#define portOutputRegister(port) ((volatile uint32_t*)GPIO_OUT_REG)
117+
#define portInputRegister(port) ((volatile uint32_t*)GPIO_IN_REG)
118+
#define portModeRegister(port) ((volatile uint32_t*)GPIO_ENABLE_REG)
118119
#elif SOC_GPIO_PIN_COUNT <= 64
119-
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin)>31)?1:0)
120-
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin)&31))
121-
#define portOutputRegister(port) ((volatile uint32_t*)((port)?GPIO_OUT1_REG:GPIO_OUT_REG))
122-
#define portInputRegister(port) ((volatile uint32_t*)((port)?GPIO_IN1_REG:GPIO_IN_REG))
123-
#define portModeRegister(port) ((volatile uint32_t*)((port)?GPIO_ENABLE1_REG:GPIO_ENABLE_REG))
120+
#define digitalPinToPort(pin) ((digitalPinToGPIONumber(pin) > 31) ? 1 : 0)
121+
#define digitalPinToBitMask(pin) (1UL << (digitalPinToGPIONumber(pin) & 31))
122+
#define portOutputRegister(port) ((volatile uint32_t*)((port) ? GPIO_OUT1_REG : GPIO_OUT_REG))
123+
#define portInputRegister(port) ((volatile uint32_t*)((port) ? GPIO_IN1_REG : GPIO_IN_REG))
124+
#define portModeRegister(port) ((volatile uint32_t*)((port) ? GPIO_ENABLE1_REG : GPIO_ENABLE_REG))
124125
#else
125126
#error SOC_GPIO_PIN_COUNT > 64 not implemented
126127
#endif
@@ -131,16 +132,16 @@
131132
#define NOT_ON_TIMER 0
132133

133134
// some defines generic for all SoC moved from variants/board_name/pins_arduino.h
134-
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs
135+
#define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs
135136
#if SOC_ADC_PERIPH_NUM == 1
136-
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)) // Depends on the SoC (ESP32C6, ESP32H2, ESP32C2, ESP32P4)
137+
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)) // Depends on the SoC (ESP32C6, ESP32H2, ESP32C2, ESP32P4)
137138
#elif SOC_ADC_PERIPH_NUM == 2
138-
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0)+SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3)
139+
#define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0) + SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3)
139140
#endif
140-
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
141-
#define analogInputToDigitalPin(p) (((p)<NUM_ANALOG_INPUTS)?(analogChannelToDigitalPin(p)):-1)
142-
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)?digitalPinToGPIONumber(p):NOT_AN_INTERRUPT)
143-
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p))<NUM_DIGITAL_PINS)
141+
#define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs
142+
#define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1)
143+
#define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS) ? digitalPinToGPIONumber(p) : NOT_AN_INTERRUPT)
144+
#define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS)
144145

145146
typedef bool boolean;
146147
typedef uint8_t byte;
@@ -150,7 +151,7 @@ typedef unsigned int word;
150151
void setup(void);
151152
void loop(void);
152153

153-
// The default is using Real Hardware random number generator
154+
// The default is using Real Hardware random number generator
154155
// But when randomSeed() is called, it turns to Psedo random
155156
// generator, exactly as done in Arduino mainstream
156157
long random(long);
@@ -169,15 +170,15 @@ long map(long, long, long, long, long);
169170
extern "C" {
170171
#endif
171172

172-
void init(void);
173-
void initVariant(void);
174-
void initArduino(void);
173+
void init(void);
174+
void initVariant(void);
175+
void initArduino(void);
175176

176-
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
177-
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
177+
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout);
178+
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout);
178179

179-
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
180-
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
180+
uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder);
181+
void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val);
181182

182183
#ifdef __cplusplus
183184
}
@@ -211,23 +212,29 @@ uint16_t makeWord(uint8_t h, uint8_t l);
211212
#define word(...) makeWord(__VA_ARGS__)
212213

213214
size_t getArduinoLoopTaskStackSize(void);
214-
#define SET_LOOP_TASK_STACK_SIZE(sz) size_t getArduinoLoopTaskStackSize() { return sz;}
215+
#define SET_LOOP_TASK_STACK_SIZE(sz) \
216+
size_t getArduinoLoopTaskStackSize() { return sz; }
215217

216218
bool shouldPrintChipDebugReport(void);
217-
#define ENABLE_CHIP_DEBUG_REPORT bool shouldPrintChipDebugReport(void){return true;}
219+
#define ENABLE_CHIP_DEBUG_REPORT \
220+
bool shouldPrintChipDebugReport(void) { return true; }
218221

219222
// allows user to bypass esp_spiram_test()
220223
bool esp_psram_extram_test(void);
221-
#define BYPASS_SPIRAM_TEST(bypass) bool testSPIRAM(void) { if (bypass) return true; else return esp_psram_extram_test(); }
224+
#define BYPASS_SPIRAM_TEST(bypass) \
225+
bool testSPIRAM(void) { \
226+
if (bypass) return true; \
227+
else return esp_psram_extram_test(); \
228+
}
222229

223230
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
224231
unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L);
225232

226-
extern "C" bool getLocalTime(struct tm * info, uint32_t ms = 5000);
233+
extern "C" bool getLocalTime(struct tm* info, uint32_t ms = 5000);
227234
extern "C" void configTime(long gmtOffset_sec, int daylightOffset_sec,
228-
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
235+
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
229236
extern "C" void configTzTime(const char* tz,
230-
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
237+
const char* server1, const char* server2 = nullptr, const char* server3 = nullptr);
231238

232239
void setToneChannel(uint8_t channel = 0);
233240
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0);

cores/esp32/Client.h

+16-18
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,24 @@
2323
#include "Stream.h"
2424
#include "IPAddress.h"
2525

26-
class Client: public Stream
27-
{
26+
class Client : public Stream {
2827
public:
29-
virtual int connect(IPAddress ip, uint16_t port) =0;
30-
virtual int connect(const char *host, uint16_t port) =0;
31-
virtual size_t write(uint8_t) =0;
32-
virtual size_t write(const uint8_t *buf, size_t size) =0;
33-
virtual int available() = 0;
34-
virtual int read() = 0;
35-
virtual int read(uint8_t *buf, size_t size) = 0;
36-
virtual int peek() = 0;
37-
virtual void flush() = 0;
38-
virtual void stop() = 0;
39-
virtual uint8_t connected() = 0;
40-
virtual operator bool() = 0;
28+
virtual int connect(IPAddress ip, uint16_t port) = 0;
29+
virtual int connect(const char *host, uint16_t port) = 0;
30+
virtual size_t write(uint8_t) = 0;
31+
virtual size_t write(const uint8_t *buf, size_t size) = 0;
32+
virtual int available() = 0;
33+
virtual int read() = 0;
34+
virtual int read(uint8_t *buf, size_t size) = 0;
35+
virtual int peek() = 0;
36+
virtual void flush() = 0;
37+
virtual void stop() = 0;
38+
virtual uint8_t connected() = 0;
39+
virtual operator bool() = 0;
4140
protected:
42-
uint8_t* rawIPAddress(IPAddress& addr)
43-
{
44-
return addr.raw_address();
45-
}
41+
uint8_t *rawIPAddress(IPAddress &addr) {
42+
return addr.raw_address();
43+
}
4644
};
4745

4846
#endif

0 commit comments

Comments
 (0)