From b484828f3ecee02055e2624524e8960832b6039a Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Tue, 1 Mar 2016 08:24:15 -0500 Subject: [PATCH] 2.0.2016030101 FEATURE_AZ_POSITION_HH12_AS5045_SSI: AZIMUTH_STARTING_POINT_DEFAULT used in heading calculation now --- k3ng_rotator_controller.ino | 43 +++++++++++++++++++------------- rotator_features.h | 4 +-- rotator_features_ea4tx_ars_usb.h | 1 + rotator_features_test.h | 21 ++++++++-------- rotator_pins_test.h | 6 ++--- 5 files changed, 43 insertions(+), 32 deletions(-) diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index 8d1e658..a45f0e0 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -454,13 +454,19 @@ 2.0.2016012301 Further work to get k3ngdisplay files to play with Arduino IDE 1.6.7 + 2.0.2016021601 + DEBUG_HH12 more information output + + 2.0.2016030101 + FEATURE_AZ_POSITION_HH12_AS5045_SSI: AZIMUTH_STARTING_POINT_DEFAULT used in heading calculation now + All library files should be placed in \sketchbook\libraries\some-directory\ in order to compile in Arduino IDE 1.6.7 Anything rotator_*.* should be in the ino directory! */ -#define CODE_VERSION "2.0.2016012301" +#define CODE_VERSION "2.0.2016030101" #include #include @@ -4651,9 +4657,9 @@ void read_azimuth(byte force_read){ #ifdef FEATURE_AZ_POSITION_HH12_AS5045_SSI #if defined(OPTION_REVERSE_AZ_HH12_AS5045) - raw_azimuth = int((360.0-azimuth_hh12.heading()) * HEADING_MULTIPLIER); + raw_azimuth = int((360.0-azimuth_hh12.heading()+AZIMUTH_STARTING_POINT_DEFAULT) * HEADING_MULTIPLIER); #else - raw_azimuth = int(azimuth_hh12.heading() * HEADING_MULTIPLIER); + raw_azimuth = int((azimuth_hh12.heading()+AZIMUTH_STARTING_POINT_DEFAULT) * HEADING_MULTIPLIER); #endif #ifdef DEBUG_HH12 if ((millis() - last_hh12_debug) > 5000) { @@ -5503,20 +5509,23 @@ void read_elevation(byte force_read){ #else elevation = int(elevation_hh12.heading() * HEADING_MULTIPLIER); #endif - #ifdef DEBUG_HH12 - if ((millis() - last_hh12_debug) > 5000) { - debug.print(F("read_elevation: HH-12 raw: ")); - control_port->println(elevation); - last_hh12_debug = millis(); - } - #endif // DEBUG_HH12 - #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); - #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); - if (elevation > (180 * HEADING_MULTIPLIER)) { - elevation = elevation - (360 * HEADING_MULTIPLIER); - } + #ifdef DEBUG_HH12 //zzzzzzzz + if ((millis() - last_hh12_debug) > 5000) { + debug.print(F("read_elevation: HH-12 from device: ")); + debug.print(elevation_hh12.heading()); + debug.print(F(" uncorrected: ")); + debug.println(elevation/HEADING_MULTIPLIER); + // control_port->println(elevation); + last_hh12_debug = millis(); + } + #endif // DEBUG_HH12 + #ifdef FEATURE_ELEVATION_CORRECTION + elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + #endif // FEATURE_ELEVATION_CORRECTION + elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + if (elevation > (180 * HEADING_MULTIPLIER)) { + elevation = elevation - (360 * HEADING_MULTIPLIER); + } #endif // FEATURE_EL_POSITION_HH12_AS5045_SSI diff --git a/rotator_features.h b/rotator_features.h index 8508b78..ce08a8b 100755 --- a/rotator_features.h +++ b/rotator_features.h @@ -60,8 +60,8 @@ // #define FEATURE_EL_POSITION_INCREMENTAL_ENCODER // #define FEATURE_EL_POSITION_MEMSIC_2125 // #define FEATURE_EL_POSITION_A2_ABSOLUTE_ENCODER - -// All displays require rotator_k3ngdisplay.h and rotator_k3ngdisplay.cpp in the ino directory! + +// All displays require k3ngdisplay.h and k3ngdisplay.cpp in a directory in \sketchbook\libraries\ // And if you are using an Adafruit, Yourduino, RFRobot, or YWRobot display, you must change the feature setting in k3ngdisplay.h!!!! // #define FEATURE_4_BIT_LCD_DISPLAY // Uncomment for classic 4 bit LCD display (most common) // #define FEATURE_ADAFRUIT_I2C_LCD diff --git a/rotator_features_ea4tx_ars_usb.h b/rotator_features_ea4tx_ars_usb.h index bc88802..8a04f1c 100644 --- a/rotator_features_ea4tx_ars_usb.h +++ b/rotator_features_ea4tx_ars_usb.h @@ -18,6 +18,7 @@ #define FEATURE_EL_POSITION_POTENTIOMETER +// LCD display requires k3ngdisplay.h and k3ngdisplay.cpp in a directory in \sketchbook\libraries\ #define FEATURE_4_BIT_LCD_DISPLAY //Uncomment for classic 4 bit LCD display (most common) diff --git a/rotator_features_test.h b/rotator_features_test.h index bdcceda..8362002 100755 --- a/rotator_features_test.h +++ b/rotator_features_test.h @@ -22,7 +22,7 @@ #define FEATURE_GPS #define FEATURE_RTC_DS1307 // #define FEATURE_RTC_PCF8583 -#define FEATURE_ETHERNET +// #define FEATURE_ETHERNET // #define FEATURE_STEPPER_MOTOR // requires Mega or an AVR with Timer 5 support // #define FEATURE_AUTOCORRECT @@ -38,22 +38,22 @@ // #define FEATURE_REMOTE_UNIT_SLAVE // uncomment this to make this unit a remote unit controlled by a host unit // #define FEATURE_MASTER_WITH_SERIAL_SLAVE // [master]{remote_port}<-------serial-------->{control_port}[slave] -#define FEATURE_MASTER_WITH_ETHERNET_SLAVE // [master]<-------------------ethernet--------------------->[slave] +// #define FEATURE_MASTER_WITH_ETHERNET_SLAVE // [master]<-------------------ethernet--------------------->[slave] /* position sensors - pick one for azimuth and one for elevation if using an az/el rotator */ -#define FEATURE_AZ_POSITION_POTENTIOMETER //this is used for both a voltage from a rotator control or a homebrew rotator with a potentiometer +// #define FEATURE_AZ_POSITION_POTENTIOMETER //this is used for both a voltage from a rotator control or a homebrew rotator with a potentiometer // #define FEATURE_AZ_POSITION_ROTARY_ENCODER // #define FEATURE_AZ_POSITION_PULSE_INPUT // #define FEATURE_AZ_POSITION_HMC5883L // HMC5883L digital compass support // #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 -#define FEATURE_EL_POSITION_POTENTIOMETER +// #define FEATURE_EL_POSITION_POTENTIOMETER // #define FEATURE_EL_POSITION_ROTARY_ENCODER // #define FEATURE_EL_POSITION_PULSE_INPUT // #define FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB // Uncomment for elevation ADXL345 accelerometer support using ADXL345 library @@ -61,14 +61,15 @@ // #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 -// All displays require rotator_k3ngdisplay.h and rotator_k3ngdisplay.cpp in the ino directory! + +// All displays require k3ngdisplay.h and k3ngdisplay.cpp in a directory in \sketchbook\libraries\ // And if you are using an Adafruit, Yourduino, RFRobot, or YWRobot display, you must change the feature setting in k3ngdisplay.h!!!! -// #define FEATURE_4_BIT_LCD_DISPLAY // Uncomment for classic 4 bit LCD display (most common) +#define FEATURE_4_BIT_LCD_DISPLAY // Uncomment for classic 4 bit LCD display (most common) // #define FEATURE_ADAFRUIT_I2C_LCD // #define FEATURE_ADAFRUIT_BUTTONS // Uncomment this to use Adafruit I2C LCD buttons for manual AZ/EL instead of normal buttons // #define FEATURE_YOURDUINO_I2C_LCD @@ -151,8 +152,8 @@ // #define OPTION_SCANCON_2RMHF3600_INC_ENCODER // use with FEATURE_AZ_POSITION_INCREMENTAL_ENCODER and/or FEATURE_EL_POSITION_INCREMENTAL_ENCODER if using the ScanCon 2RMHF3600 incremental encoder // #define OPTION_RESET_METHOD_JMP_ASM_0 // #define OPTION_SAVE_MEMORY_EXCLUDE_REMOTE_CMDS -#define OPTION_REVERSE_AZ_HH12_AS5045 -#define OPTION_REVERSE_EL_HH12_AS5045 +// #define OPTION_REVERSE_AZ_HH12_AS5045 +// #define OPTION_REVERSE_EL_HH12_AS5045 // #define OPTION_DONT_READ_GPS_PORT_AS_OFTEN diff --git a/rotator_pins_test.h b/rotator_pins_test.h index a576236..8016721 100644 --- a/rotator_pins_test.h +++ b/rotator_pins_test.h @@ -119,9 +119,9 @@ #endif //FEATURE_AZ_POSITION_HH_12 #ifdef FEATURE_EL_POSITION_HH12_AS5045_SSI -#define el_hh12_clock_pin 11 -#define el_hh12_cs_pin 12 -#define el_hh12_data_pin 13 +#define el_hh12_clock_pin 53 //11 +#define el_hh12_cs_pin 52 //12 +#define el_hh12_data_pin 51 //13 #endif //FEATURE_EL_POSITION_HH_12 #ifdef FEATURE_PARK