diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index db61b23..a4a5c63 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -62,7 +62,7 @@ jobs: | ps -p "$$" arduino-cli lib install NimBLE-Arduino@1.4.1 - arduino-cli lib install ATC_MiThermometer@0.3.1 + arduino-cli lib install ATC_MiThermometer@0.4.1 - name: Install platform if: ${{ env.run-build == 'true' }} diff --git a/examples/ATC_MiThermometer_Client/ATC_MiThermometer_Client.ino b/examples/ATC_MiThermometer_Client/ATC_MiThermometer_Client.ino index e626278..a79e18c 100644 --- a/examples/ATC_MiThermometer_Client/ATC_MiThermometer_Client.ino +++ b/examples/ATC_MiThermometer_Client/ATC_MiThermometer_Client.ino @@ -81,6 +81,7 @@ void loop() { if (miThermometer.data[i].valid) { Serial.println(); Serial.printf("Sensor %d: %s\n", i, knownBLEAddresses[i].c_str()); + Serial.printf("Name: %s\n", miThermometer.data[i].name.c_str()); Serial.printf("%.2f°C\n", miThermometer.data[i].temperature/100.0); Serial.printf("%.2f%%\n", miThermometer.data[i].humidity/100.0); Serial.printf("%.3fV\n", miThermometer.data[i].batt_voltage/1000.0); diff --git a/examples/ATC_MiThermometer_Nonblocking/ATC_MiThermometer_Nonblocking.ino b/examples/ATC_MiThermometer_Nonblocking/ATC_MiThermometer_Nonblocking.ino index 2b371d6..7b84d9f 100644 --- a/examples/ATC_MiThermometer_Nonblocking/ATC_MiThermometer_Nonblocking.ino +++ b/examples/ATC_MiThermometer_Nonblocking/ATC_MiThermometer_Nonblocking.ino @@ -13,7 +13,7 @@ #endif // List of known sensors' BLE addresses -std::vector knownBLEAddresses = {"a4:c1:38:02:8B:E0", "a4:c1:38:64:8F:10", "a4:c1:38:F3:C1:B4"}; +std::vector knownBLEAddresses = {"a4:c1:38:b8:1f:7f", "a4:c1:38:02:8B:E0", "a4:c1:38:64:8F:10", "a4:c1:38:F3:C1:B4"}; ATC_MiThermometer miTh(knownBLEAddresses); MiThData_S miThData[3]; @@ -44,6 +44,7 @@ void loop() { if (miThDat.valid) { count++; Serial.printf("sensor #%d -> ", i); + Serial.printf("name: %s ; ", miThDat.name.c_str()); Serial.printf("temperature: %.2fC ; ", miThDat.temperature *0.01f ); Serial.printf("humidity: %.2f%% ; ", miThDat.humidity *0.01f ); Serial.printf("voltage: %.3fV ; ", miThDat.batt_voltage*0.001f); diff --git a/library.properties b/library.properties index cc339b6..0b3d244 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ATC_MiThermometer -version=0.3.1 +version=0.4.1 author=Matthias Prinke maintainer=Matthias Prinke sentence=Arduino library for BLE ATC_MiThermometer thermometer/hygrometer sensors. diff --git a/src/ATC_MiThermometer.cpp b/src/ATC_MiThermometer.cpp index 17e8638..abdbfee 100644 --- a/src/ATC_MiThermometer.cpp +++ b/src/ATC_MiThermometer.cpp @@ -96,6 +96,8 @@ unsigned ATC_MiThermometer::getData(uint32_t duration) { log_d("Assigning scan results..."); for (unsigned i=0; i #include +#include // MiThermometer data struct / type struct MiThData_S { bool valid; //!< data valid + std::string name; //!< BT device name int16_t temperature; //!< temperature x 100°C uint16_t humidity; //!< humidity x 100% uint16_t batt_voltage; //!< battery voltage [mv]