修一下

This commit is contained in:
shentou 2025-12-04 17:58:51 +08:00
parent 9c6684f9a8
commit d9e728e006
2 changed files with 2 additions and 69 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
build/
/build
/.cache

View File

@ -38,79 +38,11 @@
/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
// void frequency_set(uint16_t frequency)
// {
//
// uint16_t perid = 4608000/frequency;
// HRTIM1_TIMA->CMP1xR = 50;
// HRTIM1_TIMA->CMP2xR = perid*0.5f+50;
// HRTIM1_TIMB->CMP1xR = perid*0.5f+50;
// HRTIM1_TIMB->CMP2xR = 50;
// HRTIM1_TIMA->PERxR = perid;
// HRTIM1_TIMB->PERxR = perid;
//
// }
// void inventor_enable()
// {
// HAL_HRTIM_WaveformCounterStart(&hhrtim1,HRTIM_TIMERID_MASTER);
// HAL_HRTIM_WaveformCounterStart(&hhrtim1,HRTIM_TIMERID_TIMER_A);
// HAL_HRTIM_WaveformCounterStart(&hhrtim1,HRTIM_TIMERID_TIMER_B);
// HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TA2);
// HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TB2);
// HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, 1);
// HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, 1);
// }
/* USER CODE END PD */
/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */
// #define WINDOW_SIZE 2000
//
// typedef struct {
// float* buffer;
// uint32_t index;
// float sum;
// uint8_t is_full;
// int size;
// } MovingAverageFilter;
//
// // 初始化
// void MAF_Init(MovingAverageFilter *f)
// {
// for (int i = 0; i < f->size; i++)
// f->buffer[i] = 0.0f;
//
// f->index = 0;
// f->sum = 0.0f;
// f->is_full = 0;
// }
//
// // 输入新数据并返回最新平均值
// float MAF_Update(MovingAverageFilter *f, float new_value)
// {
// if (f->is_full) {
// // 删除最旧值
// f->sum -= f->buffer[f->index];
// }
//
// // 写入新值
// f->buffer[f->index] = new_value;
// f->sum += new_value;
//
// f->index++;
// if (f->index >= f->size) {
// f->index = 0;
// f->is_full = 1; // 表示缓冲区装满了
// }
//
// // 未满时平均值 = sum / 已填入的数量
// if (!f->is_full)
// return f->sum / (float)f->index;
//
// // 满了以后标准滑动平均
// return f->sum / f->size;
// }
/* USER CODE END PM */
/* Private variables ---------------------------------------------------------*/