GithubHelp home page GithubHelp logo

esp32-mqtt-bluetooth-monitor's People

Contributors

robomagus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

esp32-mqtt-bluetooth-monitor's Issues

Cannot respond to mqtt arrive/depart scan commands

运行时,网页端发出扫描命令,本程序能响应,并进行扫描工作,但是不响应mqtt扫描命令。查看mqtt服务器端,发现与monitor脚本相比,很长时间中mqtt连接次数有限,不知道是不是mqtt的问题。我使用树莓派安装monitor脚本,在mqtt服务器日志中查看到的信息显示脚本很频繁地以不同客户端名称连接/断开mqtt(192.168.1.54),但是在ESP32这个固件中,连接很少(192.168.1.166).下面是谷歌翻译的英文:
Sorry i'm not proficient in english,The following is translated by Google:When it is running, the web page sends out a scan command, the program can respond and scan, but it does not respond to the mqtt scan command. Looking at the mqtt server side, it is found that compared with the monitor script, the number of mqtt connections is limited for a long time. I don't know if it is a problem with mqtt. I found in the log of the mqtt server using the Raspberry Pi to install the monitor script. The script frequently connects/disconnects mqtt with different client names, but in the ESP32 firmware, the connection Rarely .

Formula for confidence calculation always return 0

Noticed that the confidence value is never reported as anything else than 100 or 0

So started comparing the formula to the original monitor script trying to understand what the intended behavior really was.

There it looks like like this:

$(echo "scale=1; ($repetitions - $repetition + 1) / $repetitions * 90" | bc )

So for example doing that calculation for 3 repetitions would give you this:

(3 - 1 + 1) / 3 * 90 => 3 / 3 * 90 => 1   * 90 => 90.0
(3 - 2 + 1) / 3 * 90 => 2 / 3 * 90 => 0.6 * 90 => 54.0
(3 - 3 + 1) / 3 * 90 => 1 / 3 * 90 => 0.3 * 90 => 27.0

The odd part is the scale=1; that basically drops precision to just 1 decimal 🤔

Only confirmed this by running echo "scale=1; (3 - 3 + 1) / 3 * 90" | bc manually.
Not sure if there is any real intention behind using bc this way, or of it's just a fast way to get a reasonably good result in a shell script.

Based on that it looks like the formula is a bit wrong now:

uint8_t confidence = min(100.0f, float(dev.scansLeft) / (num_departure_scans*90.0f));

Changing it to this:

min(100.0f, float(dev.scansLeft + 1) / float(num_departure_scans) * 90.0f)); 

Yields somewhat the same result as the original script.

(2 + 1) / 3 * 90 => 3.0 / 3.0 * 90 => 1        * 90 => 90.0
(1 + 1) / 3 * 90 => 2.0 / 3.0 * 90 => 0.666... * 90 => 60.0
(0 + 1) / 3 * 90 => 1.0 / 3.0 * 90 => 0.333... * 90 => 30.0

(The last run is naturally dropped to 0 but the corresponding calculation would have been 30)

Other than that I can confirm that things run quite nicely on a AZ-Delivery devkit board 👍

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.