diff --git a/firmware/common/sine_table.hpp b/firmware/common/sine_table.hpp index fb0eae88..a585ad62 100644 --- a/firmware/common/sine_table.hpp +++ b/firmware/common/sine_table.hpp @@ -35,7 +35,10 @@ w = numpy.arange(length, dtype=numpy.float64) * (2 * numpy.pi / length) v = numpy.sin(w) print(v) */ -constexpr uint16_t sine_table_f32_period = 256; +constexpr uint16_t sine_table_f32_period = 256; +// periode is 256 . means sine_table_f32[0]= sine_table_f32[0+256], sine_table_f32[1]=sine_table_f32[1+256] (those two added manualy) +// Then table has 257 values , [0,..255] + [256] and [257], those two are used when we interpolate[255] with [255+1], and [256] with [256+1] +// [256] index is needed in the function sin_f32() when we are inputing very small radian values , example , sin_f32((-1e-14) in radians) static constexpr std::array sine_table_f32{ 0.00000000e+00, 2.45412285e-02, 4.90676743e-02, @@ -123,7 +126,7 @@ static constexpr std::array sine_table_f32{ -2.42980180e-01, -2.19101240e-01, -1.95090322e-01, -1.70961889e-01, -1.46730474e-01, -1.22410675e-01, -9.80171403e-02, -7.35645636e-02, -4.90676743e-02, - -2.45412285e-02, 0.00000000e+00, 0.00000000e+00 + -2.45412285e-02, 0.00000000e+00, 2.45412285e-02 }; inline float sin_f32(const float w) {