Compare commits
3 Commits
575b4bd3f3
...
e0bbca305b
Author | SHA1 | Date |
---|---|---|
Paul Wieland | e0bbca305b | |
Paul Wieland | b7e5b356d7 | |
Paul Wieland | 055a36d68d |
|
@ -32,7 +32,6 @@ namespace ratgdo {
|
||||||
|
|
||||||
static const int CLEAR_PRESENCE = 60000; // how long to keep arriving/leaving active
|
static const int CLEAR_PRESENCE = 60000; // how long to keep arriving/leaving active
|
||||||
static const int PRESENCE_DETECT_WINDOW = 300000; // how long to calculate presence after door state change
|
static const int PRESENCE_DETECT_WINDOW = 300000; // how long to calculate presence after door state change
|
||||||
static const int MIN_DISTANCE = 20; // ignore bugs crawling on the distance sensor
|
|
||||||
|
|
||||||
void RATGDOComponent::setup()
|
void RATGDOComponent::setup()
|
||||||
{
|
{
|
||||||
|
@ -368,9 +367,6 @@ namespace ratgdo {
|
||||||
|
|
||||||
void RATGDOComponent::set_distance_measurement(int16_t distance)
|
void RATGDOComponent::set_distance_measurement(int16_t distance)
|
||||||
{
|
{
|
||||||
if (distance > 0 && distance < MIN_DISTANCE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this->last_distance_measurement = distance;
|
this->last_distance_measurement = distance;
|
||||||
|
|
||||||
// current value = [0], last value = [1]
|
// current value = [0], last value = [1]
|
||||||
|
|
|
@ -6,6 +6,7 @@ namespace esphome {
|
||||||
namespace ratgdo {
|
namespace ratgdo {
|
||||||
|
|
||||||
static const char* const TAG = "ratgdo.sensor";
|
static const char* const TAG = "ratgdo.sensor";
|
||||||
|
static const int MIN_DISTANCE = 100; // ignore bugs crawling on the distance sensor & dust protection film
|
||||||
|
|
||||||
void RATGDOSensor::setup()
|
void RATGDOSensor::setup()
|
||||||
{
|
{
|
||||||
|
@ -91,7 +92,7 @@ namespace ratgdo {
|
||||||
VL53L4CX_TargetRangeData_t *d = &pDistanceData->RangeData[i];
|
VL53L4CX_TargetRangeData_t *d = &pDistanceData->RangeData[i];
|
||||||
if (d->RangeStatus == 0) {
|
if (d->RangeStatus == 0) {
|
||||||
maxDistance = std::max(maxDistance, d->RangeMilliMeter);
|
maxDistance = std::max(maxDistance, d->RangeMilliMeter);
|
||||||
maxDistance = maxDistance <= 25 ? -1 : maxDistance; // ignore the dust protection sticker
|
maxDistance = maxDistance <= MIN_DISTANCE ? -1 : maxDistance;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -255,7 +255,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<esp-web-install-button></esp-web-install-button>
|
<form method="get" action="v32board-esp32/v32board-esp32.ota.bin" id="download_ota_form" style="float: right">
|
||||||
|
<button type="submit" style="padding: 8px 28px; font-size: 14px; border-radius: 4px; color: #fff; background-color: #03a9f4; border: none; box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.12), 0 1px 5px 0 rgba(0,0,0,.2);">Download OTA Firmware</button>
|
||||||
|
</form>
|
||||||
|
<esp-web-install-button></esp-web-install-button>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,6 +313,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setOTAFirmwarePath(url) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', url, true);
|
||||||
|
xhr.responseType = 'json';
|
||||||
|
xhr.onload = function() {
|
||||||
|
var status = xhr.status;
|
||||||
|
if (status === 200) {
|
||||||
|
document.querySelector("#download_ota_form").action = xhr.response.builds[0].ota.path;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
};
|
||||||
|
|
||||||
document.querySelectorAll('div.radios input').forEach((radio) =>
|
document.querySelectorAll('div.radios input').forEach((radio) =>
|
||||||
radio.addEventListener("change", () => {
|
radio.addEventListener("change", () => {
|
||||||
const button = document.querySelector("esp-web-install-button");
|
const button = document.querySelector("esp-web-install-button");
|
||||||
|
@ -337,6 +353,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
button.manifest = `${hardware}${protocol}-manifest.json`;
|
button.manifest = `${hardware}${protocol}-manifest.json`;
|
||||||
|
setOTAFirmwarePath(button.manifest);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue