Skip to content

Commit eced0f4

Browse files
authored
Merge branch 'master' into docs/preferences-getbool
2 parents a171d2b + 3f6c34a commit eced0f4

File tree

13 files changed

+213
-67
lines changed

13 files changed

+213
-67
lines changed

.github/scripts/install-arduino-core-esp32.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
2828
#git submodule update --init --recursive > /dev/null 2>&1
2929

3030
echo "Installing Platform Tools ..."
31-
cd tools && python get.py
31+
if [ "$OS_IS_WINDOWS" == "1" ]; then
32+
cd tools && ./get.exe
33+
else
34+
cd tools && python get.py
35+
fi
3236
cd $script_init_path
3337

3438
echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"

.github/workflows/build_py_tools.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ name: Build Python Tools
33
on:
44
pull_request:
55
paths:
6-
- 'tools/get.py'
7-
- 'tools/espota.py'
8-
- 'tools/gen_esp32part.py'
9-
- 'tools/gen_insights_package.py'
6+
- '.github/workflows/build_py_tools.yml'
7+
- 'tools/get.py'
8+
- 'tools/espota.py'
9+
- 'tools/gen_esp32part.py'
10+
- 'tools/gen_insights_package.py'
1011

1112
jobs:
1213
find-changed-tools:
@@ -21,6 +22,13 @@ jobs:
2122
with:
2223
fetch-depth: 2
2324
ref: ${{ github.event.pull_request.head.ref }}
25+
26+
- name: Check if checkout failed
27+
if: failure()
28+
run: |
29+
echo "Checkout failed."
30+
echo "Make sure you are using a branch inside the repository and not a fork."
31+
2432
- name: Verify Python Tools Changed
2533
uses: tj-actions/changed-files@v41
2634
id: verify-changed-files
@@ -47,7 +55,7 @@ jobs:
4755
strategy:
4856
fail-fast: false
4957
matrix:
50-
os: [windows-latest, macos-latest, ubuntu-20.04, ARM, ARM64]
58+
os: [windows-latest, macos-latest, ubuntu-20.04, ARM]
5159
include:
5260
- os: windows-latest
5361
TARGET: win64
@@ -63,10 +71,6 @@ jobs:
6371
CONTAINER: python:3.8-bullseye
6472
TARGET: arm
6573
SEPARATOR: ':'
66-
- os: ARM64
67-
CONTAINER: python:3.8-bullseye
68-
TARGET: arm64
69-
SEPARATOR: ':'
7074
container: ${{ matrix.CONTAINER }} # use python container on ARM
7175
env:
7276
DISTPATH: pytools-${{ matrix.TARGET }}
@@ -93,7 +97,7 @@ jobs:
9397
ref: ${{ github.event.pull_request.head.ref }}
9498
- name: Set up Python 3.8
9599
# Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
96-
if: matrix.os != 'ARM' && matrix.os != 'ARM64'
100+
if: matrix.os != 'ARM'
97101
uses: actions/setup-python@master
98102
with:
99103
python-version: 3.8
@@ -108,7 +112,7 @@ jobs:
108112
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=.github/pytools/espressif.ico tools/$tool.py
109113
done
110114
- name: Sign binaries
111-
if: matrix.os == 'windows-latest' && env.CERTIFICATE != '' && env.CERTIFICATE_PASSWORD != ''
115+
if: matrix.os == 'windows-latest'
112116
env:
113117
CERTIFICATE: ${{ secrets.CERTIFICATE }}
114118
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp)
236236
set(ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp)
237237

238238
set(ARDUINO_LIBRARY_BLE_SRCS
239+
libraries/BLE/src/BLE2901.cpp
239240
libraries/BLE/src/BLE2902.cpp
240241
libraries/BLE/src/BLE2904.cpp
241242
libraries/BLE/src/BLEAddress.cpp

boards.txt

+41-8
Original file line numberDiff line numberDiff line change
@@ -21731,12 +21731,25 @@ heltec_wifi_kit_32.build.defines=
2173121731
heltec_wifi_kit_32.build.band=LoRaWAN_NONE
2173221732
heltec_wifi_kit_32.build.LoRaWanDebugLevel=0
2173321733

21734-
heltec_wifi_kit_32.menu.PSRAM.disabled=Disabled
21735-
heltec_wifi_kit_32.menu.PSRAM.disabled.build.defines=
21736-
heltec_wifi_kit_32.menu.PSRAM.disabled.build.extra_libs=
21737-
heltec_wifi_kit_32.menu.PSRAM.enabled=Enabled
21738-
heltec_wifi_kit_32.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw
21739-
heltec_wifi_kit_32.menu.PSRAM.enabled.build.extra_libs=
21734+
heltec_wifi_kit_32.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
21735+
heltec_wifi_kit_32.menu.PartitionScheme.default.build.partitions=default
21736+
heltec_wifi_kit_32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
21737+
heltec_wifi_kit_32.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
21738+
heltec_wifi_kit_32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
21739+
heltec_wifi_kit_32.menu.PartitionScheme.no_ota.build.partitions=no_ota
21740+
heltec_wifi_kit_32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
21741+
heltec_wifi_kit_32.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
21742+
heltec_wifi_kit_32.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
21743+
heltec_wifi_kit_32.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
21744+
heltec_wifi_kit_32.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
21745+
heltec_wifi_kit_32.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
21746+
heltec_wifi_kit_32.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
21747+
heltec_wifi_kit_32.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
21748+
heltec_wifi_kit_32.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
21749+
heltec_wifi_kit_32.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
21750+
heltec_wifi_kit_32.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
21751+
heltec_wifi_kit_32.menu.PartitionScheme.huge_app.build.partitions=huge_app
21752+
heltec_wifi_kit_32.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
2174021753

2174121754
heltec_wifi_kit_32.menu.CPUFreq.240=240MHz (WiFi/BT)
2174221755
heltec_wifi_kit_32.menu.CPUFreq.240.build.f_cpu=240000000L
@@ -21907,14 +21920,34 @@ heltec_wifi_lora_32.build.variant=heltec_wifi_lora_32
2190721920
heltec_wifi_lora_32.build.board=HELTEC_WIFI_LORA_32
2190821921

2190921922
heltec_wifi_lora_32.build.f_cpu=240000000L
21910-
heltec_wifi_lora_32.build.flash_size=8MB
21923+
heltec_wifi_lora_32.build.flash_size=4MB
2191121924
heltec_wifi_lora_32.build.flash_freq=80m
2191221925
heltec_wifi_lora_32.build.flash_mode=dio
2191321926
heltec_wifi_lora_32.build.boot=qio
21914-
heltec_wifi_lora_32.build.partitions=default_8MB
21927+
heltec_wifi_lora_32.build.partitions=default
2191521928
heltec_wifi_lora_32.build.psram=
2191621929
heltec_wifi_lora_32.build.defines=-D{build.band} -DMCU_ESP32_D0 -DWIFI_LORA_32 -DHELTEC_BOARD=1 -DRADIO_CHIP_SX127X -DSLOW_CLK_TPYE=0 -DLoRaWAN_DEBUG_LEVEL={build.LoRaWanDebugLevel} -DACTIVE_REGION=LORAMAC_{build.band} -DLORAWAN_PREAMBLE_LENGTH={build.LORAWAN_PREAMBLE_LENGTH} -DLORAWAN_DEVEUI_AUTO={build.LORAWAN_DEVEUI_AUTO} {build.psram}
2191721930

21931+
heltec_wifi_lora_32.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
21932+
heltec_wifi_lora_32.menu.PartitionScheme.default.build.partitions=default
21933+
heltec_wifi_lora_32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
21934+
heltec_wifi_lora_32.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
21935+
heltec_wifi_lora_32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
21936+
heltec_wifi_lora_32.menu.PartitionScheme.no_ota.build.partitions=no_ota
21937+
heltec_wifi_lora_32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
21938+
heltec_wifi_lora_32.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
21939+
heltec_wifi_lora_32.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
21940+
heltec_wifi_lora_32.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
21941+
heltec_wifi_lora_32.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
21942+
heltec_wifi_lora_32.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
21943+
heltec_wifi_lora_32.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
21944+
heltec_wifi_lora_32.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
21945+
heltec_wifi_lora_32.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
21946+
heltec_wifi_lora_32.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
21947+
heltec_wifi_lora_32.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
21948+
heltec_wifi_lora_32.menu.PartitionScheme.huge_app.build.partitions=huge_app
21949+
heltec_wifi_lora_32.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
21950+
2191821951
heltec_wifi_lora_32.menu.CPUFreq.240=240MHz (WiFi/BT)
2191921952
heltec_wifi_lora_32.menu.CPUFreq.240.build.f_cpu=240000000L
2192021953
heltec_wifi_lora_32.menu.CPUFreq.160=160MHz (WiFi/BT)

libraries/BLE/examples/Notify/Notify.ino

+10-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@
2323
#include <BLEServer.h>
2424
#include <BLEUtils.h>
2525
#include <BLE2902.h>
26+
#include <BLE2901.h>
2627

2728
BLEServer *pServer = NULL;
2829
BLECharacteristic *pCharacteristic = NULL;
30+
BLE2901 *descriptor_2901 = NULL;
31+
2932
bool deviceConnected = false;
3033
bool oldDeviceConnected = false;
3134
uint32_t value = 0;
@@ -65,9 +68,13 @@ void setup() {
6568
BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE | BLECharacteristic::PROPERTY_NOTIFY | BLECharacteristic::PROPERTY_INDICATE
6669
);
6770

68-
// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.descriptor.gatt.client_characteristic_configuration.xml
69-
// Create a BLE Descriptor
71+
// Creates BLE Descriptor 0x2902: Client Characteristic Configuration Descriptor (CCCD)
7072
pCharacteristic->addDescriptor(new BLE2902());
73+
// Adds also the Characteristic User Description - 0x2901 descriptor
74+
descriptor_2901 = new BLE2901();
75+
descriptor_2901->setDescription("My own description for this characteristic.");
76+
descriptor_2901->setAccessPermissions(ESP_GATT_PERM_READ); // enforce read only - default is Read|Write
77+
pCharacteristic->addDescriptor(descriptor_2901);
7178

7279
// Start the service
7380
pService->start();
@@ -87,7 +94,7 @@ void loop() {
8794
pCharacteristic->setValue((uint8_t *)&value, 4);
8895
pCharacteristic->notify();
8996
value++;
90-
delay(3); // bluetooth stack will go into congestion, if too many packets are sent, in 6 hours test i was able to go as low as 3ms
97+
delay(500);
9198
}
9299
// disconnecting
93100
if (!deviceConnected && oldDeviceConnected) {

libraries/BLE/src/BLE2901.cpp

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
BLE2901.h
3+
4+
GATT Descriptor 0x2901 Characteristic User Description
5+
6+
The value of this description is a user-readable string
7+
describing the characteristic.
8+
9+
The Characteristic User Description descriptor
10+
provides a textual user description for a characteristic
11+
value.
12+
If the Writable Auxiliary bit of the Characteristics
13+
Properties is set then this descriptor is written. Only one
14+
User Description descriptor exists in a characteristic
15+
definition.
16+
*/
17+
18+
#include "soc/soc_caps.h"
19+
#if SOC_BLE_SUPPORTED
20+
21+
#include "sdkconfig.h"
22+
#if defined(CONFIG_BLUEDROID_ENABLED)
23+
24+
#include "BLE2901.h"
25+
26+
BLE2901::BLE2901() : BLEDescriptor(BLEUUID((uint16_t)0x2901)) {} // BLE2901
27+
28+
/**
29+
* @brief Set the Characteristic User Description
30+
*/
31+
void BLE2901::setDescription(String userDesc) {
32+
if (userDesc.length() > ESP_GATT_MAX_ATTR_LEN) {
33+
log_e("Size %d too large, must be no bigger than %d", userDesc.length(), ESP_GATT_MAX_ATTR_LEN);
34+
return;
35+
}
36+
setValue(userDesc);
37+
}
38+
39+
#endif
40+
#endif /* SOC_BLE_SUPPORTED */

libraries/BLE/src/BLE2901.h

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
BLE2901.h
3+
4+
GATT Descriptor 0x2901 Characteristic User Description
5+
6+
The value of this description is a user-readable string
7+
describing the characteristic.
8+
9+
The Characteristic User Description descriptor
10+
provides a textual user description for a characteristic
11+
value.
12+
If the Writable Auxiliary bit of the Characteristics
13+
Properties is set then this descriptor is written. Only one
14+
User Description descriptor exists in a characteristic
15+
definition.
16+
17+
*/
18+
19+
#ifndef COMPONENTS_CPP_UTILS_BLE2901_H_
20+
#define COMPONENTS_CPP_UTILS_BLE2901_H_
21+
#include "soc/soc_caps.h"
22+
#if SOC_BLE_SUPPORTED
23+
24+
#include "sdkconfig.h"
25+
#if defined(CONFIG_BLUEDROID_ENABLED)
26+
27+
#include "BLEDescriptor.h"
28+
29+
class BLE2901 : public BLEDescriptor {
30+
public:
31+
BLE2901();
32+
void setDescription(String desc);
33+
}; // BLE2901
34+
35+
#endif /* CONFIG_BLUEDROID_ENABLED */
36+
#endif /* SOC_BLE_SUPPORTED */
37+
#endif /* COMPONENTS_CPP_UTILS_BLE2901_H_ */

libraries/ESP32/examples/Time/SimpleTime/SimpleTime.ino

+9-8
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ void setup() {
3333
// First step is to configure WiFi STA and connect in order to get the current time and date.
3434
Serial.printf("Connecting to %s ", ssid);
3535
WiFi.begin(ssid, password);
36-
while (WiFi.status() != WL_CONNECTED) {
37-
delay(500);
38-
Serial.print(".");
39-
}
40-
Serial.println(" CONNECTED");
41-
42-
// set notification call-back function
43-
sntp_set_time_sync_notification_cb(timeavailable);
4436

4537
/**
4638
* NTP server address could be acquired via DHCP,
@@ -52,6 +44,15 @@ void setup() {
5244
*/
5345
esp_sntp_servermode_dhcp(1); // (optional)
5446

47+
while (WiFi.status() != WL_CONNECTED) {
48+
delay(500);
49+
Serial.print(".");
50+
}
51+
Serial.println(" CONNECTED");
52+
53+
// set notification call-back function
54+
sntp_set_time_sync_notification_cb(timeavailable);
55+
5556
/**
5657
* This will set configured ntp servers and constant TimeZone/daylightOffset
5758
* should be OK if your time zone does not need to adjust daylightOffset twice a year,

libraries/NetBIOS/src/NetBIOS.cpp

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "NetBIOS.h"
22
#include <functional>
3+
extern "C" {
4+
#include <lwip/netif.h>
5+
}; // extern "C"
36

47
#define NBNS_PORT 137
58
#define NBNS_MAX_HOSTNAME_LEN 32
@@ -91,7 +94,16 @@ void NetBIOS::_onPacket(AsyncUDPPacket &packet) {
9194
append_32((void *)&nbnsa.ttl, 300000);
9295
append_16((void *)&nbnsa.data_len, 6);
9396
append_16((void *)&nbnsa.flags, 0);
94-
nbnsa.addr = packet.localIP();
97+
nbnsa.addr = packet.localIP(); // By default, should be overridden below
98+
// Iterate over all netifs, see if the incoming address matches one of the netmaskes networks
99+
for (auto netif = netif_list; netif; netif = netif->next) {
100+
auto maskedip = ip4_addr_get_u32(netif_ip4_addr(netif)) & ip4_addr_get_u32(netif_ip4_netmask(netif));
101+
auto maskedin = ((uint32_t)packet.localIP()) & ip4_addr_get_u32(netif_ip4_netmask(netif));
102+
if (maskedip == maskedin) {
103+
nbnsa.addr = ip4_addr_get_u32(netif_ip4_addr(netif));
104+
break;
105+
}
106+
}
95107
_udp.writeTo((uint8_t *)&nbnsa, sizeof(nbnsa), packet.remoteIP(), NBNS_PORT);
96108
}
97109
}

tools/get.exe

-7.38 KB
Binary file not shown.

0 commit comments

Comments
 (0)