feat(web,mqtt): add repeater dashboard, MQTT settings, and stabilise HTTPS/TLS startup
Этот коммит содержится в:
@@ -185,6 +185,29 @@ static const char* getWifiStateLabel(wl_status_t status) {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static int getWifiQualityPercent(int rssi_dbm) {
|
||||
if (rssi_dbm <= -100) {
|
||||
return 0;
|
||||
}
|
||||
if (rssi_dbm >= -50) {
|
||||
return 100;
|
||||
}
|
||||
return 2 * (rssi_dbm + 100);
|
||||
}
|
||||
|
||||
static const char* getWifiQualityLabel(int rssi_dbm) {
|
||||
if (rssi_dbm >= -60) {
|
||||
return "excellent";
|
||||
}
|
||||
if (rssi_dbm >= -67) {
|
||||
return "good";
|
||||
}
|
||||
if (rssi_dbm >= -75) {
|
||||
return "fair";
|
||||
}
|
||||
return "poor";
|
||||
}
|
||||
#endif
|
||||
|
||||
void MyMesh::writeOKFrame() {
|
||||
@@ -2049,8 +2072,11 @@ void MyMesh::checkCLIRescueCmd() {
|
||||
if (_prefs.wifi_ssid[0] == 0) {
|
||||
Serial.println(" > ssid:- status:off code:255 state:unconfigured");
|
||||
} else if (status == WL_CONNECTED) {
|
||||
Serial.printf(" > ssid:%s status:connected code:%d state:%s ip:%s\n", _prefs.wifi_ssid,
|
||||
static_cast<int>(status), getWifiStateLabel(status), WiFi.localIP().toString().c_str());
|
||||
const int rssi_dbm = WiFi.RSSI();
|
||||
Serial.printf(" > ssid:%s status:connected code:%d state:%s ip:%s rssi:%d quality:%d%% signal:%s\n",
|
||||
_prefs.wifi_ssid, static_cast<int>(status), getWifiStateLabel(status),
|
||||
WiFi.localIP().toString().c_str(), rssi_dbm, getWifiQualityPercent(rssi_dbm),
|
||||
getWifiQualityLabel(rssi_dbm));
|
||||
} else {
|
||||
const char* overall = (status == WL_IDLE_STATUS) ? "connecting" : "disconnected";
|
||||
Serial.printf(" > ssid:%s status:%s code:%d state:%s\n", _prefs.wifi_ssid, overall,
|
||||
|
||||
@@ -1081,16 +1081,16 @@ void MyMesh::removeNeighbor(const uint8_t *pubkey, int key_len) {
|
||||
#endif
|
||||
}
|
||||
|
||||
void MyMesh::formatStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatCoreStats(reply, board, *_ms, _err_flags, _mgr);
|
||||
void MyMesh::formatStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatCoreStats(reply, reply_size, board, *_ms, _err_flags, _mgr);
|
||||
}
|
||||
|
||||
void MyMesh::formatRadioStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatRadioStats(reply, _radio, radio_driver, getTotalAirTime(), getReceiveAirTime());
|
||||
void MyMesh::formatRadioStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatRadioStats(reply, reply_size, _radio, radio_driver, getTotalAirTime(), getReceiveAirTime());
|
||||
}
|
||||
|
||||
void MyMesh::formatPacketStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatPacketStats(reply, radio_driver, getNumSentFlood(), getNumSentDirect(),
|
||||
void MyMesh::formatPacketStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatPacketStats(reply, reply_size, radio_driver, getNumSentFlood(), getNumSentDirect(),
|
||||
getNumRecvFlood(), getNumRecvDirect());
|
||||
}
|
||||
|
||||
@@ -1439,6 +1439,9 @@ void MyMesh::runWebCommand(const char* command, char* reply, size_t reply_size)
|
||||
matches_exact("start ota") ||
|
||||
matches_exact("get wifi.status") ||
|
||||
matches_exact("get wifi.powersaving") ||
|
||||
matches_exact("stats-core") ||
|
||||
matches_exact("stats-radio") ||
|
||||
matches_exact("stats-packets") ||
|
||||
matches_exact("memory") ||
|
||||
matches_exact("get mqtt.iata") ||
|
||||
matches_exact("get mqtt.owner") ||
|
||||
|
||||
@@ -212,9 +212,9 @@ public:
|
||||
void setTxPower(int8_t power_dbm) override;
|
||||
void formatNeighborsReply(char *reply) override;
|
||||
void removeNeighbor(const uint8_t* pubkey, int key_len) override;
|
||||
void formatStatsReply(char *reply) override;
|
||||
void formatRadioStatsReply(char *reply) override;
|
||||
void formatPacketStatsReply(char *reply) override;
|
||||
void formatStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatRadioStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatPacketStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatMemoryReply(char *reply, size_t reply_size) override;
|
||||
|
||||
mesh::LocalIdentity& getSelfId() override { return self_id; }
|
||||
|
||||
@@ -750,16 +750,16 @@ void MyMesh::clearStats() {
|
||||
((SimpleMeshTables *)getTables())->resetStats();
|
||||
}
|
||||
|
||||
void MyMesh::formatStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatCoreStats(reply, board, *_ms, _err_flags, _mgr);
|
||||
void MyMesh::formatStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatCoreStats(reply, reply_size, board, *_ms, _err_flags, _mgr);
|
||||
}
|
||||
|
||||
void MyMesh::formatRadioStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatRadioStats(reply, _radio, radio_driver, getTotalAirTime(), getReceiveAirTime());
|
||||
void MyMesh::formatRadioStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatRadioStats(reply, reply_size, _radio, radio_driver, getTotalAirTime(), getReceiveAirTime());
|
||||
}
|
||||
|
||||
void MyMesh::formatPacketStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatPacketStats(reply, radio_driver, getNumSentFlood(), getNumSentDirect(),
|
||||
void MyMesh::formatPacketStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatPacketStats(reply, reply_size, radio_driver, getNumSentFlood(), getNumSentDirect(),
|
||||
getNumRecvFlood(), getNumRecvDirect());
|
||||
}
|
||||
|
||||
|
||||
@@ -193,9 +193,9 @@ public:
|
||||
void formatNeighborsReply(char *reply) override {
|
||||
strcpy(reply, "not supported");
|
||||
}
|
||||
void formatStatsReply(char *reply) override;
|
||||
void formatRadioStatsReply(char *reply) override;
|
||||
void formatPacketStatsReply(char *reply) override;
|
||||
void formatStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatRadioStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatPacketStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatMemoryReply(char *reply, size_t reply_size) override;
|
||||
|
||||
mesh::LocalIdentity& getSelfId() override { return self_id; }
|
||||
|
||||
@@ -820,16 +820,16 @@ void SensorMesh::setTxPower(int8_t power_dbm) {
|
||||
radio_set_tx_power(power_dbm);
|
||||
}
|
||||
|
||||
void SensorMesh::formatStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatCoreStats(reply, board, *_ms, _err_flags, _mgr);
|
||||
void SensorMesh::formatStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatCoreStats(reply, reply_size, board, *_ms, _err_flags, _mgr);
|
||||
}
|
||||
|
||||
void SensorMesh::formatRadioStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatRadioStats(reply, _radio, radio_driver, getTotalAirTime(), getReceiveAirTime());
|
||||
void SensorMesh::formatRadioStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatRadioStats(reply, reply_size, _radio, radio_driver, getTotalAirTime(), getReceiveAirTime());
|
||||
}
|
||||
|
||||
void SensorMesh::formatPacketStatsReply(char *reply) {
|
||||
StatsFormatHelper::formatPacketStats(reply, radio_driver, getNumSentFlood(), getNumSentDirect(),
|
||||
void SensorMesh::formatPacketStatsReply(char *reply, size_t reply_size) {
|
||||
StatsFormatHelper::formatPacketStats(reply, reply_size, radio_driver, getNumSentFlood(), getNumSentDirect(),
|
||||
getNumRecvFlood(), getNumRecvDirect());
|
||||
}
|
||||
|
||||
|
||||
@@ -70,9 +70,9 @@ public:
|
||||
void formatNeighborsReply(char *reply) override {
|
||||
strcpy(reply, "not supported");
|
||||
}
|
||||
void formatStatsReply(char *reply) override;
|
||||
void formatRadioStatsReply(char *reply) override;
|
||||
void formatPacketStatsReply(char *reply) override;
|
||||
void formatStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatRadioStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatPacketStatsReply(char *reply, size_t reply_size) override;
|
||||
void formatMemoryReply(char *reply, size_t reply_size) override;
|
||||
mesh::LocalIdentity& getSelfId() override { return self_id; }
|
||||
void saveIdentity(const mesh::LocalIdentity& new_id) override;
|
||||
|
||||
Ссылка в новой задаче
Block a user