diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index 8a2d628..ee843f4 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -266,6 +266,9 @@ 2.0.2016100301 FEATURE_AZ_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY and FEATURE_EL_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY ready for testing + 2.0.2016102201 + Fixed bug with FEATURE_AZ_POSITION_HH12_AS5045_SSI, negative offset, and crossing between 359 and 0 degrees + All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc. in order to compile in Arduino IDE 1.6.7 Anything rotator_*.* should be in the ino directory! @@ -273,7 +276,7 @@ */ -#define CODE_VERSION "2.0.2016100301" +#define CODE_VERSION "2.0.2016102201" #include #include @@ -4636,14 +4639,11 @@ void read_azimuth(byte force_read){ raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); #endif // FEATURE_AZIMUTH_CORRECTION raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + if (raw_azimuth < 0){raw_azimuth = raw_azimuth + (360 * HEADING_MULTIPLIER);} if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); } else { - if (raw_azimuth < 0) { - azimuth = raw_azimuth + (360 * HEADING_MULTIPLIER); - } else { - azimuth = raw_azimuth; - } + azimuth = raw_azimuth; } #endif // FEATURE_AZ_POSITION_HH12_AS5045_SSI /* diff --git a/rotator_features_test.h b/rotator_features_test.h index 08d5f7c..633834a 100755 --- a/rotator_features_test.h +++ b/rotator_features_test.h @@ -51,7 +51,7 @@ // #define FEATURE_AZ_POSITION_GET_FROM_REMOTE_UNIT // requires FEATURE_MASTER_WITH_SERIAL_SLAVE or FEATURE_MASTER_WITH_ETHERNET_SLAVE // #define FEATURE_AZ_POSITION_ADAFRUIT_LSM303 // Uncomment for azimuth using LSM303 compass and Adafruit library (https://github.com/adafruit/Adafruit_LSM303) (also uncomment object declaration below) // #define FEATURE_AZ_POSITION_POLOLU_LSM303 // Uncomment for azimuth using LSM303 compass and Polulu library -// #define FEATURE_AZ_POSITION_HH12_AS5045_SSI +#define FEATURE_AZ_POSITION_HH12_AS5045_SSI // #define FEATURE_AZ_POSITION_INCREMENTAL_ENCODER // #define FEATURE_AZ_POSITION_A2_ABSOLUTE_ENCODER @@ -64,7 +64,7 @@ // #define FEATURE_EL_POSITION_GET_FROM_REMOTE_UNIT // requires FEATURE_MASTER_WITH_SERIAL_SLAVE or FEATURE_MASTER_WITH_ETHERNET_SLAVE // #define FEATURE_EL_POSITION_ADAFRUIT_LSM303 // Uncomment for elevation using LSM303 accelerometer and Adafruit library (https://github.com/adafruit/Adafruit_LSM303) (also uncomment object declaration below) // #define FEATURE_EL_POSITION_POLOLU_LSM303 // Uncomment for elevation using LSM303 compass and Polulu library -// #define FEATURE_EL_POSITION_HH12_AS5045_SSI +#define FEATURE_EL_POSITION_HH12_AS5045_SSI // #define FEATURE_EL_POSITION_INCREMENTAL_ENCODER // #define FEATURE_EL_POSITION_MEMSIC_2125 // #define FEATURE_EL_POSITION_A2_ABSOLUTE_ENCODER