Skip to content

Commit

Permalink
Updated history
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-bs committed Apr 26, 2024
1 parent 9cc4e1a commit ba1ad59
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
// History:
//
// 20221123 Created
// 20240403 Added reedSwitchState, gpioTrgOutput, controlParameters,
// tempTriggerEvent &humiTriggerEvent
// 20240425 Added device name
//
// To Do:
// -
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// https://github.com/matthias-bs/ATC_MiThermometer
// Mijia lywsd03mmc thermometers are first to be loaded with a custom firmware as per:
// https://pvvx.github.io/ATC_MiThermometer/TelinkMiFlasher.html
//
// 20240425 Added device name

#include "ATC_MiThermometer.h"

Expand Down
11 changes: 7 additions & 4 deletions src/ATC_MiThermometer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
//
// 20221123 Created
// 20221223 Added support for ATC1441 format
// 20240403 Added reedSwitchState, gpioTrgOutput, controlParameters,
// tempTriggerEvent &humiTriggerEvent
// 20240425 Added device name
//
// ToDo:
// -
Expand Down Expand Up @@ -73,12 +76,12 @@ class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks {


// Set up BLE scanning
void ATC_MiThermometer::begin(void)
void ATC_MiThermometer::begin(bool activeScan)
{
NimBLEDevice::init("");
_pBLEScan = BLEDevice::getScan(); //create new scan
_pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
_pBLEScan->setActiveScan(false); //active scan uses more power, but get results faster
_pBLEScan->setActiveScan(activeScan); //active scan uses more power, but get results faster
_pBLEScan->setInterval(100);
_pBLEScan->setFilterPolicy(BLE_HCI_SCAN_FILT_NO_WL);
_pBLEScan->setWindow(99); // less or equal setInterval value
Expand Down Expand Up @@ -133,7 +136,7 @@ unsigned ATC_MiThermometer::getData(uint32_t duration) {
data[n].batt_level = foundDevices.getDevice(i).getServiceData().c_str()[12];

// Count
data[n].count = foundDevices.getDevice(i).getServiceData().c_str()[13];
data[n].count = foundDevices.getDevice(i).getServiceData().c_str()[13];

//Flags
uint8_t flagsByte = foundDevices.getDevice(i).getServiceData().c_str()[14];
Expand Down Expand Up @@ -178,7 +181,7 @@ unsigned ATC_MiThermometer::getData(uint32_t duration) {
return foundDevices.getCount();
}


// Set all array members invalid
void ATC_MiThermometer::resetData(void)
{
Expand Down

0 comments on commit ba1ad59

Please sign in to comment.