diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index 386ae5e..cc59e2d 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -1,4 +1,5 @@ /* Arduino Rotator Controller + Anthony Good K3NG anthony.good@gmail.com @@ -6,7 +7,7 @@ Code contributions, testing, ideas, bug fixes, hardware, support, encouragement, and/or bourbon provided by: - John Eigenbode W3SA + John W3SA Gord VO1GPK Anthony M0UPU Pete VE5VA @@ -34,7 +35,7 @@ Ismael PY4PI - (If you contributed something and I forgot to put your name and call in here, please email me!) + (If you contributed something and I forgot to put your name and call in here, *please* email me!) *************************************************************************************************************** * @@ -342,24 +343,34 @@ Updated for Arduino 1.6.1 - Fixed compilation isse with FEATURE_ELEVATION_CORRECTION and Arduino 1.6.x + Fixed compilation issue with FEATURE_ELEVATION_CORRECTION and Arduino 1.6.x + + OPTION_RESET_METHOD_JMP_ASM_0 + Change /E command to do setup() for system reset + + Fixed calculation issues with FEATURE_ELEVATION_CORRECTION */ -#define CODE_VERSION "2.0.2015032601" +#define CODE_VERSION "2.0.2015032801" #include #include #include #include + #include "rotator_hardware.h" + #ifdef HARDWARE_EA4TX_ARS_USB #include "rotator_features_ea4tx_ars_usb.h" #endif #ifdef HARDWARE_WB6KCN #include "rotator_features_wb6kcn.h" #endif -#if !defined(HARDWARE_EA4TX_ARS_USB) && !defined(HARDWARE_WB6KCN) +#ifdef HARDWARE_M0UPU +#include "rotator_features_m0upu.h" +#endif +#if !defined(HARDWARE_CUSTOM) #include "rotator_features.h" #endif #include "rotator_dependencies.h" @@ -421,6 +432,7 @@ #include "rotator.h" + #ifdef HARDWARE_EA4TX_ARS_USB #include "rotator_pins_ea4tx_ars_usb.h" #endif @@ -431,14 +443,23 @@ //#include "rotator_pins_wb6kcn_az_test_setup.h" #include "rotator_pins_wb6kcn.h" #endif -#if !defined(HARDWARE_M0UPU) && !defined(HARDWARE_EA4TX_ARS_USB) &&!defined(HARDWARE_WB6KCN) +#if !defined(HARDWARE_CUSTOM) #include "rotator_pins.h" #endif + +#ifdef HARDWARE_EA4TX_ARS_USB +#include "rotator_settings_ea4tx_ars_usb.h" +#endif #ifdef HARDWARE_WB6KCN #include "rotator_settings_wb6kcn.h" -#else +#endif +#ifdef HARDWARE_M0UPU +#include "rotator_settings_m0upu.h" +#endif +#if !defined(HARDWARE_CUSTOM) #include "rotator_settings.h" #endif + #ifdef FEATURE_STEPPER_MOTOR #include "TimerFive.h" #endif @@ -985,6 +1006,8 @@ void loop() { check_moon_pushbutton_calibration(); #endif //defined(FEATURE_MOON_PUSHBUTTON_AZ_EL_CALIBRATION) && defined(FEATURE_MOON_TRACKING) + check_for_reset_flag(); + } /* loop */ /* -------------------------------------- subroutines ----------------------------------------------- @@ -1024,7 +1047,7 @@ void service_blink_led(){ } #endif // blink_led - check_for_reset_flag(); + } /* service_blink_led */ @@ -1040,12 +1063,20 @@ void check_for_reset_flag(){ detected_reset_flag_time = millis(); } else { if ((millis()-detected_reset_flag_time) > 5000){ // let things run for 5 seconds - //wdt_enable(WDTO_30MS); while(1) {}; //doesn't work on Mega -//zzzzzz + + #ifdef reset_pin digitalWrite(reset_pin,HIGH); #else // reset_pin + + #ifdef OPTION_RESET_METHOD_JMP_ASM_0 asm volatile (" jmp 0"); // reboot! // doesn't work on Arduino Mega but works on SainSmart Mega. + //wdt_enable(WDTO_30MS); while(1) {}; //doesn't work on Mega + #else //OPTION_RESET_METHOD_JMP_ASM_0 + setup(); + reset_the_unit = 0; + #endif //OPTION_RESET_METHOD_JMP_ASM_0 + #endif //reset_pin } } @@ -1085,7 +1116,7 @@ void check_az_speed_pot() { byte new_azimuth_speed_voltage = 0; - if (az_speed_pot && azimuth_speed_voltage && ((millis() - last_pot_check_time) > 500)) { + if (az_speed_pot /*&& azimuth_speed_voltage*/ && ((millis() - last_pot_check_time) > 500)) { pot_read = analogReadEnhanced(az_speed_pot); new_azimuth_speed_voltage = map(pot_read, SPEED_POT_LOW, SPEED_POT_HIGH, SPEED_POT_LOW_MAP, SPEED_POT_HIGH_MAP); if (new_azimuth_speed_voltage != normal_az_speed_voltage) { @@ -1098,7 +1129,6 @@ void check_az_speed_pot() { debug_println(""); } #endif // DEBUG_AZ_SPEED_POT - // analogWriteEnhanced(azimuth_speed_voltage, new_azimuth_speed_voltage); normal_az_speed_voltage = new_azimuth_speed_voltage; update_az_variable_outputs(normal_az_speed_voltage); #if defined(OPTION_EL_SPEED_FOLLOWS_AZ_SPEED) && defined(FEATURE_ELEVATION_CONTROL) @@ -1856,7 +1886,7 @@ void service_remote_unit_serial_buffer(){ */ - String command_string; + static String command_string; // changed to static 2013-03-27 byte command_good = 0; if (control_port_buffer_carriage_return_flag) { @@ -2746,11 +2776,11 @@ void update_display(){ static byte lcd_state_row_0 = 0; static byte lcd_state_row_1 = 0; - String row_0_string; + static String row_0_string; // changed to static 2013-03-27 to see if it helps display stability static int last_azimuth = -1; - char workstring[10] = ""; + static char workstring[10] = ""; // changed to static 2013-03-27 to see if it helps display stability unsigned int target = 0; @@ -5513,7 +5543,7 @@ void update_el_variable_outputs(byte speed_voltage){ void update_az_variable_outputs(byte speed_voltage){ - #ifdef DEBUG_VARIABLE_OUTPUTS + #ifdef DEBUG_VARIABLE_OUTPUTS int temp_int = 0; debug_print("update_az_variable_outputs: az_state: "); @@ -8389,7 +8419,8 @@ float correct_azimuth(float azimuth_in){ } for (unsigned int x = 0; x < (sizeof(azimuth_calibration_from) - 2); x++) { if ((azimuth_in >= azimuth_calibration_from[x]) && (azimuth_in <= azimuth_calibration_from[x + 1])) { - return (map(azimuth_in * 10, azimuth_calibration_from[x] * 10, azimuth_calibration_from[x + 1] * 10, azimuth_calibration_to[x] * 10, azimuth_calibration_to[x + 1] * 10)) / 10.0; + //return (map(azimuth_in * 10, azimuth_calibration_from[x] * 10, azimuth_calibration_from[x + 1] * 10, azimuth_calibration_to[x] * 10, azimuth_calibration_to[x + 1] * 10)) / 10.0; + return (azimuth_in - azimuth_calibration_from[x]) * (azimuth_calibration_to[x+1] - azimuth_calibration_to[x]) / (azimuth_calibration_from[x + 1] - azimuth_calibration_from[x]) + azimuth_calibration_to[x]; } } return(azimuth_in); @@ -8400,21 +8431,22 @@ float correct_azimuth(float azimuth_in){ #ifdef FEATURE_ELEVATION_CORRECTION float correct_elevation(float elevation_in){ + if (sizeof(elevation_calibration_from) != sizeof(elevation_calibration_to)) { return elevation_in; } - for (unsigned int x = 0; x < (sizeof(elevation_calibration_from) - 2); x++) { + for (int x = 0; x < (sizeof(elevation_calibration_from) - 2); x++) { if ((elevation_in >= elevation_calibration_from[x]) && (elevation_in <= elevation_calibration_from[x + 1])) { - long x = (elevation_in*10); - long in_min = (elevation_calibration_from[x]*10); - long in_max = (elevation_calibration_from[x+1]*10); - long out_min = (elevation_calibration_to[x]*10); - long out_max =(elevation_calibration_to[x+1]*10); - return (map(x,in_min,in_max,out_min,out_max)) / 10.0; + // changed this from map() 2015-03-28 due to it blowing up at compile time in Arduino 1.6.1 + return (elevation_in - elevation_calibration_from[x]) * (elevation_calibration_to[x+1] - elevation_calibration_to[x]) / (elevation_calibration_from[x + 1] - elevation_calibration_from[x]) + elevation_calibration_to[x]; } } return(elevation_in); + + + //return 123; + } #endif // FEATURE_ELEVATION_CORRECTION // -------------------------------------------------------------------------- @@ -11778,23 +11810,20 @@ void service_power_switch(){ //------------------------------------------------------ -char * coordinates_to_maidenhead(float latitude_degrees,float longitude_degrees){ +char *coordinates_to_maidenhead(float latitude_degrees,float longitude_degrees){ - char temp_string[8] = ""; - - const char* asciiuppercase[] = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R"}; - const char* asciinumbers[] = {"0","1","2","3","4","5","6","7","8","9"}; - const char* asciilowercase[] = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x"}; + static char temp_string[8] = ""; // I had to declare this static in Arduino 1.6, otherwise this won't work (it worked before) latitude_degrees += 90.0; longitude_degrees += 180.0; - strcat(temp_string,asciiuppercase[int(longitude_degrees/20)]); - strcat(temp_string,asciiuppercase[int(latitude_degrees/10)]); - strcat(temp_string,asciinumbers[int((longitude_degrees - int(longitude_degrees/20)*20)/2)]); - strcat(temp_string,asciinumbers[int(latitude_degrees - int(latitude_degrees/10)*10)]); - strcat(temp_string,asciilowercase[int((longitude_degrees - (int(longitude_degrees/2)*2)) / (5.0/60.0))]); - strcat(temp_string,asciilowercase[int((latitude_degrees - (int(latitude_degrees/1)*1)) / (2.5/60.0))]); + temp_string[0] = (int(longitude_degrees/20)) + 65; + temp_string[1] = (int(latitude_degrees/10)) + 65; + temp_string[2] = (int((longitude_degrees - int(longitude_degrees/20)*20)/2)) + 48; + temp_string[3] = (int(latitude_degrees - int(latitude_degrees/10)*10)) + 48; + temp_string[4] = (int((longitude_degrees - (int(longitude_degrees/2)*2)) / (5.0/60.0))) + 97; + temp_string[5] = (int((latitude_degrees - (int(latitude_degrees/1)*1)) / (2.5/60.0))) + 97; + temp_string[6] = 0; return temp_string; diff --git a/rotator_features.h b/rotator_features.h index 4b69976..cc38833 100644 --- a/rotator_features.h +++ b/rotator_features.h @@ -44,7 +44,7 @@ //#define FEATURE_AZ_POSITION_HH12_AS5045_SSI //#define FEATURE_AZ_POSITION_INCREMENTAL_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 @@ -130,7 +130,7 @@ //#define OPTION_BLINK_OVERLAP_LED //#define OPTION_EL_PULSE_DEBOUNCE //#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 diff --git a/rotator_features_m0upu.h b/rotator_features_m0upu.h new file mode 100644 index 0000000..3c486f5 --- /dev/null +++ b/rotator_features_m0upu.h @@ -0,0 +1,209 @@ +/* ---------------------- Features and Options - you must configure this !! ------------------------------------------------ + + + If you are using EA4TX ARS USB, edit rotator_features_ea4tx_ars_usb.h, not this file. + +*/ + +/* main features */ +//#define FEATURE_ELEVATION_CONTROL // uncomment this for AZ/EL rotators +#define FEATURE_YAESU_EMULATION // uncomment this for Yaesu GS-232 emulation on control port +//#define FEATURE_EASYCOM_EMULATION // Easycom protocol emulation on control port (undefine FEATURE_YAESU_EMULATION above) + +//#define FEATURE_MOON_TRACKING +//#define FEATURE_SUN_TRACKING +//#define FEATURE_CLOCK +//#define FEATURE_GPS +//#define FEATURE_RTC_DS1307 +//#define FEATURE_RTC_PCF8583 +//#define FEATURE_ETHERNET +//#define FEATURE_STEPPER_MOTOR // requires Mega or an AVR with Timer 5 support +//#define FEATURE_AUTOCORRECT + +#define LANGUAGE_ENGLISH +//#define LANGUAGE_SPANISH +//#define LANGUAGE_CZECH +//#define LANGUAGE_ITALIAN +//#define LANGUAGE_PORTUGUESE_BRASIL + +/* master and remote slave unit functionality */ +//#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] + + +/* 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_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_INCREMENTAL_ENCODER + +#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 +//#define FEATURE_EL_POSITION_ADXL345_USING_ADAFRUIT_LIB // Uncomment for elevation ADXL345 accelerometer support using Adafruit library +//#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_INCREMENTAL_ENCODER +//#define FEATURE_EL_POSITION_MEMSIC_2125 + +//#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 +//#define FEATURE_RFROBOT_I2C_DISPLAY +//#define FEATURE_ANALOG_OUTPUT_PINS + +//#define FEATURE_SUN_PUSHBUTTON_AZ_EL_CALIBRATION +//#define FEATURE_MOON_PUSHBUTTON_AZ_EL_CALIBRATION + +/* preset rotary encoder features and options */ +//#define FEATURE_AZ_PRESET_ENCODER // Uncomment for Rotary Encoder Azimuth Preset support +//#define FEATURE_EL_PRESET_ENCODER // Uncomment for Rotary Encoder Elevation Preset support (requires FEATURE_AZ_PRESET_ENCODER above) +#define OPTION_ENCODER_HALF_STEP_MODE +#define OPTION_ENCODER_ENABLE_PULLUPS // define to enable weak pullups on rotary encoder pins +#define OPTION_INCREMENTAL_ENCODER_PULLUPS // define to enable weak pullups on 3 phase incremental rotary encoder pins +//#define OPTION_PRESET_ENCODER_RELATIVE_CHANGE // this makes the encoder(s) change the az or el in a relative fashion rather then store an absolute setting +#define OPTION_PRESET_ENCODER_0_360_DEGREES + +/* position sensor options */ +#define OPTION_AZ_POSITION_ROTARY_ENCODER_HARD_LIMIT // stop azimuth at lower and upper limit rather than rolling over +#define OPTION_EL_POSITION_ROTARY_ENCODER_HARD_LIMIT // stop elevation at lower and upper limits rather than rolling over +#define OPTION_AZ_POSITION_PULSE_HARD_LIMIT // stop azimuth at lower and upper limit rather than rolling over +#define OPTION_EL_POSITION_PULSE_HARD_LIMIT // stop elevation at lower and upper limits rather than rolling over +#define OPTION_POSITION_PULSE_INPUT_PULLUPS // define to enable weak pullups on position pulse inputs + +/* less often used features and options */ +#define OPTION_GS_232B_EMULATION // comment this out to default to Yaesu GS-232A emulation when using FEATURE_YAESU_EMULATION above +//#define FEATURE_ROTATION_INDICATOR_PIN // activate rotation_indication_pin to indicate rotation +//#define FEATURE_LIMIT_SENSE +//#define FEATURE_TIMED_BUFFER // Support for Yaesu timed buffer commands +//#define OPTION_SERIAL_HELP_TEXT // Yaesu help command prints help +//#define FEATURE_PARK +//#define OPTION_AZ_MANUAL_ROTATE_LIMITS // this option will automatically stop the L and R commands when hitting a CCW or CW limit (settings below - AZ_MANUAL_ROTATE_*_LIMIT) +//#define OPTION_EL_MANUAL_ROTATE_LIMITS +#define OPTION_EASYCOM_AZ_QUERY_COMMAND // Adds non-standard Easycom command: AZ with no parm returns current azimuth +#define OPTION_EASYCOM_EL_QUERY_COMMAND // Adds non-standard Easycom command: EL with no parm returns current elevation +//#define OPTION_C_COMMAND_SENDS_AZ_AND_EL // uncomment this when using Yaesu emulation with Ham Radio Deluxe +//#define OPTION_DELAY_C_CMD_OUTPUT // uncomment this when using Yaesu emulation with Ham Radio Deluxe +#define FEATURE_ONE_DECIMAL_PLACE_HEADINGS +//#define FEATURE_TWO_DECIMAL_PLACE_HEADINGS // under development - not working yet! +//#define FEATURE_AZIMUTH_CORRECTION // correct the azimuth using a calibration table in rotator_settings.h +//#define FEATURE_ELEVATION_CORRECTION // correct the elevation using a calibration table in rotator_settings.h +//#define FEATURE_ANCILLARY_PIN_CONTROL // control I/O pins with serial commands \F, \N, \P +//#define FEATURE_JOYSTICK_CONTROL // analog joystick support +//#define OPTION_JOYSTICK_REVERSE_X_AXIS +//#define OPTION_JOYSTICK_REVERSE_Y_AXIS +#define OPTION_EL_SPEED_FOLLOWS_AZ_SPEED // changing the azimith speed with Yaesu X commands or an azimuth speed pot will also change elevation speed +//#define OPTION_PULSE_IGNORE_AMBIGUOUS_PULSES // for azimuth and elevation position pulse input feature, ignore pulses that arrive when no rotation is active +//#define OPTION_BUTTON_RELEASE_NO_SLOWDOWN // disables slowdown when CW or CCW button is released, or stop button is depressed +#define OPTION_SYNC_RTC_TO_GPS // if both realtime clock and GPS are present, synchronize realtime clock to GPS +//#define OPTION_DISPLAY_HHMM_CLOCK // display HH:MM clock on LCD row 1 (set position with #define LCD_HHMM_CLOCK_POSITION) +#define OPTION_DISPLAY_HHMMSS_CLOCK // display HH:MM:SS clock on LCD row 1 (set position with #define LCD_HHMMSS_CLOCK_POSITION) +//#define OPTION_DISPLAY_ALT_HHMM_CLOCK_AND_MAIDENHEAD // display alternating HH:MM clock and maidenhead on LCD row 1 (set position with #define LCD_HHMMCLOCK_POSITION) +//#define OPTION_DISPLAY_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD // display constant HH:MM:SS clock and maidenhead on LCD row 1 (set position with #define LCD_CONSTANT_HHMMSSCLOCK_MAIDENHEAD_POSITION) +//#define OPTION_DISPLAY_BIG_CLOCK // display date & time clock (set row with #define LCD_BIG_CLOCK_ROW) +//#define OPTION_CLOCK_ALWAYS_HAVE_HOUR_LEADING_ZERO +#define OPTION_DISPLAY_GPS_INDICATOR // display GPS indicator on LCD - set position with LCD_GPS_INDICATOR_POSITION and LCD_GPS_INDICATOR_ROW +#define OPTION_DISPLAY_MOON_TRACKING_CONTINUOUSLY +//#define OPTION_DISPLAY_DIRECTION_STATUS // N, W, E, S, NW, etc. direction indicator in row 1 center +#define OPTION_DISPLAY_SUN_TRACKING_CONTINUOUSLY +//#define OPTION_DISPLAY_MOON_OR_SUN_TRACKING_CONDITIONAL +//#define OPTION_DISPLAY_VERSION_ON_STARTUP //code provided by Paolo, IT9IPQ +//#define FEATURE_POWER_SWITCH +//#define OPTION_EXTERNAL_ANALOG_REFERENCE //Activate external analog voltage reference (needed for RemoteQTH.com unit) +//#define OPTION_SYNC_MASTER_CLOCK_TO_SLAVE // use when GPS unit is connected to slave unit and you want to synchronize the master unit clock to the slave unit GPS clock +//#define OPTION_SYNC_MASTER_COORDINATES_TO_SLAVE // use when GPS unit is connected to slave unit and you want to synchronize the master unit coordinates to the slave unit GPS +//#define OPTION_DISABLE_HMC5883L_ERROR_CHECKING +//#define OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK +//#define OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK +//#define OPTION_NO_ELEVATION_CHECK_TARGET_DELAY +//#define OPTION_BLINK_OVERLAP_LED +//#define OPTION_EL_PULSE_DEBOUNCE +//#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 + + + + /* + + Note: + + Ham Radio Deluxe expects AZ and EL in output for Yaesu C command in AZ/EL mode. I'm not sure if this is default behavior for + the Yaesu interface since the C2 command is supposed to be for AZ and EL. If you have problems with other software with this code in AZ/EL mode, + uncomment #define OPTION_C_COMMAND_SENDS_AZ_AND_EL. + + */ + +/* ---------------------- debug stuff - don't touch unless you know what you are doing --------------------------- */ + + + +#define DEFAULT_DEBUG_STATE 0 // 1 = activate debug mode at startup; this should be set to zero unless you're debugging something at startup + +#define DEBUG_DUMP // normally compile with this activated unless you're really trying to save memory +// #define DEBUG_MEMORY +// #define DEBUG_BUTTONS +// #define DEBUG_SERIAL +// #define DEBUG_SERVICE_REQUEST_QUEUE +// #define DEBUG_EEPROM +// #define DEBUG_AZ_SPEED_POT +// #define DEBUG_AZ_PRESET_POT +// #define DEBUG_PRESET_ENCODERS +// #define DEBUG_AZ_MANUAL_ROTATE_LIMITS +// #define DEBUG_EL_MANUAL_ROTATE_LIMITS +// #define DEBUG_BRAKE +// #define DEBUG_OVERLAP +// #define DEBUG_DISPLAY +// #define DEBUG_AZ_CHECK_OPERATION_TIMEOUT +// #define DEBUG_TIMED_BUFFER +// #define DEBUG_EL_CHECK_OPERATION_TIMEOUT +// #define DEBUG_VARIABLE_OUTPUTS +// #define DEBUG_ROTATOR +// #define DEBUG_SUBMIT_REQUEST +// #define DEBUG_SERVICE_ROTATION +// #define DEBUG_POSITION_ROTARY_ENCODER +// #define DEBUG_PROFILE_LOOP_TIME +// #define DEBUG_POSITION_PULSE_INPUT +// #define DEBUG_ACCEL +// #define DEBUG_SVC_REMOTE_COMM_INCOMING_BUFFER +// #define DEBUG_SVC_REMOTE_COMM_INCOMING_BUFFER_BAD_DATA +// #define DEBUG_HEADING_READING_TIME +// #define DEBUG_JOYSTICK +// #define DEBUG_ROTATION_INDICATION_PIN +// #define DEBUG_HH12 +// #define DEBUG_PARK +// #define DEBUG_LIMIT_SENSE +// #define DEBUG_AZ_POSITION_INCREMENTAL_ENCODER +// #define DEBUG_EL_POSITION_INCREMENTAL_ENCODER +// #define DEBUG_MOON_TRACKING +// #define DEBUG_SUN_TRACKING +// #define DEBUG_GPS +// #define DEBUG_GPS_SERIAL +// #define DEBUG_OFFSET +// #define DEBUG_RTC +// #define DEBUG_PROCESS_YAESU +// #define DEBUG_ETHERNET +// #define DEBUG_PROCESS_SLAVE +// #define DEBUG_MEMSIC_2125 +// #define DEBUG_SYNC_MASTER_CLOCK_TO_SLAVE +// #define DEBUG_SYNC_MASTER_COORDINATES_TO_SLAVE +// #define DEBUG_HMC5883L +// #define DEBUG_POLOLU_LSM303_CALIBRATION +// #define DEBUG_STEPPER +// #define DEBUG_AUTOCORRECT + + + + + + diff --git a/rotator_features_wb6kcn.h b/rotator_features_wb6kcn.h index f81da3d..6b289fd 100644 --- a/rotator_features_wb6kcn.h +++ b/rotator_features_wb6kcn.h @@ -125,7 +125,7 @@ #define OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK //#define OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK //#define OPTION_NO_ELEVATION_CHECK_TARGET_DELAY - +//#define OPTION_RESET_METHOD_JMP_ASM_0 diff --git a/rotator_hardware.h b/rotator_hardware.h index e97299d..5aef2fb 100644 --- a/rotator_hardware.h +++ b/rotator_hardware.h @@ -1,9 +1,15 @@ /* rotator_hardware.h - Uncomment defines below if you're specifically using any of this hardware + Uncomment defines below if you're specifically using any of this hardware and edit the appropriate special features, pins, and settings files */ -//#define HARDWARE_M0UPU -//#define HARDWARE_EA4TX_ARS_USB // if using EA4TX ARS USB hardware, customize rotator_features_e4tx_ars_usb.h (not rotator_features.h) -//#define HARDWARE_WB6KCN // customize rotator_features_wb6kcn.h, rotators_pins_wb6kcn.h, rotator_settings_wb6kcn.h \ No newline at end of file +//#define HARDWARE_M0UPU // customize rotator_features_m0upu.h, rotators_pins_m0upu.h, rotator_settings_m0upu.h +//#define HARDWARE_EA4TX_ARS_USB // customize rotator_features_e4tx_ars_usb.h, rotators_pins_e4tx_ars_usb.h, rotator_settings_e4tx_ars_usb.h +//#define HARDWARE_WB6KCN // customize rotator_features_wb6kcn.h, rotators_pins_wb6kcn.h, rotator_settings_wb6kcn.h + +// do not modify anything below this line + +#if defined(HARDWARE_M0UPU) || defined(HARDWARE_EA4TX_ARS_USB) || defined(HARDWARE_WB6KCN) +#define HARDWARE_CUSTOM +#endif \ No newline at end of file diff --git a/rotator_pins.h b/rotator_pins.h index 250fd67..f950d6d 100644 --- a/rotator_pins.h +++ b/rotator_pins.h @@ -109,9 +109,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 11 //53 //11 +#define el_hh12_cs_pin 12 //52 //12 +#define el_hh12_data_pin 13 //51 //13 #endif //FEATURE_EL_POSITION_HH_12 #ifdef FEATURE_PARK diff --git a/rotator_settings.h b/rotator_settings.h index b1cf6b0..acb5b6c 100644 --- a/rotator_settings.h +++ b/rotator_settings.h @@ -473,8 +473,12 @@ You can tweak these, but read the online documentation! // #define AZIMUTH_CALIBRATION_TO_ARRAY {359,0} -#define ELEVATION_CALIBRATION_FROM_ARRAY {-180,0,180} -#define ELEVATION_CALIBRATION_TO_ARRAY {-180,0,180} +#define ELEVATION_CALIBRATION_FROM_ARRAY {-360,0,360} +#define ELEVATION_CALIBRATION_TO_ARRAY {-360,0,360} + +// example: reverse elevation sensing +//#define ELEVATION_CALIBRATION_FROM_ARRAY {0,180,360} +//#define ELEVATION_CALIBRATION_TO_ARRAY {180,0,-180} #define ANALOG_OUTPUT_MAX_EL_DEGREES 180 diff --git a/rotator_settings_ea4tx_ars_usb.h b/rotator_settings_ea4tx_ars_usb.h new file mode 100644 index 0000000..b1cf6b0 --- /dev/null +++ b/rotator_settings_ea4tx_ars_usb.h @@ -0,0 +1,594 @@ + +/* -------------------------- rotation settings ---------------------------------------*/ + +#define AZIMUTH_STARTING_POINT_DEFAULT 180 // the starting point in degrees of the azimuthal rotator + +#define AZIMUTH_ROTATION_CAPABILITY_DEFAULT 450 // the default rotation capability of the rotator in degrees + +#define ELEVATION_MAXIMUM_DEGREES 180 // change this to set the maximum elevation in degrees + +/* --------------------------- Settings ------------------------------------------------ + +You can tweak these, but read the online documentation! + +*/ + +// analog voltage calibration - these are default values; you can either tweak these or set via the Yaesu O and F commands (and O2 and F2).... +#define ANALOG_AZ_FULL_CCW 4 +#define ANALOG_AZ_FULL_CW 1009 +#define ANALOG_EL_0_DEGREES 2 +#define ANALOG_EL_MAX_ELEVATION 1018 // maximum elevation is normally 180 degrees unless change below for ELEVATION_MAXIMUM_DEGREES + +#define ANALOG_AZ_OVERLAP_DEGREES 540 // if overlap_led above is enabled, turn on overlap led line if azimuth is greater than this setting + // you must use raw azimuth (if the azimuth on the rotator crosses over to 0 degrees, add 360 + // for example, on a Yaesu 450 degree rotator with a starting point of 180 degrees, and an overlap LED + // turning on when going CW and crossing 180, ANALOG_AZ_OVERLAP_DEGREES should be set for 540 (180 + 360) +#define OPTION_OVERLAP_LED_BLINK_MS 100 + +// PWM speed voltage settings +#define PWM_SPEED_VOLTAGE_X1 64 // 0 to 255 +#define PWM_SPEED_VOLTAGE_X2 128 // 0 to 255 +#define PWM_SPEED_VOLTAGE_X3 191 // 0 to 255 +#define PWM_SPEED_VOLTAGE_X4 253 // 0 to 255 + +//AZ +#define AZ_SLOWSTART_DEFAULT 0 // 0 = off ; 1 = on +#define AZ_SLOWDOWN_DEFAULT 0 // 0 = off ; 1 = on +#define AZ_SLOW_START_UP_TIME 2000 // if slow start is enabled, the unit will ramp up speed for this many milliseconds +#define AZ_SLOW_START_STARTING_PWM 1 // PWM starting value for slow start (must be < 256) +#define AZ_SLOW_START_STEPS 20 // must be < 256 + + +#define SLOW_DOWN_BEFORE_TARGET_AZ 10.0 // if slow down is enabled, slowdown will be activated within this many degrees of target azimuth +#define AZ_SLOW_DOWN_PWM_START 200 // starting PWM value for slow down (must be < 256) +#define AZ_SLOW_DOWN_PWM_STOP 20 // ending PWM value for slow down (must be < 256) +#define AZ_SLOW_DOWN_STEPS 200 //20 // must be < 256 +#define AZ_INITIALLY_IN_SLOW_DOWN_PWM 50 // PWM value to start at if we're starting in the slow down zone (1 - 255) + +//EL +#define EL_SLOWSTART_DEFAULT 0 // 0 = off ; 1 = on +#define EL_SLOWDOWN_DEFAULT 0 // 0 = off ; 1 = on +#define EL_SLOW_START_UP_TIME 2000 // if slow start is enabled, the unit will ramp up speed for this many milliseconds +#define EL_SLOW_START_STARTING_PWM 1 // PWM starting value for slow start (must be < 256) +#define EL_SLOW_START_STEPS 20 // must be < 256 + +#define SLOW_DOWN_BEFORE_TARGET_EL 10.0 // if slow down is enabled, slowdown will be activated within this many degrees of target elevation +#define EL_SLOW_DOWN_PWM_START 200 // starting PWM value for slow down (must be < 256) +#define EL_SLOW_DOWN_PWM_STOP 20 // ending PWM value for slow down (must be < 256) +#define EL_SLOW_DOWN_STEPS 20 +#define EL_INITIALLY_IN_SLOW_DOWN_PWM 50 // PWM value to start at if we're starting in the slow down zone (1 - 255) + +#define TIMED_SLOW_DOWN_TIME 2000 + +//Variable frequency output settings - LOWEST FREQUENCY IS 31 HERTZ DUE TO ARDUINO tone() FUNCTION LIMITATIONS! +#define AZ_VARIABLE_FREQ_OUTPUT_LOW 31 // Frequency in hertz of minimum speed +#define AZ_VARIABLE_FREQ_OUTPUT_HIGH 5000 //100 // Frequency in hertz of maximum speed +#define EL_VARIABLE_FREQ_OUTPUT_LOW 31 // Frequency in hertz of minimum speed +#define EL_VARIABLE_FREQ_OUTPUT_HIGH 100 // Frequency in hertz of maximum speed + +// Settings for OPTION_AZ_MANUAL_ROTATE_LIMITS +#define AZ_MANUAL_ROTATE_CCW_LIMIT 0 // if using a rotator that starts at 180 degrees, set this to something like 185 +#define AZ_MANUAL_ROTATE_CW_LIMIT 535 // add 360 to this if you go past 0 degrees (i.e. 180 CW after 0 degrees = 540) + +// Settings for OPTION_EL_MANUAL_ROTATE_LIMITS +#define EL_MANUAL_ROTATE_DOWN_LIMIT -1 +#define EL_MANUAL_ROTATE_UP_LIMIT 181 + +// Speed pot settings +#define SPEED_POT_LOW 0 +#define SPEED_POT_HIGH 1023 +#define SPEED_POT_LOW_MAP 1 +#define SPEED_POT_HIGH_MAP 255 + +// Azimuth preset pot settings +#define AZ_PRESET_POT_FULL_CW 0 +#define AZ_PRESET_POT_FULL_CCW 1023 +#define AZ_PRESET_POT_FULL_CW_MAP 180 // azimuth pot fully counter-clockwise degrees +#define AZ_PRESET_POT_FULL_CCW_MAP 630 // azimuth pot fully clockwise degrees + +#define ENCODER_PRESET_TIMEOUT 5000 + +// various code settings +#define AZIMUTH_TOLERANCE 3.0 // rotator will stop within X degrees when doing autorotation +#define ELEVATION_TOLERANCE 0.1 //1.0 +#define OPERATION_TIMEOUT 120000 // timeout for any rotation operation in mS ; 120 seconds is usually enough unless you have the speed turned down +#define TIMED_INTERVAL_ARRAY_SIZE 20 + +#define CONTROL_PORT_BAUD_RATE 9600 +#define REMOTE_UNIT_PORT_BAUD_RATE 9600 +#define GPS_PORT_BAUD_RATE 9600 +#define GPS_MIRROR_PORT_BAUD_RATE 9600 +#define CONTROL_PORT_MAPPED_TO &Serial // change this line to map the control port to a different serial port (Serial1, Serial2, etc.) +//#define REMOTE_PORT_MAPPED_TO &Serial1 // change this line to map the remote_unit port to a different serial port +#define GPS_PORT_MAPPED_TO &Serial2 // change this line to map the GPS port to a different serial port +//#define GPS_MIRROR_PORT &Serial1 //3 // use this to mirror output from a GPS unit into the Arduino out another port (uncomment to enable) + +#define LCD_COLUMNS 20 //16 +#define LCD_ROWS 4 //2 // this is automatically set below for HARDWARE_EA4TX_ARS_USB and HARDWARE_M0UPU +#define LCD_UPDATE_TIME 1000 // LCD update time in milliseconds +#define I2C_LCD_COLOR GREEN // default color of I2C LCD display, including Adafruit and Yourduino; some Yourduino may want this as LED_ON +#define LCD_HHMM_CLOCK_POSITION LEFT //LEFT or RIGHT +#define LCD_HHMMSS_CLOCK_POSITION LEFT //LEFT or RIGHT +#define LCD_ALT_HHMM_CLOCK_AND_MAIDENHEAD_POSITION LEFT +#define LCD_ALT_HHMM_CLOCK_AND_MAIDENHEAD_ROW 1 +#define LCD_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD_POSITION LEFT +#define LCD_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD_ROW 1 +#define LCD_BIG_CLOCK_ROW 4 +#define LCD_GPS_INDICATOR_POSITION RIGHT //LEFT or RIGHT +#define LCD_GPS_INDICATOR_ROW 1 +#define LCD_MOON_TRACKING_ROW 3 // LCD display row for OPTION_DISPLAY_MOON_TRACKING_CONTINUOUSLY +#define LCD_MOON_TRACKING_UPDATE_INTERVAL 5000 +#define LCD_SUN_TRACKING_ROW 4 // LCD display row for OPTION_DISPLAY_SUN_TRACKING_CONTINUOUSLY +#define LCD_SUN_TRACKING_UPDATE_INTERVAL 5000 +#define LCD_MOON_OR_SUN_TRACKING_CONDITIONAL_ROW 3 // LCD display row for OPTION_DISPLAY_MOON_OR_SUN_TRACKING_CONDITIONAL +#define SPLASH_SCREEN_TIME 3000 + +#define AZ_BRAKE_DELAY 3000 // in milliseconds +#define EL_BRAKE_DELAY 3000 // in milliseconds + +#define BRAKE_ACTIVE_STATE HIGH +#define BRAKE_INACTIVE_STATE LOW + +#define EEPROM_MAGIC_NUMBER 104 +#define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds + + +#if defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) +#define HEADING_MULTIPLIER 100L +#define LCD_HEADING_MULTIPLIER 100.0 +#define LCD_DECIMAL_PLACES 2 +#endif //FEATURE_TWO_DECIMAL_PLACE_HEADINGS + +#if defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) +#define HEADING_MULTIPLIER 10 +#define LCD_HEADING_MULTIPLIER 10.0 +#define LCD_DECIMAL_PLACES 1 +#endif //FEATURE_ONE_DECIMAL_PLACE_HEADINGS + +#if !defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) +#define HEADING_MULTIPLIER 1 +#define LCD_HEADING_MULTIPLIER 1.0 +#define LCD_DECIMAL_PLACES 0 +#endif //!defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) + +#define AZ_POSITION_ROTARY_ENCODER_DEG_PER_PULSE 0.5 +#define EL_POSITION_ROTARY_ENCODER_DEG_PER_PULSE 0.5 + +#define AZ_POSITION_PULSE_DEG_PER_PULSE 0.5 +#define EL_POSITION_PULSE_DEG_PER_PULSE 0.5 + +#define PARK_AZIMUTH 360.0 * HEADING_MULTIPLIER // replace the 0.0 with your park azimuth; azimuth is in raw degrees (i.e. on a 180 degree starting point rotator, 0 degrees = 360) +#define PARK_ELEVATION 0.0 * HEADING_MULTIPLIER // replace the 0.0 with your park elevation + +#define COMMAND_BUFFER_SIZE 50 + +#define REMOTE_BUFFER_TIMEOUT_MS 250 +#define REMOTE_UNIT_COMMAND_TIMEOUT_MS 2000 +#define AZ_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for azimuth +#define EL_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for elevation + +#define ROTATE_PIN_INACTIVE_VALUE LOW +#define ROTATE_PIN_ACTIVE_VALUE HIGH + +#define AZIMUTH_SMOOTHING_FACTOR 0 // value = 0 to 99.9 +#define ELEVATION_SMOOTHING_FACTOR 0 // value = 0 to 99.9 + +#define AZIMUTH_MEASUREMENT_FREQUENCY_MS 100 // this does not apply if using FEATURE_AZ_POSITION_GET_FROM_REMOTE_UNIT +#define ELEVATION_MEASUREMENT_FREQUENCY_MS 100 // this does not apply if using FEATURE_EL_POSITION_GET_FROM_REMOTE_UNIT + +#define JOYSTICK_WAIT_TIME_MS 100 + +#define ROTATION_INDICATOR_PIN_ACTIVE_STATE HIGH +#define ROTATION_INDICATOR_PIN_INACTIVE_STATE LOW +#define ROTATION_INDICATOR_PIN_TIME_DELAY_SECONDS 0 +#define ROTATION_INDICATOR_PIN_TIME_DELAY_MINUTES 0 + +#define AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000.0 +#define EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000.0 +#define AZ_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION 0 // can be 0 to 4 x AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV +#define EL_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION 0 // can be 0 to 4 x EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV + +#define SERIAL_LED_TIME_MS 250 + +#define DEFAULT_LATITUDE 40.889958 +#define DEFAULT_LONGITUDE -75.585972 + +#define MOON_TRACKING_CHECK_INTERVAL 5000 +#define MOON_AOS_AZIMUTH_MIN 0 +#define MOON_AOS_AZIMUTH_MAX 360 +#define MOON_AOS_ELEVATION_MIN 0 +#define MOON_AOS_ELEVATION_MAX 180 + + +#define SUN_TRACKING_CHECK_INTERVAL 5000 +#define SUN_AOS_AZIMUTH_MIN 0 +#define SUN_AOS_AZIMUTH_MAX 360 +#define SUN_AOS_ELEVATION_MIN 0 +#define SUN_AOS_ELEVATION_MAX 180 + +#ifdef LANGUAGE_ENGLISH // English language support (copy leading and trailing spaces when making your own language section) +#define MOON_STRING "moon " +#define SUN_STRING "sun " +#define AZ_TARGET_STRING "Az Target " +#define EL_TARGET_STRING "El Target " +#define TARGET_STRING "Target " +#define PARKED_STRING "Parked" +#define ROTATING_CW_STRING "Rotating CW" +#define ROTATING_CCW_STRING "Rotating CCW" +#define ROTATING_TO_STRING "Rotating to " +#define ELEVATING_TO_STRING "Elevating to " +#define ELEVATING_UP_STRING "Elevating Up" +#define ELEVATING_DOWN_STRING "Elevating Down" +#define ROTATING_STRING "Rotating " +#define CW_STRING "CW" +#define CCW_STRING "CCW" +#define UP_STRING "UP" +#define DOWN_STRING "DOWN" +#define AZIMUTH_STRING "Azimuth " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "W" +#define S_STRING "S" +#define E_STRING "E" +#define NW_STRING "NW" +#define SW_STRING "SW" +#define SE_STRING "SE" +#define NE_STRING "NE" +#define NNW_STRING "NNW" +#define WNW_STRING "WNW" +#define WSW_STRING "WSW" +#define SSW_STRING "SSW" +#define SSE_STRING "SSE" +#define ESE_STRING "ESE" +#define ENE_STRING "ENE" +#define NNE_STRING "NNE" +#endif //LANGUAGE_ENGLISH + +#ifdef LANGUAGE_SPANISH // Courtesy of Maximo, EA1DDO +#define MOON_STRING "Luna " +#define SUN_STRING "Sol " +#define AZ_TARGET_STRING "Az Objetivo " +#define EL_TARGET_STRING "El Objetivo " +#define TARGET_STRING "Objetivo " +#define PARKED_STRING "Aparcado" +#define ROTATING_CW_STRING "Girando Dcha" +#define ROTATING_CCW_STRING "Girando Izq" +#define ROTATING_TO_STRING "Girando a " +#define ELEVATING_TO_STRING "Elevando a " +#define ELEVATING_UP_STRING "Subiendo" +#define ELEVATING_DOWN_STRING "Bajando" +#define ROTATING_STRING "Girando " +#define CW_STRING "Dcha" +#define CCW_STRING "Izq" +#define UP_STRING "Arriba" +#define DOWN_STRING "Abajo" +#define AZIMUTH_STRING "Azimuth " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "O" +#define S_STRING "S" +#define E_STRING "E" +#define NW_STRING "NO" +#define SW_STRING "SO" +#define SE_STRING "SE" +#define NE_STRING "NE" +#define NNW_STRING "NNO" +#define WNW_STRING "ONO" +#define WSW_STRING "OSO" +#define SSW_STRING "SSO" +#define SSE_STRING "SSE" +#define ESE_STRING "ESE" +#define ENE_STRING "ENE" +#define NNE_STRING "NNE" +#endif //LANGUAGE_SPANISH + +#ifdef LANGUAGE_CZECH // courtesy of Jan, OK2ZAW +#define MOON_STRING "mesic " +#define SUN_STRING "slunce " +#define AZ_TARGET_STRING "Az cíl " +#define EL_TARGET_STRING "El cíl " +#define TARGET_STRING "Cil " +#define PARKED_STRING "Parkovat" +#define ROTATING_CW_STRING "Otacim CW" +#define ROTATING_CCW_STRING "Otacim CCW" +#define ROTATING_TO_STRING "Otacim na " +#define ELEVATING_TO_STRING "Elevovat na " +#define ELEVATING_UP_STRING "Elevovat nahoru" +#define ELEVATING_DOWN_STRING "Elevovat dolu" +#define ROTATING_STRING "Otacet " +#define CW_STRING "CW" +#define CCW_STRING "CCW" +#define UP_STRING "Nahoru" +#define DOWN_STRING "Dolu" +#define AZIMUTH_STRING "Azimut " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "smer ^ KL" +#define W_STRING "smer < HK" +#define S_STRING "smer v ZS" +#define E_STRING "smer > VK" +#define NW_STRING "smer < W" +#define SW_STRING "smer v VP8" +#define SE_STRING "smer > HZ" +#define NE_STRING "smer ^ JA" +#define NNW_STRING "smer ^ VE" +#define WNW_STRING "smer < CO" +#define WSW_STRING "smer < PY" +#define SSW_STRING "smer v ZD9" +#define SSE_STRING "smer v 5R" +#define ESE_STRING "smer > 8Q" +#define ENE_STRING "smer > ZL" +#define NNE_STRING "smer ^ UA0" +#endif //LANGUAGE_CZECH + +#ifdef LANGUAGE_ITALIAN // courtesy of Paolo, IT9IPQ +#define MOON_STRING "luna" +#define SUN_STRING "sole " +#define AZ_TARGET_STRING "Punta Az " +#define EL_TARGET_STRING "Punta El " +#define TARGET_STRING "Punta " +#define PARKED_STRING "Posa " +#define ROTATING_CW_STRING "Ruota DX > " +#define ROTATING_CCW_STRING "Ruota SX < " +#define ROTATING_TO_STRING "Ruota verso " +#define ELEVATING_TO_STRING "Alza verso " +#define ELEVATING_UP_STRING "Alzo Su " +#define ELEVATING_DOWN_STRING "Abbasso Giu' " +#define ROTATING_STRING "Ruota " +#define CW_STRING "DX" +#define CCW_STRING "SX " +#define UP_STRING "SU" +#define DOWN_STRING "GIU'" +#define AZIMUTH_STRING "Azimuth " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "W" +#define S_STRING "S" +#define E_STRING "E" +#define NW_STRING "NW" +#define SW_STRING "SW" +#define SE_STRING "SE" +#define NE_STRING "NE" +#define NNW_STRING "NNW" +#define WNW_STRING "WNW" +#define WSW_STRING "WSW" +#define SSW_STRING "SSW" +#define SSE_STRING "SSE" +#define ESE_STRING "ESE" +#define ENE_STRING "ENE" +#define NNE_STRING "NNE" +#endif //LANGUAGE_ITALIAN + +#ifdef LANGUAGE_PORTUGUESE_BRASIL // courtesy of Ismael, PY4PI +#define MOON_STRING "lua " +#define SUN_STRING "sol " +#define AZ_TARGET_STRING "Objetivo Az " +#define EL_TARGET_STRING "Objetivo El " +#define TARGET_STRING "Objetivo " +#define PARKED_STRING "Estacionado" +#define ROTATING_CW_STRING "Rodando DIR" +#define ROTATING_CCW_STRING "Rodando ESQ" +#define ROTATING_TO_STRING "Rodando para " +#define ELEVATING_TO_STRING "Elevando para " +#define ELEVATING_UP_STRING "Subindo" +#define ELEVATING_DOWN_STRING "Descendo" +#define ROTATING_STRING "Rodando " +#define CW_STRING "DIR" +#define CCW_STRING "ESQ" +#define UP_STRING "SOBE" +#define DOWN_STRING "DESCE" +#define AZIMUTH_STRING "Azimute " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "O" +#define S_STRING "S" +#define E_STRING "L" +#define NW_STRING "NO" +#define SW_STRING "SO" +#define SE_STRING "SL" +#define NE_STRING "NL" +#define NNW_STRING "NNO" +#define WNW_STRING "ONO" +#define WSW_STRING "OSO" +#define SSW_STRING "SSO" +#define SSE_STRING "SSL" +#define ESE_STRING "LSL" +#define ENE_STRING "LNL" +#define NNE_STRING "NNL" +#endif //LANGUAGE_PORTUGUESE_BRASIL + +#define TRACKING_ACTIVE_CHAR "*" +#define TRACKING_INACTIVE_CHAR "-" + +#define INTERNAL_CLOCK_CORRECTION 0.00145 + +#define SYNC_TIME_WITH_GPS 1 +#define SYNC_COORDINATES_WITH_GPS 1 +#define GPS_SYNC_PERIOD_SECONDS 10 // how long to consider internal clock syncronized after a GPS reading +#define GPS_VALID_FIX_AGE_MS 10000 // consider a GPS reading valid if the fix age is less than this +#define GPS_UPDATE_LATENCY_COMPENSATION_MS 200 + +#define SYNC_WITH_RTC_SECONDS 59 // syncronize internal clock with realtime clock every x seconds +#define SYNC_RTC_TO_GPS_SECONDS 12 // synchronize realtime clock to GPS every x seconds + +#define SYNC_MASTER_CLOCK_TO_SLAVE_CLOCK_SECS 10 // for OPTION_SYNC_MASTER_CLOCK_TO_SLAVE - use when GPS unit is connected to slave unit and you want to synchronize the master unit clock to the slave unit clock +#define SYNC_MASTER_COORDINATES_TO_SLAVE_SECS 20 // for OPTION_SYNC_MASTER_COORDINATES_TO_SLAVE - use when GPS unit is connected to slave unit and you want to synchronize the master unit coordinates to the slave unit GPS + + +#define ETHERNET_MAC_ADDRESS 0xDE,0xAD,0xBE,0xEF,0xFE,0xEE //<-DON'T FORGET TO USE DIFFERENT MAC ADDRESSES FOR MASTER AND SLAVE!!! +#define ETHERNET_IP_ADDRESS 192,168,1,172 //<-DON'T FORGET TO USE DIFFERENT IP ADDRESSES FOR MASTER AND SLAVE!!! +#define ETHERNET_IP_GATEWAY 192,168,1,1 +#define ETHERNET_IP_SUBNET_MASK 255,255,255,0 +#define ETHERNET_TCP_PORT_0 23 +#define ETHERNET_TCP_PORT_1 24 +#define ETHERNET_MESSAGE_TIMEOUT_MS 5000 +#define ETHERNET_PREAMBLE "K3NG" // used only with Ethernet master/slave link + +#define ETHERNET_SLAVE_IP_ADDRESS 192,168,1,173 +#define ETHERNET_SLAVE_TCP_PORT 23 +#define ETHERNET_SLAVE_RECONNECT_TIME_MS 250 + +#define POWER_SWITCH_IDLE_TIMEOUT 15 // use with FEATURE_POWER_SWITCH; units are minutes + +#ifdef HARDWARE_EA4TX_ARS_USB +#define BUTTON_ACTIVE_STATE HIGH +#define BUTTON_INACTIVE_STATE LOW +#else +#define BUTTON_ACTIVE_STATE LOW +#define BUTTON_INACTIVE_STATE HIGH +#endif + +/* + * + * Azimuth and Elevation calibraton tables - use with FEATURE_AZIMUTH_CORRECTION and/or FEATURE_ELEVATION_CORRECTION + * + * You must have the same number of entries in the _FROM_ and _TO_ arrays! + * + */ + +#define AZIMUTH_CALIBRATION_FROM_ARRAY {180,630} /* these are in "raw" degrees, i.e. when going east past 360 degrees, add 360 degrees*/ +#define AZIMUTH_CALIBRATION_TO_ARRAY {180,630} + +// example: reverse rotation sensing +// #define AZIMUTH_CALIBRATION_FROM_ARRAY {0,359} +// #define AZIMUTH_CALIBRATION_TO_ARRAY {359,0} + + +#define ELEVATION_CALIBRATION_FROM_ARRAY {-180,0,180} +#define ELEVATION_CALIBRATION_TO_ARRAY {-180,0,180} + +#define ANALOG_OUTPUT_MAX_EL_DEGREES 180 + +#define EL_POSITION_PULSE_DEBOUNCE 500 // in ms + + +/* Pololu LSM303 Calibration tables + * + * + * For use with FEATURE_AZ_POSITION_POLOLU_LSM303 and/or FEATURE_EL_POSITION_POLOLU_LSM303 + * + + + Calibration values; the default values of +/-32767 for each axis + lead to an assumed magnetometer bias of 0. Use the Calibrate example + program to determine appropriate values for your particular unit. + + min: { +59, +19, -731} max: { +909, +491, +14} + min: {32767, 32767, 32767} max: {-32768, -32768, -32768} + + */ + +#define POLOLU_LSM_303_MIN_ARRAY {+59, +19, -731} +#define POLOLU_LSM_303_MAX_ARRAY {+909, +491, +14} + +#define AUTOCORRECT_TIME_MS_AZ 1000 +#define AUTOCORRECT_TIME_MS_EL 1000 + + + + +/* ---------------------------- object declarations ---------------------------------------------- + + + Object declarations are required for several devices, including LCD displays, compass devices, and accelerometers + + +*/ + + +#ifdef FEATURE_4_BIT_LCD_DISPLAY +LiquidCrystal lcd(lcd_4_bit_rs_pin, lcd_4_bit_enable_pin, lcd_4_bit_d4_pin, lcd_4_bit_d5_pin, lcd_4_bit_d6_pin, lcd_4_bit_d7_pin); +#endif //FEATURE_4_BIT_LCD_DISPLAY + + +#ifdef FEATURE_ADAFRUIT_I2C_LCD +Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield(); +#endif //FEATURE_ADAFRUIT_I2C_LCD + +#ifdef FEATURE_YOURDUINO_I2C_LCD +#define I2C_ADDR 0x20 +#define BACKLIGHT_PIN 3 +#define LED_OFF 1 +#define LED_ON 0 +LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); +#endif //FEATURE_YOURDUINO_I2C_LCD + +#ifdef FEATURE_RFROBOT_I2C_DISPLAY +LiquidCrystal_I2C lcd(0x27,16,2); +#endif //FEATURE_RFROBOT_I2C_DISPLAY + +#ifdef FEATURE_AZ_POSITION_HMC5883L +HMC5883L compass; +#endif //FEATURE_AZ_POSITION_HMC5883L + +#ifdef FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB +ADXL345 accel; +#endif //FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB + +#ifdef FEATURE_EL_POSITION_ADXL345_USING_ADAFRUIT_LIB +Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); +#endif //FEATURE_EL_POSITION_ADXL345_USING_ADAFRUIT_LIB + +#if defined(FEATURE_EL_POSITION_ADAFRUIT_LSM303) || defined(FEATURE_AZ_POSITION_ADAFRUIT_LSM303) +Adafruit_LSM303 lsm; +#endif + +#if defined(FEATURE_AZ_POSITION_POLOLU_LSM303) || defined(FEATURE_EL_POSITION_POLOLU_LSM303) +LSM303 compass; +LSM303::vector running_min = {32767, 32767, 32767}, running_max = {-32768, -32768, -32768}; +char report[80]; +#endif //FEATURE_AZ_POSITION_POLOLU_LSM303 + +#ifdef FEATURE_AZ_POSITION_HH12_AS5045_SSI +#include "hh12.h" +hh12 azimuth_hh12; +#endif //FEATURE_AZ_POSITION_HH12_AS5045_SSI + +#ifdef FEATURE_EL_POSITION_HH12_AS5045_SSI +#include "hh12.h" +hh12 elevation_hh12; +#endif //FEATURE_EL_POSITION_HH12_AS5045_SSI + +#ifdef FEATURE_GPS +TinyGPS gps; +#endif //FEATURE_GPS + +#ifdef FEATURE_RTC_DS1307 +RTC_DS1307 rtc; +#endif //FEATURE_RTC_DS1307 + +#ifdef FEATURE_RTC_PCF8583 +PCF8583 rtc(0xA0); +#endif //FEATURE_RTC_PCF8583 + +#ifdef HARDWARE_EA4TX_ARS_USB +#undef LCD_COLUMNS +#undef LCD_ROWS +#define LCD_COLUMNS 16 +#define LCD_ROWS 2 +#endif //HARDWARE_EA4TX_ARS_USB + +#ifdef HARDWARE_M0UPU +#undef LCD_ROWS +#define LCD_ROWS 2 +#endif //HARDWARE_M0UPU + diff --git a/rotator_settings_m0upu.h b/rotator_settings_m0upu.h new file mode 100644 index 0000000..b1cf6b0 --- /dev/null +++ b/rotator_settings_m0upu.h @@ -0,0 +1,594 @@ + +/* -------------------------- rotation settings ---------------------------------------*/ + +#define AZIMUTH_STARTING_POINT_DEFAULT 180 // the starting point in degrees of the azimuthal rotator + +#define AZIMUTH_ROTATION_CAPABILITY_DEFAULT 450 // the default rotation capability of the rotator in degrees + +#define ELEVATION_MAXIMUM_DEGREES 180 // change this to set the maximum elevation in degrees + +/* --------------------------- Settings ------------------------------------------------ + +You can tweak these, but read the online documentation! + +*/ + +// analog voltage calibration - these are default values; you can either tweak these or set via the Yaesu O and F commands (and O2 and F2).... +#define ANALOG_AZ_FULL_CCW 4 +#define ANALOG_AZ_FULL_CW 1009 +#define ANALOG_EL_0_DEGREES 2 +#define ANALOG_EL_MAX_ELEVATION 1018 // maximum elevation is normally 180 degrees unless change below for ELEVATION_MAXIMUM_DEGREES + +#define ANALOG_AZ_OVERLAP_DEGREES 540 // if overlap_led above is enabled, turn on overlap led line if azimuth is greater than this setting + // you must use raw azimuth (if the azimuth on the rotator crosses over to 0 degrees, add 360 + // for example, on a Yaesu 450 degree rotator with a starting point of 180 degrees, and an overlap LED + // turning on when going CW and crossing 180, ANALOG_AZ_OVERLAP_DEGREES should be set for 540 (180 + 360) +#define OPTION_OVERLAP_LED_BLINK_MS 100 + +// PWM speed voltage settings +#define PWM_SPEED_VOLTAGE_X1 64 // 0 to 255 +#define PWM_SPEED_VOLTAGE_X2 128 // 0 to 255 +#define PWM_SPEED_VOLTAGE_X3 191 // 0 to 255 +#define PWM_SPEED_VOLTAGE_X4 253 // 0 to 255 + +//AZ +#define AZ_SLOWSTART_DEFAULT 0 // 0 = off ; 1 = on +#define AZ_SLOWDOWN_DEFAULT 0 // 0 = off ; 1 = on +#define AZ_SLOW_START_UP_TIME 2000 // if slow start is enabled, the unit will ramp up speed for this many milliseconds +#define AZ_SLOW_START_STARTING_PWM 1 // PWM starting value for slow start (must be < 256) +#define AZ_SLOW_START_STEPS 20 // must be < 256 + + +#define SLOW_DOWN_BEFORE_TARGET_AZ 10.0 // if slow down is enabled, slowdown will be activated within this many degrees of target azimuth +#define AZ_SLOW_DOWN_PWM_START 200 // starting PWM value for slow down (must be < 256) +#define AZ_SLOW_DOWN_PWM_STOP 20 // ending PWM value for slow down (must be < 256) +#define AZ_SLOW_DOWN_STEPS 200 //20 // must be < 256 +#define AZ_INITIALLY_IN_SLOW_DOWN_PWM 50 // PWM value to start at if we're starting in the slow down zone (1 - 255) + +//EL +#define EL_SLOWSTART_DEFAULT 0 // 0 = off ; 1 = on +#define EL_SLOWDOWN_DEFAULT 0 // 0 = off ; 1 = on +#define EL_SLOW_START_UP_TIME 2000 // if slow start is enabled, the unit will ramp up speed for this many milliseconds +#define EL_SLOW_START_STARTING_PWM 1 // PWM starting value for slow start (must be < 256) +#define EL_SLOW_START_STEPS 20 // must be < 256 + +#define SLOW_DOWN_BEFORE_TARGET_EL 10.0 // if slow down is enabled, slowdown will be activated within this many degrees of target elevation +#define EL_SLOW_DOWN_PWM_START 200 // starting PWM value for slow down (must be < 256) +#define EL_SLOW_DOWN_PWM_STOP 20 // ending PWM value for slow down (must be < 256) +#define EL_SLOW_DOWN_STEPS 20 +#define EL_INITIALLY_IN_SLOW_DOWN_PWM 50 // PWM value to start at if we're starting in the slow down zone (1 - 255) + +#define TIMED_SLOW_DOWN_TIME 2000 + +//Variable frequency output settings - LOWEST FREQUENCY IS 31 HERTZ DUE TO ARDUINO tone() FUNCTION LIMITATIONS! +#define AZ_VARIABLE_FREQ_OUTPUT_LOW 31 // Frequency in hertz of minimum speed +#define AZ_VARIABLE_FREQ_OUTPUT_HIGH 5000 //100 // Frequency in hertz of maximum speed +#define EL_VARIABLE_FREQ_OUTPUT_LOW 31 // Frequency in hertz of minimum speed +#define EL_VARIABLE_FREQ_OUTPUT_HIGH 100 // Frequency in hertz of maximum speed + +// Settings for OPTION_AZ_MANUAL_ROTATE_LIMITS +#define AZ_MANUAL_ROTATE_CCW_LIMIT 0 // if using a rotator that starts at 180 degrees, set this to something like 185 +#define AZ_MANUAL_ROTATE_CW_LIMIT 535 // add 360 to this if you go past 0 degrees (i.e. 180 CW after 0 degrees = 540) + +// Settings for OPTION_EL_MANUAL_ROTATE_LIMITS +#define EL_MANUAL_ROTATE_DOWN_LIMIT -1 +#define EL_MANUAL_ROTATE_UP_LIMIT 181 + +// Speed pot settings +#define SPEED_POT_LOW 0 +#define SPEED_POT_HIGH 1023 +#define SPEED_POT_LOW_MAP 1 +#define SPEED_POT_HIGH_MAP 255 + +// Azimuth preset pot settings +#define AZ_PRESET_POT_FULL_CW 0 +#define AZ_PRESET_POT_FULL_CCW 1023 +#define AZ_PRESET_POT_FULL_CW_MAP 180 // azimuth pot fully counter-clockwise degrees +#define AZ_PRESET_POT_FULL_CCW_MAP 630 // azimuth pot fully clockwise degrees + +#define ENCODER_PRESET_TIMEOUT 5000 + +// various code settings +#define AZIMUTH_TOLERANCE 3.0 // rotator will stop within X degrees when doing autorotation +#define ELEVATION_TOLERANCE 0.1 //1.0 +#define OPERATION_TIMEOUT 120000 // timeout for any rotation operation in mS ; 120 seconds is usually enough unless you have the speed turned down +#define TIMED_INTERVAL_ARRAY_SIZE 20 + +#define CONTROL_PORT_BAUD_RATE 9600 +#define REMOTE_UNIT_PORT_BAUD_RATE 9600 +#define GPS_PORT_BAUD_RATE 9600 +#define GPS_MIRROR_PORT_BAUD_RATE 9600 +#define CONTROL_PORT_MAPPED_TO &Serial // change this line to map the control port to a different serial port (Serial1, Serial2, etc.) +//#define REMOTE_PORT_MAPPED_TO &Serial1 // change this line to map the remote_unit port to a different serial port +#define GPS_PORT_MAPPED_TO &Serial2 // change this line to map the GPS port to a different serial port +//#define GPS_MIRROR_PORT &Serial1 //3 // use this to mirror output from a GPS unit into the Arduino out another port (uncomment to enable) + +#define LCD_COLUMNS 20 //16 +#define LCD_ROWS 4 //2 // this is automatically set below for HARDWARE_EA4TX_ARS_USB and HARDWARE_M0UPU +#define LCD_UPDATE_TIME 1000 // LCD update time in milliseconds +#define I2C_LCD_COLOR GREEN // default color of I2C LCD display, including Adafruit and Yourduino; some Yourduino may want this as LED_ON +#define LCD_HHMM_CLOCK_POSITION LEFT //LEFT or RIGHT +#define LCD_HHMMSS_CLOCK_POSITION LEFT //LEFT or RIGHT +#define LCD_ALT_HHMM_CLOCK_AND_MAIDENHEAD_POSITION LEFT +#define LCD_ALT_HHMM_CLOCK_AND_MAIDENHEAD_ROW 1 +#define LCD_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD_POSITION LEFT +#define LCD_CONSTANT_HHMMSS_CLOCK_AND_MAIDENHEAD_ROW 1 +#define LCD_BIG_CLOCK_ROW 4 +#define LCD_GPS_INDICATOR_POSITION RIGHT //LEFT or RIGHT +#define LCD_GPS_INDICATOR_ROW 1 +#define LCD_MOON_TRACKING_ROW 3 // LCD display row for OPTION_DISPLAY_MOON_TRACKING_CONTINUOUSLY +#define LCD_MOON_TRACKING_UPDATE_INTERVAL 5000 +#define LCD_SUN_TRACKING_ROW 4 // LCD display row for OPTION_DISPLAY_SUN_TRACKING_CONTINUOUSLY +#define LCD_SUN_TRACKING_UPDATE_INTERVAL 5000 +#define LCD_MOON_OR_SUN_TRACKING_CONDITIONAL_ROW 3 // LCD display row for OPTION_DISPLAY_MOON_OR_SUN_TRACKING_CONDITIONAL +#define SPLASH_SCREEN_TIME 3000 + +#define AZ_BRAKE_DELAY 3000 // in milliseconds +#define EL_BRAKE_DELAY 3000 // in milliseconds + +#define BRAKE_ACTIVE_STATE HIGH +#define BRAKE_INACTIVE_STATE LOW + +#define EEPROM_MAGIC_NUMBER 104 +#define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds + + +#if defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) +#define HEADING_MULTIPLIER 100L +#define LCD_HEADING_MULTIPLIER 100.0 +#define LCD_DECIMAL_PLACES 2 +#endif //FEATURE_TWO_DECIMAL_PLACE_HEADINGS + +#if defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) +#define HEADING_MULTIPLIER 10 +#define LCD_HEADING_MULTIPLIER 10.0 +#define LCD_DECIMAL_PLACES 1 +#endif //FEATURE_ONE_DECIMAL_PLACE_HEADINGS + +#if !defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) +#define HEADING_MULTIPLIER 1 +#define LCD_HEADING_MULTIPLIER 1.0 +#define LCD_DECIMAL_PLACES 0 +#endif //!defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) + +#define AZ_POSITION_ROTARY_ENCODER_DEG_PER_PULSE 0.5 +#define EL_POSITION_ROTARY_ENCODER_DEG_PER_PULSE 0.5 + +#define AZ_POSITION_PULSE_DEG_PER_PULSE 0.5 +#define EL_POSITION_PULSE_DEG_PER_PULSE 0.5 + +#define PARK_AZIMUTH 360.0 * HEADING_MULTIPLIER // replace the 0.0 with your park azimuth; azimuth is in raw degrees (i.e. on a 180 degree starting point rotator, 0 degrees = 360) +#define PARK_ELEVATION 0.0 * HEADING_MULTIPLIER // replace the 0.0 with your park elevation + +#define COMMAND_BUFFER_SIZE 50 + +#define REMOTE_BUFFER_TIMEOUT_MS 250 +#define REMOTE_UNIT_COMMAND_TIMEOUT_MS 2000 +#define AZ_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for azimuth +#define EL_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for elevation + +#define ROTATE_PIN_INACTIVE_VALUE LOW +#define ROTATE_PIN_ACTIVE_VALUE HIGH + +#define AZIMUTH_SMOOTHING_FACTOR 0 // value = 0 to 99.9 +#define ELEVATION_SMOOTHING_FACTOR 0 // value = 0 to 99.9 + +#define AZIMUTH_MEASUREMENT_FREQUENCY_MS 100 // this does not apply if using FEATURE_AZ_POSITION_GET_FROM_REMOTE_UNIT +#define ELEVATION_MEASUREMENT_FREQUENCY_MS 100 // this does not apply if using FEATURE_EL_POSITION_GET_FROM_REMOTE_UNIT + +#define JOYSTICK_WAIT_TIME_MS 100 + +#define ROTATION_INDICATOR_PIN_ACTIVE_STATE HIGH +#define ROTATION_INDICATOR_PIN_INACTIVE_STATE LOW +#define ROTATION_INDICATOR_PIN_TIME_DELAY_SECONDS 0 +#define ROTATION_INDICATOR_PIN_TIME_DELAY_MINUTES 0 + +#define AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000.0 +#define EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV 2000.0 +#define AZ_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION 0 // can be 0 to 4 x AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV +#define EL_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION 0 // can be 0 to 4 x EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV + +#define SERIAL_LED_TIME_MS 250 + +#define DEFAULT_LATITUDE 40.889958 +#define DEFAULT_LONGITUDE -75.585972 + +#define MOON_TRACKING_CHECK_INTERVAL 5000 +#define MOON_AOS_AZIMUTH_MIN 0 +#define MOON_AOS_AZIMUTH_MAX 360 +#define MOON_AOS_ELEVATION_MIN 0 +#define MOON_AOS_ELEVATION_MAX 180 + + +#define SUN_TRACKING_CHECK_INTERVAL 5000 +#define SUN_AOS_AZIMUTH_MIN 0 +#define SUN_AOS_AZIMUTH_MAX 360 +#define SUN_AOS_ELEVATION_MIN 0 +#define SUN_AOS_ELEVATION_MAX 180 + +#ifdef LANGUAGE_ENGLISH // English language support (copy leading and trailing spaces when making your own language section) +#define MOON_STRING "moon " +#define SUN_STRING "sun " +#define AZ_TARGET_STRING "Az Target " +#define EL_TARGET_STRING "El Target " +#define TARGET_STRING "Target " +#define PARKED_STRING "Parked" +#define ROTATING_CW_STRING "Rotating CW" +#define ROTATING_CCW_STRING "Rotating CCW" +#define ROTATING_TO_STRING "Rotating to " +#define ELEVATING_TO_STRING "Elevating to " +#define ELEVATING_UP_STRING "Elevating Up" +#define ELEVATING_DOWN_STRING "Elevating Down" +#define ROTATING_STRING "Rotating " +#define CW_STRING "CW" +#define CCW_STRING "CCW" +#define UP_STRING "UP" +#define DOWN_STRING "DOWN" +#define AZIMUTH_STRING "Azimuth " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "W" +#define S_STRING "S" +#define E_STRING "E" +#define NW_STRING "NW" +#define SW_STRING "SW" +#define SE_STRING "SE" +#define NE_STRING "NE" +#define NNW_STRING "NNW" +#define WNW_STRING "WNW" +#define WSW_STRING "WSW" +#define SSW_STRING "SSW" +#define SSE_STRING "SSE" +#define ESE_STRING "ESE" +#define ENE_STRING "ENE" +#define NNE_STRING "NNE" +#endif //LANGUAGE_ENGLISH + +#ifdef LANGUAGE_SPANISH // Courtesy of Maximo, EA1DDO +#define MOON_STRING "Luna " +#define SUN_STRING "Sol " +#define AZ_TARGET_STRING "Az Objetivo " +#define EL_TARGET_STRING "El Objetivo " +#define TARGET_STRING "Objetivo " +#define PARKED_STRING "Aparcado" +#define ROTATING_CW_STRING "Girando Dcha" +#define ROTATING_CCW_STRING "Girando Izq" +#define ROTATING_TO_STRING "Girando a " +#define ELEVATING_TO_STRING "Elevando a " +#define ELEVATING_UP_STRING "Subiendo" +#define ELEVATING_DOWN_STRING "Bajando" +#define ROTATING_STRING "Girando " +#define CW_STRING "Dcha" +#define CCW_STRING "Izq" +#define UP_STRING "Arriba" +#define DOWN_STRING "Abajo" +#define AZIMUTH_STRING "Azimuth " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "O" +#define S_STRING "S" +#define E_STRING "E" +#define NW_STRING "NO" +#define SW_STRING "SO" +#define SE_STRING "SE" +#define NE_STRING "NE" +#define NNW_STRING "NNO" +#define WNW_STRING "ONO" +#define WSW_STRING "OSO" +#define SSW_STRING "SSO" +#define SSE_STRING "SSE" +#define ESE_STRING "ESE" +#define ENE_STRING "ENE" +#define NNE_STRING "NNE" +#endif //LANGUAGE_SPANISH + +#ifdef LANGUAGE_CZECH // courtesy of Jan, OK2ZAW +#define MOON_STRING "mesic " +#define SUN_STRING "slunce " +#define AZ_TARGET_STRING "Az cíl " +#define EL_TARGET_STRING "El cíl " +#define TARGET_STRING "Cil " +#define PARKED_STRING "Parkovat" +#define ROTATING_CW_STRING "Otacim CW" +#define ROTATING_CCW_STRING "Otacim CCW" +#define ROTATING_TO_STRING "Otacim na " +#define ELEVATING_TO_STRING "Elevovat na " +#define ELEVATING_UP_STRING "Elevovat nahoru" +#define ELEVATING_DOWN_STRING "Elevovat dolu" +#define ROTATING_STRING "Otacet " +#define CW_STRING "CW" +#define CCW_STRING "CCW" +#define UP_STRING "Nahoru" +#define DOWN_STRING "Dolu" +#define AZIMUTH_STRING "Azimut " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "smer ^ KL" +#define W_STRING "smer < HK" +#define S_STRING "smer v ZS" +#define E_STRING "smer > VK" +#define NW_STRING "smer < W" +#define SW_STRING "smer v VP8" +#define SE_STRING "smer > HZ" +#define NE_STRING "smer ^ JA" +#define NNW_STRING "smer ^ VE" +#define WNW_STRING "smer < CO" +#define WSW_STRING "smer < PY" +#define SSW_STRING "smer v ZD9" +#define SSE_STRING "smer v 5R" +#define ESE_STRING "smer > 8Q" +#define ENE_STRING "smer > ZL" +#define NNE_STRING "smer ^ UA0" +#endif //LANGUAGE_CZECH + +#ifdef LANGUAGE_ITALIAN // courtesy of Paolo, IT9IPQ +#define MOON_STRING "luna" +#define SUN_STRING "sole " +#define AZ_TARGET_STRING "Punta Az " +#define EL_TARGET_STRING "Punta El " +#define TARGET_STRING "Punta " +#define PARKED_STRING "Posa " +#define ROTATING_CW_STRING "Ruota DX > " +#define ROTATING_CCW_STRING "Ruota SX < " +#define ROTATING_TO_STRING "Ruota verso " +#define ELEVATING_TO_STRING "Alza verso " +#define ELEVATING_UP_STRING "Alzo Su " +#define ELEVATING_DOWN_STRING "Abbasso Giu' " +#define ROTATING_STRING "Ruota " +#define CW_STRING "DX" +#define CCW_STRING "SX " +#define UP_STRING "SU" +#define DOWN_STRING "GIU'" +#define AZIMUTH_STRING "Azimuth " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "W" +#define S_STRING "S" +#define E_STRING "E" +#define NW_STRING "NW" +#define SW_STRING "SW" +#define SE_STRING "SE" +#define NE_STRING "NE" +#define NNW_STRING "NNW" +#define WNW_STRING "WNW" +#define WSW_STRING "WSW" +#define SSW_STRING "SSW" +#define SSE_STRING "SSE" +#define ESE_STRING "ESE" +#define ENE_STRING "ENE" +#define NNE_STRING "NNE" +#endif //LANGUAGE_ITALIAN + +#ifdef LANGUAGE_PORTUGUESE_BRASIL // courtesy of Ismael, PY4PI +#define MOON_STRING "lua " +#define SUN_STRING "sol " +#define AZ_TARGET_STRING "Objetivo Az " +#define EL_TARGET_STRING "Objetivo El " +#define TARGET_STRING "Objetivo " +#define PARKED_STRING "Estacionado" +#define ROTATING_CW_STRING "Rodando DIR" +#define ROTATING_CCW_STRING "Rodando ESQ" +#define ROTATING_TO_STRING "Rodando para " +#define ELEVATING_TO_STRING "Elevando para " +#define ELEVATING_UP_STRING "Subindo" +#define ELEVATING_DOWN_STRING "Descendo" +#define ROTATING_STRING "Rodando " +#define CW_STRING "DIR" +#define CCW_STRING "ESQ" +#define UP_STRING "SOBE" +#define DOWN_STRING "DESCE" +#define AZIMUTH_STRING "Azimute " +#define AZ_STRING "Az" +#define AZ_SPACE_STRING "Az " +#define SPACE_EL_STRING " El" +#define SPACE_EL_SPACE_STRING " El " +#define GPS_STRING "GPS" +#define N_STRING "N" +#define W_STRING "O" +#define S_STRING "S" +#define E_STRING "L" +#define NW_STRING "NO" +#define SW_STRING "SO" +#define SE_STRING "SL" +#define NE_STRING "NL" +#define NNW_STRING "NNO" +#define WNW_STRING "ONO" +#define WSW_STRING "OSO" +#define SSW_STRING "SSO" +#define SSE_STRING "SSL" +#define ESE_STRING "LSL" +#define ENE_STRING "LNL" +#define NNE_STRING "NNL" +#endif //LANGUAGE_PORTUGUESE_BRASIL + +#define TRACKING_ACTIVE_CHAR "*" +#define TRACKING_INACTIVE_CHAR "-" + +#define INTERNAL_CLOCK_CORRECTION 0.00145 + +#define SYNC_TIME_WITH_GPS 1 +#define SYNC_COORDINATES_WITH_GPS 1 +#define GPS_SYNC_PERIOD_SECONDS 10 // how long to consider internal clock syncronized after a GPS reading +#define GPS_VALID_FIX_AGE_MS 10000 // consider a GPS reading valid if the fix age is less than this +#define GPS_UPDATE_LATENCY_COMPENSATION_MS 200 + +#define SYNC_WITH_RTC_SECONDS 59 // syncronize internal clock with realtime clock every x seconds +#define SYNC_RTC_TO_GPS_SECONDS 12 // synchronize realtime clock to GPS every x seconds + +#define SYNC_MASTER_CLOCK_TO_SLAVE_CLOCK_SECS 10 // for OPTION_SYNC_MASTER_CLOCK_TO_SLAVE - use when GPS unit is connected to slave unit and you want to synchronize the master unit clock to the slave unit clock +#define SYNC_MASTER_COORDINATES_TO_SLAVE_SECS 20 // for OPTION_SYNC_MASTER_COORDINATES_TO_SLAVE - use when GPS unit is connected to slave unit and you want to synchronize the master unit coordinates to the slave unit GPS + + +#define ETHERNET_MAC_ADDRESS 0xDE,0xAD,0xBE,0xEF,0xFE,0xEE //<-DON'T FORGET TO USE DIFFERENT MAC ADDRESSES FOR MASTER AND SLAVE!!! +#define ETHERNET_IP_ADDRESS 192,168,1,172 //<-DON'T FORGET TO USE DIFFERENT IP ADDRESSES FOR MASTER AND SLAVE!!! +#define ETHERNET_IP_GATEWAY 192,168,1,1 +#define ETHERNET_IP_SUBNET_MASK 255,255,255,0 +#define ETHERNET_TCP_PORT_0 23 +#define ETHERNET_TCP_PORT_1 24 +#define ETHERNET_MESSAGE_TIMEOUT_MS 5000 +#define ETHERNET_PREAMBLE "K3NG" // used only with Ethernet master/slave link + +#define ETHERNET_SLAVE_IP_ADDRESS 192,168,1,173 +#define ETHERNET_SLAVE_TCP_PORT 23 +#define ETHERNET_SLAVE_RECONNECT_TIME_MS 250 + +#define POWER_SWITCH_IDLE_TIMEOUT 15 // use with FEATURE_POWER_SWITCH; units are minutes + +#ifdef HARDWARE_EA4TX_ARS_USB +#define BUTTON_ACTIVE_STATE HIGH +#define BUTTON_INACTIVE_STATE LOW +#else +#define BUTTON_ACTIVE_STATE LOW +#define BUTTON_INACTIVE_STATE HIGH +#endif + +/* + * + * Azimuth and Elevation calibraton tables - use with FEATURE_AZIMUTH_CORRECTION and/or FEATURE_ELEVATION_CORRECTION + * + * You must have the same number of entries in the _FROM_ and _TO_ arrays! + * + */ + +#define AZIMUTH_CALIBRATION_FROM_ARRAY {180,630} /* these are in "raw" degrees, i.e. when going east past 360 degrees, add 360 degrees*/ +#define AZIMUTH_CALIBRATION_TO_ARRAY {180,630} + +// example: reverse rotation sensing +// #define AZIMUTH_CALIBRATION_FROM_ARRAY {0,359} +// #define AZIMUTH_CALIBRATION_TO_ARRAY {359,0} + + +#define ELEVATION_CALIBRATION_FROM_ARRAY {-180,0,180} +#define ELEVATION_CALIBRATION_TO_ARRAY {-180,0,180} + +#define ANALOG_OUTPUT_MAX_EL_DEGREES 180 + +#define EL_POSITION_PULSE_DEBOUNCE 500 // in ms + + +/* Pololu LSM303 Calibration tables + * + * + * For use with FEATURE_AZ_POSITION_POLOLU_LSM303 and/or FEATURE_EL_POSITION_POLOLU_LSM303 + * + + + Calibration values; the default values of +/-32767 for each axis + lead to an assumed magnetometer bias of 0. Use the Calibrate example + program to determine appropriate values for your particular unit. + + min: { +59, +19, -731} max: { +909, +491, +14} + min: {32767, 32767, 32767} max: {-32768, -32768, -32768} + + */ + +#define POLOLU_LSM_303_MIN_ARRAY {+59, +19, -731} +#define POLOLU_LSM_303_MAX_ARRAY {+909, +491, +14} + +#define AUTOCORRECT_TIME_MS_AZ 1000 +#define AUTOCORRECT_TIME_MS_EL 1000 + + + + +/* ---------------------------- object declarations ---------------------------------------------- + + + Object declarations are required for several devices, including LCD displays, compass devices, and accelerometers + + +*/ + + +#ifdef FEATURE_4_BIT_LCD_DISPLAY +LiquidCrystal lcd(lcd_4_bit_rs_pin, lcd_4_bit_enable_pin, lcd_4_bit_d4_pin, lcd_4_bit_d5_pin, lcd_4_bit_d6_pin, lcd_4_bit_d7_pin); +#endif //FEATURE_4_BIT_LCD_DISPLAY + + +#ifdef FEATURE_ADAFRUIT_I2C_LCD +Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield(); +#endif //FEATURE_ADAFRUIT_I2C_LCD + +#ifdef FEATURE_YOURDUINO_I2C_LCD +#define I2C_ADDR 0x20 +#define BACKLIGHT_PIN 3 +#define LED_OFF 1 +#define LED_ON 0 +LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin); +#endif //FEATURE_YOURDUINO_I2C_LCD + +#ifdef FEATURE_RFROBOT_I2C_DISPLAY +LiquidCrystal_I2C lcd(0x27,16,2); +#endif //FEATURE_RFROBOT_I2C_DISPLAY + +#ifdef FEATURE_AZ_POSITION_HMC5883L +HMC5883L compass; +#endif //FEATURE_AZ_POSITION_HMC5883L + +#ifdef FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB +ADXL345 accel; +#endif //FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB + +#ifdef FEATURE_EL_POSITION_ADXL345_USING_ADAFRUIT_LIB +Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); +#endif //FEATURE_EL_POSITION_ADXL345_USING_ADAFRUIT_LIB + +#if defined(FEATURE_EL_POSITION_ADAFRUIT_LSM303) || defined(FEATURE_AZ_POSITION_ADAFRUIT_LSM303) +Adafruit_LSM303 lsm; +#endif + +#if defined(FEATURE_AZ_POSITION_POLOLU_LSM303) || defined(FEATURE_EL_POSITION_POLOLU_LSM303) +LSM303 compass; +LSM303::vector running_min = {32767, 32767, 32767}, running_max = {-32768, -32768, -32768}; +char report[80]; +#endif //FEATURE_AZ_POSITION_POLOLU_LSM303 + +#ifdef FEATURE_AZ_POSITION_HH12_AS5045_SSI +#include "hh12.h" +hh12 azimuth_hh12; +#endif //FEATURE_AZ_POSITION_HH12_AS5045_SSI + +#ifdef FEATURE_EL_POSITION_HH12_AS5045_SSI +#include "hh12.h" +hh12 elevation_hh12; +#endif //FEATURE_EL_POSITION_HH12_AS5045_SSI + +#ifdef FEATURE_GPS +TinyGPS gps; +#endif //FEATURE_GPS + +#ifdef FEATURE_RTC_DS1307 +RTC_DS1307 rtc; +#endif //FEATURE_RTC_DS1307 + +#ifdef FEATURE_RTC_PCF8583 +PCF8583 rtc(0xA0); +#endif //FEATURE_RTC_PCF8583 + +#ifdef HARDWARE_EA4TX_ARS_USB +#undef LCD_COLUMNS +#undef LCD_ROWS +#define LCD_COLUMNS 16 +#define LCD_ROWS 2 +#endif //HARDWARE_EA4TX_ARS_USB + +#ifdef HARDWARE_M0UPU +#undef LCD_ROWS +#define LCD_ROWS 2 +#endif //HARDWARE_M0UPU +