From ea0a1d039db6bd3354302c6997a664c7dbe8f67a Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Thu, 20 Nov 2014 21:03:26 -0500 Subject: [PATCH] 2.0.2014112001 --- k3ng_rotator_controller.ino | 231 ++++++++++++---- rotator_features.h | 8 +- rotator_features_wb6kcn.h | 200 ++++++++++++++ rotator_hardware.h | 3 +- rotator_pins.h | 10 +- rotator_pins_wb6kcn.h | 189 +++++++++++++ rotator_settings.h | 4 +- rotator_settings_wb6kcn.h | 538 ++++++++++++++++++++++++++++++++++++ 8 files changed, 1121 insertions(+), 62 deletions(-) create mode 100644 rotator_features_wb6kcn.h create mode 100755 rotator_pins_wb6kcn.h create mode 100644 rotator_settings_wb6kcn.h diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index 0185ed1..5a52be0 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -278,9 +278,13 @@ check_brake_release() bug fix + configuration.az_stepper_motor_last_direction, configuration.az_stepper_motor_last_pin_state, configuration.el_stepper_motor_last_direction, configuration.el_stepper_motor_last_pin_state + + OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK ; HARDWARE_WB6KCN + */ -#define CODE_VERSION "2.0.2014111701" +#define CODE_VERSION "2.0.2014112001" #include #include @@ -289,7 +293,11 @@ #include "rotator_hardware.h" #ifdef HARDWARE_EA4TX_ARS_USB #include "rotator_features_ea4tx_ars_usb.h" -#else +#endif +#ifdef HARDWARE_WB6KCN +#include "rotator_features_wb6kcn.h" +#endif +#if !defined(HARDWARE_EA4TX_ARS_USB) && !defined(HARDWARE_WB6KCN) #include "rotator_features.h" #endif #include "rotator_dependencies.h" @@ -355,11 +363,17 @@ #ifdef HARDWARE_M0UPU #include "rotator_pins_m0upu.h" #endif -#if !defined(HARDWARE_M0UPU) && !defined(HARDWARE_EA4TX_ARS_USB) +#ifdef HARDWARE_WB6KCN +#include "rotator_pins_wb6kcn.h" +#endif +#if !defined(HARDWARE_M0UPU) && !defined(HARDWARE_EA4TX_ARS_USB) &&!defined(HARDWARE_WB6KCN) #include "rotator_pins.h" #endif +#ifdef HARDWARE_WB6KCN +#include "rotator_settings_wb6kcn.h" +#else #include "rotator_settings.h" - +#endif @@ -429,6 +443,10 @@ struct config_t { int last_el_incremental_encoder_position; float azimuth_offset; float elevation_offset; + byte az_stepper_motor_last_pin_state; + byte el_stepper_motor_last_pin_state; + byte az_stepper_motor_last_direction; + byte el_stepper_motor_last_direction; } configuration; @@ -675,8 +693,8 @@ unsigned long last_activity_time = 0; #endif //FEATURE_POWER_SWITCH #ifdef FEATURE_STEPPER_MOTOR -byte az_stepper_motor_last_direction = STEPPER_UNDEF; -byte az_stepper_motor_last_pin_state = LOW; +//byte az_stepper_motor_last_direction = STEPPER_UNDEF; +//byte az_stepper_motor_last_pin_state = LOW; #ifdef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE unsigned long az_stepper_pulse_period_us = 0; unsigned long az_stepper_pulses_remaining = 0; @@ -686,11 +704,16 @@ unsigned long el_stepper_pulses_remaining = 0; #endif //FEATURE_ELEVATION_CONTROL #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE #ifdef FEATURE_ELEVATION_CONTROL -byte el_stepper_motor_last_direction = STEPPER_UNDEF; -byte el_stepper_motor_last_pin_state = LOW; +//byte el_stepper_motor_last_direction = STEPPER_UNDEF; +//byte el_stepper_motor_last_pin_state = LOW; #endif //FEATURE_ELEVATION_CONTROL #endif //FEATURE_STEPPER_MOTOR +#if defined(FEATURE_STEPPER_MOTOR) && defined(FEATURE_ELEVATION_CONTROL) && defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) +byte el_stepper_freq_pin = 0; +unsigned int el_stepper_freq = 0; +#endif //defined(FEATURE_STEPPER_MOTOR) && defined(FEATURE_ELEVATION_CONTROL) && defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) + #ifdef FEATURE_AZIMUTH_CORRECTION float azimuth_calibration_from[] = AZIMUTH_CALIBRATION_FROM_ARRAY; @@ -856,6 +879,10 @@ void loop() { service_analog_output_pins(); #endif //FEATURE_ANALOG_OUTPUT_PINS + #if defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) && defined(FEATURE_STEPPER_MOTOR) + service_stepper_motor_pulse_pins(); + #endif + } /* loop */ /* -------------------------------------- subroutines ----------------------------------------------- @@ -2088,12 +2115,16 @@ void check_serial(){ process_easycom_command(control_port_buffer,1,CONTROL_PORT0,return_string); //control_port->println(return_string); zzzzzz control_port->print(return_string); - control_port->write(incoming_serial_byte); + #ifndef OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK + control_port->write(incoming_serial_byte); + #endif //OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK } else { // we got just a bare AZ command process_easycom_command(control_port_buffer,control_port_buffer_index,CONTROL_PORT0,return_string); //control_port->println(return_string); zzzzzz control_port->print(return_string); + #ifndef OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK control_port->write(incoming_serial_byte); + #endif //OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK } } else { @@ -2101,7 +2132,9 @@ void check_serial(){ process_easycom_command(control_port_buffer,control_port_buffer_index,CONTROL_PORT0,return_string); //control_port->println(return_string); zzzzzz control_port->print(return_string); + #ifndef OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK control_port->write(incoming_serial_byte); + #endif //OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK } } @@ -2110,7 +2143,9 @@ void check_serial(){ process_easycom_command(control_port_buffer,control_port_buffer_index,CONTROL_PORT0,return_string); //control_port->println(return_string); zzzzzz control_port->print(return_string); + #ifndef OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK control_port->write(incoming_serial_byte); + #endif //OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK } #endif //defined(OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK) && defined(FEATURE_ELEVATION_CONTROL) clear_command_buffer(); @@ -3822,6 +3857,14 @@ void initialize_eeprom_with_defaults(){ configuration.last_elevation = 0; #endif + #ifdef FEATURE_STEPPER_MOTOR + configuration.az_stepper_motor_last_direction = STEPPER_UNDEF; + configuration.az_stepper_motor_last_pin_state = LOW; + configuration.el_stepper_motor_last_direction = STEPPER_UNDEF; + configuration.el_stepper_motor_last_pin_state = LOW; + #endif //FEATURE_STEPPER_MOTOR + + write_settings_to_eeprom(); } /* initialize_eeprom_with_defaults */ @@ -4362,6 +4405,15 @@ void output_debug(){ debug_print("debug: \t"); debug_print(CODE_VERSION); + #ifdef HARDWARE_WB6KCN + debug_print(" HARDWARE_WB6KCN"); + #endif + #ifdef HARDWARE_M0UPU + debug_print(" HARDWARE_M0UPU"); + #endif + #ifdef HARDWARE_EA4TX_ARS_USB + debug_print(" HARDWARE_EA4TX_ARS_USB"); + #endif debug_print("\t\t"); #ifdef FEATURE_CLOCK @@ -5311,6 +5363,7 @@ void update_el_variable_outputs(byte speed_voltage){ #endif // DEBUG_VARIABLE_OUTPUTS el_tone = map(speed_voltage, 0, 255, EL_VARIABLE_FREQ_OUTPUT_LOW, EL_VARIABLE_FREQ_OUTPUT_HIGH); + #ifndef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE if ((el_tone < 31) && (el_tone != 0)) {el_tone = 31;} if (el_tone > 20000) {el_tone = 20000;} if (el_tone > 0) { @@ -5318,6 +5371,14 @@ void update_el_variable_outputs(byte speed_voltage){ } else { noTone(el_stepper_motor_pulse); } +//zzzzzzzz + #else //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + set_el_stepper_freq(el_stepper_motor_pulse,el_tone); + #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + + + + #ifdef DEBUG_VARIABLE_OUTPUTS debug_print_int(el_tone); #endif // DEBUG_VARIABLE_OUTPUTS @@ -5532,15 +5593,16 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (az_stepper_motor_direction){ - if (az_stepper_motor_last_direction != STEPPER_CW){ - if (az_stepper_motor_last_pin_state == LOW){ + if (configuration.az_stepper_motor_last_direction != STEPPER_CW){ + if (configuration.az_stepper_motor_last_pin_state == LOW){ digitalWriteEnhanced(az_stepper_motor_direction,HIGH); - az_stepper_motor_last_pin_state = HIGH; + configuration.az_stepper_motor_last_pin_state = HIGH; } else { digitalWriteEnhanced(az_stepper_motor_direction,LOW); - az_stepper_motor_last_pin_state = LOW; + configuration.az_stepper_motor_last_pin_state = LOW; } - az_stepper_motor_last_direction = STEPPER_CW; + configuration.az_stepper_motor_last_direction = STEPPER_CW; + configuration_dirty = 1; } } #endif //FEATURE_STEPPER_MOTOR @@ -5648,15 +5710,16 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (az_stepper_motor_direction){ - if (az_stepper_motor_last_direction != STEPPER_CCW){ - if (az_stepper_motor_last_pin_state == LOW){ + if (configuration.az_stepper_motor_last_direction != STEPPER_CCW){ + if (configuration.az_stepper_motor_last_pin_state == LOW){ digitalWriteEnhanced(az_stepper_motor_direction,HIGH); - az_stepper_motor_last_pin_state = HIGH; + configuration.az_stepper_motor_last_pin_state = HIGH; } else { digitalWriteEnhanced(az_stepper_motor_direction,LOW); - az_stepper_motor_last_pin_state = LOW; + configuration.az_stepper_motor_last_pin_state = LOW; } - az_stepper_motor_last_direction = STEPPER_CCW; + configuration.az_stepper_motor_last_direction = STEPPER_CCW; + configuration_dirty = 1; } } #endif //FEATURE_STEPPER_MOTOR @@ -5720,8 +5783,14 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_pulse) { + #ifndef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE noTone(el_stepper_motor_pulse); digitalWriteEnhanced(el_stepper_motor_pulse,LOW); + #else //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + set_el_stepper_freq(el_stepper_motor_pulse,0); + digitalWriteEnhanced(el_stepper_motor_pulse,LOW); + #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + } #endif //FEATURE_STEPPER_MOTOR } else { @@ -5739,7 +5808,12 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_pulse) { + #ifndef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE tone(el_stepper_motor_pulse, map(normal_el_speed_voltage, 0, 255, EL_VARIABLE_FREQ_OUTPUT_LOW, EL_VARIABLE_FREQ_OUTPUT_HIGH)); + #else //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + set_el_stepper_freq(el_stepper_motor_pulse,map(normal_el_speed_voltage, 0, 255, EL_VARIABLE_FREQ_OUTPUT_LOW, EL_VARIABLE_FREQ_OUTPUT_HIGH)); + #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + } #endif //FEATURE_STEPPER_MOTOR if (rotate_down_freq) { @@ -5757,15 +5831,16 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_direction){ - if (el_stepper_motor_last_direction != STEPPER_UP){ - if (el_stepper_motor_last_pin_state == LOW){ + if (configuration.el_stepper_motor_last_direction != STEPPER_UP){ + if (configuration.el_stepper_motor_last_pin_state == LOW){ digitalWriteEnhanced(el_stepper_motor_direction,HIGH); - el_stepper_motor_last_pin_state = HIGH; + configuration.el_stepper_motor_last_pin_state = HIGH; } else { digitalWriteEnhanced(el_stepper_motor_direction,LOW); - el_stepper_motor_last_pin_state = LOW; + configuration.el_stepper_motor_last_pin_state = LOW; } - el_stepper_motor_last_direction = STEPPER_UP; + configuration.el_stepper_motor_last_direction = STEPPER_UP; + configuration_dirty = 1; } } #endif //FEATURE_STEPPER_MOTOR @@ -5792,8 +5867,14 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_pulse) { + #ifndef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE noTone(el_stepper_motor_pulse); digitalWriteEnhanced(el_stepper_motor_pulse,HIGH); + #else //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + set_el_stepper_freq(el_stepper_motor_pulse,0); + digitalWriteEnhanced(el_stepper_motor_pulse,HIGH); + #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + } #endif //FEATURE_STEPPER_MOTOR } @@ -5830,8 +5911,13 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_pulse) { + #ifndef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE noTone(el_stepper_motor_pulse); digitalWriteEnhanced(el_stepper_motor_pulse,LOW); + #else //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + set_el_stepper_freq(el_stepper_motor_pulse,0); + digitalWriteEnhanced(el_stepper_motor_pulse,LOW); + #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE } #endif //FEATURE_STEPPER_MOTOR } else { @@ -5852,8 +5938,13 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_pulse) { + #ifndef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE tone(el_stepper_motor_pulse, map(normal_el_speed_voltage, 0, 255, EL_VARIABLE_FREQ_OUTPUT_LOW, EL_VARIABLE_FREQ_OUTPUT_HIGH)); digitalWriteEnhanced(el_stepper_motor_pulse,LOW); + #else //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + set_el_stepper_freq(el_stepper_motor_pulse,map(normal_el_speed_voltage, 0, 255, EL_VARIABLE_FREQ_OUTPUT_LOW, EL_VARIABLE_FREQ_OUTPUT_HIGH)); + digitalWriteEnhanced(el_stepper_motor_pulse,LOW); + #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE } #endif //FEATURE_STEPPER_MOTOR } @@ -5868,15 +5959,16 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_direction){ - if (el_stepper_motor_last_direction != STEPPER_DOWN){ - if (el_stepper_motor_last_pin_state == LOW){ + if (configuration.el_stepper_motor_last_direction != STEPPER_DOWN){ + if (configuration.el_stepper_motor_last_pin_state == LOW){ digitalWriteEnhanced(el_stepper_motor_direction,HIGH); - el_stepper_motor_last_pin_state = HIGH; + configuration.el_stepper_motor_last_pin_state = HIGH; } else { digitalWriteEnhanced(el_stepper_motor_direction,LOW); - el_stepper_motor_last_pin_state = LOW; + configuration.el_stepper_motor_last_pin_state = LOW; } - el_stepper_motor_last_direction = STEPPER_DOWN; + configuration.el_stepper_motor_last_direction = STEPPER_DOWN; + configuration_dirty = 1; } } #endif //FEATURE_STEPPER_MOTOR @@ -5903,8 +5995,13 @@ void rotator(byte rotation_action, byte rotation_type) { } #ifdef FEATURE_STEPPER_MOTOR if (el_stepper_motor_pulse) { - noTone(el_stepper_motor_pulse); - digitalWriteEnhanced(el_stepper_motor_pulse,HIGH); + #ifndef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + noTone(el_stepper_motor_pulse); + digitalWriteEnhanced(el_stepper_motor_pulse,HIGH); + #else //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + set_el_stepper_freq(el_stepper_motor_pulse,0); + digitalWriteEnhanced(el_stepper_motor_pulse,HIGH); + #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE } #endif //FEATURE_STEPPER_MOTOR } @@ -6190,7 +6287,7 @@ void initialize_pins(){ if (az_stepper_motor_direction){ pinModeEnhanced(az_stepper_motor_direction, OUTPUT); - digitalWriteEnhanced(az_stepper_motor_direction, LOW); + digitalWriteEnhanced(az_stepper_motor_direction, configuration.az_stepper_motor_last_pin_state); } @@ -6202,7 +6299,7 @@ void initialize_pins(){ if (el_stepper_motor_direction){ pinModeEnhanced(el_stepper_motor_direction, OUTPUT); - digitalWriteEnhanced(el_stepper_motor_direction, LOW); + digitalWriteEnhanced(el_stepper_motor_direction, configuration.el_stepper_motor_last_pin_state); } #endif //FEATURE_ELEVATION_CONTROL #endif //FEATURE_STEPPER_MOTOR @@ -10816,13 +10913,13 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ switch (easycom_command_buffer[0]) { // look at the first character of the command #if defined(OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK) && defined(FEATURE_ELEVATION_CONTROL) //zzzzzz case 'Z': - strcpy(return_string,"+"); + //strcpy(return_string,"+"); + strcpy(return_string,"="); dtostrf((float)azimuth/(float)HEADING_MULTIPLIER,0,1,tempstring); strcat(return_string,tempstring); if (elevation >= 0){ - strcat(return_string,"+"); - } else { - strcat(return_string,"-"); + //strcat(return_string,"+"); + strcat(return_string,"="); } dtostrf((float)elevation/(float)HEADING_MULTIPLIER,0,1,tempstring); strcat(return_string,tempstring); @@ -10869,8 +10966,6 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ //strcpy(return_string,"EL"); if (elevation >= 0){ strcpy(return_string,"+"); - } else { - strcpy(return_string,"-"); } dtostrf((float)elevation/(float)HEADING_MULTIPLIER,0,1,tempstring); strcat(return_string,tempstring); @@ -11427,33 +11522,69 @@ void sync_master_clock_to_slave(){ //------------------------------------------------------ #ifdef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE -void set_az_stepper_freq(int frequency){ +void set_az_stepper_freq(unsigned int frequency){ - az_stepper_pulse_period_us = 1000000 / frequency; } #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE //------------------------------------------------------ -#if defined(FEATURE_ELEVATION_CONTROL) && defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) -void set_el_stepper_freq(int frequency){ +#if defined(FEATURE_ELEVATION_CONTROL) && defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) && defined(FEATURE_STEPPER_MOTOR) +void set_el_stepper_freq(byte pin, unsigned int frequency){ - el_stepper_pulse_period_us = 1000000 / frequency; + if (frequency > 31) { + tone(pin, frequency); + } else { + if (frequency == 0) { + noTone(pin); + el_stepper_freq_pin = 0; + } else { + el_stepper_freq_pin = pin; + el_stepper_freq = frequency; + } + } } -#endif //defined(FEATURE_ELEVATION_CONTROL) && defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) +#endif //defined(FEATURE_ELEVATION_CONTROL) && defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) && defined(FEATURE_STEPPER_MOTOR) //------------------------------------------------------ -#ifdef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE -void service_stepper_pins(){ +#if defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) && defined(FEATURE_STEPPER_MOTOR) +void service_stepper_motor_pulse_pins(){ + #if defined(FEATURE_ELEVATION_CONTROL) + static byte el_stepper_freq_pin_active = 0; + static unsigned long el_stepper_freq_pin_next_transition = 0; + static byte el_stepper_freq_pin_last_state = 0; -//az_stepper_pulses_remaining + // pin just got activated + if ((el_stepper_freq_pin) && (!el_stepper_freq_pin_active)){ + digitalWriteEnhanced(el_stepper_freq_pin,HIGH); + el_stepper_freq_pin_last_state = HIGH; + el_stepper_freq_pin_next_transition = millis() + ((1.0/el_stepper_freq)*500); + el_stepper_freq_pin_active = 1; + } -//el_stepper_pulses_remaining + // pin got deactivated + if ((el_stepper_freq_pin_active) && (!el_stepper_freq_pin)) {el_stepper_freq_pin_active = 0;} + + // pin is active, are we ready for a transition? + if ((el_stepper_freq_pin_active) && (millis() >= el_stepper_freq_pin_next_transition)){ + if (el_stepper_freq_pin_last_state == LOW){ + digitalWriteEnhanced(el_stepper_freq_pin,HIGH); + el_stepper_freq_pin_last_state = HIGH; + } else { + digitalWriteEnhanced(el_stepper_freq_pin,LOW); + el_stepper_freq_pin_last_state = LOW; + } + el_stepper_freq_pin_next_transition = millis() + ((1.0/el_stepper_freq)*500); + } + #endif //defined(FEATURE_ELEVATION_CONTROL) } -#endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE +#endif //defined(FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) && defined(FEATURE_STEPPER_MOTOR) + + + //------------------------------------------------------- #ifdef FEATURE_ANALOG_OUTPUT_PINS void service_analog_output_pins(){ diff --git a/rotator_features.h b/rotator_features.h index a6237ff..66be450 100644 --- a/rotator_features.h +++ b/rotator_features.h @@ -45,7 +45,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 @@ -97,8 +97,8 @@ //#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 below -//#define FEATURE_ELEVATION_CORRECTION // correct the elevation using a calibration table below +//#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 @@ -124,7 +124,7 @@ //#define OPTION_SYNC_MASTER_CLOCK_TO_SLAVE //#define OPTION_DISABLE_HMC5883L_ERROR_CHECKING //#define OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK - +//#define OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK diff --git a/rotator_features_wb6kcn.h b/rotator_features_wb6kcn.h new file mode 100644 index 0000000..b4676ec --- /dev/null +++ b/rotator_features_wb6kcn.h @@ -0,0 +1,200 @@ +/* ---------------------- 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 +#define FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE + +#define LANGUAGE_ENGLISH +//#define LANGUAGE_SPANISH +//#define LANGUAGE_CZECH +//#define LANGUAGE_ITALIAN + +/* 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 + + + +/* 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, syncronize 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 +//#define OPTION_DISABLE_HMC5883L_ERROR_CHECKING +#define OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK +#define OPTION_HAMLIB_EASYCOM_NO_TERMINATOR_CHARACTER_HACK + + + + + /* + + 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// this should be set to zero unless you're debugging something at startup + +#define DEBUG_DUMP +// #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_HMC5883L +// #define DEBUG_POLOLU_LSM303_CALIBRATION + + + + + + diff --git a/rotator_hardware.h b/rotator_hardware.h index ea77452..e6dd691 100644 --- a/rotator_hardware.h +++ b/rotator_hardware.h @@ -5,4 +5,5 @@ */ //#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) \ No newline at end of file +//#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 \ No newline at end of file diff --git a/rotator_pins.h b/rotator_pins.h index ee6a7ae..14dc1ad 100644 --- a/rotator_pins.h +++ b/rotator_pins.h @@ -137,11 +137,11 @@ #endif //FEATURE_AZ_POSITION_INCREMENTAL_ENCODER #ifdef FEATURE_EL_POSITION_INCREMENTAL_ENCODER -#define el_incremental_encoder_pin_phase_a 18 //2 // must be an interrupt capable pin -#define el_incremental_encoder_pin_phase_b 19 //3 // must be an interrupt capable pin -#define el_incremental_encoder_pin_phase_z 22 //4 -#define EL_POSITION_INCREMENTAL_ENCODER_A_PIN_INTERRUPT 5 //0 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 -#define EL_POSITION_INCREMENTAL_ENCODER_B_PIN_INTERRUPT 4 //1 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 +#define el_incremental_encoder_pin_phase_a 2 //18 //2 // must be an interrupt capable pin +#define el_incremental_encoder_pin_phase_b 3 //19 //3 // must be an interrupt capable pin +#define el_incremental_encoder_pin_phase_z 5 //22 //4 +#define EL_POSITION_INCREMENTAL_ENCODER_A_PIN_INTERRUPT 0 //5 //0 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 +#define EL_POSITION_INCREMENTAL_ENCODER_B_PIN_INTERRUPT 1 //4 //1 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 // read http://arduino.cc/en/Reference/AttachInterrupt for details on hardware and interrupts #endif //FEATURE_EL_POSITION_INCREMENTAL_ENCODER diff --git a/rotator_pins_wb6kcn.h b/rotator_pins_wb6kcn.h new file mode 100755 index 0000000..87b1b50 --- /dev/null +++ b/rotator_pins_wb6kcn.h @@ -0,0 +1,189 @@ +/* ------------------------------------- Pin Definitions ------------------------------------------ + + You need to look at these and set them appropriately ! + + Most pins can be disabled by setting them to 0 (zero). If you're not using a pin or function, set it to 0. + + Pins > 99 = remote unit pin, for example: pin 109 = pin 9 on remote unit, pin A0+100 = pin A0 on remote unit + +*/ + +/* azimuth pins --------------------- (use just the azimuth pins for an azimuth-only rotator) */ + +#define rotate_cw 6 // goes high to activate rotator R (CW) rotation - pin 1 on Yaesu connector +#define rotate_ccw 7 // goes high to activate rotator L (CCW) rotation - pin 2 on Yaesu connector +#define rotate_cw_ccw 35 // goes high for both CW and CCW rotation +#define rotate_cw_pwm 0 // optional - PWM CW output - set to 0 to disable (must be PWM capable pin) +#define rotate_ccw_pwm 0 // optional - PWM CCW output - set to 0 to disable (must be PWM capable pin) +#define rotate_cw_ccw_pwm 0 // optional - PWM on CW and CCW output - set to 0 to disable (must be PWM capable pin) +#define rotate_cw_freq 0 // optional - CW variable frequency output +#define rotate_ccw_freq 0 // optional - CCW variable frequency output +#define button_cw 43 // normally open button to ground for manual CW rotation (schematic pin: A1) +#define button_ccw 39 // normally open button to ground for manual CCW rotation (schematic pin: A2) +#define serial_led 0 // LED blinks when command is received on serial port (set to 0 to disable) +#define rotator_analog_az A0 // reads analog azimuth voltage from rotator - pin 4 on Yaesu connector +#define azimuth_speed_voltage 0 // optional - PWM output for speed control voltage feed into rotator (on continually unlike rotate_cw_pwm and rotate_ccw_pwm) +#define overlap_led 0 // line goes high when azimuth rotator is in overlap (> 360 rotators) +#define brake_az 0 // goes high to disengage azimuth brake (set to 0 to disable) +#define az_speed_pot 0 // connect to wiper of 1K to 10K potentiometer for speed control (set to 0 to disable) +#define az_preset_pot 0 // connect to wiper of 1K to 10K potentiometer for preset control (set to 0 to disable) +#define preset_start_button 0 // connect to momentary switch (ground on button press) for preset start (set to 0 to disable or for preset automatic start) +#define button_stop 41 // connect to momentary switch (ground on button press) for preset stop (set to 0 to disable or for preset automatic start) +#define rotation_indication_pin 47 +#define blink_led 0 +#define az_stepper_motor_pulse 33 //0 +#define az_stepper_motor_direction 37 + + +/*----------- elevation pins --------------*/ +#ifdef FEATURE_ELEVATION_CONTROL +#define rotate_up 0 // goes high to activate rotator elevation up +#define rotate_down 0 // goes high to activate rotator elevation down +#define rotate_up_or_down 27 // goes high when elevation up or down is activated +#define rotate_up_pwm 0 // optional - PWM UP output - set to 0 to disable (must be PWM capable pin) +#define rotate_down_pwm 0 // optional - PWM DOWN output - set to 0 to disable (must be PWM capable pin) +#define rotate_up_down_pwm 0 // optional - PWM on both UP and DOWN (must be PWM capable pin) +#define rotate_up_freq 0 // optional - UP variable frequency output +#define rotate_down_freq 0 // optional - UP variable frequency output +#define rotator_analog_el A1 // reads analog elevation voltage from rotator +#define button_up 49 // normally open button to ground for manual up elevation +#define button_down 45 // normally open button to ground for manual down rotation +#define brake_el 0 // goes high to disengage elevation brake (set to 0 to disable) +#define elevation_speed_voltage 0 // optional - PWM output for speed control voltage feed into rotator (on continually unlike rotate_up_pwm and rotate_down_pwm) +#define el_stepper_motor_pulse 29 +#define el_stepper_motor_direction 31 +#endif //FEATURE_ELEVATION_CONTROL + +// rotary encoder pins and options +#ifdef FEATURE_AZ_PRESET_ENCODER +#define az_rotary_preset_pin1 0 // CW Encoder Pin +#define az_rotary_preset_pin2 0 // CCW Encoder Pin +#endif //FEATURE_AZ_PRESET_ENCODER + +#ifdef FEATURE_EL_PRESET_ENCODER +#define el_rotary_preset_pin1 0 // UP Encoder Pin +#define el_rotary_preset_pin2 0 // DOWN Encoder Pin +#endif //FEATURE_EL_PRESET_ENCODER + +#ifdef FEATURE_AZ_POSITION_ROTARY_ENCODER +#define az_rotary_position_pin1 0 // CW Encoder Pin +#define az_rotary_position_pin2 0 // CCW Encoder Pin +#endif //FEATURE_AZ_POSITION_ROTARY_ENCODER + +#ifdef FEATURE_EL_POSITION_ROTARY_ENCODER +#define el_rotary_position_pin1 0 // CW Encoder Pin +#define el_rotary_position_pin2 0 // CCW Encoder Pin +#endif //FEATURE_EL_POSITION_ROTARY_ENCODER + +#ifdef FEATURE_AZ_POSITION_PULSE_INPUT +#define az_position_pulse_pin 0 // must be an interrupt capable pin! +#define AZ_POSITION_PULSE_PIN_INTERRUPT 0 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 +#endif // read http://arduino.cc/en/Reference/AttachInterrupt for details on hardware and interrupts + +#ifdef FEATURE_EL_POSITION_PULSE_INPUT +#define el_position_pulse_pin 1 // must be an interrupt capable pin! +#define EL_POSITION_PULSE_PIN_INTERRUPT 1 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 +#endif // read http://arduino.cc/en/Reference/AttachInterrupt for details on hardware and interrupts + +#ifdef FEATURE_PARK +#define button_park 0 +#endif + +//classic 4 bit LCD pins +#define lcd_4_bit_rs_pin 12 +#define lcd_4_bit_enable_pin 11 +#define lcd_4_bit_d4_pin 5 +#define lcd_4_bit_d5_pin 4 +#define lcd_4_bit_d6_pin 3 +#define lcd_4_bit_d7_pin 2 + + +#ifdef FEATURE_JOYSTICK_CONTROL +#define pin_joystick_x A0 +#define pin_joystick_y A1 +#endif //FEATURE_JOYSTICK_CONTROL + +#ifdef FEATURE_AZ_POSITION_HH12_AS5045_SSI +#define az_hh12_clock_pin 11 +#define az_hh12_cs_pin 12 +#define az_hh12_data_pin 13 +#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 +#endif //FEATURE_EL_POSITION_HH_12 + +#ifdef FEATURE_PARK +#define park_in_progress_pin 0 // goes high when a park has been initiated and rotation is in progress +#define parked_pin 0 // goes high when in a parked position +#endif //FEATURE_PARK + +#define heading_reading_inhibit_pin 0 // input - a high will cause the controller to suspend taking azimuth (and elevation) readings; use when RF interferes with sensors + +#ifdef FEATURE_LIMIT_SENSE +#define az_limit_sense_pin 0 // input - low stops azimuthal rotation +#define el_limit_sense_pin 0 // input - low stops elevation rotation +#endif //FEATURE_LIMIT_SENSE + +#ifdef FEATURE_AZ_POSITION_INCREMENTAL_ENCODER +#define az_incremental_encoder_pin_phase_a 18 //3 must be an interrupt capable pin +#define az_incremental_encoder_pin_phase_b 19 //3 // must be an interrupt capable pin +#define az_incremental_encoder_pin_phase_z 15 //4 +#define AZ_POSITION_INCREMENTAL_ENCODER_A_PIN_INTERRUPT 5 //0 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 +#define AZ_POSITION_INCREMENTAL_ENCODER_B_PIN_INTERRUPT 4 //1 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 + // read http://arduino.cc/en/Reference/AttachInterrupt for details on hardware and interrupts +#endif //FEATURE_AZ_POSITION_INCREMENTAL_ENCODER + +#ifdef FEATURE_EL_POSITION_INCREMENTAL_ENCODER +#define el_incremental_encoder_pin_phase_a 2 //2 // must be an interrupt capable pin +#define el_incremental_encoder_pin_phase_b 3 //3 // must be an interrupt capable pin +#define el_incremental_encoder_pin_phase_z 5 //4 +#define EL_POSITION_INCREMENTAL_ENCODER_A_PIN_INTERRUPT 0 //0 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 +#define EL_POSITION_INCREMENTAL_ENCODER_B_PIN_INTERRUPT 1 //1 // Uno: pin 2 = interrupt 0, pin 3 = interrupt 1 ; Mega: pin 2 = interrupt 0, pin 3 = interrupt 1, pin 21 = interrupt 2, pin 20 = interrupt 3, pin 19 = interrupt 4, pin 18 = interrupt 5 + // read http://arduino.cc/en/Reference/AttachInterrupt for details on hardware and interrupts +#endif //FEATURE_EL_POSITION_INCREMENTAL_ENCODER + +#ifdef FEATURE_YOURDUINO_I2C_LCD +#define En_pin 2 +#define Rw_pin 1 +#define Rs_pin 0 +#define D4_pin 4 +#define D5_pin 5 +#define D6_pin 6 +#define D7_pin 7 +#endif //FEATURE_YOURDUINO_I2C_LCD + +#ifdef FEATURE_MOON_TRACKING +#define moon_tracking_active_pin 0 // goes high when moon tracking is active +#define moon_tracking_activate_line 0 // ground this pin to activate moon tracking (not for use with a button) +#define moon_tracking_button 0 // use with a normally open momentary switch to ground +#endif //FEATURE_MOON_TRACKING + +#ifdef FEATURE_SUN_TRACKING +#define sun_tracking_active_pin 0 // goes high when sun tracking is active +#define sun_tracking_activate_line 0 // ground this pin to activate sun tracking (not for use with a button) +#define sun_tracking_button 0 // use with a normally open momentary switch to ground +#endif //FEATURE_SUN_TRACKING + +#ifdef FEATURE_GPS +#define gps_sync 0 +#endif //FEATURE_GPS + +#ifdef FEATURE_POWER_SWITCH +#define power_switch 0 // use with FEATURE_POWER_SWITCH +#endif //FEATURE_POWER_SWITCH + +#ifdef FEATURE_EL_POSITION_MEMSIC_2125 +#define pin_memsic_2125_x 0 +#define pin_memsic_2125_y 0 +#endif //FEATURE_EL_POSITION_MEMSIC_2125 + +#ifdef FEATURE_ANALOG_OUTPUT_PINS +#define pin_analog_az_out 0 +#define pin_analog_el_out 0 +#endif //FEATURE_ANALOG_OUTPUT_PINS + + + diff --git a/rotator_settings.h b/rotator_settings.h index 806fa65..1a61d43 100644 --- a/rotator_settings.h +++ b/rotator_settings.h @@ -52,7 +52,7 @@ You can tweak these, but read the online documentation! #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 azimuth +#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 @@ -126,7 +126,7 @@ You can tweak these, but read the online documentation! #define AZ_BRAKE_DELAY 3000 // in milliseconds #define EL_BRAKE_DELAY 3000 // in milliseconds -#define EEPROM_MAGIC_NUMBER 103 +#define EEPROM_MAGIC_NUMBER 104 #define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds diff --git a/rotator_settings_wb6kcn.h b/rotator_settings_wb6kcn.h new file mode 100644 index 0000000..a02531d --- /dev/null +++ b/rotator_settings_wb6kcn.h @@ -0,0 +1,538 @@ + +/* -------------------------- rotation settings ---------------------------------------*/ + +#define AZIMUTH_STARTING_POINT_DEFAULT 180 // the starting point in degrees of the azimuthal rotator + +#define AZIMUTH_ROTATION_CAPABILITY_DEFAULT 360 // 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) + + +// PWM speed voltage settings +#define PWM_SPEED_VOLTAGE_X1 74 // 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 1 // 0 = off ; 1 = on +#define AZ_SLOWDOWN_DEFAULT 1 // 0 = off ; 1 = on +#define AZ_SLOW_START_UP_TIME 550 // if slow start is enabled, the unit will ramp up speed for this many milliseconds +#define AZ_SLOW_START_STARTING_PWM 2 // PWM starting value for slow start (must be < 256) +#define AZ_SLOW_START_STEPS 20 // must be < 256 + + +#define SLOW_DOWN_BEFORE_TARGET_AZ 5.0 // if slow down is enabled, slowdown will be activated within this many degrees of target azimuth +#define AZ_SLOW_DOWN_PWM_START 150 // starting PWM value for slow down (must be < 256) +#define AZ_SLOW_DOWN_PWM_STOP 10 // 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 10 // PWM value to start at if we're starting in the slow down zone (1 - 255) + +//EL +#define EL_SLOWSTART_DEFAULT 1 // 0 = off ; 1 = on +#define EL_SLOWDOWN_DEFAULT 1 // 0 = off ; 1 = on +#define EL_SLOW_START_UP_TIME 200 // if slow start is enabled, the unit will ramp up speed for this many milliseconds +#define EL_SLOW_START_STARTING_PWM 3 // PWM starting value for slow start (must be < 256 and > 0) +#define EL_SLOW_START_STEPS 20 // must be < 256 + +#define SLOW_DOWN_BEFORE_TARGET_EL 20.0 //5.0 // if slow down is enabled, slowdown will be activated within this many degrees of target elevtion +#define EL_SLOW_DOWN_PWM_START 50 //150 // starting PWM value for slow down (must be < 256 and > 0) +#define EL_SLOW_DOWN_PWM_STOP 1 // ending PWM value for slow down (must be < 256 and > 0) +#define EL_SLOW_DOWN_STEPS 500 //200 +#define EL_INITIALLY_IN_SLOW_DOWN_PWM 10 // PWM value to start at if we're starting in the slow down zone (1 - 255) + +#define TIMED_SLOW_DOWN_TIME 500 + +//Variable frequency output settings - LOWEST FREQUENCY IS 31 HERTZ DUE TO ARDUINO tone() FUNCTION LIMITATIONS! +// (Except when used with FEATURE_STEPPER_MOTOR and FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE) +#define AZ_VARIABLE_FREQ_OUTPUT_LOW 32 // Frequency in hertz of minimum speed +#define AZ_VARIABLE_FREQ_OUTPUT_HIGH 1000 //100 // Frequency in hertz of maximum speed +#define EL_VARIABLE_FREQ_OUTPUT_LOW 5 //32 // Frequency in hertz of minimum speed +#define EL_VARIABLE_FREQ_OUTPUT_HIGH 500 // Frequency in hertz of maximum speed + +// Settings for OPTION_AZ_MANUAL_ROTATE_LIMITS +#define AZ_MANUAL_ROTATE_CCW_LIMIT 179 // if using a rotator that starts at 180 degrees, set this to something like 185 +#define AZ_MANUAL_ROTATE_CW_LIMIT 539 // 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 10 +#define EL_MANUAL_ROTATE_UP_LIMIT 170 + +// 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 0.10 // 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 &Serial3 // 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 +#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 EEPROM_MAGIC_NUMBER 103 +#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 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_CHECK // 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 "Alzo 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 + +#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 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,254 +#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 ELEVATION_CALIBRATION_FROM_ARRAY {0,269.9,270.0,359.9} +#define ELEVATION_CALIBRATION_TO_ARRAY {0,269.9,-90.0,-0.1} + +#define ANALOG_OUTPUT_MAX_EL_DEGREES 180 + + +/* 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} + + + +/* ---------------------------- 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 +