#define main historical_tests_main
#include "test_drill_smo.c"
#undef main
static void probe(float dt, bool expand_profile) {
 drill_smo_config c=config();if(expand_profile)c.max_dt_s=dt;
 drill_smo_state s;assert(drill_smo_init(&s,&c));
 float theta=0.7f;const float speed=20525.0f;drill_smo_output o={0};
 unsigned completed=0;bool rejected=false;
 for(unsigned n=0;n<150000u;++n){
  /* Same waveform family, independent libm sine/cosine generator. */
  const float ea=-speed*0.00030f*sinf(theta),eb=speed*0.00030f*cosf(theta);
  drill_smo_input i={.voltage_alpha_v=c.phase_resistance_ohm*0.20f+ea,.voltage_beta_v=c.phase_resistance_ohm*(-0.10f)+eb,.current_alpha_a=0.20f,.current_beta_a=-0.10f,.dt_s=dt,.commanded_direction=1};
  if(!drill_smo_step(&s,&i,&o)){rejected=true;break;}
  ++completed;theta=wrap_pi_test(theta+speed*dt);
 }
 printf("PROBE dt_us=%.3f expanded_profile=%d completed=%u rejected=%d initialized=%d rpm=%.6f angle_error_rad=%.6f locked=%d valid=%d\n",dt*1e6f,expand_profile,completed,rejected,s.initialized,o.mechanical_speed_rpm,wrap_pi_test(o.electrical_angle_rad-theta),o.observer_locked,o.valid);
}
int main(void){probe(0.00001f,false);probe(0.00005f,false);probe(0.00005f,true);return 0;}
