Skip to content

Commit 7fe4aa6

Browse files
authored
Merge branch 'master' into release/v3.1.x
2 parents c7e01e7 + 4098c53 commit 7fe4aa6

File tree

8 files changed

+123
-23
lines changed

8 files changed

+123
-23
lines changed

Diff for: .github/workflows/docs_build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
- release/*
7+
- release/v2.x
88
paths:
99
- 'docs/**'
1010
- '.github/workflows/docs_build.yml'

Diff for: .github/workflows/docs_deploy.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [published]
66
push:
77
branches:
8-
- release/*
8+
- release/v2.x
99
- master
1010
paths:
1111
- 'docs/**'

Diff for: .github/workflows/push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
push:
66
branches:
77
- master
8-
- release/*
8+
- release/v2.x
99
pull_request:
1010
paths:
1111
- 'cores/**'

Diff for: cores/esp32/esp32-hal-rgb-led.c

+52-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,26 @@
1+
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
115
#include "soc/soc_caps.h"
216

317
#include "esp32-hal-rgb-led.h"
418

5-
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
19+
void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
20+
rgbLedWriteOrdered(pin, RGB_BUILTIN_LED_COLOR_ORDER, red_val, green_val, blue_val);
21+
}
22+
23+
void rgbLedWriteOrdered(uint8_t pin, rgb_led_color_order_t order, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
624
#if SOC_RMT_SUPPORTED
725
rmt_data_t led_data[24];
826

@@ -15,7 +33,39 @@ void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue
1533
return;
1634
}
1735

18-
int color[] = {green_val, red_val, blue_val}; // Color coding is in order GREEN, RED, BLUE
36+
// default WS2812B color order is G, R, B
37+
int color[3] = {green_val, red_val, blue_val};
38+
39+
switch (order) {
40+
case LED_COLOR_ORDER_RGB:
41+
color[0] = red_val;
42+
color[1] = green_val;
43+
color[2] = blue_val;
44+
break;
45+
case LED_COLOR_ORDER_BGR:
46+
color[0] = blue_val;
47+
color[1] = green_val;
48+
color[2] = red_val;
49+
break;
50+
case LED_COLOR_ORDER_BRG:
51+
color[0] = blue_val;
52+
color[1] = red_val;
53+
color[2] = green_val;
54+
break;
55+
case LED_COLOR_ORDER_RBG:
56+
color[0] = red_val;
57+
color[1] = blue_val;
58+
color[2] = green_val;
59+
break;
60+
case LED_COLOR_ORDER_GBR:
61+
color[0] = green_val;
62+
color[1] = blue_val;
63+
color[2] = red_val;
64+
break;
65+
default: // GRB
66+
break;
67+
}
68+
1969
int i = 0;
2070
for (int col = 0; col < 3; col++) {
2171
for (int bit = 0; bit < 8; bit++) {

Diff for: cores/esp32/esp32-hal-rgb-led.h

+20-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,26 @@ extern "C" {
1111
#define RGB_BRIGHTNESS 64
1212
#endif
1313

14-
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
14+
#ifndef RGB_BUILTIN_LED_COLOR_ORDER
15+
#define RGB_BUILTIN_LED_COLOR_ORDER LED_COLOR_ORDER_GRB // default WS2812B color order
16+
#endif
17+
18+
typedef enum {
19+
LED_COLOR_ORDER_RGB,
20+
LED_COLOR_ORDER_BGR,
21+
LED_COLOR_ORDER_BRG,
22+
LED_COLOR_ORDER_RBG,
23+
LED_COLOR_ORDER_GBR,
24+
LED_COLOR_ORDER_GRB
25+
} rgb_led_color_order_t;
26+
27+
void rgbLedWriteOrdered(uint8_t pin, rgb_led_color_order_t order, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
28+
29+
// Will use RGB_BUILTIN_LED_COLOR_ORDER
30+
void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
31+
32+
// Backward compatibility
33+
#define neopixelWrite(p, r, g, b) rgbLedWrite(p, r, g, b)
1534

1635
#ifdef __cplusplus
1736
}

Diff for: tools/get.exe

-86.5 KB
Binary file not shown.

Diff for: tools/get.py

+45-17
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,36 @@ def verify_files(filename, destination, rename_to):
147147
return True
148148

149149

150-
def unpack(filename, destination, force_extract): # noqa: C901
150+
def is_latest_version(destination, dirname, rename_to, cfile, checksum):
151+
current_version = None
152+
expected_version = None
153+
154+
try:
155+
expected_version = checksum
156+
with open(os.path.join(destination, rename_to, ".package_checksum"), "r") as f:
157+
current_version = f.read()
158+
159+
if verbose:
160+
print(f"\nTool: {rename_to}")
161+
print(f"Current version: {current_version}")
162+
print(f"Expected version: {expected_version}")
163+
164+
if current_version and current_version == expected_version:
165+
if verbose:
166+
print("Latest version already installed. Skipping extraction")
167+
return True
168+
169+
if verbose:
170+
print("New version detected")
171+
172+
except Exception as e:
173+
if verbose:
174+
print(f"Falied to verify version for {rename_to}: {e}")
175+
176+
return False
177+
178+
179+
def unpack(filename, destination, force_extract, checksum): # noqa: C901
151180
dirname = ""
152181
cfile = None # Compressed file
153182
file_is_corrupted = False
@@ -196,11 +225,11 @@ def unpack(filename, destination, force_extract): # noqa: C901
196225
rename_to = "esp32-arduino-libs"
197226

198227
if not force_extract:
199-
if verify_files(filename, destination, rename_to):
200-
print(" Files ok. Skipping Extraction")
201-
return True
202-
else:
203-
print(" Extracting archive...")
228+
if is_latest_version(destination, dirname, rename_to, cfile, checksum):
229+
if verify_files(filename, destination, rename_to):
230+
print(" Files ok. Skipping Extraction")
231+
return True
232+
print(" Extracting archive...")
204233
else:
205234
print(" Forcing extraction")
206235

@@ -225,6 +254,9 @@ def unpack(filename, destination, force_extract): # noqa: C901
225254
shutil.rmtree(rename_to)
226255
shutil.move(dirname, rename_to)
227256

257+
with open(os.path.join(destination, rename_to, ".package_checksum"), "w") as f:
258+
f.write(checksum)
259+
228260
if verify_files(filename, destination, rename_to):
229261
print(" Files extracted successfully.")
230262
return True
@@ -324,11 +356,11 @@ def get_tool(tool, force_download, force_extract):
324356
print("Tool {0} already downloaded".format(archive_name))
325357
sys.stdout.flush()
326358

327-
if "esp32-arduino-libs" not in archive_name and sha256sum(local_path) != checksum:
359+
if sha256sum(local_path) != checksum:
328360
print("Checksum mismatch for {0}".format(archive_name))
329361
return False
330362

331-
return unpack(local_path, ".", force_extract)
363+
return unpack(local_path, ".", force_extract, checksum)
332364

333365

334366
def load_tools_list(filename, platform):
@@ -379,21 +411,17 @@ def identify_platform():
379411
if __name__ == "__main__":
380412
parser = argparse.ArgumentParser(description="Download and extract tools")
381413

382-
parser.add_argument("-v", "--verbose", type=bool, default=False, required=False, help="Print verbose output")
414+
parser.add_argument("-v", "--verbose", action="store_true", required=False, help="Print verbose output")
383415

384-
parser.add_argument(
385-
"-d", "--force_download", type=bool, default=False, required=False, help="Force download of tools"
386-
)
416+
parser.add_argument("-d", "--force_download", action="store_true", required=False, help="Force download of tools")
387417

388-
parser.add_argument(
389-
"-e", "--force_extract", type=bool, default=False, required=False, help="Force extraction of tools"
390-
)
418+
parser.add_argument("-e", "--force_extract", action="store_true", required=False, help="Force extraction of tools")
391419

392420
parser.add_argument(
393-
"-f", "--force_all", type=bool, default=False, required=False, help="Force download and extraction of tools"
421+
"-f", "--force_all", action="store_true", required=False, help="Force download and extraction of tools"
394422
)
395423

396-
parser.add_argument("-t", "--test", type=bool, default=False, required=False, help=argparse.SUPPRESS)
424+
parser.add_argument("-t", "--test", action="store_true", required=False, help=argparse.SUPPRESS)
397425

398426
args = parser.parse_args()
399427

Diff for: variants/lolin_s3_mini/pins_arduino.h

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ static const uint8_t LED_BUILTIN = 47 + SOC_GPIO_PIN_COUNT;
1212
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
1313
#define RGB_BUILTIN LED_BUILTIN
1414
#define RGB_BRIGHTNESS 64
15+
// This board has a builtin RGB LED that works with a different signal color order
16+
// Other order options can be found in https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-rgb-led.h
17+
#define RGB_BUILTIN_LED_COLOR_ORDER LED_COLOR_ORDER_RGB
1518

1619
static const uint8_t TX = 43;
1720
static const uint8_t RX = 44;

0 commit comments

Comments
 (0)