last_rab_alpha+hysteresis

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
vadyschka01
2026-05-08 15:21:04 +03:00
parent ef940ed92e
commit c4de796f82
20 changed files with 412 additions and 385 deletions
+23 -23
View File
@@ -23,7 +23,7 @@ typedef struct {
} Telemetry_t;
#pragma pack(pop)
// 2. ПРОТОТИПЫ (Чтобы компилятор не ругался)
// 2. ПРОТОТИПЫ
void SystemClock_Config_160MHz(void);
void UART2_Init_921600(void);
void TIM6_Init_1000Hz(void);
@@ -54,31 +54,31 @@ int main(void) {
// В основном цикле while(1) внутри if (imu_flag)
while (1) {
if (imu_flag) {
imu_flag = 0;
IMU_ReadRawData();
DSP_AddSample((float32_t)raw_gx);
pkt.gx = raw_gx;
pkt.filt_gx = (int16_t)filt_gx;
// Заполняем частоты из dsp_manager.c
// extern float active_notch_freqs[3]; // Если компилятор не видит, добавьте в заголовок
pkt.freq1 = (uint16_t)active_notch_freqs[0];
pkt.freq2 = (uint16_t)active_notch_freqs[1];
pkt.freq3 = (uint16_t)active_notch_freqs[2];
while (1) {
if (imu_flag) {
imu_flag = 0;
IMU_ReadRawData();
DSP_AddSample((float32_t)raw_gx);
pkt.gx = raw_gx;
pkt.filt_gx = (int16_t)filt_gx;
// Заполняем частоты из dsp_manager.c
// extern float active_notch_freqs[3]; // Если компилятор не видит, добавьте в заголовок
pkt.freq1 = (uint16_t)active_notch_freqs[0];
pkt.freq2 = (uint16_t)active_notch_freqs[1];
pkt.freq3 = (uint16_t)active_notch_freqs[2];
UART_SendPacket(&pkt);
Set_Motor_Individual(m1_speed, m2_speed, m3_speed, m4_speed);
UART_SendPacket(&pkt);
Set_Motor_Individual(m1_speed, m2_speed, m3_speed, m4_speed);
}
if (dsp_buffer_ready) {
DSP_Process();
}
}
if (dsp_buffer_ready) {
DSP_Process();
}
}
}
// 4. РЕАЛИЗАЦИЯ ФУНКЦИЙ (Тут был провал - их не хватало!)
// 4. РЕАЛИЗАЦИЯ ФУНКЦИЙ
void SystemClock_Config_160MHz(void) {
RCC->CR |= RCC_CR_HSION;