Skip to content

Commit

Permalink
Merge branch 'master' into docs/preferences-getbool
Browse files Browse the repository at this point in the history
  • Loading branch information
P-R-O-C-H-Y committed Jun 19, 2024
2 parents a171d2b + 3f6c34a commit eced0f4
Show file tree
Hide file tree
Showing 13 changed files with 213 additions and 67 deletions.
6 changes: 5 additions & 1 deletion .github/scripts/install-arduino-core-esp32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ if [ ! -d "$ARDUINO_ESP32_PATH" ]; then
#git submodule update --init --recursive > /dev/null 2>&1

echo "Installing Platform Tools ..."
cd tools && python get.py
if [ "$OS_IS_WINDOWS" == "1" ]; then
cd tools && ./get.exe
else
cd tools && python get.py
fi
cd $script_init_path

echo "ESP32 Arduino has been installed in '$ARDUINO_ESP32_PATH'"
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/build_py_tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: Build Python Tools
on:
pull_request:
paths:
- 'tools/get.py'
- 'tools/espota.py'
- 'tools/gen_esp32part.py'
- 'tools/gen_insights_package.py'
- '.github/workflows/build_py_tools.yml'
- 'tools/get.py'
- 'tools/espota.py'
- 'tools/gen_esp32part.py'
- 'tools/gen_insights_package.py'

jobs:
find-changed-tools:
Expand All @@ -21,6 +22,13 @@ jobs:
with:
fetch-depth: 2
ref: ${{ github.event.pull_request.head.ref }}

- name: Check if checkout failed
if: failure()
run: |
echo "Checkout failed."
echo "Make sure you are using a branch inside the repository and not a fork."
- name: Verify Python Tools Changed
uses: tj-actions/changed-files@v41
id: verify-changed-files
Expand All @@ -47,7 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-20.04, ARM, ARM64]
os: [windows-latest, macos-latest, ubuntu-20.04, ARM]
include:
- os: windows-latest
TARGET: win64
Expand All @@ -63,10 +71,6 @@ jobs:
CONTAINER: python:3.8-bullseye
TARGET: arm
SEPARATOR: ':'
- os: ARM64
CONTAINER: python:3.8-bullseye
TARGET: arm64
SEPARATOR: ':'
container: ${{ matrix.CONTAINER }} # use python container on ARM
env:
DISTPATH: pytools-${{ matrix.TARGET }}
Expand All @@ -93,7 +97,7 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python 3.8
# Skip setting python on ARM because of missing compatibility: https://github.com/actions/setup-python/issues/108
if: matrix.os != 'ARM' && matrix.os != 'ARM64'
if: matrix.os != 'ARM'
uses: actions/setup-python@master
with:
python-version: 3.8
Expand All @@ -108,7 +112,7 @@ jobs:
pyinstaller --distpath ./${{ env.DISTPATH }} -F --icon=.github/pytools/espressif.ico tools/$tool.py
done
- name: Sign binaries
if: matrix.os == 'windows-latest' && env.CERTIFICATE != '' && env.CERTIFICATE_PASSWORD != ''
if: matrix.os == 'windows-latest'
env:
CERTIFICATE: ${{ secrets.CERTIFICATE }}
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ set(ARDUINO_LIBRARY_WiFiProv_SRCS libraries/WiFiProv/src/WiFiProv.cpp)
set(ARDUINO_LIBRARY_Wire_SRCS libraries/Wire/src/Wire.cpp)

set(ARDUINO_LIBRARY_BLE_SRCS
libraries/BLE/src/BLE2901.cpp
libraries/BLE/src/BLE2902.cpp
libraries/BLE/src/BLE2904.cpp
libraries/BLE/src/BLEAddress.cpp
Expand Down
49 changes: 41 additions & 8 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21731,12 +21731,25 @@ heltec_wifi_kit_32.build.defines=
heltec_wifi_kit_32.build.band=LoRaWAN_NONE
heltec_wifi_kit_32.build.LoRaWanDebugLevel=0

heltec_wifi_kit_32.menu.PSRAM.disabled=Disabled
heltec_wifi_kit_32.menu.PSRAM.disabled.build.defines=
heltec_wifi_kit_32.menu.PSRAM.disabled.build.extra_libs=
heltec_wifi_kit_32.menu.PSRAM.enabled=Enabled
heltec_wifi_kit_32.menu.PSRAM.enabled.build.defines=-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue -mfix-esp32-psram-cache-strategy=memw
heltec_wifi_kit_32.menu.PSRAM.enabled.build.extra_libs=
heltec_wifi_kit_32.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
heltec_wifi_kit_32.menu.PartitionScheme.default.build.partitions=default
heltec_wifi_kit_32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
heltec_wifi_kit_32.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
heltec_wifi_kit_32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
heltec_wifi_kit_32.menu.PartitionScheme.no_ota.build.partitions=no_ota
heltec_wifi_kit_32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
heltec_wifi_kit_32.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
heltec_wifi_kit_32.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
heltec_wifi_kit_32.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
heltec_wifi_kit_32.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
heltec_wifi_kit_32.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
heltec_wifi_kit_32.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
heltec_wifi_kit_32.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
heltec_wifi_kit_32.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
heltec_wifi_kit_32.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
heltec_wifi_kit_32.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
heltec_wifi_kit_32.menu.PartitionScheme.huge_app.build.partitions=huge_app
heltec_wifi_kit_32.menu.PartitionScheme.huge_app.upload.maximum_size=3145728

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

heltec_wifi_lora_32.build.f_cpu=240000000L
heltec_wifi_lora_32.build.flash_size=8MB
heltec_wifi_lora_32.build.flash_size=4MB
heltec_wifi_lora_32.build.flash_freq=80m
heltec_wifi_lora_32.build.flash_mode=dio
heltec_wifi_lora_32.build.boot=qio
heltec_wifi_lora_32.build.partitions=default_8MB
heltec_wifi_lora_32.build.partitions=default
heltec_wifi_lora_32.build.psram=
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}

heltec_wifi_lora_32.menu.PartitionScheme.default=Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS)
heltec_wifi_lora_32.menu.PartitionScheme.default.build.partitions=default
heltec_wifi_lora_32.menu.PartitionScheme.defaultffat=Default 4MB with ffat (1.2MB APP/1.5MB FATFS)
heltec_wifi_lora_32.menu.PartitionScheme.defaultffat.build.partitions=default_ffat
heltec_wifi_lora_32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
heltec_wifi_lora_32.menu.PartitionScheme.no_ota.build.partitions=no_ota
heltec_wifi_lora_32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152
heltec_wifi_lora_32.menu.PartitionScheme.noota_3g=No OTA (1MB APP/3MB SPIFFS)
heltec_wifi_lora_32.menu.PartitionScheme.noota_3g.build.partitions=noota_3g
heltec_wifi_lora_32.menu.PartitionScheme.noota_3g.upload.maximum_size=1048576
heltec_wifi_lora_32.menu.PartitionScheme.noota_ffat=No OTA (2MB APP/2MB FATFS)
heltec_wifi_lora_32.menu.PartitionScheme.noota_ffat.build.partitions=noota_ffat
heltec_wifi_lora_32.menu.PartitionScheme.noota_ffat.upload.maximum_size=2097152
heltec_wifi_lora_32.menu.PartitionScheme.noota_3gffat=No OTA (1MB APP/3MB FATFS)
heltec_wifi_lora_32.menu.PartitionScheme.noota_3gffat.build.partitions=noota_3gffat
heltec_wifi_lora_32.menu.PartitionScheme.noota_3gffat.upload.maximum_size=1048576
heltec_wifi_lora_32.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
heltec_wifi_lora_32.menu.PartitionScheme.huge_app.build.partitions=huge_app
heltec_wifi_lora_32.menu.PartitionScheme.huge_app.upload.maximum_size=3145728

heltec_wifi_lora_32.menu.CPUFreq.240=240MHz (WiFi/BT)
heltec_wifi_lora_32.menu.CPUFreq.240.build.f_cpu=240000000L
heltec_wifi_lora_32.menu.CPUFreq.160=160MHz (WiFi/BT)
Expand Down
13 changes: 10 additions & 3 deletions libraries/BLE/examples/Notify/Notify.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
#include <BLE2901.h>

BLEServer *pServer = NULL;
BLECharacteristic *pCharacteristic = NULL;
BLE2901 *descriptor_2901 = NULL;

bool deviceConnected = false;
bool oldDeviceConnected = false;
uint32_t value = 0;
Expand Down Expand Up @@ -65,9 +68,13 @@ void setup() {
BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE | BLECharacteristic::PROPERTY_NOTIFY | BLECharacteristic::PROPERTY_INDICATE
);

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

// Start the service
pService->start();
Expand All @@ -87,7 +94,7 @@ void loop() {
pCharacteristic->setValue((uint8_t *)&value, 4);
pCharacteristic->notify();
value++;
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
delay(500);
}
// disconnecting
if (!deviceConnected && oldDeviceConnected) {
Expand Down
40 changes: 40 additions & 0 deletions libraries/BLE/src/BLE2901.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
BLE2901.h
GATT Descriptor 0x2901 Characteristic User Description
The value of this description is a user-readable string
describing the characteristic.
The Characteristic User Description descriptor
provides a textual user description for a characteristic
value.
If the Writable Auxiliary bit of the Characteristics
Properties is set then this descriptor is written. Only one
User Description descriptor exists in a characteristic
definition.
*/

#include "soc/soc_caps.h"
#if SOC_BLE_SUPPORTED

#include "sdkconfig.h"
#if defined(CONFIG_BLUEDROID_ENABLED)

#include "BLE2901.h"

BLE2901::BLE2901() : BLEDescriptor(BLEUUID((uint16_t)0x2901)) {} // BLE2901

/**
* @brief Set the Characteristic User Description
*/
void BLE2901::setDescription(String userDesc) {
if (userDesc.length() > ESP_GATT_MAX_ATTR_LEN) {
log_e("Size %d too large, must be no bigger than %d", userDesc.length(), ESP_GATT_MAX_ATTR_LEN);
return;
}
setValue(userDesc);
}

#endif
#endif /* SOC_BLE_SUPPORTED */
37 changes: 37 additions & 0 deletions libraries/BLE/src/BLE2901.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
BLE2901.h
GATT Descriptor 0x2901 Characteristic User Description
The value of this description is a user-readable string
describing the characteristic.
The Characteristic User Description descriptor
provides a textual user description for a characteristic
value.
If the Writable Auxiliary bit of the Characteristics
Properties is set then this descriptor is written. Only one
User Description descriptor exists in a characteristic
definition.
*/

#ifndef COMPONENTS_CPP_UTILS_BLE2901_H_
#define COMPONENTS_CPP_UTILS_BLE2901_H_
#include "soc/soc_caps.h"
#if SOC_BLE_SUPPORTED

#include "sdkconfig.h"
#if defined(CONFIG_BLUEDROID_ENABLED)

#include "BLEDescriptor.h"

class BLE2901 : public BLEDescriptor {
public:
BLE2901();
void setDescription(String desc);
}; // BLE2901

#endif /* CONFIG_BLUEDROID_ENABLED */
#endif /* SOC_BLE_SUPPORTED */
#endif /* COMPONENTS_CPP_UTILS_BLE2901_H_ */
17 changes: 9 additions & 8 deletions libraries/ESP32/examples/Time/SimpleTime/SimpleTime.ino
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,6 @@ void setup() {
// First step is to configure WiFi STA and connect in order to get the current time and date.
Serial.printf("Connecting to %s ", ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(" CONNECTED");

// set notification call-back function
sntp_set_time_sync_notification_cb(timeavailable);

/**
* NTP server address could be acquired via DHCP,
Expand All @@ -52,6 +44,15 @@ void setup() {
*/
esp_sntp_servermode_dhcp(1); // (optional)

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(" CONNECTED");

// set notification call-back function
sntp_set_time_sync_notification_cb(timeavailable);

/**
* This will set configured ntp servers and constant TimeZone/daylightOffset
* should be OK if your time zone does not need to adjust daylightOffset twice a year,
Expand Down
14 changes: 13 additions & 1 deletion libraries/NetBIOS/src/NetBIOS.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#include "NetBIOS.h"
#include <functional>
extern "C" {
#include <lwip/netif.h>
}; // extern "C"

#define NBNS_PORT 137
#define NBNS_MAX_HOSTNAME_LEN 32
Expand Down Expand Up @@ -91,7 +94,16 @@ void NetBIOS::_onPacket(AsyncUDPPacket &packet) {
append_32((void *)&nbnsa.ttl, 300000);
append_16((void *)&nbnsa.data_len, 6);
append_16((void *)&nbnsa.flags, 0);
nbnsa.addr = packet.localIP();
nbnsa.addr = packet.localIP(); // By default, should be overridden below
// Iterate over all netifs, see if the incoming address matches one of the netmaskes networks
for (auto netif = netif_list; netif; netif = netif->next) {
auto maskedip = ip4_addr_get_u32(netif_ip4_addr(netif)) & ip4_addr_get_u32(netif_ip4_netmask(netif));
auto maskedin = ((uint32_t)packet.localIP()) & ip4_addr_get_u32(netif_ip4_netmask(netif));
if (maskedip == maskedin) {
nbnsa.addr = ip4_addr_get_u32(netif_ip4_addr(netif));
break;
}
}
_udp.writeTo((uint8_t *)&nbnsa, sizeof(nbnsa), packet.remoteIP(), NBNS_PORT);
}
}
Expand Down
Binary file modified tools/get.exe
Binary file not shown.
Loading

0 comments on commit eced0f4

Please sign in to comment.