Unverified Commit 7fe4aa67 authored by Me No Dev's avatar Me No Dev Committed by GitHub

Merge branch 'master' into release/v3.1.x

parents c7e01e72 4098c53f
......@@ -4,7 +4,7 @@ on:
push:
branches:
- master
- release/*
- release/v2.x
paths:
- 'docs/**'
- '.github/workflows/docs_build.yml'
......
......@@ -5,7 +5,7 @@ on:
types: [published]
push:
branches:
- release/*
- release/v2.x
- master
paths:
- 'docs/**'
......
......@@ -5,7 +5,7 @@ on:
push:
branches:
- master
- release/*
- release/v2.x
pull_request:
paths:
- 'cores/**'
......
// Copyright 2024 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "soc/soc_caps.h"
#include "esp32-hal-rgb-led.h"
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
rgbLedWriteOrdered(pin, RGB_BUILTIN_LED_COLOR_ORDER, red_val, green_val, blue_val);
}
void rgbLedWriteOrdered(uint8_t pin, rgb_led_color_order_t order, uint8_t red_val, uint8_t green_val, uint8_t blue_val) {
#if SOC_RMT_SUPPORTED
rmt_data_t led_data[24];
......@@ -15,7 +33,39 @@ void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue
return;
}
int color[] = {green_val, red_val, blue_val}; // Color coding is in order GREEN, RED, BLUE
// default WS2812B color order is G, R, B
int color[3] = {green_val, red_val, blue_val};
switch (order) {
case LED_COLOR_ORDER_RGB:
color[0] = red_val;
color[1] = green_val;
color[2] = blue_val;
break;
case LED_COLOR_ORDER_BGR:
color[0] = blue_val;
color[1] = green_val;
color[2] = red_val;
break;
case LED_COLOR_ORDER_BRG:
color[0] = blue_val;
color[1] = red_val;
color[2] = green_val;
break;
case LED_COLOR_ORDER_RBG:
color[0] = red_val;
color[1] = blue_val;
color[2] = green_val;
break;
case LED_COLOR_ORDER_GBR:
color[0] = green_val;
color[1] = blue_val;
color[2] = red_val;
break;
default: // GRB
break;
}
int i = 0;
for (int col = 0; col < 3; col++) {
for (int bit = 0; bit < 8; bit++) {
......
......@@ -11,7 +11,26 @@ extern "C" {
#define RGB_BRIGHTNESS 64
#endif
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
#ifndef RGB_BUILTIN_LED_COLOR_ORDER
#define RGB_BUILTIN_LED_COLOR_ORDER LED_COLOR_ORDER_GRB // default WS2812B color order
#endif
typedef enum {
LED_COLOR_ORDER_RGB,
LED_COLOR_ORDER_BGR,
LED_COLOR_ORDER_BRG,
LED_COLOR_ORDER_RBG,
LED_COLOR_ORDER_GBR,
LED_COLOR_ORDER_GRB
} rgb_led_color_order_t;
void rgbLedWriteOrdered(uint8_t pin, rgb_led_color_order_t order, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
// Will use RGB_BUILTIN_LED_COLOR_ORDER
void rgbLedWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val);
// Backward compatibility
#define neopixelWrite(p, r, g, b) rgbLedWrite(p, r, g, b)
#ifdef __cplusplus
}
......
No preview for this file type
......@@ -147,7 +147,36 @@ def verify_files(filename, destination, rename_to):
return True
def unpack(filename, destination, force_extract): # noqa: C901
def is_latest_version(destination, dirname, rename_to, cfile, checksum):
current_version = None
expected_version = None
try:
expected_version = checksum
with open(os.path.join(destination, rename_to, ".package_checksum"), "r") as f:
current_version = f.read()
if verbose:
print(f"\nTool: {rename_to}")
print(f"Current version: {current_version}")
print(f"Expected version: {expected_version}")
if current_version and current_version == expected_version:
if verbose:
print("Latest version already installed. Skipping extraction")
return True
if verbose:
print("New version detected")
except Exception as e:
if verbose:
print(f"Falied to verify version for {rename_to}: {e}")
return False
def unpack(filename, destination, force_extract, checksum): # noqa: C901
dirname = ""
cfile = None # Compressed file
file_is_corrupted = False
......@@ -196,10 +225,10 @@ def unpack(filename, destination, force_extract): # noqa: C901
rename_to = "esp32-arduino-libs"
if not force_extract:
if is_latest_version(destination, dirname, rename_to, cfile, checksum):
if verify_files(filename, destination, rename_to):
print(" Files ok. Skipping Extraction")
return True
else:
print(" Extracting archive...")
else:
print(" Forcing extraction")
......@@ -225,6 +254,9 @@ def unpack(filename, destination, force_extract): # noqa: C901
shutil.rmtree(rename_to)
shutil.move(dirname, rename_to)
with open(os.path.join(destination, rename_to, ".package_checksum"), "w") as f:
f.write(checksum)
if verify_files(filename, destination, rename_to):
print(" Files extracted successfully.")
return True
......@@ -324,11 +356,11 @@ def get_tool(tool, force_download, force_extract):
print("Tool {0} already downloaded".format(archive_name))
sys.stdout.flush()
if "esp32-arduino-libs" not in archive_name and sha256sum(local_path) != checksum:
if sha256sum(local_path) != checksum:
print("Checksum mismatch for {0}".format(archive_name))
return False
return unpack(local_path, ".", force_extract)
return unpack(local_path, ".", force_extract, checksum)
def load_tools_list(filename, platform):
......@@ -379,21 +411,17 @@ def identify_platform():
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Download and extract tools")
parser.add_argument("-v", "--verbose", type=bool, default=False, required=False, help="Print verbose output")
parser.add_argument("-v", "--verbose", action="store_true", required=False, help="Print verbose output")
parser.add_argument(
"-d", "--force_download", type=bool, default=False, required=False, help="Force download of tools"
)
parser.add_argument("-d", "--force_download", action="store_true", required=False, help="Force download of tools")
parser.add_argument(
"-e", "--force_extract", type=bool, default=False, required=False, help="Force extraction of tools"
)
parser.add_argument("-e", "--force_extract", action="store_true", required=False, help="Force extraction of tools")
parser.add_argument(
"-f", "--force_all", type=bool, default=False, required=False, help="Force download and extraction of tools"
"-f", "--force_all", action="store_true", required=False, help="Force download and extraction of tools"
)
parser.add_argument("-t", "--test", type=bool, default=False, required=False, help=argparse.SUPPRESS)
parser.add_argument("-t", "--test", action="store_true", required=False, help=argparse.SUPPRESS)
args = parser.parse_args()
......
......@@ -12,6 +12,9 @@ static const uint8_t LED_BUILTIN = 47 + SOC_GPIO_PIN_COUNT;
#define LED_BUILTIN LED_BUILTIN // allow testing #ifdef LED_BUILTIN
#define RGB_BUILTIN LED_BUILTIN
#define RGB_BRIGHTNESS 64
// This board has a builtin RGB LED that works with a different signal color order
// Other order options can be found in https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-rgb-led.h
#define RGB_BUILTIN_LED_COLOR_ORDER LED_COLOR_ORDER_RGB
static const uint8_t TX = 43;
static const uint8_t RX = 44;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment