refactor feedback, update telemetry report

This commit is contained in:
2026-08-28 10:44:56 -07:00
parent 9d66ee6ab8
commit 93a20cf8e1
3 changed files with 211 additions and 171 deletions
+9 -15
View File
@@ -99,9 +99,8 @@ pub struct AudioTelemetrySnapshot {
pub dac_underflow_count: u16,
pub usb_underflow_count: u16,
pub dac_overflow_count: u16,
pub p: i32,
pub i: i32,
pub fb: i32,
pub cur_rate: u32,
pub fb_rate_estimate: f32,
}
pub mod hid {
@@ -123,10 +122,8 @@ pub mod hid {
dac_underflow_count=input;
usb_underflow_count=input;
dac_overflow_count=input;
p=input;
i=input;
fb=input;
integrator=input;
cur_rate=input;
fb_rate_estimate=input;
}
)]
#[repr(C, packed)]
@@ -138,10 +135,8 @@ pub mod hid {
pub dac_underflow_count: u16,
pub usb_underflow_count: u16,
pub dac_overflow_count: u16,
pub p: i32,
pub i: i32,
pub fb: i32,
pub integrator: i32,
pub cur_rate: i32,
pub fb_rate_estimate: i32,
}
impl From<AudioTelemetryReport> for AudioTelemetrySnapshot {
@@ -149,13 +144,12 @@ pub mod hid {
AudioTelemetrySnapshot {
state: AudioState::try_from(value.state).expect("Invalid AudioState"),
average_buffer_fill: value.average_buffer_fill,
frame_count: i32::cast_unsigned(value.frame_count), // on firmware side is usize == u32
frame_count: value.frame_count.cast_unsigned(), // on firmware side is usize == u32
dac_underflow_count: value.dac_underflow_count,
usb_underflow_count: value.usb_underflow_count,
dac_overflow_count: value.dac_overflow_count,
p: value.p,
i: value.i,
fb: value.fb,
cur_rate: value.cur_rate.cast_unsigned(),
fb_rate_estimate: (value.fb_rate_estimate as f32),
}
}
}