mirror of
https://github.com/Laxilef/OTGateway.git
synced 2026-03-21 01:38:38 +05:00
Compare commits
6 Commits
c0ff34f2e0
...
async
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5482e0b70a | ||
|
|
3fdb48e016 | ||
|
|
11747dd8bd | ||
|
|
af1a9b59c4 | ||
|
|
9c86ad4427 | ||
|
|
5f8ca61d79 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.pio
|
.pio
|
||||||
|
.dummy
|
||||||
.vscode
|
.vscode
|
||||||
.PVS-Studio
|
.PVS-Studio
|
||||||
build/*
|
build/*
|
||||||
@@ -10,5 +11,4 @@ package-lock.json
|
|||||||
*.lock
|
*.lock
|
||||||
sdkconfig.*
|
sdkconfig.*
|
||||||
CMakeLists.txt
|
CMakeLists.txt
|
||||||
!sdkconfig.defaults
|
|
||||||
!.gitkeep
|
!.gitkeep
|
||||||
@@ -4,7 +4,7 @@ extra_configs = secrets.default.ini
|
|||||||
core_dir = .pio
|
core_dir = .pio
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
version = 1.6.0-async-dht
|
version = 1.6.0-async
|
||||||
framework = arduino
|
framework = arduino
|
||||||
lib_deps = ESP32Async/AsyncTCP@^3.4.10
|
lib_deps = ESP32Async/AsyncTCP@^3.4.10
|
||||||
ESP32Async/ESPAsyncWebServer@^3.9.4
|
ESP32Async/ESPAsyncWebServer@^3.9.4
|
||||||
@@ -17,14 +17,14 @@ lib_deps = ESP32Async/AsyncTCP@^3.4.10
|
|||||||
gyverlibs/GyverPID@^3.3.2
|
gyverlibs/GyverPID@^3.3.2
|
||||||
gyverlibs/GyverBlinker@^1.1.1
|
gyverlibs/GyverBlinker@^1.1.1
|
||||||
pstolarz/OneWireNg@^0.14.1
|
pstolarz/OneWireNg@^0.14.1
|
||||||
;milesburton/DallasTemperature@^4.0.5
|
milesburton/DallasTemperature@^4.0.6
|
||||||
https://github.com/Laxilef/Arduino-Temperature-Control-Library#fix_85c
|
|
||||||
https://github.com/Laxilef/esp32DHT#idf5
|
https://github.com/Laxilef/esp32DHT#idf5
|
||||||
;laxilef/TinyLogger@^1.1.1
|
;laxilef/TinyLogger@^1.1.1
|
||||||
https://github.com/Laxilef/TinyLogger#custom_handlers
|
https://github.com/Laxilef/TinyLogger#custom_handlers
|
||||||
lib_ignore = OneWire
|
lib_ignore = OneWire
|
||||||
build_type = ${secrets.build_type}
|
build_type = ${secrets.build_type}
|
||||||
build_flags = -mtext-section-literals
|
build_flags = ;-mtext-section-literals
|
||||||
|
-O2
|
||||||
-Wno-deprecated-declarations
|
-Wno-deprecated-declarations
|
||||||
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
-D MQTT_CLIENT_STD_FUNCTION_CALLBACK=1
|
||||||
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
;-D DEBUG_ESP_CORE -D DEBUG_ESP_WIFI -D DEBUG_ESP_HTTP_SERVER -D DEBUG_ESP_PORT=Serial
|
||||||
@@ -63,7 +63,7 @@ check_flags = ;pvs-studio: --analysis-mode=4 --exclude-path=./.pio/l
|
|||||||
|
|
||||||
; Defaults
|
; Defaults
|
||||||
[esp32_defaults]
|
[esp32_defaults]
|
||||||
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.36/platform-espressif32.zip
|
platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.37/platform-espressif32.zip
|
||||||
platform_packages = ${env.platform_packages}
|
platform_packages = ${env.platform_packages}
|
||||||
board_build.partitions = esp32_partitions.csv
|
board_build.partitions = esp32_partitions.csv
|
||||||
lib_deps = ${env.lib_deps}
|
lib_deps = ${env.lib_deps}
|
||||||
@@ -98,7 +98,8 @@ custom_component_remove = espressif/esp_hosted
|
|||||||
espressif/esp-zboss-lib
|
espressif/esp-zboss-lib
|
||||||
espressif/esp-zigbee-lib
|
espressif/esp-zigbee-lib
|
||||||
chmorgan/esp-libhelix-mp3
|
chmorgan/esp-libhelix-mp3
|
||||||
extra_scripts = post:tools/esp32.py
|
extra_scripts = pre:tools/add_build_commit.py
|
||||||
|
post:tools/esp32.py
|
||||||
post:tools/build.py
|
post:tools/build.py
|
||||||
build_type = ${env.build_type}
|
build_type = ${env.build_type}
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
@@ -146,7 +147,7 @@ extends = esp32_defaults
|
|||||||
board = lolin_c3_mini
|
board = lolin_c3_mini
|
||||||
lib_deps = ${esp32_defaults.lib_deps}
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
${esp32_defaults.nimble_lib}
|
${esp32_defaults.nimble_lib}
|
||||||
build_unflags = -mtext-section-literals
|
;build_unflags = -mtext-section-literals
|
||||||
build_flags = ${esp32_defaults.build_flags}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
@@ -194,7 +195,7 @@ extends = esp32_defaults
|
|||||||
board = esp32-c6-devkitc-1
|
board = esp32-c6-devkitc-1
|
||||||
lib_deps = ${esp32_defaults.lib_deps}
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
${esp32_defaults.nimble_lib}
|
${esp32_defaults.nimble_lib}
|
||||||
build_unflags = -mtext-section-literals
|
;build_unflags = -mtext-section-literals
|
||||||
build_flags = ${esp32_defaults.build_flags}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
-D DEFAULT_OT_IN_GPIO=15
|
-D DEFAULT_OT_IN_GPIO=15
|
||||||
@@ -203,13 +204,18 @@ build_flags = ${esp32_defaults.build_flags}
|
|||||||
-D DEFAULT_SENSOR_INDOOR_GPIO=0
|
-D DEFAULT_SENSOR_INDOOR_GPIO=0
|
||||||
-D DEFAULT_STATUS_LED_GPIO=11
|
-D DEFAULT_STATUS_LED_GPIO=11
|
||||||
-D DEFAULT_OT_RX_LED_GPIO=10
|
-D DEFAULT_OT_RX_LED_GPIO=10
|
||||||
|
custom_sdkconfig = '# CONFIG_OPENTHREAD_ENABLED is not set'
|
||||||
|
'# CONFIG_ESP_WIFI_ENTERPRISE_SUPPORT is not set'
|
||||||
|
'# CONFIG_LWIP_IPV6 is not set'
|
||||||
|
'# CONFIG_LWIP_IPV6_AUTOCONFIG is not set'
|
||||||
|
'# CONFIG_LWIP_PPP_SUPPORT is not set'
|
||||||
|
|
||||||
[env:otthing]
|
[env:otthing]
|
||||||
extends = esp32_defaults
|
extends = esp32_defaults
|
||||||
board = lolin_c3_mini
|
board = lolin_c3_mini
|
||||||
lib_deps = ${esp32_defaults.lib_deps}
|
lib_deps = ${esp32_defaults.lib_deps}
|
||||||
${esp32_defaults.nimble_lib}
|
${esp32_defaults.nimble_lib}
|
||||||
build_unflags = -mtext-section-literals
|
;build_unflags = -mtext-section-literals
|
||||||
build_flags = ${esp32_defaults.build_flags}
|
build_flags = ${esp32_defaults.build_flags}
|
||||||
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
-D MYNEWT_VAL_BLE_EXT_ADV=1
|
||||||
-D USE_BLE=1
|
-D USE_BLE=1
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
# Source:
|
|
||||||
# https://github.com/pioarduino/platform-espressif32/tree/main/examples/espidf-arduino-h2zero-BLE_scan
|
|
||||||
|
|
||||||
CONFIG_FREERTOS_HZ=1000
|
|
||||||
CONFIG_MBEDTLS_PSK_MODES=y
|
|
||||||
CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
|
|
||||||
CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y
|
|
||||||
CONFIG_COMPILER_OPTIMIZATION_SIZE=y
|
|
||||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
|
||||||
CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# BT config
|
|
||||||
CONFIG_BT_ENABLED=y
|
|
||||||
CONFIG_BTDM_CTRL_MODE_BLE_ONLY=y
|
|
||||||
CONFIG_BTDM_CTRL_MODE_BR_EDR_ONLY=n
|
|
||||||
CONFIG_BTDM_CTRL_MODE_BTDM=n
|
|
||||||
CONFIG_BT_BLUEDROID_ENABLED=n
|
|
||||||
CONFIG_BT_NIMBLE_ENABLED=y
|
|
||||||
|
|
||||||
#
|
|
||||||
# Arduino Configuration
|
|
||||||
CONFIG_AUTOSTART_ARDUINO=y
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_COMPILATION=y
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_Zigbee=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_Matter=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_WiFiProv=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_BLE=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_BluetoothSerial=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_SimpleBLE=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_RainMaker=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_OpenThread=n
|
|
||||||
CONFIG_ARDUINO_SELECTIVE_Insights=n
|
|
||||||
@@ -176,9 +176,10 @@ public:
|
|||||||
objId.c_str()
|
objId.c_str()
|
||||||
);
|
);
|
||||||
|
|
||||||
// set device class, name, value template for bluetooth sensors
|
// set device class, name, value template for Bluetooth/DHT sensors
|
||||||
// or name & value template for another sensors
|
// or name & value template for another sensors
|
||||||
if (sSensor.type == Sensors::Type::BLUETOOTH) {
|
if (sSensor.type == Sensors::Type::BLUETOOTH ||
|
||||||
|
sSensor.type == Sensors::Type::DHT11 || sSensor.type == Sensors::Type::DHT22) {
|
||||||
// available state topic
|
// available state topic
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = doc[FPSTR(HA_STATE_TOPIC)];
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_TOPIC)] = doc[FPSTR(HA_STATE_TOPIC)];
|
||||||
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_SENSOR_CONN, true);
|
doc[FPSTR(HA_AVAILABILITY)][1][FPSTR(HA_VALUE_TEMPLATE)] = JsonString(AVAILABILITY_SENSOR_CONN, true);
|
||||||
|
|||||||
@@ -552,6 +552,7 @@ protected:
|
|||||||
|
|
||||||
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
||||||
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
||||||
|
docBuild[FPSTR(S_COMMIT)] = BUILD_COMMIT;
|
||||||
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
||||||
docBuild[FPSTR(S_ENV)] = BUILD_ENV;
|
docBuild[FPSTR(S_ENV)] = BUILD_ENV;
|
||||||
docBuild[FPSTR(S_CORE)] = ESP.getCoreVersion();
|
docBuild[FPSTR(S_CORE)] = ESP.getCoreVersion();
|
||||||
@@ -592,6 +593,7 @@ protected:
|
|||||||
|
|
||||||
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
auto docBuild = doc[FPSTR(S_BUILD)].to<JsonObject>();
|
||||||
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
docBuild[FPSTR(S_VERSION)] = BUILD_VERSION;
|
||||||
|
docBuild[FPSTR(S_COMMIT)] = BUILD_COMMIT;
|
||||||
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
docBuild[FPSTR(S_DATE)] = __DATE__ " " __TIME__;
|
||||||
docBuild[FPSTR(S_ENV)] = BUILD_ENV;
|
docBuild[FPSTR(S_ENV)] = BUILD_ENV;
|
||||||
docBuild[FPSTR(S_CORE)] = ESP.getCoreVersion();
|
docBuild[FPSTR(S_CORE)] = ESP.getCoreVersion();
|
||||||
|
|||||||
@@ -51,27 +51,23 @@ protected:
|
|||||||
class SensorsTask : public LeanTask {
|
class SensorsTask : public LeanTask {
|
||||||
public:
|
public:
|
||||||
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
SensorsTask(bool _enabled = false, unsigned long _interval = 0) : LeanTask(_enabled, _interval) {
|
||||||
|
this->gpioLastPollingTime.reserve(2);
|
||||||
|
|
||||||
// OneWire
|
// OneWire
|
||||||
this->owInstances.reserve(2);
|
this->owInstances.reserve(2);
|
||||||
this->dallasInstances.reserve(2);
|
this->dallasInstances.reserve(2);
|
||||||
this->dallasSearchTime.reserve(2);
|
this->dallasSearchTime.reserve(2);
|
||||||
this->dallasPolling.reserve(2);
|
this->dallasPolling.reserve(2);
|
||||||
this->dallasLastPollingTime.reserve(2);
|
|
||||||
|
|
||||||
// DHT
|
|
||||||
this->dhtLastPollingTime.reserve(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~SensorsTask() {
|
~SensorsTask() {
|
||||||
|
this->gpioLastPollingTime.clear();
|
||||||
|
|
||||||
// OneWire
|
// OneWire
|
||||||
this->dallasInstances.clear();
|
this->dallasInstances.clear();
|
||||||
this->owInstances.clear();
|
this->owInstances.clear();
|
||||||
this->dallasSearchTime.clear();
|
this->dallasSearchTime.clear();
|
||||||
this->dallasPolling.clear();
|
this->dallasPolling.clear();
|
||||||
this->dallasLastPollingTime.clear();
|
|
||||||
|
|
||||||
// DHT
|
|
||||||
this->dhtLastPollingTime.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -85,17 +81,17 @@ protected:
|
|||||||
const unsigned int bleSetDtInterval = 7200000;
|
const unsigned int bleSetDtInterval = 7200000;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
std::unordered_map<uint8_t, unsigned long> gpioLastPollingTime;
|
||||||
|
|
||||||
// OneWire
|
// OneWire
|
||||||
std::unordered_map<uint8_t, OneWire> owInstances;
|
std::unordered_map<uint8_t, OneWire> owInstances;
|
||||||
std::unordered_map<uint8_t, DallasTemperature> dallasInstances;
|
std::unordered_map<uint8_t, DallasTemperature> dallasInstances;
|
||||||
std::unordered_map<uint8_t, unsigned long> dallasSearchTime;
|
std::unordered_map<uint8_t, unsigned long> dallasSearchTime;
|
||||||
std::unordered_map<uint8_t, bool> dallasPolling;
|
std::unordered_map<uint8_t, bool> dallasPolling;
|
||||||
std::unordered_map<uint8_t, unsigned long> dallasLastPollingTime;
|
|
||||||
|
|
||||||
// DHT
|
// DHT
|
||||||
DHT dhtInstance;
|
DHT dhtInstance;
|
||||||
bool dhtIsPolling = false;
|
bool dhtIsPolling = false;
|
||||||
std::unordered_map<uint8_t, unsigned long> dhtLastPollingTime;
|
|
||||||
|
|
||||||
#if USE_BLE
|
#if USE_BLE
|
||||||
// Bluetooth
|
// Bluetooth
|
||||||
@@ -194,7 +190,7 @@ protected:
|
|||||||
|
|
||||||
this->dallasSearchTime[sSensor.gpio] = 0;
|
this->dallasSearchTime[sSensor.gpio] = 0;
|
||||||
this->dallasPolling[sSensor.gpio] = false;
|
this->dallasPolling[sSensor.gpio] = false;
|
||||||
this->dallasLastPollingTime[sSensor.gpio] = 0;
|
this->gpioLastPollingTime[sSensor.gpio] = 0;
|
||||||
|
|
||||||
auto& instance = this->dallasInstances[sSensor.gpio];
|
auto& instance = this->dallasInstances[sSensor.gpio];
|
||||||
instance.setOneWire(&owInstance);
|
instance.setOneWire(&owInstance);
|
||||||
@@ -229,7 +225,7 @@ protected:
|
|||||||
this->owInstances.erase(gpio);
|
this->owInstances.erase(gpio);
|
||||||
this->dallasSearchTime.erase(gpio);
|
this->dallasSearchTime.erase(gpio);
|
||||||
this->dallasPolling.erase(gpio);
|
this->dallasPolling.erase(gpio);
|
||||||
this->dallasLastPollingTime.erase(gpio);
|
this->gpioLastPollingTime.erase(gpio);
|
||||||
|
|
||||||
Log.sinfoln(FPSTR(L_SENSORS_DALLAS), F("Stopped on GPIO %hhu"), gpio);
|
Log.sinfoln(FPSTR(L_SENSORS_DALLAS), F("Stopped on GPIO %hhu"), gpio);
|
||||||
continue;
|
continue;
|
||||||
@@ -350,7 +346,7 @@ protected:
|
|||||||
|
|
||||||
if (this->dallasPolling[gpio]) {
|
if (this->dallasPolling[gpio]) {
|
||||||
unsigned long minPollingTime = instance.millisToWaitForConversion(12) * 2;
|
unsigned long minPollingTime = instance.millisToWaitForConversion(12) * 2;
|
||||||
unsigned long estimatePollingTime = ts - this->dallasLastPollingTime[gpio];
|
unsigned long estimatePollingTime = ts - this->gpioLastPollingTime[gpio];
|
||||||
|
|
||||||
// check conversion time
|
// check conversion time
|
||||||
// isConversionComplete does not work with chinese clones!
|
// isConversionComplete does not work with chinese clones!
|
||||||
@@ -402,7 +398,7 @@ protected:
|
|||||||
this->dallasPolling[gpio] = false;
|
this->dallasPolling[gpio] = false;
|
||||||
|
|
||||||
} else if (newPolling) {
|
} else if (newPolling) {
|
||||||
auto estimateLastPollingTime = ts - this->dallasLastPollingTime[gpio];
|
auto estimateLastPollingTime = ts - this->gpioLastPollingTime[gpio];
|
||||||
|
|
||||||
// check last polling time
|
// check last polling time
|
||||||
if (estimateLastPollingTime < this->dallasPollingInterval) {
|
if (estimateLastPollingTime < this->dallasPollingInterval) {
|
||||||
@@ -413,7 +409,7 @@ protected:
|
|||||||
instance.setResolution(12);
|
instance.setResolution(12);
|
||||||
instance.requestTemperatures();
|
instance.requestTemperatures();
|
||||||
this->dallasPolling[gpio] = true;
|
this->dallasPolling[gpio] = true;
|
||||||
this->dallasLastPollingTime[gpio] = ts;
|
this->gpioLastPollingTime[gpio] = ts;
|
||||||
|
|
||||||
Log.straceln(FPSTR(L_SENSORS_DALLAS), F("GPIO %hhu, polling..."), gpio);
|
Log.straceln(FPSTR(L_SENSORS_DALLAS), F("GPIO %hhu, polling..."), gpio);
|
||||||
}
|
}
|
||||||
@@ -437,7 +433,7 @@ protected:
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->dhtLastPollingTime.count(sSensor.gpio) && millis() - this->dhtLastPollingTime[sSensor.gpio] < this->dhtPollingInterval) {
|
if (this->gpioLastPollingTime.count(sSensor.gpio) && millis() - this->gpioLastPollingTime[sSensor.gpio] < this->dhtPollingInterval) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +459,7 @@ protected:
|
|||||||
rSensor.signalQuality++;
|
rSensor.signalQuality++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->dhtLastPollingTime[sSensor.gpio] = millis();
|
this->gpioLastPollingTime[sSensor.gpio] = millis();
|
||||||
this->dhtIsPolling = false;
|
this->dhtIsPolling = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -480,18 +476,15 @@ protected:
|
|||||||
rSensor.signalQuality--;
|
rSensor.signalQuality--;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->dhtLastPollingTime[sSensor.gpio] = millis();
|
this->gpioLastPollingTime[sSensor.gpio] = millis();
|
||||||
this->dhtIsPolling = false;
|
this->dhtIsPolling = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
DHT::Type sType;
|
DHT::Type sType = DHT::Type::DHT22;
|
||||||
if (sSensor.type == Sensors::Type::DHT11) {
|
if (sSensor.type == Sensors::Type::DHT11) {
|
||||||
sType = DHT::Type::DHT11;
|
sType = DHT::Type::DHT11;
|
||||||
|
|
||||||
} else if (sSensor.type == Sensors::Type::DHT11) {
|
} else if (sSensor.type == Sensors::Type::DHT22) {
|
||||||
sType = DHT::Type::DHT22;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
sType = DHT::Type::DHT22;
|
sType = DHT::Type::DHT22;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,7 +492,10 @@ protected:
|
|||||||
Log.sinfoln(FPSTR(L_SENSORS_DHT), F("Started on GPIO %hhu"), sSensor.gpio);
|
Log.sinfoln(FPSTR(L_SENSORS_DHT), F("Started on GPIO %hhu"), sSensor.gpio);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Log.swarningln(FPSTR(L_SENSORS_DHT), F("Failed to start on GPIO %hhu"), sSensor.gpio);
|
Log.swarningln(
|
||||||
|
FPSTR(L_SENSORS_DHT), F("Failed to start on GPIO %hhu (err: %s)"),
|
||||||
|
sSensor.gpio, DHT::statusToString(this->dhtInstance.getStatus())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,10 @@
|
|||||||
#define BUILD_VERSION "0.0.0"
|
#define BUILD_VERSION "0.0.0"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUILD_COMMIT
|
||||||
|
#define BUILD_COMMIT "undefined"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef BUILD_ENV
|
#ifndef BUILD_ENV
|
||||||
#define BUILD_ENV "undefined"
|
#define BUILD_ENV "undefined"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
dependencies:
|
|
||||||
idf: ">=5.3.2"
|
|
||||||
h2zero/esp-nimble-cpp: ">=2.2.1"
|
|
||||||
@@ -57,6 +57,7 @@ const char S_CHANNEL[] PROGMEM = "channel";
|
|||||||
const char S_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled";
|
const char S_CH2_ALWAYS_ENABLED[] PROGMEM = "ch2AlwaysEnabled";
|
||||||
const char S_CHIP[] PROGMEM = "chip";
|
const char S_CHIP[] PROGMEM = "chip";
|
||||||
const char S_CODE[] PROGMEM = "code";
|
const char S_CODE[] PROGMEM = "code";
|
||||||
|
const char S_COMMIT[] PROGMEM = "commit";
|
||||||
const char S_CONNECTED[] PROGMEM = "connected";
|
const char S_CONNECTED[] PROGMEM = "connected";
|
||||||
const char S_CONTINUES[] PROGMEM = "continues";
|
const char S_CONTINUES[] PROGMEM = "continues";
|
||||||
const char S_COOLING[] PROGMEM = "cooling";
|
const char S_COOLING[] PROGMEM = "cooling";
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"title": "Build",
|
"title": "Build",
|
||||||
"version": "固件版本",
|
"version": "固件版本",
|
||||||
|
"commit": "Commit",
|
||||||
"date": "日期",
|
"date": "日期",
|
||||||
"core": "内核版本",
|
"core": "内核版本",
|
||||||
"sdk": "SDK"
|
"sdk": "SDK"
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"title": "Build",
|
"title": "Build",
|
||||||
"version": "Version",
|
"version": "Version",
|
||||||
|
"commit": "Commit",
|
||||||
"date": "Date",
|
"date": "Date",
|
||||||
"core": "Core",
|
"core": "Core",
|
||||||
"sdk": "SDK"
|
"sdk": "SDK"
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"title": "Build",
|
"title": "Build",
|
||||||
"version": "Versione",
|
"version": "Versione",
|
||||||
|
"commit": "Commit",
|
||||||
"date": "Data",
|
"date": "Data",
|
||||||
"core": "Core",
|
"core": "Core",
|
||||||
"sdk": "SDK"
|
"sdk": "SDK"
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"title": "Build",
|
"title": "Build",
|
||||||
"version": "Versie",
|
"version": "Versie",
|
||||||
|
"commit": "Commit",
|
||||||
"date": "Datum",
|
"date": "Datum",
|
||||||
"core": "Core",
|
"core": "Core",
|
||||||
"sdk": "SDK"
|
"sdk": "SDK"
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"build": {
|
"build": {
|
||||||
"title": "Билд",
|
"title": "Билд",
|
||||||
"version": "Версия",
|
"version": "Версия",
|
||||||
|
"commit": "Коммит",
|
||||||
"date": "Дата",
|
"date": "Дата",
|
||||||
"core": "Ядро",
|
"core": "Ядро",
|
||||||
"sdk": "SDK"
|
"sdk": "SDK"
|
||||||
|
|||||||
@@ -104,6 +104,7 @@
|
|||||||
<th scope="row" data-i18n>index.system.build.title</th>
|
<th scope="row" data-i18n>index.system.build.title</th>
|
||||||
<td>
|
<td>
|
||||||
Env: <b id="build-env"></b><br />
|
Env: <b id="build-env"></b><br />
|
||||||
|
<span data-i18n>index.system.build.commit</span>: <b id="build-commit"></b><br />
|
||||||
<span data-i18n>index.system.build.date</span>: <b id="build-date"></b><br />
|
<span data-i18n>index.system.build.date</span>: <b id="build-date"></b><br />
|
||||||
<span data-i18n>index.system.build.core</span>: <b id="build-core"></b><br />
|
<span data-i18n>index.system.build.core</span>: <b id="build-core"></b><br />
|
||||||
<span data-i18n>index.system.build.sdk</span>: <b id="build-sdk"></b>
|
<span data-i18n>index.system.build.sdk</span>: <b id="build-sdk"></b>
|
||||||
@@ -206,6 +207,7 @@
|
|||||||
setBusy('#main-busy', '#main-table', false);
|
setBusy('#main-busy', '#main-table', false);
|
||||||
|
|
||||||
setValue('#build-version', result.build.version);
|
setValue('#build-version', result.build.version);
|
||||||
|
setValue('#build-commit', result.build.commit);
|
||||||
setValue('#build-date', result.build.date);
|
setValue('#build-date', result.build.date);
|
||||||
setValue('#build-env', result.build.env);
|
setValue('#build-env', result.build.env);
|
||||||
setValue('#build-core', result.build.core);
|
setValue('#build-core', result.build.core);
|
||||||
|
|||||||
16
tools/add_build_commit.py
Normal file
16
tools/add_build_commit.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import subprocess
|
||||||
|
Import("env")
|
||||||
|
|
||||||
|
try:
|
||||||
|
commit_hash = "undefined"
|
||||||
|
result = subprocess.check_output(
|
||||||
|
["git", "rev-parse", "--short", "HEAD"]
|
||||||
|
)
|
||||||
|
commit_hash = result.decode("utf-8").strip()
|
||||||
|
env.Append(
|
||||||
|
CPPDEFINES=[
|
||||||
|
("BUILD_COMMIT", '\\"{}\\"'.format(commit_hash))
|
||||||
|
]
|
||||||
|
)
|
||||||
|
except Exception as error:
|
||||||
|
print("Failed to get commit hash: {}".format(error))
|
||||||
Reference in New Issue
Block a user