Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2d82b4bcb8 |
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
ClearESP WindSensors 是基于 ESP32-C3 的 RS485 风速风向传感器采集网关固件,面向现场部署和批量配置使用。
|
||||
|
||||
当前固件版本:`RC1.0.2`
|
||||
当前固件版本:`RC1.0.3`
|
||||
|
||||
主要能力:
|
||||
|
||||
@@ -148,6 +148,20 @@ AP 名称格式:
|
||||
- `<topicPrefix>/<MAC>/sensors`
|
||||
- `<topicPrefix>/<MAC>/realtime`
|
||||
|
||||
### 7. OTA
|
||||
|
||||
云服务页面新增 OTA 卡片,显示以下内容:
|
||||
|
||||
- Gitea 项目地址
|
||||
- 当前版本发布页地址
|
||||
- 当前版本 bin 固件直链
|
||||
|
||||
当前 OTA 来源仓库:
|
||||
|
||||
- `http://107.173.157.41:3000/clear/wind_vt_esp32`
|
||||
|
||||
固件升级可直接使用发布页中的 bin 文件。
|
||||
|
||||
## HTTP API
|
||||
|
||||
所有接口均为只读 JSON。
|
||||
@@ -245,12 +259,13 @@ platformio run -t upload
|
||||
|
||||
## 当前版本更新点
|
||||
|
||||
`RC1.0.2` 包含以下调整:
|
||||
`RC1.0.3` 包含以下调整:
|
||||
|
||||
- 页面标题更新为 `ClearESP WindSensors`
|
||||
- 顶部新增“数字植物实验室”标识
|
||||
- 改址成功提示改为更适合现场使用的话术
|
||||
- 系统状态页新增固件版本显示
|
||||
- 云服务页新增 OTA 卡片与固件下载地址
|
||||
- 系统状态页新增“恢复出厂”和“系统重启”
|
||||
- “清空配置并重新引导”不再误删 STA / MQTT 配置
|
||||
- 针对部分不返回标准写应答的传感器,采用写后读回验证确认站号是否生效
|
||||
+59
-2
@@ -28,7 +28,8 @@ constexpr uint32_t MODBUS_RESPONSE_TIMEOUT_MS = 500;
|
||||
constexpr uint32_t WIFI_RETRY_INTERVAL_MS = 15000;
|
||||
constexpr uint32_t WIFI_CONNECT_TIMEOUT_MS = 20000;
|
||||
constexpr bool ENABLE_BOOT_DIAGNOSTICS = false;
|
||||
constexpr char FIRMWARE_VERSION[] = "RC1.0.2";
|
||||
constexpr char FIRMWARE_VERSION[] = "RC1.0.3";
|
||||
constexpr char OTA_PROJECT_URL[] = "http://107.173.157.41:3000/clear/wind_vt_esp32";
|
||||
constexpr uint16_t MQTT_DEFAULT_PORT = 1883;
|
||||
constexpr uint32_t MQTT_RETRY_INTERVAL_MS = 10000;
|
||||
constexpr uint32_t MQTT_PUBLISH_INTERVAL_MS = 1000;
|
||||
@@ -633,6 +634,13 @@ const char WEB_PAGE[] PROGMEM = R"HTML(
|
||||
<div class="label">上报主题</div>
|
||||
<code class="mono" id="mqttTopics">--</code>
|
||||
</div>
|
||||
<div class="api-card">
|
||||
<div class="label">OTA</div>
|
||||
<div class="subtext">当前固件可直接通过 Gitea 发布页中的 bin 文件进行升级。</div>
|
||||
<code class="mono" id="otaProject">--</code>
|
||||
<code class="mono" id="otaRelease">--</code>
|
||||
<code class="mono" id="otaBin">--</code>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -787,12 +795,34 @@ const char WEB_PAGE[] PROGMEM = R"HTML(
|
||||
].join('');
|
||||
}
|
||||
|
||||
function renderOtaPanel(data) {
|
||||
document.getElementById('otaProject').textContent = `Project: ${data.otaProjectUrl}`;
|
||||
document.getElementById('otaRelease').textContent = `Release: ${data.otaReleaseUrl}`;
|
||||
document.getElementById('otaBin').textContent = `BIN: ${data.otaBinUrl}`;
|
||||
}
|
||||
|
||||
function renderSystemPanel(data) {
|
||||
document.getElementById('systemWrap').innerHTML = [
|
||||
text('AP SSID', data.apSsid),
|
||||
text('AP IP', data.apIp),
|
||||
text('\u56fa\u4ef6\u7248\u672c', data.firmwareVersion),
|
||||
text('STA SSID', data.staSsid || 'NA'),
|
||||
text('STA IP', data.staIp),
|
||||
text('\u5916\u90e8 WiFi \u72b6\u6001', data.staStatus),
|
||||
text('MQTT', data.mqttStatus),
|
||||
text('\u5df2\u914d\u7f6e\u4f20\u611f\u5668', String(data.configuredCount)),
|
||||
text('\u5f53\u524d\u6a21\u5f0f', data.setupComplete ? '\u8fd0\u884c\u4e2d' : '\u5f15\u5bfc\u914d\u7f6e\u4e2d'),
|
||||
text('\u4e0b\u4e00\u76ee\u6807\u7ad9\u53f7', String(data.nextTargetId))
|
||||
].join('');
|
||||
}
|
||||
|
||||
function renderState(data) {
|
||||
renderOverview(data);
|
||||
renderSetup(data);
|
||||
renderWifi(data);
|
||||
renderMqtt(data);
|
||||
renderSystem(data);
|
||||
renderOtaPanel(data);
|
||||
renderSystemPanel(data);
|
||||
document.getElementById('apiBase').textContent = window.location.origin || ('http://' + data.apIp);
|
||||
}
|
||||
|
||||
@@ -1030,6 +1060,26 @@ String modbusResultSummary(const char *label, uint8_t code) {
|
||||
return String(label) + "=" + String(code) + "(" + String(modbusResultText(code)) + ")";
|
||||
}
|
||||
|
||||
String otaReleaseTag() {
|
||||
String tag = FIRMWARE_VERSION;
|
||||
if (tag.startsWith("RC")) {
|
||||
tag.remove(0, 2);
|
||||
}
|
||||
return "v" + tag;
|
||||
}
|
||||
|
||||
String otaAssetName() {
|
||||
return "ClearESP-WindSensors-ESP32C3-" + otaReleaseTag() + ".bin";
|
||||
}
|
||||
|
||||
String otaReleaseUrl() {
|
||||
return String(OTA_PROJECT_URL) + "/releases/tag/" + otaReleaseTag();
|
||||
}
|
||||
|
||||
String otaBinUrl() {
|
||||
return otaReleaseUrl() + "/" + otaAssetName();
|
||||
}
|
||||
|
||||
const char *directionCodeToText(uint16_t code, float angle) {
|
||||
static constexpr const char *kDir8[] = {
|
||||
"N", "NE", "E", "SE", "S", "SW", "W", "NW"};
|
||||
@@ -1723,6 +1773,9 @@ String buildStateJson() {
|
||||
json += "\"mqttStatus\":\"" + jsonEscaped(state.mqttStatus) + "\",";
|
||||
json += "\"mqttHint\":\"" + jsonEscaped(mqttHintText()) + "\",";
|
||||
json += "\"firmwareVersion\":\"" + String(FIRMWARE_VERSION) + "\",";
|
||||
json += "\"otaProjectUrl\":\"" + jsonEscaped(String(OTA_PROJECT_URL)) + "\",";
|
||||
json += "\"otaReleaseUrl\":\"" + jsonEscaped(otaReleaseUrl()) + "\",";
|
||||
json += "\"otaBinUrl\":\"" + jsonEscaped(otaBinUrl()) + "\",";
|
||||
json += "\"configuredCount\":" + String(state.configuredCount) + ",";
|
||||
json += "\"setupComplete\":" + String(state.setupComplete ? "true" : "false") + ",";
|
||||
json += "\"nextTargetId\":" + String(state.configuredCount + 1) + ",";
|
||||
@@ -1810,6 +1863,10 @@ String buildSystemJson() {
|
||||
String json = "{";
|
||||
json += "\"device\":\"ClearESP-Wind\",";
|
||||
json += "\"mac\":\"" + hexMacString() + "\",";
|
||||
json += "\"firmware_version\":\"" + String(FIRMWARE_VERSION) + "\",";
|
||||
json += "\"ota_project_url\":\"" + jsonEscaped(String(OTA_PROJECT_URL)) + "\",";
|
||||
json += "\"ota_release_url\":\"" + jsonEscaped(otaReleaseUrl()) + "\",";
|
||||
json += "\"ota_bin_url\":\"" + jsonEscaped(otaBinUrl()) + "\",";
|
||||
json += "\"uptime_ms\":" + String(millis()) + ",";
|
||||
json += "\"free_heap\":" + String(ESP.getFreeHeap()) + ",";
|
||||
json += "\"configured_sensor_count\":" + String(state.configuredCount) + ",";
|
||||
|
||||
Reference in new issue
Block a user