fix(native-usb): prevent transmit-bank starvation and retain battery telemetry

This commit is contained in:
Joey Yakimowich-Payne 2026-09-13 21:00:17 -06:00
commit a699a6920b
16 changed files with 342 additions and 82 deletions

View file

@ -143,9 +143,10 @@ int main() {
source.accel_valid = source.gyro_valid = true;
source.accel_q13[1] = 8192; // SDL up -> virtual native rail-down +X.
memcpy(source.gyro_q10, bias_q10, sizeof(bias_q10));
source.battery = 128;
assert(poll());
assert(controls.active && packet[15] == 30); // Wii IMU starts before background bias learning.
assert(packet[1] == 0x01); // USB power, no fabricated charge level or charging state.
assert(packet[1] == 0x15); // Measured half battery, USB powered, not charging.
for (unsigned i = 1; i < 450; ++i) assert(poll());
assert(controls.active && packet[15] == 30 && packet[19] == 0x0c);
assert(signed32(packet+32) == (1 << 28));