last_rab_alpha

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
vadyschka01
2026-05-07 18:10:42 +03:00
parent e5ca7f608a
commit ef940ed92e
29 changed files with 764 additions and 484 deletions
+29 -17
View File
@@ -11,11 +11,15 @@ volatile uint32_t m2_speed = 900;
volatile uint32_t m3_speed = 900;
volatile uint32_t m4_speed = 900;
// В main.c меняем структуру
#pragma pack(push, 1)
typedef struct {
uint8_t header[2];
int16_t gx;
int16_t filt_gx;
uint8_t header[2]; // 0xAA, 0xBB
int16_t gx; // Сырой гиро
int16_t filt_gx; // Отфильтрованный гиро
uint16_t freq1; // Пик 1 (Гц)
uint16_t freq2; // Пик 2 (Гц)
uint16_t freq3; // Пик 3 (Гц)
} Telemetry_t;
#pragma pack(pop)
@@ -49,22 +53,30 @@ int main(void) {
pkt.header[0] = 0xAA; pkt.header[1] = 0xBB;
while (1) {
if (imu_flag) {
imu_flag = 0;
// В основном цикле 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];
IMU_ReadRawData(); // Теперь она внутри себя вызывает FMAC_Process_Sample
pkt.gx = raw_gx;
pkt.filt_gx = (int16_t)filt_gx; // filt_gx обновится внутри IMU_ReadRawData
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();
}
}
}
// 4. РЕАЛИЗАЦИЯ ФУНКЦИЙ (Тут был провал - их не хватало!)