N K
/
foc-ed_in_the_bot_compact
last working
Fork of foc-ed_in_the_bot_compact by
Diff: main.cpp
- Revision:
- 10:6829abb438fc
- Parent:
- 9:074575151e4b
--- a/main.cpp Tue May 17 06:44:09 2016 +0000 +++ b/main.cpp Tue May 17 09:58:58 2016 +0000 @@ -150,15 +150,15 @@ float sin_p = sinf(p); float cos_p = cosf(p); - //float pos_dac = 0.85f * p / (2 * PI) + 0.05f; - //DAC->DHR12R2 = (unsigned int) (pos_dac * 4096); + float pos_dac = 0.85f * p / (2 * PI) + 0.05f; + DAC->DHR12R2 = (unsigned int) (pos_dac * 4096); ia = ((float) adval1 / 4096.0f * AVDD - I_OFFSET - ia_supp_offset) / I_SCALE; ib = ((float) adval2 / 4096.0f * AVDD - I_OFFSET - ib_supp_offset) / I_SCALE; ic = -ia - ib; - float u = ib; - float v = ic; + float u = ia; + float v = ib; alpha = u; beta = 1 / sqrtf(3.0f) * u + 2 / sqrtf(3.0f) * v; @@ -185,7 +185,7 @@ if (vq < -1.0f) vq = -1.0f; if (vq > 1.0f) vq = 1.0f; - DAC->DHR12R2 = (unsigned int) (-q * 20 + 2048); + //DAC->DHR12R2 = (unsigned int) (-q * 20 + 2048); //DAC->DHR12R2 = (unsigned int) (-vd * 2000 + 2048); //vd = 0.0f; @@ -208,5 +208,7 @@ startup_msg(); for (;;) { + //pc.printf("%f\r\n", p); + //wait_ms(100); } }