Merge branch 'main' of https://git.xn--876a.net/feie9454/nano-force-esp32-neo
This commit is contained in:
commit
3d9e7e7b2f
@ -5,10 +5,10 @@
|
|||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <U8g2_for_Adafruit_GFX.h>
|
#include <U8g2_for_Adafruit_GFX.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <math.h>
|
|
||||||
#include <freertos/FreeRTOS.h>
|
#include <freertos/FreeRTOS.h>
|
||||||
#include <freertos/queue.h>
|
#include <freertos/queue.h>
|
||||||
#include <freertos/task.h>
|
#include <freertos/task.h>
|
||||||
|
#include <math.h>
|
||||||
#include "ad7606.h"
|
#include "ad7606.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "ui.h"
|
#include "ui.h"
|
||||||
@ -99,8 +99,8 @@ static QueueHandle_t g_sampleQ = nullptr; // 队列元素:int16_t(CH0 原
|
|||||||
|
|
||||||
// 采样任务:固定频率触发 AD7606 读取,推入队列
|
// 采样任务:固定频率触发 AD7606 读取,推入队列
|
||||||
static void samplerTask(void* param) {
|
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();
|
TickType_t last = xTaskGetTickCount();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int16_t s = ad7606::readCH0();
|
int16_t s = ad7606::readCH0();
|
||||||
@ -471,7 +471,8 @@ void setup() {
|
|||||||
// 创建采样队列与任务(将采样放到另一核,降低 UI 阻塞影响)
|
// 创建采样队列与任务(将采样放到另一核,降低 UI 阻塞影响)
|
||||||
g_sampleQ = xQueueCreate(2048, sizeof(int16_t));
|
g_sampleQ = xQueueCreate(2048, sizeof(int16_t));
|
||||||
// 在 Core 0 上跑采样任务,优先级略高于默认
|
// 在 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)
|
for (int i = 0; i < AppState::GraphW; ++i)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user