File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ void MA730::init(SPIClass* _spi) {
1616};
1717
1818float MA730::getCurrentAngle () {
19- return (( float ) readRawAngle ())/( float )MA730_CPR * 2 . 0f * ( float )PI ;
19+ return (readRawAngle () * _2PI)/MA730_CPR ;
2020}; // angle in radians, return current value
2121
2222uint16_t MA730::readRawAngle () {
2323 uint16_t angle = transfer16 (0x0000 );
24- return angle>> 2 ;
24+ return angle;
2525}; // 14bit angle value
2626
2727uint16_t MA730::getZero () {
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ enum FieldStrength {
1313};
1414
1515
16- #define MA730_CPR 16384
16+ #define _2PI 6 .28318530718f
17+ #define MA730_CPR 65536 .0f
1718
1819#define MA730_REG_ZERO_POSITION_LSB 0x00
1920#define MA730_REG_ZERO_POSITION_MSB 0x01
@@ -27,7 +28,7 @@ enum FieldStrength {
2728
2829#define MA730_BITORDER MSBFIRST
2930
30- static SPISettings MA730SPISettings (8000000 , MA730_BITORDER, SPI_MODE3); // @suppress("Invalid arguments")
31+ static SPISettings MA730SPISettings (1000000 , MA730_BITORDER, SPI_MODE3); // @suppress("Invalid arguments")
3132static SPISettings MA730SSISettings (4000000 , MA730_BITORDER, SPI_MODE1); // @suppress("Invalid arguments")
3233
3334
You can’t perform that action at this time.
0 commit comments