From a32b406582e74b0366cf598f45818151ab114048 Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Wed, 7 Sep 2016 20:38:56 -0400 Subject: [PATCH] 2.0.2016083001 Re-merged changes manually from dfannin submitted issue 30 - incorrect index for row_override; pull request 31 (Couldn't get pull from git to compile correctly, not sure why) --- k3ng_rotator_controller.ino | 135 ++++-------------------------------- rotator_features_test.h | 12 ++-- rotator_settings.h | 2 +- 3 files changed, 20 insertions(+), 129 deletions(-) diff --git a/k3ng_rotator_controller.ino b/k3ng_rotator_controller.ino index dbaf0d1..b7b6403 100644 --- a/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller.ino @@ -489,6 +489,10 @@ 2.0.2016071801 Fixed bug with Maidenhead not being calculated when FEATURE_MOON_TRACKING or FEATURE_SUN_TRACKING wasn't compiled + 2.0.2016083001 + Re-merged changes manually from dfannin submitted issue 30 - incorrect index for row_override; pull request 31 + (Couldn't get pull from git to compile correctly, not sure why) + All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc. in order to compile in Arduino IDE 1.6.7 Anything rotator_*.* should be in the ino directory! @@ -496,7 +500,7 @@ */ -#define CODE_VERSION "2.0.2016071801" +#define CODE_VERSION "2.0.2016083001" #include #include @@ -701,14 +705,6 @@ struct config_t { byte el_stepper_motor_last_pin_state; byte az_stepper_motor_last_direction; byte el_stepper_motor_last_direction; -#ifdef FEATURE_TWO_DECIMAL_PLACE_HEADINGS - long azimuth_starting_point; - long azimuth_rotation_capability; -#else - int azimuth_starting_point; - int azimuth_rotation_capability; -#endif - byte brake_az_disabled; } configuration; @@ -2278,7 +2274,7 @@ void check_brake_release() { void brake_release(byte az_or_el, byte operation){ if (az_or_el == AZ) { - if (brake_az && (configuration.brake_az_disabled == 0)) { + if (brake_az) { if (operation == BRAKE_RELEASE_ON) { digitalWriteEnhanced(brake_az, BRAKE_ACTIVE_STATE); brake_az_engaged = 1; @@ -4198,16 +4194,10 @@ void read_settings_from_eeprom(){ debug.print(configuration.azimuth_offset,2); debug.print("\nel_offset:"); debug.print(configuration.elevation_offset,2); - debug.print("az starting point:"); - debug.print(configuration.azimuth_starting_point); - debug.print("az rotation capability:"); - debug.print(configuration.azimuth_rotation_capability); debug.println(""); } #endif // DEBUG_EEPROM - azimuth_starting_point = configuration.azimuth_starting_point; - azimuth_rotation_capability = configuration.azimuth_rotation_capability; #if defined(FEATURE_AZ_POSITION_INCREMENTAL_ENCODER) az_incremental_encoder_position = configuration.last_az_incremental_encoder_position; @@ -4286,10 +4276,6 @@ void initialize_eeprom_with_defaults(){ configuration.last_el_incremental_encoder_position = 0; configuration.azimuth_offset = 0; configuration.elevation_offset = 0; - configuration.azimuth_starting_point = AZIMUTH_STARTING_POINT_DEFAULT; - configuration.azimuth_rotation_capability = AZIMUTH_ROTATION_CAPABILITY_DEFAULT; - configuration.brake_az_disabled = (brake_az ? 1 : 0); - #ifdef FEATURE_ELEVATION_CONTROL configuration.last_elevation = elevation; #else @@ -7604,7 +7590,7 @@ void service_request_queue(){ #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print("->F"); #endif // DEBUG_SERVICE_REQUEST_QUEUE - if ((az_request_parm > (360 * HEADING_MULTIPLIER)) && (az_request_parm <= ((azimuth_starting_point + azimuth_rotation_capability) * HEADING_MULTIPLIER))) { + if ((az_request_parm > (360 * HEADING_MULTIPLIER)) && (az_request_parm <= ((azimuth_starting_point + azimuth_rotation_capability) * HEADING_MULTIPLIER))) { target_azimuth = az_request_parm - (360 * HEADING_MULTIPLIER); target_raw_azimuth = az_request_parm; if (az_request_parm > raw_azimuth) { @@ -10037,16 +10023,6 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte #endif // FEATURE_ELEVATION_CONTROL #endif // defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) -#ifdef FEATURE_TWO_DECIMAL_PLACE_HEADINGS - long new_azimuth_starting_point; - long new_azimuth_rotation_capability; -#else - int new_azimuth_starting_point; - int new_azimuth_rotation_capability; -#endif - - byte brake_az_disabled; - char temp_string[20] = ""; switch (input_buffer[1]) { @@ -10077,7 +10053,7 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte strcpy(return_string, "Error. Format: \\Ax[x][x] "); } break; - #else // defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) + #else // defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) case 'A': // \Ax[xxx][.][xxxx] - manually set azimuth place_multiplier = 1; for (int x = input_buffer_index - 1; x > 1; x--) { @@ -10104,86 +10080,8 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte } break; - #endif // defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) + #endif // defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_PULSE_INPUT) - case 'I': // \Ix[x][x] - set az starting point - new_azimuth_starting_point = 9999; - switch (input_buffer_index) { - case 2: - new_azimuth_starting_point = configuration.azimuth_starting_point; - break; - case 3: - new_azimuth_starting_point = (input_buffer[2] - 48); - break; - case 4: - new_azimuth_starting_point = ((input_buffer[2] - 48) * 10) + (input_buffer[3] - 48); - break; - case 5: - new_azimuth_starting_point = ((input_buffer[2] - 48) * 100) + ((input_buffer[3] - 48) * 10) + (input_buffer[4] - 48); - break; - } - if ((new_azimuth_starting_point >= 0) && (new_azimuth_starting_point < 360)) { - if (input_buffer_index > 2) { - azimuth_starting_point = configuration.azimuth_starting_point = new_azimuth_starting_point; - configuration_dirty = 1; - } - strcpy(return_string, "Azimuth starting point set to "); - dtostrf(new_azimuth_starting_point, 0, 0, temp_string); - strcat(return_string, temp_string); - } else { - strcpy(return_string, "Error. Format: \\Ix[x][x]"); - } - break; - - case 'J': // \Jx[x][x] - set az rotation capability - new_azimuth_rotation_capability = 9999; - switch (input_buffer_index) { - case 2: - new_azimuth_rotation_capability = configuration.azimuth_rotation_capability; - break; - case 3: - new_azimuth_rotation_capability = (input_buffer[2] - 48); - break; - case 4: - new_azimuth_rotation_capability = ((input_buffer[2] - 48) * 10) + (input_buffer[3] - 48); - break; - case 5: - new_azimuth_rotation_capability = ((input_buffer[2] - 48) * 100) + ((input_buffer[3] - 48) * 10) + (input_buffer[4] - 48); - break; - } - if ((new_azimuth_rotation_capability >= 0) && (new_azimuth_rotation_capability <= 450)) { - if (input_buffer_index > 2) { - azimuth_rotation_capability = configuration.azimuth_rotation_capability = new_azimuth_rotation_capability; - configuration_dirty = 1; - } - strcpy(return_string, "Azimuth rotation capability set to "); - dtostrf(new_azimuth_rotation_capability, 0, 0, temp_string); - strcat(return_string, temp_string); - } else { - strcpy(return_string, "Error. Format: \\Jx[x][x]"); - } - break; - - case 'K': // \Kx - Force disable the az brake even if a pin is defined (x: 0 = enable, 1 = disable) - brake_az_disabled = 2; - if (input_buffer_index == 2) { - brake_az_disabled = configuration.brake_az_disabled; - } else - switch (input_buffer[2]) { - case '0': brake_az_disabled = 0; break; - case '1': brake_az_disabled = 1; break; - } - if ((brake_az_disabled >=0) && (brake_az_disabled <= 1)) { - if (input_buffer_index > 2) { - configuration.brake_az_disabled = brake_az_disabled; - configuration_dirty = 1; - } - strcpy(return_string, "Az brake "); - strcat(return_string, (brake_az_disabled ? "disabled." : "enabled.")); - } else { - strcpy(return_string, "Error."); - } - break; #if defined(FEATURE_ELEVATION_CONTROL) #if defined(FEATURE_EL_POSITION_ROTARY_ENCODER) || defined(FEATURE_EL_POSITION_PULSE_INPUT) @@ -10303,27 +10201,21 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte #endif // FEATURE_CLOCK - case 'D': // \D - Debug + case 'D': if (debug_mode & source_port) { debug_mode = debug_mode & (~source_port); } else { debug_mode = debug_mode | source_port; } - break; + break; // D - Debug - case 'E': // \E - Initialize eeprom + case 'E': // E - Initialize eeprom initialize_eeprom_with_defaults(); strcpy(return_string, "Initialized eeprom, resetting unit in 5 seconds..."); reset_the_unit = 1; break; - case 'Q': // \Q - Save settings in the EEPROM and restart - write_settings_to_eeprom(); - strcpy(return_string, "Settings saved in EEPROM, resetting unit in 5 seconds..."); - reset_the_unit = 1; - break; - - case 'L': // \L - rotate to long path + case 'L': // L - rotate to long path if (azimuth < (180 * HEADING_MULTIPLIER)) { submit_request(AZ, REQUEST_AZIMUTH, (azimuth + (180 * HEADING_MULTIPLIER)), 15); } else { @@ -12066,7 +11958,6 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer break; case 'Z': // Z - Starting point toggle - if (azimuth_starting_point == 180) { azimuth_starting_point = 0; strcpy(return_string,"N"); diff --git a/rotator_features_test.h b/rotator_features_test.h index 18a4356..587954f 100755 --- a/rotator_features_test.h +++ b/rotator_features_test.h @@ -16,11 +16,11 @@ #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_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 @@ -67,7 +67,7 @@ // #define FEATURE_EL_POSITION_A2_ABSOLUTE_ENCODER // And if you are using an Adafruit, Yourduino, RFRobot, YWRobot, or SainSmart display, you must also change the feature setting in rotator_k3ngdisplay.h!!!! -// #define FEATURE_4_BIT_LCD_DISPLAY // Uncomment for classic 4 bit LCD display (most common) +#define FEATURE_4_BIT_LCD_DISPLAY // Uncomment for classic 4 bit LCD display (most common) // #define FEATURE_ADAFRUIT_I2C_LCD // #define FEATURE_ADAFRUIT_BUTTONS // Uncomment this to use Adafruit I2C LCD buttons for manual AZ/EL instead of normal buttons (also set this feature in rotator_k3ngdisplay.h) // #define FEATURE_YOURDUINO_I2C_LCD diff --git a/rotator_settings.h b/rotator_settings.h index a498e66..a8a3fe7 100755 --- a/rotator_settings.h +++ b/rotator_settings.h @@ -142,7 +142,7 @@ You can tweak these, but read the online documentation! #define BRAKE_ACTIVE_STATE HIGH #define BRAKE_INACTIVE_STATE LOW -#define EEPROM_MAGIC_NUMBER 106 +#define EEPROM_MAGIC_NUMBER 105 #define EEPROM_WRITE_DIRTY_CONFIG_TIME 30 //time in seconds