mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Bug Fix for network emits
Originally the address used for the SSID would become inconsistent because of the way the ESP32 uses the string class to store the SSID. This would eventually end in an emit that crashed the socket from the client with an inconsistent UTF-8 byte. The fix was to convert the string to a pointer for the emits.
This commit is contained in:
parent
16e85d5e08
commit
028cce5d8f
7 changed files with 9 additions and 9 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
#ifndef configsettings_h
|
#ifndef configsettings_h
|
||||||
#define configsettings_h
|
#define configsettings_h
|
||||||
|
|
||||||
#define FW_VERSION "v1.2.1"
|
#define FW_VERSION "v1.2.2"
|
||||||
enum DeviceStatus {
|
enum DeviceStatus {
|
||||||
DS_OK = 0,
|
DS_OK = 0,
|
||||||
DS_ERROR = 1,
|
DS_ERROR = 1,
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,9 @@ void Network::loop() {
|
||||||
}
|
}
|
||||||
void Network::emitSockets() {
|
void Network::emitSockets() {
|
||||||
if(WiFi.status() == WL_CONNECTED) {
|
if(WiFi.status() == WL_CONNECTED) {
|
||||||
if(abs(abs(WiFi.RSSI()) - abs(this->lastRSSI)) > 2 || WiFi.channel() != this->lastChannel) {
|
if(abs(abs(WiFi.RSSI()) - abs(this->lastRSSI)) > 1 || WiFi.channel() != this->lastChannel) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
snprintf(buf, sizeof(buf), "{\"ssid\":\"%s\",\"strength\":%d,\"channel\":%d}", WiFi.SSID(), WiFi.RSSI(), WiFi.channel());
|
snprintf(buf, sizeof(buf), "{\"ssid\":\"%s\",\"strength\":%d,\"channel\":%d}", WiFi.SSID().c_str(), WiFi.RSSI(), WiFi.channel());
|
||||||
sockEmit.sendToClients("wifiStrength", buf);
|
sockEmit.sendToClients("wifiStrength", buf);
|
||||||
this->lastRSSI = WiFi.RSSI();
|
this->lastRSSI = WiFi.RSSI();
|
||||||
this->lastChannel = WiFi.channel();
|
this->lastChannel = WiFi.channel();
|
||||||
|
|
@ -73,7 +73,7 @@ void Network::emitSockets() {
|
||||||
void Network::emitSockets(uint8_t num) {
|
void Network::emitSockets(uint8_t num) {
|
||||||
if(WiFi.status() == WL_CONNECTED) {
|
if(WiFi.status() == WL_CONNECTED) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
snprintf(buf, sizeof(buf), "{\"ssid\":\"%s\",\"strength\":%d,\"channel\":%d}", WiFi.SSID(), WiFi.RSSI(), WiFi.channel());
|
snprintf(buf, sizeof(buf), "{\"ssid\":\"%s\",\"strength\":%d,\"channel\":%d}", WiFi.SSID().c_str(), WiFi.RSSI(), WiFi.channel());
|
||||||
sockEmit.sendToClient(num, "wifiStrength", buf);
|
sockEmit.sendToClient(num, "wifiStrength", buf);
|
||||||
this->lastRSSI = WiFi.RSSI();
|
this->lastRSSI = WiFi.RSSI();
|
||||||
this->lastChannel = WiFi.channel();
|
this->lastChannel = WiFi.channel();
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -3,10 +3,10 @@
|
||||||
<head>
|
<head>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="main.css?v=1.2.1" type="text/css" />
|
<link rel="stylesheet" href="main.css?v=1.2.2" type="text/css" />
|
||||||
<link rel="stylesheet" href="icons.css?v=1.2.1" type="text/css" />
|
<link rel="stylesheet" href="icons.css?v=1.2.2" type="text/css" />
|
||||||
<link rel="icon" type="image/png" href="favicon.png" />
|
<link rel="icon" type="image/png" href="favicon.png" />
|
||||||
<script type="text/javascript" src="index.js?v=1.2.1"></script>
|
<script type="text/javascript" src="index.js?v=1.2.2"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="divContainer" class="container" style="user-select:none;position:relative;">
|
<div id="divContainer" class="container" style="user-select:none;position:relative;">
|
||||||
|
|
|
||||||
|
|
@ -328,7 +328,7 @@ async function reopenSocket() {
|
||||||
await initSockets();
|
await initSockets();
|
||||||
}
|
}
|
||||||
class General {
|
class General {
|
||||||
appVersion = 'v1.2.1';
|
appVersion = 'v1.2.2';
|
||||||
reloadApp = false;
|
reloadApp = false;
|
||||||
async init() {
|
async init() {
|
||||||
this.setAppVersion();
|
this.setAppVersion();
|
||||||
|
|
|
||||||
|
|
@ -601,7 +601,7 @@ div.waitoverlay > .lds-roller {
|
||||||
width:100%;
|
width:100%;
|
||||||
background-color:gainsboro;
|
background-color:gainsboro;
|
||||||
color:gray;
|
color:gray;
|
||||||
height:60px;
|
min-height:60px;
|
||||||
top:0px;
|
top:0px;
|
||||||
padding-left:7px;
|
padding-left:7px;
|
||||||
padding-right:7px;
|
padding-right:7px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue