parent
36398c2078
commit
2353f938f0
|
@ -30,7 +30,7 @@ build_flags =
|
|||
-Wformat-truncation
|
||||
-D CONFIG_BT_NIMBLE_TASK_STACK_SIZE=4096
|
||||
-D SCAN_TASK_STACK_SIZE=2096
|
||||
-D REPORT_TASK_STACK_SIZE=3277
|
||||
-D ARDUINO_LOOP_STACK_SIZE=4096
|
||||
-D MQTT_MIN_FREE_MEMORY=12192
|
||||
-D CONFIG_ASYNC_TCP_USE_WDT=0
|
||||
-D CONFIG_BT_NIMBLE_MSYS1_BLOCK_COUNT=20
|
||||
|
@ -54,7 +54,7 @@ lib_deps =
|
|||
kitesurfer1404/WS2812FX@^1.4.1
|
||||
|
||||
[esp32]
|
||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.4/platform-espressif32-2.0.4.zip
|
||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.02.00/platform-espressif32.zip
|
||||
platform_packages =
|
||||
debug_tool = esp-prog
|
||||
framework = ${common.framework}
|
||||
|
@ -97,6 +97,7 @@ lib_deps =
|
|||
sensirion/arduino-sht@^1.2.2
|
||||
|
||||
[env:esp32]
|
||||
extends = esp32
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
framework = ${esp32.framework}
|
||||
|
@ -115,6 +116,7 @@ build_flags =
|
|||
${esp32.build_flags}
|
||||
|
||||
[env:esp32c3]
|
||||
extends = esp32c3
|
||||
platform = ${esp32c3.platform}
|
||||
platform_packages = ${esp32c3.platform_packages}
|
||||
framework = ${esp32c3.framework}
|
||||
|
@ -134,6 +136,7 @@ build_flags =
|
|||
${esp32c3.build_flags}
|
||||
|
||||
[env:esp32-verbose]
|
||||
extends = esp32
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
framework = ${esp32.framework}
|
||||
|
@ -154,6 +157,7 @@ build_flags =
|
|||
${esp32.build_flags}
|
||||
|
||||
[env:esp32c3-verbose]
|
||||
extends = esp32c3
|
||||
platform = ${esp32c3.platform}
|
||||
platform_packages = ${esp32c3.platform_packages}
|
||||
framework = ${esp32c3.framework}
|
||||
|
@ -174,6 +178,7 @@ build_flags =
|
|||
${esp32c3.build_flags}
|
||||
|
||||
[env:m5stickc]
|
||||
extends = esp32
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
framework = ${esp32.framework}
|
||||
|
@ -195,6 +200,7 @@ build_flags =
|
|||
${esp32.build_flags}
|
||||
|
||||
[env:m5stickc-plus]
|
||||
extends = esp32
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
framework = ${esp32.framework}
|
||||
|
@ -217,6 +223,7 @@ build_flags =
|
|||
${esp32.build_flags}
|
||||
|
||||
[env:m5atom]
|
||||
extends = esp32
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
framework = ${esp32.framework}
|
||||
|
@ -236,6 +243,7 @@ build_flags =
|
|||
${esp32.build_flags}
|
||||
|
||||
[env:macchina-a0]
|
||||
extends = esp32
|
||||
platform = ${esp32.platform}
|
||||
platform_packages = ${esp32.platform_packages}
|
||||
framework = ${esp32.framework}
|
||||
|
|
59
src/main.cpp
59
src/main.cpp
|
@ -80,7 +80,7 @@ bool sendTelemetry(unsigned int totalSeen, unsigned int totalFpSeen, int unsigne
|
|||
|
||||
#ifdef VERSION
|
||||
doc["ver"] = String(VERSION);
|
||||
# else
|
||||
#else
|
||||
doc["ver"] = ESP.getSketchMD5();
|
||||
#endif
|
||||
|
||||
|
@ -104,7 +104,6 @@ bool sendTelemetry(unsigned int totalSeen, unsigned int totalFpSeen, int unsigne
|
|||
doc["maxAllocHeap"] = maxHeap;
|
||||
doc["memFrag"] = 100 - (maxHeap * 100.0 / freeHeap);
|
||||
doc["scanHighWater"] = uxTaskGetStackHighWaterMark(scanTaskHandle);
|
||||
doc["reportHighWater"] = uxTaskGetStackHighWaterMark(reportTaskHandle);
|
||||
|
||||
serializeJson(doc, buffer);
|
||||
if (pub(teleTopic.c_str(), 0, false, buffer)) return true;
|
||||
|
@ -402,40 +401,41 @@ unsigned int totalFpSeen = 0;
|
|||
unsigned int totalFpQueried = 0;
|
||||
unsigned int totalFpReported = 0;
|
||||
|
||||
void reportTask(void *parameter) {
|
||||
void reportSetup() {
|
||||
connectToMqtt();
|
||||
}
|
||||
|
||||
while (true) {
|
||||
while (!mqttClient.connected())
|
||||
delay(1000);
|
||||
void reportLoop() {
|
||||
if (!mqttClient.connected()) {
|
||||
return;
|
||||
}
|
||||
|
||||
yield();
|
||||
auto copy = BleFingerprintCollection::GetCopy();
|
||||
yield();
|
||||
auto copy = BleFingerprintCollection::GetCopy();
|
||||
|
||||
unsigned int count = 0;
|
||||
for (auto &i : copy)
|
||||
if (i->shouldCount())
|
||||
count++;
|
||||
unsigned int count = 0;
|
||||
for (auto &i : copy)
|
||||
if (i->shouldCount())
|
||||
count++;
|
||||
|
||||
GUI::Count(count);
|
||||
GUI::Count(count);
|
||||
|
||||
yield();
|
||||
sendTelemetry(totalSeen, totalFpSeen, totalFpQueried, totalFpReported, count);
|
||||
yield();
|
||||
yield();
|
||||
sendTelemetry(totalSeen, totalFpSeen, totalFpQueried, totalFpReported, count);
|
||||
yield();
|
||||
|
||||
auto reported = 0;
|
||||
for (auto &f : copy) {
|
||||
auto seen = f->getSeenCount();
|
||||
if (seen) {
|
||||
totalSeen += seen;
|
||||
totalFpSeen++;
|
||||
}
|
||||
if (reportDevice(f)) {
|
||||
totalFpReported++;
|
||||
reported++;
|
||||
}
|
||||
yield();
|
||||
auto reported = 0;
|
||||
for (auto &f : copy) {
|
||||
auto seen = f->getSeenCount();
|
||||
if (seen) {
|
||||
totalSeen += seen;
|
||||
totalFpSeen++;
|
||||
}
|
||||
if (reportDevice(f)) {
|
||||
totalFpReported++;
|
||||
reported++;
|
||||
}
|
||||
yield();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -520,10 +520,11 @@ void setup() {
|
|||
HX711::Setup();
|
||||
#endif
|
||||
xTaskCreatePinnedToCore(scanTask, "scanTask", SCAN_TASK_STACK_SIZE, nullptr, 1, &scanTaskHandle, CONFIG_BT_NIMBLE_PINNED_TO_CORE);
|
||||
xTaskCreatePinnedToCore(reportTask, "reportTask", REPORT_TASK_STACK_SIZE, nullptr, 1, &reportTaskHandle, REPORT_PINNED_TO_CORE);
|
||||
reportSetup();
|
||||
}
|
||||
|
||||
void loop() {
|
||||
reportLoop();
|
||||
static unsigned long lastSlowLoop = 0;
|
||||
if (millis() - lastSlowLoop > 5000) {
|
||||
lastSlowLoop = millis();
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#endif
|
||||
|
||||
TimerHandle_t reconnectTimer;
|
||||
TaskHandle_t scanTaskHandle, reportTaskHandle;
|
||||
TaskHandle_t scanTaskHandle;
|
||||
|
||||
unsigned long updateStartedMillis = 0;
|
||||
unsigned long lastTeleMillis = 0;
|
||||
|
|
Loading…
Reference in New Issue