From c1944dcb25aa2d6a664b813343fe872e1523186b Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Sun, 4 Jan 2015 11:23:04 -0500 Subject: [PATCH] 2.0.2015010401 OPTION_BLINK_OVERLAP_LED and OPTION_OVERLAP_LED_BLINK_MS setting --- k3ng_rotator_controller.ino | 38 +++++++++++++++++++++++++++++++------ rotator_features.h | 9 +++++---- rotator_settings.h | 6 ++++-- rotator_settings_wb6kcn.h | 2 ++ 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index 8b738ad..e249d8e 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -284,9 +284,14 @@ FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE_2 + AZ_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION + EL_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION + + OPTION_BLINK_OVERLAP_LED and OPTION_OVERLAP_LED_BLINK_MS setting + */ -#define CODE_VERSION "2.0.2014120201" +#define CODE_VERSION "2.0.2015010401" #include #include @@ -700,11 +705,11 @@ unsigned long last_activity_time = 0; #endif //FEATURE_POWER_SWITCH #ifdef FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE_2 -unsigned int az_stepper_freq_count = 0; +volatile unsigned int az_stepper_freq_count = 0; #ifdef FEATURE_ELEVATION_CONTROL -unsigned int el_stepper_freq_count = 0; +volatile unsigned int el_stepper_freq_count = 0; #endif //FEATURE_ELEVATION_CONTROL -unsigned long service_stepper_motor_pulse_pins_count = 0; +volatile unsigned long service_stepper_motor_pulse_pins_count = 0; #endif //FEATURE_STEPPER_MOTOR_EXPERIMENTAL_CODE_2 @@ -1605,12 +1610,20 @@ void check_overlap(){ static byte overlap_led_status = 0; static unsigned long last_check_time; + #ifdef OPTION_BLINK_OVERLAP_LED + static unsigned long last_overlap_led_transition = 0; + static byte blink_status = 0; + #endif //OPTION_BLINK_OVERLAP_LED if ((overlap_led) && ((millis() - last_check_time) > 500)) { // if ((analog_az > (500*HEADING_MULTIPLIER)) && (azimuth > (ANALOG_AZ_OVERLAP_DEGREES*HEADING_MULTIPLIER)) && (!overlap_led_status)) { if ((raw_azimuth > (ANALOG_AZ_OVERLAP_DEGREES * HEADING_MULTIPLIER)) && (!overlap_led_status)) { digitalWriteEnhanced(overlap_led, HIGH); overlap_led_status = 1; + #ifdef OPTION_BLINK_OVERLAP_LED + last_overlap_led_transition = millis(); + blink_status = 1; + #endif //OPTION_BLINK_OVERLAP_LED #ifdef DEBUG_OVERLAP debug_println("check_overlap: in overlap"); #endif // DEBUG_OVERLAP @@ -1628,6 +1641,19 @@ void check_overlap(){ } + #ifdef OPTION_BLINK_OVERLAP_LED + if ((overlap_led_status) && ((millis() - last_overlap_led_transition) >= OPTION_OVERLAP_LED_BLINK_MS)){ + if (blink_status){ + digitalWriteEnhanced(overlap_led, LOW); + blink_status = 0; + } else { + digitalWriteEnhanced(overlap_led, HIGH); + blink_status = 1; + } + last_overlap_led_transition = millis(); + } + #endif //OPTION_BLINK_OVERLAP_LED + } /* check_overlap */ @@ -8720,7 +8746,7 @@ void az_position_incremental_encoder_interrupt_handler(){ if ((current_phase_a == LOW) && (current_phase_b == LOW) && (current_phase_z == LOW)) { if ((az_incremental_encoder_position < int((AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.) / 2)) || (az_incremental_encoder_position > int((AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.) * 1.5))) { - az_incremental_encoder_position = 0; + az_incremental_encoder_position = AZ_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION; } else { az_incremental_encoder_position = int(AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.); } @@ -8777,7 +8803,7 @@ void el_position_incremental_encoder_interrupt_handler(){ if ((current_phase_a == LOW) && (current_phase_b == LOW) && (current_phase_z == LOW)) { - el_incremental_encoder_position = 0; + el_incremental_encoder_position = EL_INCREMENTAL_ENCODER_ZERO_PULSE_POSITION; } else { if (el_incremental_encoder_position < 0) { diff --git a/rotator_features.h b/rotator_features.h index bdd7a4c..e336758 100644 --- a/rotator_features.h +++ b/rotator_features.h @@ -115,10 +115,10 @@ //#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_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) @@ -127,6 +127,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_BLINK_OVERLAP_LED diff --git a/rotator_settings.h b/rotator_settings.h index caf6219..28a8c89 100644 --- a/rotator_settings.h +++ b/rotator_settings.h @@ -23,7 +23,7 @@ You can tweak these, but read the online documentation! // 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 @@ -104,7 +104,7 @@ You can tweak these, but read the online documentation! #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 +#define LCD_ROWS 2 //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 @@ -182,6 +182,8 @@ You can tweak these, but read the online documentation! #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 diff --git a/rotator_settings_wb6kcn.h b/rotator_settings_wb6kcn.h index 340a981..c1abcf3 100644 --- a/rotator_settings_wb6kcn.h +++ b/rotator_settings_wb6kcn.h @@ -183,6 +183,8 @@ You can tweak these, but read the online documentation! #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