上传时间字段
This commit is contained in:
parent
003d96fdca
commit
531ac11c68
17
src/main.cpp
17
src/main.cpp
@ -5,10 +5,10 @@
|
||||
#include <SPI.h>
|
||||
#include <U8g2_for_Adafruit_GFX.h>
|
||||
#include <WiFi.h>
|
||||
#include <math.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/queue.h>
|
||||
#include <freertos/task.h>
|
||||
#include <math.h>
|
||||
#include "ad7606.h"
|
||||
#include "init.h"
|
||||
#include "ui.h"
|
||||
@ -96,8 +96,8 @@ static QueueHandle_t g_sampleQ = nullptr; // 队列元素:int16_t(CH0 原
|
||||
|
||||
// 采样任务:固定频率触发 AD7606 读取,推入队列
|
||||
static void samplerTask(void* param) {
|
||||
// 目标采样率(可按需调高/调低)。示例:1000Hz
|
||||
const TickType_t period = pdMS_TO_TICKS(1);
|
||||
// 目标采样率(可按需调高/调低)。
|
||||
const TickType_t period = pdMS_TO_TICKS(4);
|
||||
TickType_t last = xTaskGetTickCount();
|
||||
for (;;) {
|
||||
int16_t s = ad7606::readCH0();
|
||||
@ -153,9 +153,9 @@ static void postRecording(AppState& s) {
|
||||
}
|
||||
payload += "]";
|
||||
// 附带录制起止时间(毫秒)
|
||||
payload += ",\"startTime\":";
|
||||
payload += ",\"recStartMs\":";
|
||||
payload += String(s.recStartMs);
|
||||
payload += ",\"endTime\":";
|
||||
payload += ",\"recEndMs\":";
|
||||
payload += String(s.recEndMs);
|
||||
if (s.fitReady) {
|
||||
payload += ",\"fit\":{\"a\":";
|
||||
@ -190,10 +190,6 @@ static void postRecording(AppState& s) {
|
||||
}
|
||||
if (ok) {
|
||||
s.statusColor = GREEN;
|
||||
if (idStr.length())
|
||||
snprintf(s.statusMsg, sizeof(s.statusMsg), "上传成功\nID:%s",
|
||||
idStr.c_str());
|
||||
else
|
||||
snprintf(s.statusMsg, sizeof(s.statusMsg), "上传成功");
|
||||
s.statusUntilMs = millis() + 3000;
|
||||
} else {
|
||||
@ -449,7 +445,8 @@ void setup() {
|
||||
// 创建采样队列与任务(将采样放到另一核,降低 UI 阻塞影响)
|
||||
g_sampleQ = xQueueCreate(2048, sizeof(int16_t));
|
||||
// 在 Core 0 上跑采样任务,优先级略高于默认
|
||||
xTaskCreatePinnedToCore(samplerTask, "sampler", 4096, nullptr, 3, nullptr, 0);
|
||||
xTaskCreatePinnedToCore(samplerTask, "sampler", 4096, nullptr, 3, nullptr,
|
||||
0);
|
||||
|
||||
// 清空波形缓存并初始化计时
|
||||
for (int i = 0; i < AppState::GraphW; ++i)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user