feat: add mqtt client version to repeater app and cli
This commit is contained in:
@@ -12,7 +12,11 @@
|
||||
|
||||
bool ESP32Board::startOTAUpdate(const char* id, char reply[]) {
|
||||
inhibit_sleep = true; // prevent sleep during OTA
|
||||
WiFi.softAP("MeshCore-OTA", NULL);
|
||||
WiFi.mode(WIFI_AP_STA);
|
||||
if (!WiFi.softAP("MeshCore-OTA", NULL)) {
|
||||
strcpy(reply, "Error - OTA AP start failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
sprintf(reply, "Started: http://%s/update", WiFi.softAPIP().toString().c_str());
|
||||
MESH_DEBUG_PRINTLN("startOTAUpdate: %s", reply);
|
||||
@@ -22,7 +26,12 @@ bool ESP32Board::startOTAUpdate(const char* id, char reply[]) {
|
||||
static char home_buf[90];
|
||||
sprintf(home_buf, "<H2>Hi! I am a MeshCore Repeater. ID: %s</H2>", id);
|
||||
|
||||
AsyncWebServer* server = new AsyncWebServer(80);
|
||||
static AsyncWebServer* server = nullptr;
|
||||
if (server != nullptr) {
|
||||
delete server;
|
||||
server = nullptr;
|
||||
}
|
||||
server = new AsyncWebServer(80);
|
||||
|
||||
server->on("/", HTTP_GET, [](AsyncWebServerRequest *request) {
|
||||
request->send(200, "text/html", home_buf);
|
||||
|
||||
@@ -116,6 +116,10 @@ MQTTUplink::MQTTUplink(mesh::RTCClock& rtc, mesh::LocalIdentity& identity)
|
||||
MQTT_LOG("uplink init");
|
||||
}
|
||||
|
||||
const char* MQTTUplink::getClientVersion() const {
|
||||
return CLIENT_VERSION;
|
||||
}
|
||||
|
||||
bool MQTTUplink::savePrefs() {
|
||||
return MQTTPrefsStore::save(_fs, _prefs);
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
bool isTxEnabled() const { return _prefs.tx_enabled != 0; }
|
||||
bool setIata(const char* iata);
|
||||
const char* getIata() const { return _prefs.iata; }
|
||||
const char* getClientVersion() const;
|
||||
void setNodeNameSource(const char* node_name) { _node_name = node_name; }
|
||||
bool setOwnerPublicKey(const char* owner_public_key);
|
||||
const char* getOwnerPublicKey() const { return _prefs.owner_public_key; }
|
||||
|
||||
@@ -576,6 +576,7 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(
|
||||
<span class="label">MQTT</span>
|
||||
<div class="quick">
|
||||
<button data-cmd="get mqtt.status">mqtt.status</button>
|
||||
<button data-cmd="get mqtt.client_version">mqtt.client_version</button>
|
||||
<button data-cmd="get mqtt.iata">mqtt.iata</button>
|
||||
<button data-cmd="get mqtt.owner">mqtt.owner</button>
|
||||
<button data-cmd="get mqtt.email">mqtt.email</button>
|
||||
@@ -599,18 +600,15 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(
|
||||
<div class="stack">
|
||||
<div class="row">
|
||||
<div class="field-card">
|
||||
<label class="label" for="roleValue">Role</label>
|
||||
<label class="label" for="versionValue">Version</label>
|
||||
<div class="fieldline">
|
||||
<input id="roleValue" readonly disabled>
|
||||
<span class="placeholder-slot" aria-hidden="true"></span>
|
||||
<input id="versionValue" readonly disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-card">
|
||||
<label class="label" for="clockUtc">Clock UTC</label>
|
||||
<div class="inline-actions">
|
||||
<input id="clockUtc" readonly disabled>
|
||||
<button class="iconbtn" data-load-cmd="clock" data-load-input="clockUtc" title="Refresh clock UTC">↻</button>
|
||||
<button id="syncClockBtn" class="savebtn">Sync</button>
|
||||
<label class="label" for="clientVersionValue">Client Version</label>
|
||||
<div class="fieldline">
|
||||
<input id="clientVersionValue" readonly disabled>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -629,12 +627,22 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(
|
||||
<div class="stack">
|
||||
<div class="section-group">
|
||||
<h3>Repeater Settings</h3>
|
||||
<div class="field-card">
|
||||
<label class="label" for="nodeName">Device Name</label>
|
||||
<div class="inline-actions">
|
||||
<input id="nodeName" placeholder="MeshCore-HOWL">
|
||||
<button class="iconbtn" data-load-cmd="get name" data-load-input="nodeName" title="Refresh device name">↻</button>
|
||||
<button class="savebtn" data-prefix="set name " data-input="nodeName">Save</button>
|
||||
<div class="row">
|
||||
<div class="field-card">
|
||||
<label class="label" for="nodeName">Device Name</label>
|
||||
<div class="inline-actions">
|
||||
<input id="nodeName" placeholder="MeshCore-HOWL">
|
||||
<button class="iconbtn" data-load-cmd="get name" data-load-input="nodeName" title="Refresh device name">↻</button>
|
||||
<button class="savebtn" data-prefix="set name " data-input="nodeName">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-card">
|
||||
<label class="label" for="clockUtc">Clock UTC</label>
|
||||
<div class="inline-actions">
|
||||
<input id="clockUtc" readonly disabled>
|
||||
<button class="iconbtn" data-load-cmd="clock" data-load-input="clockUtc" title="Refresh clock UTC">↻</button>
|
||||
<button id="syncClockBtn" class="savebtn">Sync</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -2531,7 +2539,8 @@ const char kWebPanelAppHtml[] PROGMEM = R"HTML(
|
||||
const quiet = { recordHistory:false, updateInput:false };
|
||||
try {
|
||||
await loadSection("Loading info...", [
|
||||
() => loadField("get role", "roleValue", null, quiet),
|
||||
() => loadField("ver", "versionValue", null, quiet),
|
||||
() => loadField("get mqtt.client_version", "clientVersionValue", null, quiet),
|
||||
() => loadField("clock", "clockUtc", null, quiet),
|
||||
() => loadField("get public.key", "publicKey", "uppercase", quiet)
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user