From 704e1ed46f3e13e25f4eeabedc6c9b5898e43d52 Mon Sep 17 00:00:00 2001 From: Anthony Good Date: Fri, 12 Jun 2020 11:39:24 -0400 Subject: [PATCH] 2020.06.12.02 Typo fix on \X0 command --- .../k3ng_rotator_controller.ino | 872 ++++++++---------- k3ng_rotator_controller/rotator_features.h | 2 - .../rotator_features_m0upu.h | 2 - .../rotator_features_test.h | 2 - .../rotator_features_wb6kcn.h | 2 - k3ng_rotator_controller/rotator_hardware.h | 2 +- k3ng_rotator_controller/rotator_settings.h | 17 - .../rotator_settings_ea4tx_ars_usb.h | 17 - .../rotator_settings_m0upu.h | 17 - .../rotator_settings_test.h | 21 +- .../rotator_settings_wb6kcn.h | 17 - 11 files changed, 406 insertions(+), 565 deletions(-) diff --git a/k3ng_rotator_controller/k3ng_rotator_controller.ino b/k3ng_rotator_controller/k3ng_rotator_controller.ino index 2c059a0..a08e05e 100644 --- a/k3ng_rotator_controller/k3ng_rotator_controller.ino +++ b/k3ng_rotator_controller/k3ng_rotator_controller.ino @@ -496,6 +496,12 @@ 2020.06.12.01 \A Azimuth calibration command now also modifies azimuth_starting_point so that proper rotation decisions are made for large calibration values + 2020.06.12.03 + azimuth, raw_azimuth, and elevation variables changed from int to float datatypes + Eliminated HEADING_MULTIPLIER, LCD_HEADING_MULTIPLIER settings related to azimuth, raw_azimuth, and elevation variables being int datatypes + Eliminated FEATURE_ONE_DECIMAL_PLACE_HEADINGS and FEATURE_TWO_DECIMAL_PLACE_HEADINGS + LCD_DECIMAL_PLACES now is only setting need to change number of decimal places displayed + All library files should be placed in directories likes \sketchbook\libraries\library1\ , \sketchbook\libraries\library2\ , etc. Anything rotator_*.* should be in the ino directory! @@ -507,7 +513,7 @@ */ -#define CODE_VERSION "2020.06.12.01" +#define CODE_VERSION "2020.06.12.03" #include #include @@ -684,24 +690,10 @@ byte incoming_serial_byte = 0; byte reset_the_unit = 0; -#ifdef FEATURE_TWO_DECIMAL_PLACE_HEADINGS - long azimuth = 0; - long raw_azimuth = 0; - long target_azimuth = 0; - long target_raw_azimuth = 0; - //long azimuth_starting_point = AZIMUTH_STARTING_POINT_DEFAULT; - //long azimuth_rotation_capability = AZIMUTH_ROTATION_CAPABILITY_DEFAULT; -#else - int azimuth = 0; - int raw_azimuth = 0; - int target_azimuth = 0; - int target_raw_azimuth = 0; - //int azimuth_starting_point = AZIMUTH_STARTING_POINT_DEFAULT; - //int azimuth_rotation_capability = AZIMUTH_ROTATION_CAPABILITY_DEFAULT; -#endif - - - +float azimuth = 0; +float raw_azimuth = 0; +float target_azimuth = 0; +float target_raw_azimuth = 0; byte control_port_buffer[COMMAND_BUFFER_SIZE]; int control_port_buffer_index = 0; @@ -748,13 +740,8 @@ 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; float clock_timezone_offset; byte autopark_active; @@ -837,19 +824,11 @@ byte current_az_speed_voltage = 0; #endif // OPTION_ENCODER_HALF_STEP_MODE #ifdef FEATURE_AZ_PRESET_ENCODER // Rotary Encoder State Tables - #if defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) - double az_encoder_raw_degrees = 0; - #else - int az_encoder_raw_degrees = 0; - #endif + float az_encoder_raw_degrees = 0; volatile unsigned char az_encoder_state = 0; #ifdef FEATURE_EL_PRESET_ENCODER volatile unsigned char el_encoder_state = 0; - #if defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) - double el_encoder_degrees = 0; - #else - int el_encoder_degrees = 0; - #endif + float el_encoder_degrees = 0; #endif // FEATURE_EL_PRESET_ENCODER byte preset_encoders_state = ENCODER_IDLE; #endif // FEATURE_AZ_PRESET_ENCODER @@ -1973,7 +1952,7 @@ void check_az_preset_potentiometer() { if (check_pot) { pot_read = analogReadEnhanced(az_preset_pot); new_pot_azimuth = map(pot_read, AZ_PRESET_POT_FULL_CW, AZ_PRESET_POT_FULL_CCW, AZ_PRESET_POT_FULL_CW_MAP, AZ_PRESET_POT_FULL_CCW_MAP); - if ((abs(last_pot_read - pot_read) > 4) && (abs(new_pot_azimuth - (raw_azimuth / HEADING_MULTIPLIER)) > AZIMUTH_TOLERANCE)) { + if ((abs(last_pot_read - pot_read) > 4) && (abs(new_pot_azimuth - raw_azimuth) > AZIMUTH_TOLERANCE)) { pot_changed_waiting = 1; #ifdef DEBUG_AZ_PRESET_POT if (debug_mode) { @@ -1995,13 +1974,13 @@ void check_az_preset_potentiometer() { #ifdef DEBUG_AZ_PRESET_POT if (debug_mode) { debug.print("check_az_preset_potentiometer: pot change - current raw_azimuth: "); - debug.print(raw_azimuth / HEADING_MULTIPLIER,0); + debug.print(raw_azimuth,0); debug.print(" new_azimuth: "); debug.print(new_pot_azimuth); debug.println(""); } #endif // DEBUG_AZ_PRESET_POT - submit_request(AZ, REQUEST_AZIMUTH_RAW, new_pot_azimuth * HEADING_MULTIPLIER, DBG_CHECK_AZ_PRESET_POT); + submit_request(AZ, REQUEST_AZIMUTH_RAW, new_pot_azimuth, DBG_CHECK_AZ_PRESET_POT); pot_changed_waiting = 0; last_pot_read = pot_read; last_pot_check_time = millis(); @@ -2187,13 +2166,13 @@ void check_preset_encoders(){ debug.print("check_preset_encoders: az CW"); #endif // DEBUG_PRESET_ENCODERS if (az_elapsed_time < 250 /* mSec */) { - az_encoder_raw_degrees += (5 * HEADING_MULTIPLIER); - } else { az_encoder_raw_degrees += (1 * HEADING_MULTIPLIER); }; // Single deg increase unless encoder turned quickly then 10's step - // if (az_encoder_raw_degrees >=(360*HEADING_MULTIPLIER)) {az_encoder_raw_degrees -= (360*HEADING_MULTIPLIER);}; - if (az_encoder_raw_degrees > ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability) * HEADING_MULTIPLIER)) { + az_encoder_raw_degrees += (5); + } else { az_encoder_raw_degrees += (1); }; // Single deg increase unless encoder turned quickly then 10's step + // if (az_encoder_raw_degrees >=360) {az_encoder_raw_degrees -= 360;}; + if (az_encoder_raw_degrees > ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability))) { az_encoder_raw_degrees = - ((configuration.azimuth_starting_point * HEADING_MULTIPLIER) - /* + ((azimuth_starting_point+azimuth_rotation_capability)*HEADING_MULTIPLIER) - az_encoder_raw_degrees*/); + ((configuration.azimuth_starting_point) + /* + ((azimuth_starting_point+azimuth_rotation_capability)) - az_encoder_raw_degrees*/); } } if (az_encoder_result == DIR_CCW) { @@ -2201,12 +2180,12 @@ void check_preset_encoders(){ debug.print("check_preset_encoders: az CCW"); #endif // DEBUG_PRESET_ENCODERS if (az_elapsed_time < 250 /* mSec */) { - az_encoder_raw_degrees -= (5 * HEADING_MULTIPLIER); - } else { az_encoder_raw_degrees -= (1 * HEADING_MULTIPLIER); }; // Single deg decrease unless encoder turned quickly then 10's step - // if (az_encoder_raw_degrees < 0) {az_encoder_raw_degrees = (360*HEADING_MULTIPLIER);}; - if (az_encoder_raw_degrees < (configuration.azimuth_starting_point * HEADING_MULTIPLIER)) { - az_encoder_raw_degrees = (((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability) * HEADING_MULTIPLIER) - /*- (az_encoder_raw_degrees-(azimuth_starting_point*HEADING_MULTIPLIER))*/); + az_encoder_raw_degrees -= (5); + } else { az_encoder_raw_degrees -= (1); }; // Single deg decrease unless encoder turned quickly then 10's step + // if (az_encoder_raw_degrees < 0) {az_encoder_raw_degrees = 360;}; + if (az_encoder_raw_degrees < (configuration.azimuth_starting_point)) { + az_encoder_raw_degrees = (((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability)) + /*- (az_encoder_raw_degrees-(azimuth_starting_point))*/); } } #else //ndef OPTION_PRESET_ENCODER_0_360_DEGREES @@ -2215,12 +2194,12 @@ void check_preset_encoders(){ debug.print("check_preset_encoders: az CW"); #endif // DEBUG_PRESET_ENCODERS if (az_elapsed_time < 250) { // Single deg increase unless encoder turned quickly then 10's step - az_encoder_raw_degrees += (5 * HEADING_MULTIPLIER); + az_encoder_raw_degrees += (5); } else { - az_encoder_raw_degrees += (1 * HEADING_MULTIPLIER); + az_encoder_raw_degrees += (1); } - if (az_encoder_raw_degrees > (360 * HEADING_MULTIPLIER)) { - //az_encoder_raw_degrees = (360 * HEADING_MULTIPLIER); + if (az_encoder_raw_degrees > 360) { + //az_encoder_raw_degrees = 360; az_encoder_raw_degrees = 0; //} else { // if (az_encoder_raw_degrees < 0) { @@ -2233,16 +2212,16 @@ void check_preset_encoders(){ debug.print("check_preset_encoders: az CCW"); #endif // DEBUG_PRESET_ENCODERS if (az_elapsed_time < 250) { // Single deg decrease unless encoder turned quickly then 10's step - az_encoder_raw_degrees -= (5 * HEADING_MULTIPLIER); + az_encoder_raw_degrees -= (5); } else { - az_encoder_raw_degrees -= (1 * HEADING_MULTIPLIER); + az_encoder_raw_degrees -= (1); } - //if (az_encoder_raw_degrees > (360 * HEADING_MULTIPLIER)) { - // az_encoder_raw_degrees = (360 * HEADING_MULTIPLIER); + //if (az_encoder_raw_degrees > 360) { + // az_encoder_raw_degrees = 360; //} else { if (az_encoder_raw_degrees < 0) { //az_encoder_raw_degrees = 0; - az_encoder_raw_degrees = 359 * HEADING_MULTIPLIER; + az_encoder_raw_degrees = 359; } //} } @@ -2260,7 +2239,7 @@ void check_preset_encoders(){ #ifdef DEBUG_PRESET_ENCODERS debug.print("check_preset_encoders: az target: "); - dtostrf((az_encoder_raw_degrees / HEADING_MULTIPLIER),0,1,tempchar); + dtostrf((az_encoder_raw_degrees),0,1,tempchar); debug.println(tempchar); #endif // DEBUG_PRESET_ENCODERS @@ -2295,10 +2274,10 @@ void check_preset_encoders(){ debug.println("check_preset_encoders: el CW"); #endif // DEBUG_PRESET_ENCODERS if (el_elapsed_time < 250) { - el_encoder_degrees += (5 * HEADING_MULTIPLIER); - } else { el_encoder_degrees += (1 * HEADING_MULTIPLIER); }; // Single deg increase unless encoder turned quickly then 10's step - if (el_encoder_degrees > (180 * HEADING_MULTIPLIER)) { - el_encoder_degrees = (180 * HEADING_MULTIPLIER); + el_encoder_degrees += (5); + } else { el_encoder_degrees += (1); }; // Single deg increase unless encoder turned quickly then 10's step + if (el_encoder_degrees > (180)) { + el_encoder_degrees = (180); } ; } @@ -2308,8 +2287,8 @@ void check_preset_encoders(){ #endif // DEBUG_PRESET_ENCODERS // Rotary Encoder CCW 359 - 0 Deg if (el_elapsed_time < 250) { - el_encoder_degrees -= (5 * HEADING_MULTIPLIER); - } else { el_encoder_degrees -= (1 * HEADING_MULTIPLIER); }; // Single deg decrease unless encoder turned quickly then 10's step + el_encoder_degrees -= (5); + } else { el_encoder_degrees -= (1); }; // Single deg decrease unless encoder turned quickly then 10's step if (el_encoder_degrees < 0) { el_encoder_degrees = 0; } @@ -2328,7 +2307,7 @@ void check_preset_encoders(){ #ifdef DEBUG_PRESET_ENCODERS debug.print("check_preset_encoders: el target: "); char tempchar[16]; - dtostrf(el_encoder_degrees / HEADING_MULTIPLIER,0,1,tempchar); + dtostrf(el_encoder_degrees,0,1,tempchar); debug.println(tempchar); #endif // DEBUG_PRESET_ENCODERS @@ -2421,7 +2400,7 @@ void check_preset_encoders(){ #ifdef OPTION_AZ_MANUAL_ROTATE_LIMITS void check_az_manual_rotate_limit() { - if ((current_az_state() == ROTATING_CCW) && (raw_azimuth <= (AZ_MANUAL_ROTATE_CCW_LIMIT * HEADING_MULTIPLIER))) { + if ((current_az_state() == ROTATING_CCW) && (raw_azimuth <= (AZ_MANUAL_ROTATE_CCW_LIMIT))) { #ifdef DEBUG_AZ_MANUAL_ROTATE_LIMITS debug.print("check_az_manual_rotate_limit: stopping - hit AZ_MANUAL_ROTATE_CCW_LIMIT of "); debug.print(AZ_MANUAL_ROTATE_CCW_LIMIT); @@ -2429,7 +2408,7 @@ void check_az_manual_rotate_limit() { #endif // DEBUG_AZ_MANUAL_ROTATE_LIMITS submit_request(AZ, REQUEST_KILL, 0, DBG_CHECK_AZ_MANUAL_ROTATE_LIMIT_CCW); } - if ((current_az_state() == ROTATING_CW) && (raw_azimuth >= (AZ_MANUAL_ROTATE_CW_LIMIT * HEADING_MULTIPLIER))) { + if ((current_az_state() == ROTATING_CW) && (raw_azimuth >= (AZ_MANUAL_ROTATE_CW_LIMIT))) { #ifdef DEBUG_AZ_MANUAL_ROTATE_LIMITS debug.print("check_az_manual_rotate_limit: stopping - hit AZ_MANUAL_ROTATE_CW_LIMIT of "); debug.print(AZ_MANUAL_ROTATE_CW_LIMIT); @@ -2445,7 +2424,7 @@ void check_az_manual_rotate_limit() { #if defined(OPTION_EL_MANUAL_ROTATE_LIMITS) && defined(FEATURE_ELEVATION_CONTROL) void check_el_manual_rotate_limit() { - if ((current_el_state() == ROTATING_DOWN) && (elevation <= (EL_MANUAL_ROTATE_DOWN_LIMIT * HEADING_MULTIPLIER))) { + if ((current_el_state() == ROTATING_DOWN) && (elevation <= (EL_MANUAL_ROTATE_DOWN_LIMIT))) { #ifdef DEBUG_EL_MANUAL_ROTATE_LIMITS debug.print("check_el_manual_rotate_limit: stopping - hit EL_MANUAL_ROTATE_DOWN_LIMIT of "); debug.print(EL_MANUAL_ROTATE_DOWN_LIMIT); @@ -2453,7 +2432,7 @@ void check_el_manual_rotate_limit() { #endif // DEBUG_EL_MANUAL_ROTATE_LIMITS submit_request(EL, REQUEST_KILL, 0, DBG_CHECK_EL_MANUAL_ROTATE_LIMIT_DOWN); } - if ((current_el_state() == ROTATING_UP) && (elevation >= (EL_MANUAL_ROTATE_UP_LIMIT * HEADING_MULTIPLIER))) { + if ((current_el_state() == ROTATING_UP) && (elevation >= (EL_MANUAL_ROTATE_UP_LIMIT))) { #ifdef DEBUG_EL_MANUAL_ROTATE_LIMITS debug.print("check_el_manual_rotate_limit: stopping - hit EL_MANUAL_ROTATE_UP_LIMIT of "); debug.print(EL_MANUAL_ROTATE_UP_LIMIT); @@ -2560,8 +2539,8 @@ void check_overlap(){ #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)) { + // if ((analog_az > (500)) && (azimuth > (ANALOG_AZ_OVERLAP_DEGREES)) && (!overlap_led_status)) { + if ((raw_azimuth > (ANALOG_AZ_OVERLAP_DEGREES)) && (!overlap_led_status)) { digitalWriteEnhanced(overlap_led, OVERLAP_LED_ACTIVE_STATE); overlap_led_status = 1; #ifdef OPTION_BLINK_OVERLAP_LED @@ -2572,8 +2551,8 @@ void check_overlap(){ debug.println("check_overlap: in overlap"); #endif // DEBUG_OVERLAP } else { - // 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)) { + // if (((analog_az < (500)) || (azimuth < (ANALOG_AZ_OVERLAP_DEGREES))) && (overlap_led_status)) { + if ((raw_azimuth < (ANALOG_AZ_OVERLAP_DEGREES)) && (overlap_led_status)) { digitalWriteEnhanced(overlap_led, OVERLAP_LED_INACTIVE_STATE); overlap_led_status = 0; #ifdef DEBUG_OVERLAP @@ -3423,7 +3402,7 @@ void check_buttons(){ debug.println("check_buttons: button_cw pushed"); #endif // DEBUG_BUTTONS #ifdef OPTION_AZ_MANUAL_ROTATE_LIMITS - if (raw_azimuth < (AZ_MANUAL_ROTATE_CW_LIMIT * HEADING_MULTIPLIER)) { + if (raw_azimuth < (AZ_MANUAL_ROTATE_CW_LIMIT)) { #endif submit_request(AZ, REQUEST_CW, 0, DBG_CHECK_BUTTONS_BTN_CW); #if defined(FEATURE_LCD_DISPLAY) @@ -3450,7 +3429,7 @@ void check_buttons(){ debug.println("check_buttons: button_ccw pushed"); #endif // DEBUG_BUTTONS #ifdef OPTION_AZ_MANUAL_ROTATE_LIMITS - if (raw_azimuth > (AZ_MANUAL_ROTATE_CCW_LIMIT * HEADING_MULTIPLIER)) { + if (raw_azimuth > (AZ_MANUAL_ROTATE_CCW_LIMIT)) { #endif submit_request(AZ, REQUEST_CCW, 0, DBG_CHECK_BUTTONS_BTN_CCW); #if defined(FEATURE_LCD_DISPLAY) @@ -3505,7 +3484,7 @@ void check_buttons(){ #endif // FEATURE_ADAFRUIT_BUTTONS if (elevation_button_was_pushed == 0) { #ifdef OPTION_EL_MANUAL_ROTATE_LIMITS - if (elevation < (EL_MANUAL_ROTATE_UP_LIMIT * HEADING_MULTIPLIER)) { + if (elevation < (EL_MANUAL_ROTATE_UP_LIMIT)) { submit_request(EL, REQUEST_UP, 0, 66); #if defined(FEATURE_LCD_DISPLAY) perform_screen_redraw = 1; @@ -3539,7 +3518,7 @@ void check_buttons(){ if (elevation_button_was_pushed == 0) { #ifdef OPTION_EL_MANUAL_ROTATE_LIMITS - if (elevation > (EL_MANUAL_ROTATE_DOWN_LIMIT * HEADING_MULTIPLIER)) { + if (elevation > (EL_MANUAL_ROTATE_DOWN_LIMIT)) { submit_request(EL, REQUEST_DOWN, 0, 67); #if defined(FEATURE_LCD_DISPLAY) perform_screen_redraw = 1; @@ -3765,7 +3744,7 @@ char * idle_status(){ #if defined(FEATURE_LCD_DISPLAY) && defined(OPTION_DISPLAY_DIRECTION_STATUS) char * azimuth_direction(int azimuth_in){ - azimuth_in = azimuth_in / HEADING_MULTIPLIER; + azimuth_in = azimuth_in; if (azimuth_in > 348) { return N_STRING; @@ -3890,7 +3869,7 @@ void service_nextion_display(){ // Azimuth if (((azimuth != last_azimuth) && ((millis() - last_az_update) > NEXTION_DISPLAY_UPDATE_MS)) || (last_nextion_current_screen != nextion_current_screen)){ - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring1); + dtostrf(azimuth , 1, LCD_DECIMAL_PLACES, workstring1); //strcat(workstring1,"\xF8"/*DISPLAY_DEGREES_STRING*/); // haven't figured out how the hell to get degrees symbol to display tAzValue.setText(workstring1); last_azimuth = azimuth; @@ -3900,7 +3879,7 @@ void service_nextion_display(){ // Elevation #if defined(FEATURE_ELEVATION_CONTROL) if (((elevation != last_elevation) && ((millis() - last_el_update) > NEXTION_DISPLAY_UPDATE_MS)) || (last_nextion_current_screen != nextion_current_screen)){ - dtostrf(elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring1); + dtostrf(elevation , 1, LCD_DECIMAL_PLACES, workstring1); //strcat(workstring1,"\xF8"/*DISPLAY_DEGREES_STRING*/); tElValue.setText(workstring1); last_elevation = elevation; @@ -3996,7 +3975,7 @@ void service_nextion_display(){ #if defined(ANALOG_AZ_OVERLAP_DEGREES) || defined(FEATURE_PARK) strcpy(workstring1,""); #if defined(ANALOG_AZ_OVERLAP_DEGREES) - if ((raw_azimuth / HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES){ + if (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES){ overlap_indicator = 1; strcat(workstring1,TOUCH_DISPLAY_OVERLAP_STRING); strcat(workstring1,"\r\n"); @@ -4043,13 +4022,13 @@ void service_nextion_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring1,"+"); } strcat(workstring1,workstring2); @@ -4081,13 +4060,13 @@ void service_nextion_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring1,"+"); } strcat(workstring1,workstring2); @@ -4115,7 +4094,7 @@ void service_nextion_display(){ } } strcat(workstring1," "); - dtostrf(target_elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_elevation , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring1,workstring2); strcat(workstring1,DISPLAY_DEGREES_STRING); } else { @@ -4578,7 +4557,7 @@ void service_nextion_display(){ #endif //FEATURE_ELEVATION_CONTROL #endif //FEATURE_AUTOCORRECT - if ((raw_azimuth/HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES){ + if (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES){ temp = temp | 16384; } @@ -4611,13 +4590,13 @@ void service_nextion_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring1,"+"); } strcat(workstring1,workstring2); @@ -4647,13 +4626,13 @@ void service_nextion_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring1,"+"); } strcat(workstring1,workstring2); @@ -4681,7 +4660,7 @@ void service_nextion_display(){ } } strcat(workstring1," "); - dtostrf(target_elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_elevation , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring1,workstring2); strcat(workstring1,DISPLAY_DEGREES_STRING); } else { @@ -4738,7 +4717,7 @@ TODO: //zzzzzz // vSS3 - Status String 3 - Overlap, Parked Message strcpy(workstring1,""); - if ((raw_azimuth/HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES){ + if (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES){ strcat(workstring1,"OVERLAP"); strcat(workstring1,"\r\n"); } @@ -4818,7 +4797,7 @@ TODO: // Azimuth if (((azimuth != last_azimuth) || ((millis() - last_az_update) > NEXTION_FREQUENT_UPDATE_MS))){ // zAz - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring1); + dtostrf(azimuth , 1, LCD_DECIMAL_PLACES, workstring1); //strcat(workstring1,"\xF8"/*DISPLAY_DEGREES_STRING*/); // haven't figured out how the hell to get degrees symbol to display strcpy(workstring2,"vAz.txt=\""); strcat(workstring2,workstring1); @@ -4830,13 +4809,13 @@ TODO: sendNextionCommand(workstring2); // gAz - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, 0, workstring1); + dtostrf(azimuth , 1, 0, workstring1); strcpy(workstring2,"gAz="); strcat(workstring2,workstring1); sendNextionCommand(workstring2); // gAzR - dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 1, 0, workstring1); + dtostrf(raw_azimuth , 1, 0, workstring1); strcpy(workstring2,"gAzR="); strcat(workstring2,workstring1); sendNextionCommand(workstring2); @@ -4860,7 +4839,7 @@ TODO: // Elevation #if defined(FEATURE_ELEVATION_CONTROL) if ((elevation != last_elevation) || ((millis() - last_el_update) > NEXTION_FREQUENT_UPDATE_MS)){ - dtostrf(elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring1); + dtostrf(elevation , 1, LCD_DECIMAL_PLACES, workstring1); //strcat(workstring1,"\xF8"/*DISPLAY_DEGREES_STRING*/); strcpy(workstring2,"vEl.txt=\""); strcat(workstring2,workstring1); @@ -4868,7 +4847,7 @@ TODO: sendNextionCommand(workstring2); // gEl - dtostrf(elevation / LCD_HEADING_MULTIPLIER, 1, 0, workstring1); + dtostrf(elevation , 1, 0, workstring1); strcpy(workstring2,"gEl="); strcat(workstring2,workstring1); sendNextionCommand(workstring2); @@ -5074,100 +5053,96 @@ void update_lcd_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (azimuth < 100){strcat(workstring," ");} + if (azimuth < 10){strcat(workstring," ");} break; case AZ_DISPLAY_MODE_RAW: - if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (raw_azimuth < 100){strcat(workstring," ");} + if (raw_azimuth < 10){strcat(workstring," ");} break; } #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring,"+"); } strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_HEADING_ROW-1,LCD_HEADING_FIELD_SIZE); #else // --------------------az & el--------------------------------- - #if defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) - if ((azimuth >= 1000) && (elevation >= 1000) && (LCD_COLUMNS < 18)) { - strcpy(workstring,AZ_STRING); - } else { - strcpy(workstring,AZ_SPACE_STRING); - } - #else + if ((azimuth >= 1000) && (elevation >= 1000) && (LCD_COLUMNS < 18)) { + strcpy(workstring,AZ_STRING); + } else { strcpy(workstring,AZ_SPACE_STRING); - #endif // efined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) + } switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 3, LCD_DECIMAL_PLACES, workstring2); + dtostrf(azimuth , 3, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 3, LCD_DECIMAL_PLACES, workstring2); + dtostrf(raw_azimuth , 3, LCD_DECIMAL_PLACES, workstring2); break; } #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (azimuth < 100){strcat(workstring," ");} + if (azimuth < 10){strcat(workstring," ");} break; case AZ_DISPLAY_MODE_RAW: - if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (raw_azimuth < 100){strcat(workstring," ");} + if (raw_azimuth < 10){strcat(workstring," ");} break; } #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring,"+"); } strcat(workstring,workstring2); - #if !defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) + if (LCD_DECIMAL_PLACES > 1){ if (LCD_COLUMNS > 14) { strcat(workstring,DISPLAY_DEGREES_STRING); } - #else + } else { if ((LCD_COLUMNS > 18) || ((azimuth < 100) && (elevation < 100))) { strcat(workstring,DISPLAY_DEGREES_STRING); } - #endif - #if defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) + } + if (LCD_DECIMAL_PLACES > 1){ if ((elevation >= 1000) && (azimuth >= 1000) && (LCD_COLUMNS < 18)) { strcat(workstring,SPACE_EL_STRING); } else { strcat(workstring,SPACE_EL_SPACE_STRING); } - #else - strcat(workstring,SPACE_EL_SPACE_STRING); - #endif // defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) - dtostrf(elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + } else { + strcat(workstring,SPACE_EL_SPACE_STRING); + } + dtostrf(elevation , 1, LCD_DECIMAL_PLACES, workstring2); #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((elevation/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((elevation/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (elevation < 100){strcat(workstring," ");} + if (elevation < 10){strcat(workstring," ");} #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE strcat(workstring,workstring2); - #if !defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) + if (LCD_DECIMAL_PLACES > 1){ if (LCD_COLUMNS > 14) { strcat(workstring,DISPLAY_DEGREES_STRING); } - #else + } else { if ((LCD_COLUMNS > 18) || ((azimuth < 100) && (elevation < 100))) { strcat(workstring,DISPLAY_DEGREES_STRING); } - #endif + } k3ngdisplay.print_center_fixed_field_size(workstring,LCD_HEADING_ROW-1,LCD_HEADING_FIELD_SIZE); #endif // FEATURE_ELEVATION_CONTROL #endif //defined(OPTION_DISPLAY_HEADING) @@ -5178,26 +5153,26 @@ void update_lcd_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (azimuth < 100){strcat(workstring," ");} + if (azimuth < 10){strcat(workstring," ");} break; case AZ_DISPLAY_MODE_RAW: - if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((raw_azimuth/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (raw_azimuth < 100){strcat(workstring," ");} + if (raw_azimuth < 10){strcat(workstring," ");} break; } #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring,"+"); } strcat(workstring,workstring2); @@ -5208,30 +5183,22 @@ void update_lcd_display(){ // OPTION_DISPLAY_HEADING_EL_ONLY - show heading *********************************************************************************** #if defined(OPTION_DISPLAY_HEADING_EL_ONLY) && defined(FEATURE_ELEVATION_CONTROL) - // #if defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) - // if ((elevation >= 1000)) { - // strcpy(workstring,SPACE_EL_STRING); - // } else { - // strcpy(workstring,SPACE_EL_SPACE_STRING); - // } - // #else - strcpy(workstring,ELEVATION_STRING); - // #endif // defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) || defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) - dtostrf(elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + strcpy(workstring,ELEVATION_STRING); + dtostrf(elevation , 1, LCD_DECIMAL_PLACES, workstring2); #ifdef OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE - if ((elevation/ LCD_HEADING_MULTIPLIER) < 100){strcat(workstring," ");} - if ((elevation/ LCD_HEADING_MULTIPLIER) < 10){strcat(workstring," ");} + if (elevation < 100){strcat(workstring," ");} + if (elevation < 10){strcat(workstring," ");} #endif //OPTION_LCD_HEADING_FIELD_FIXED_DECIMAL_PLACE strcat(workstring,workstring2); - #if !defined(FEATURE_ONE_DECIMAL_PLACE_HEADINGS) && !defined(FEATURE_TWO_DECIMAL_PLACE_HEADINGS) + if (LCD_DECIMAL_PLACES > 1){ if (LCD_COLUMNS > 14) { strcat(workstring,DISPLAY_DEGREES_STRING); } - #else + } else { if ((LCD_COLUMNS > 18) || (elevation < 100)) { strcat(workstring,DISPLAY_DEGREES_STRING); } - #endif + } k3ngdisplay.print_center_fixed_field_size(workstring,LCD_EL_ONLY_HEADING_ROW-1,LCD_EL_ONLY_HEADING_FIELD_SIZE); #endif //defined(OPTION_DISPLAY_HEADING_EL_ONLY) @@ -5249,13 +5216,13 @@ void update_lcd_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring,"+"); } strcat(workstring,workstring2); @@ -5316,14 +5283,14 @@ void update_lcd_display(){ float target = 0; if (preset_encoders_state == ENCODER_AZ_PENDING) { target = az_encoder_raw_degrees; - if (target > (359 * LCD_HEADING_MULTIPLIER)) { - target = target - (360 * LCD_HEADING_MULTIPLIER); + if (target > 359) { + target = target - 360; } - if (target > (359 * LCD_HEADING_MULTIPLIER)) { - target = target - (360 * LCD_HEADING_MULTIPLIER); + if (target > 359) { + target = target - 360; } strcpy(workstring,TARGET_STRING); - dtostrf(target / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_STATUS_ROW-1,LCD_STATUS_FIELD_SIZE); @@ -5344,13 +5311,13 @@ void update_lcd_display(){ switch(configuration.azimuth_display_mode){ case AZ_DISPLAY_MODE_NORMAL: case AZ_DISPLAY_MODE_OVERLAP_PLUS: - dtostrf(target_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; case AZ_DISPLAY_MODE_RAW: - dtostrf(target_raw_azimuth / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_raw_azimuth , 1, LCD_DECIMAL_PLACES, workstring2); break; } - if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && ((raw_azimuth/LCD_HEADING_MULTIPLIER) > ANALOG_AZ_OVERLAP_DEGREES)){ + if ((configuration.azimuth_display_mode == AZ_DISPLAY_MODE_OVERLAP_PLUS) && (raw_azimuth > ANALOG_AZ_OVERLAP_DEGREES)){ strcat(workstring,"+"); } strcat(workstring,workstring2); @@ -5375,7 +5342,7 @@ void update_lcd_display(){ strcat(workstring,DOWN_STRING); } strcat(workstring," "); - dtostrf(target_elevation / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target_elevation , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); row_override[LCD_STATUS_ROW] = 1; @@ -5437,14 +5404,14 @@ void update_lcd_display(){ float target = 0; if (preset_encoders_state == ENCODER_AZ_PENDING) { target = az_encoder_raw_degrees; - if (target > (359 * LCD_HEADING_MULTIPLIER)) { - target = target - (360 * LCD_HEADING_MULTIPLIER); + if (target > 359) { + target = target - 360; } - if (target > (359 * LCD_HEADING_MULTIPLIER)) { - target = target - (360 * LCD_HEADING_MULTIPLIER); + if (target > 359) { + target = target - 360; } strcpy(workstring,TARGET_STRING); - dtostrf(target / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_STATUS_ROW-1,LCD_STATUS_FIELD_SIZE); @@ -5454,18 +5421,18 @@ void update_lcd_display(){ #if defined(FEATURE_AZ_PRESET_ENCODER) && defined(FEATURE_EL_PRESET_ENCODER) float target = az_encoder_raw_degrees; - if (target > (359 * LCD_HEADING_MULTIPLIER)) { - target = target - (360 * LCD_HEADING_MULTIPLIER); + if (target > 359) { + target = target - 360; } - if (target > (359 * LCD_HEADING_MULTIPLIER)) { - target = target - (360 * LCD_HEADING_MULTIPLIER); + if (target > 359) { + target = target - 360; } if (preset_encoders_state != ENCODER_IDLE) { switch (preset_encoders_state) { case ENCODER_AZ_PENDING: strcpy(workstring,AZ_TARGET_STRING); - dtostrf(target / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_STATUS_ROW-1,LCD_STATUS_FIELD_SIZE); @@ -5473,7 +5440,7 @@ void update_lcd_display(){ break; case ENCODER_EL_PENDING: strcpy(workstring,EL_TARGET_STRING); - dtostrf(el_encoder_degrees / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(el_encoder_degrees , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_STATUS_ROW-1,LCD_STATUS_FIELD_SIZE); @@ -5481,11 +5448,11 @@ void update_lcd_display(){ break; case ENCODER_AZ_EL_PENDING: strcpy(workstring,TARGET_STRING); - dtostrf(target / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(target , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); strcat(workstring," "); - dtostrf(el_encoder_degrees / LCD_HEADING_MULTIPLIER, 1, LCD_DECIMAL_PLACES, workstring2); + dtostrf(el_encoder_degrees , 1, LCD_DECIMAL_PLACES, workstring2); strcat(workstring,workstring2); strcat(workstring,DISPLAY_DEGREES_STRING); k3ngdisplay.print_center_fixed_field_size(workstring,LCD_STATUS_ROW-1,LCD_STATUS_FIELD_SIZE); @@ -5982,24 +5949,24 @@ void read_settings_from_eeprom(){ #if defined(FEATURE_AZ_POSITION_ROTARY_ENCODER) || defined(FEATURE_AZ_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY) - raw_azimuth = int(configuration.last_azimuth * HEADING_MULTIPLIER); - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); + raw_azimuth = int(configuration.last_azimuth); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; } else { azimuth = raw_azimuth; } #endif #if defined(FEATURE_ELEVATION_CONTROL) && (defined(FEATURE_EL_POSITION_ROTARY_ENCODER) || defined(FEATURE_EL_POSITION_ROTARY_ENCODER_USE_PJRC_LIBRARY)) - elevation = int(configuration.last_elevation * HEADING_MULTIPLIER); + elevation = int(configuration.last_elevation); #endif #ifdef FEATURE_AZ_POSITION_PULSE_INPUT - raw_azimuth = int(configuration.last_azimuth * HEADING_MULTIPLIER); - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); + raw_azimuth = int(configuration.last_azimuth); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; } else { azimuth = raw_azimuth; } @@ -6007,7 +5974,7 @@ void read_settings_from_eeprom(){ #endif // FEATURE_AZ_POSITION_PULSE_INPUT #if defined(FEATURE_ELEVATION_CONTROL) && defined(FEATURE_EL_POSITION_PULSE_INPUT) - elevation = int(configuration.last_elevation * HEADING_MULTIPLIER); + elevation = int(configuration.last_elevation); el_position_pulse_input_elevation = configuration.last_elevation; #endif // FEATURE_EL_POSITION_PULSE_INPUT @@ -6129,7 +6096,7 @@ void az_check_rotation_stall(){ } } else { if ((millis() - last_check_time) > STALL_CHECK_FREQUENCY_MS_AZ){ - if ((abs((raw_azimuth - last_raw_azimuth))*HEADING_MULTIPLIER) < STALL_CHECK_DEGREES_THRESHOLD_AZ){ + if ((abs((raw_azimuth - last_raw_azimuth))) < STALL_CHECK_DEGREES_THRESHOLD_AZ){ #ifdef DEBUG_ROTATION_STALL_DETECTION debug.println("az_check_rotation_stall: REQUEST_KILL"); #endif @@ -6171,7 +6138,7 @@ void el_check_rotation_stall(){ } } else { if ((millis() - last_check_time) > STALL_CHECK_FREQUENCY_MS_EL){ - if ((abs((elevation - last_elevation))*HEADING_MULTIPLIER) < STALL_CHECK_DEGREES_THRESHOLD_AZ){ + if ((abs((elevation - last_elevation))) < STALL_CHECK_DEGREES_THRESHOLD_AZ){ #ifdef DEBUG_ROTATION_STALL_DETECTION debug.println("el_check_rotation_stall: REQUEST_KILL"); #endif @@ -6322,25 +6289,24 @@ void read_azimuth(byte force_read){ #ifdef FEATURE_AZ_POSITION_POTENTIOMETER analog_az = analogReadEnhanced(rotator_analog_az); - raw_azimuth = map(analog_az, configuration.analog_az_full_ccw, configuration.analog_az_full_cw, (configuration.azimuth_starting_point * HEADING_MULTIPLIER), ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability) * HEADING_MULTIPLIER)); - //raw_azimuth = map(analog_az* HEADING_MULTIPLIER, configuration.analog_az_full_ccw* HEADING_MULTIPLIER, configuration.analog_az_full_cw* HEADING_MULTIPLIER, (configuration.azimuth_starting_point * HEADING_MULTIPLIER), ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability) * HEADING_MULTIPLIER)); + raw_azimuth = map(analog_az, configuration.analog_az_full_ccw, configuration.analog_az_full_cw, (configuration.azimuth_starting_point), ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability))); #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); - if (azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = azimuth - (360 * HEADING_MULTIPLIER); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; + if (azimuth >= 360) { + azimuth = azimuth - 360; } } else { if (raw_azimuth < 0) { - azimuth = raw_azimuth + (360 * HEADING_MULTIPLIER); + azimuth = raw_azimuth + 360; } else { azimuth = raw_azimuth; } @@ -6366,27 +6332,27 @@ void read_azimuth(byte force_read){ } } #endif // DEBUG_HEADING_READING_TIME - raw_azimuth = remote_unit_command_result_float * HEADING_MULTIPLIER; + raw_azimuth = remote_unit_command_result_float; #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); - if (azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = azimuth - (360 * HEADING_MULTIPLIER); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; + if (azimuth >= 360) { + azimuth = azimuth - 360; } } else { if (raw_azimuth < 0) { - azimuth = raw_azimuth + (360 * HEADING_MULTIPLIER); + azimuth = raw_azimuth + 360; } else { azimuth = raw_azimuth; } @@ -6440,15 +6406,15 @@ void read_azimuth(byte force_read){ #endif // OPTION_AZ_POSITION_ROTARY_ENCODER_HARD_LIMIT - raw_azimuth = int(configuration.last_azimuth * HEADING_MULTIPLIER); + raw_azimuth = int(configuration.last_azimuth); #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; } else { azimuth = raw_azimuth; } @@ -6499,15 +6465,15 @@ void read_azimuth(byte force_read){ #endif // OPTION_AZ_POSITION_ROTARY_ENCODER_HARD_LIMIT //debug.print(" Calculating raw_azimuth : "); - raw_azimuth = int(configuration.last_azimuth * HEADING_MULTIPLIER); + raw_azimuth = int(configuration.last_azimuth); #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; } else { azimuth = raw_azimuth; } @@ -6534,15 +6500,15 @@ void read_azimuth(byte force_read){ // Correct for when signs are reversed. if (heading < 0) heading += 2 * PI; if (heading > 2 * PI) heading -= 2 * PI; - raw_azimuth = (heading * RAD_TO_DEG) * HEADING_MULTIPLIER; // radians to degree + raw_azimuth = (heading * RAD_TO_DEG); // radians to degree if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); azimuth = raw_azimuth; #endif // FEATURE_AZ_POSITION_HMC5883L @@ -6582,12 +6548,12 @@ void read_azimuth(byte force_read){ if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); azimuth = raw_azimuth; #endif // FEATURE_AZ_POSITION_HMC5883L_USING_JARZEBSKI_LIBRARY @@ -6628,12 +6594,12 @@ void read_azimuth(byte force_read){ if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); azimuth = raw_azimuth; #endif //FEATURE_AZ_POSITION_DFROBOT_QMC5883 @@ -6674,12 +6640,12 @@ void read_azimuth(byte force_read){ if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); azimuth = raw_azimuth; #endif //FEATURE_AZ_POSITION_MECHASOLUTION_QMC5883 @@ -6692,14 +6658,14 @@ void read_azimuth(byte force_read){ // Correct for when signs are reversed. if (heading < 0) heading += 2 * PI; if (heading > 2 * PI) heading -= 2 * PI; - raw_azimuth = (heading * RAD_TO_DEG) * HEADING_MULTIPLIER; // radians to degree + raw_azimuth = (heading * RAD_TO_DEG); // radians to degree #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } azimuth = raw_azimuth; #endif // FEATURE_AZ_POSITION_ADAFRUIT_LSM303 @@ -6747,16 +6713,16 @@ void read_azimuth(byte force_read){ /* if (heading < 0) heading += 2 * PI; if (heading > 2 * PI) heading -= 2 * PI; - raw_azimuth = (heading * RAD_TO_DEG) * HEADING_MULTIPLIER; // radians to degree + raw_azimuth = (heading * RAD_TO_DEG); // radians to degree */ - raw_azimuth = heading * HEADING_MULTIPLIER ; // pololu library returns float value of actual heading. + raw_azimuth = heading ; // pololu library returns float value of actual heading. #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); if (AZIMUTH_SMOOTHING_FACTOR > 0) { if (raw_azimuth < 0){raw_azimuth = 0;} - raw_azimuth = int((float)raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); + raw_azimuth = int(raw_azimuth * ((float)1 - ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100))) + ((float)previous_raw_azimuth * ((float)AZIMUTH_SMOOTHING_FACTOR / (float)100)); } azimuth = raw_azimuth; #endif // FEATURE_AZ_POSITION_POLOLU_LSM303 @@ -6786,13 +6752,13 @@ void read_azimuth(byte force_read){ configuration.last_azimuth = az_position_pulse_input_azimuth; configuration_dirty = 1; last_az_position_pulse_input_azimuth = az_position_pulse_input_azimuth; - raw_azimuth = int(configuration.last_azimuth * HEADING_MULTIPLIER); + raw_azimuth = int(configuration.last_azimuth); #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; } else { azimuth = raw_azimuth; } @@ -6801,9 +6767,9 @@ void read_azimuth(byte force_read){ #ifdef FEATURE_AZ_POSITION_HH12_AS5045_SSI #if defined(OPTION_REVERSE_AZ_HH12_AS5045) - raw_azimuth = int((360.0-azimuth_hh12.heading()+ configuration.azimuth_starting_point) * HEADING_MULTIPLIER); + raw_azimuth = int((360.0-azimuth_hh12.heading()+ configuration.azimuth_starting_point)); #else - raw_azimuth = int((azimuth_hh12.heading()+ configuration.azimuth_starting_point) * HEADING_MULTIPLIER); + raw_azimuth = int((azimuth_hh12.heading()+ configuration.azimuth_starting_point)); #endif #ifdef DEBUG_HH12 if ((millis() - last_hh12_debug) > 5000) { @@ -6813,61 +6779,34 @@ void read_azimuth(byte force_read){ } #endif // DEBUG_HH12 #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); - if (raw_azimuth < 0){raw_azimuth = raw_azimuth + (360 * HEADING_MULTIPLIER);} - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); + if (raw_azimuth < 0){raw_azimuth = raw_azimuth + 360;} + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; } else { azimuth = raw_azimuth; } #endif // FEATURE_AZ_POSITION_HH12_AS5045_SSI -/* - #ifdef FEATURE_AZ_POSITION_INCREMENTAL_ENCODER - if (AZIMUTH_STARTING_POINT_DEFAULT == 0) { - raw_azimuth = (((((az_incremental_encoder_position) / ((long)AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L)) * 360L)) * (long)HEADING_MULTIPLIER); - } else { - if (az_incremental_encoder_position > ((long)AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L)) { - raw_azimuth = (((((az_incremental_encoder_position - ((long)AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L)) / ((long)AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L)) * 360L)) * (long)HEADING_MULTIPLIER); - } else { - raw_azimuth = (((((az_incremental_encoder_position + ((long)AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L)) / ((long)AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4L)) * 360L)) * (long)HEADING_MULTIPLIER); - } - } - #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); - #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); - } else { - azimuth = raw_azimuth; - } - if (raw_azimuth != incremental_encoder_previous_raw_azimuth) { - configuration.last_az_incremental_encoder_position = az_incremental_encoder_position; - configuration_dirty = 1; - incremental_encoder_previous_raw_azimuth = raw_azimuth; - } - #endif // FEATURE_AZ_POSITION_INCREMENTAL_ENCODER -*/ #ifdef FEATURE_AZ_POSITION_INCREMENTAL_ENCODER if (configuration.azimuth_starting_point /*AZIMUTH_STARTING_POINT_DEFAULT*/ == 0) { - raw_azimuth = (((((az_incremental_encoder_position) / (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0)) * HEADING_MULTIPLIER); + raw_azimuth = (((((az_incremental_encoder_position) / (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0))); } else { if (az_incremental_encoder_position > (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) { - raw_azimuth = (((((az_incremental_encoder_position - (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) / (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0)) * HEADING_MULTIPLIER); + raw_azimuth = (((((az_incremental_encoder_position - (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) / (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0))); } else { - raw_azimuth = (((((az_incremental_encoder_position + (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) / (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0)) * HEADING_MULTIPLIER); + raw_azimuth = (((((az_incremental_encoder_position + (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) / (AZ_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0))); } } #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); - if (raw_azimuth >= (360 * HEADING_MULTIPLIER)) { - azimuth = raw_azimuth - (360 * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); + if (raw_azimuth >= 360) { + azimuth = raw_azimuth - 360; } else { azimuth = raw_azimuth; } @@ -6883,11 +6822,11 @@ void read_azimuth(byte force_read){ #ifdef FEATURE_AZ_POSITION_A2_ABSOLUTE_ENCODER - raw_azimuth = az_a2_encoder * HEADING_MULTIPLIER; + raw_azimuth = az_a2_encoder; #ifdef FEATURE_AZIMUTH_CORRECTION - raw_azimuth = (correct_azimuth(raw_azimuth / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + raw_azimuth = (correct_azimuth(raw_azimuth)); #endif // FEATURE_AZIMUTH_CORRECTION - raw_azimuth = raw_azimuth + (configuration.azimuth_offset * HEADING_MULTIPLIER); + raw_azimuth = raw_azimuth + (configuration.azimuth_offset); azimuth = raw_azimuth; #endif //FEATURE_AZ_POSITION_A2_ABSOLUTE_ENCODER @@ -7037,20 +6976,20 @@ void output_debug(){ } debug.print(" AZ:"); - debug.print((azimuth / LCD_HEADING_MULTIPLIER), LCD_DECIMAL_PLACES); + debug.print((azimuth ), LCD_DECIMAL_PLACES); debug.print(" AZ_raw:"); - debug.print((raw_azimuth / LCD_HEADING_MULTIPLIER), LCD_DECIMAL_PLACES); + debug.print((raw_azimuth ), LCD_DECIMAL_PLACES); //debug.print(")"); if (az_state != IDLE) { debug.print(" Target:"); - debug.print((target_azimuth / LCD_HEADING_MULTIPLIER), LCD_DECIMAL_PLACES); + debug.print((target_azimuth ), LCD_DECIMAL_PLACES); debug.print(" Target_raw: "); - debug.print((target_raw_azimuth / LCD_HEADING_MULTIPLIER), LCD_DECIMAL_PLACES); + debug.print((target_raw_azimuth ), LCD_DECIMAL_PLACES); //debug.print(")"); debug.print(" Secs_left:"); @@ -7131,11 +7070,11 @@ void output_debug(){ case IN_PROGRESS_TO_TARGET: debug.print("IN_PROGRESS_TO_TARGET"); break; } debug.print(" EL:"); - dtostrf(elevation / LCD_HEADING_MULTIPLIER, 0, LCD_DECIMAL_PLACES,tempstring); + dtostrf(elevation , 0, LCD_DECIMAL_PLACES,tempstring); debug.print(tempstring); if (el_state != IDLE) { debug.print(" Target:"); - dtostrf(target_elevation / LCD_HEADING_MULTIPLIER, 0, LCD_DECIMAL_PLACES,tempstring); + dtostrf(target_elevation , 0, LCD_DECIMAL_PLACES,tempstring); debug.print(tempstring); } @@ -7194,10 +7133,10 @@ void output_debug(){ for (int x = 0; x < timed_buffer_number_entries_loaded; x++) { debug.print(x + 1); debug.print("\t:"); - debug.print(timed_buffer_azimuths[x] / HEADING_MULTIPLIER); + debug.print(timed_buffer_azimuths[x]); #ifdef FEATURE_ELEVATION_CONTROL debug.print("\t- "); - debug.print(timed_buffer_elevations[x] / HEADING_MULTIPLIER); + debug.print(timed_buffer_elevations[x]); #endif debug.print("\n"); } @@ -7379,13 +7318,13 @@ void output_debug(){ #endif //FEATURE_ELEVATION_CONTROL #endif //DEBUG_AUTOCORRECT - if ((raw_azimuth / LCD_HEADING_MULTIPLIER) < configuration.azimuth_starting_point){ + if ((raw_azimuth ) < configuration.azimuth_starting_point){ debug.print(F("\tWARNING: raw azimuth is CCW of configured starting point of ")); debug.print(configuration.azimuth_starting_point); debug.println("!"); } - if ((raw_azimuth / LCD_HEADING_MULTIPLIER) > (configuration.azimuth_starting_point+configuration.azimuth_rotation_capability)){ + if ((raw_azimuth ) > (configuration.azimuth_starting_point+configuration.azimuth_rotation_capability)){ debug.print(F("\tWARNING: raw azimuth is CW of configured ending point of ")); debug.print((configuration.azimuth_starting_point+configuration.azimuth_rotation_capability),0); debug.println("!"); @@ -7531,14 +7470,14 @@ void read_elevation(byte force_read){ #ifdef FEATURE_EL_POSITION_POTENTIOMETER analog_el = analogReadEnhanced(rotator_analog_el); - elevation = (map(analog_el, configuration.analog_el_0_degrees, configuration.analog_el_max_elevation, 0, (ELEVATION_MAXIMUM_DEGREES * HEADING_MULTIPLIER))); + elevation = (map(analog_el, configuration.analog_el_0_degrees, configuration.analog_el_max_elevation, 0, (ELEVATION_MAXIMUM_DEGREES))); #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); if (ELEVATION_SMOOTHING_FACTOR > 0) { if (elevation < 0){elevation = 0;} - elevation = int((float)elevation * ((float)1 - ((float)ELEVATION_SMOOTHING_FACTOR / (float)100))) + ((float)previous_elevation * ((float)ELEVATION_SMOOTHING_FACTOR / (float)100)); + elevation = int(elevation * ((float)1 - ((float)ELEVATION_SMOOTHING_FACTOR / (float)100))) + ((float)previous_elevation * ((float)ELEVATION_SMOOTHING_FACTOR / (float)100)); } if (elevation < 0) { elevation = 0; @@ -7575,9 +7514,9 @@ void read_elevation(byte force_read){ configuration.last_elevation = ELEVATION_MAXIMUM_DEGREES; } #endif - elevation = int(configuration.last_elevation * HEADING_MULTIPLIER); + elevation = int(configuration.last_elevation); #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION configuration_dirty = 1; } @@ -7612,9 +7551,9 @@ void read_elevation(byte force_read){ } #endif - elevation = int(configuration.last_elevation * HEADING_MULTIPLIER); + elevation = int(configuration.last_elevation); #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION configuration_dirty = 1; @@ -7627,10 +7566,10 @@ void read_elevation(byte force_read){ } #endif - elevation = int(configuration.last_elevation * HEADING_MULTIPLIER); + elevation = int(configuration.last_elevation); #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION configuration_dirty = 1; @@ -7649,14 +7588,14 @@ void read_elevation(byte force_read){ debug.println(raw.ZAxis); } #endif // DEBUG_ACCEL - elevation = (atan2(scaled.YAxis, scaled.ZAxis) * 180 * HEADING_MULTIPLIER) / M_PI; + elevation = (atan2(scaled.YAxis, scaled.ZAxis) * 180) / M_PI; #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); if (ELEVATION_SMOOTHING_FACTOR > 0) { if (elevation < 0){elevation = 0;} - elevation = int((float)elevation * ((float)1 - ((float)ELEVATION_SMOOTHING_FACTOR / (float)100))) + ((float)previous_elevation * ((float)ELEVATION_SMOOTHING_FACTOR / (float)100)); + elevation = int(elevation * ((float)1 - ((float)ELEVATION_SMOOTHING_FACTOR / (float)100))) + ((float)previous_elevation * ((float)ELEVATION_SMOOTHING_FACTOR / (float)100)); } #endif // FEATURE_EL_POSITION_ADXL345_USING_LOVE_ELECTRON_LIB @@ -7671,11 +7610,11 @@ void read_elevation(byte force_read){ debug.println(event.acceleration.z); } #endif // DEBUG_ACCEL - elevation = (atan2(event.acceleration.y, event.acceleration.z) * 180 * HEADING_MULTIPLIER) / M_PI; + elevation = (atan2(event.acceleration.y, event.acceleration.z) * 180) / M_PI; #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); #endif // FEATURE_EL_POSITION_ADXL345_USING_ADAFRUIT_LIB @@ -7690,11 +7629,11 @@ void read_elevation(byte force_read){ control_port->println(lsm.accelData.z); } #endif // DEBUG_ACCEL - elevation = (atan2(lsm.accelData.y, lsm.accelData.z) * 180 * HEADING_MULTIPLIER) / M_PI; + elevation = (atan2(lsm.accelData.y, lsm.accelData.z) * 180) / M_PI; #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); #endif // FEATURE_EL_POSITION_ADAFRUIT_LSM303 #ifdef FEATURE_EL_POSITION_POLOLU_LSM303 @@ -7707,11 +7646,11 @@ void read_elevation(byte force_read){ control_port->println(compass.a.z); } #endif // DEBUG_ACCEL - elevation = (atan2(compass.a.x, compass.a.z) * -180 * HEADING_MULTIPLIER) / M_PI; //lsm.accelData.y + elevation = (atan2(compass.a.x, compass.a.z) * -180) / M_PI; //lsm.accelData.y #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); #endif // FEATURE_EL_POSITION_POLOLU_LSM303 @@ -7736,11 +7675,11 @@ void read_elevation(byte force_read){ configuration.last_elevation = el_position_pulse_input_elevation; configuration_dirty = 1; last_el_position_pulse_input_elevation = el_position_pulse_input_elevation; - elevation = int(configuration.last_elevation * HEADING_MULTIPLIER); + elevation = int(configuration.last_elevation); #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); } #endif // FEATURE_EL_POSITION_PULSE_INPUT @@ -7762,14 +7701,14 @@ void read_elevation(byte force_read){ } } #endif // DEBUG_HEADING_READING_TIME - elevation = remote_unit_command_result_float * HEADING_MULTIPLIER; + elevation = remote_unit_command_result_float; #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); if (ELEVATION_SMOOTHING_FACTOR > 0) { if (elevation < 0){elevation = 0;} - elevation = int((float)elevation * ((float)1 - ((float)ELEVATION_SMOOTHING_FACTOR / (float)100))) + ((float)previous_elevation * ((float)ELEVATION_SMOOTHING_FACTOR / (float)100)); + elevation = int(elevation * ((float)1 - ((float)ELEVATION_SMOOTHING_FACTOR / (float)100))) + ((float)previous_elevation * ((float)ELEVATION_SMOOTHING_FACTOR / (float)100)); } remote_unit_command_results_available = 0; } else { @@ -7786,41 +7725,41 @@ void read_elevation(byte force_read){ #ifdef FEATURE_EL_POSITION_HH12_AS5045_SSI #if defined(OPTION_REVERSE_EL_HH12_AS5045) - elevation = int((360.0-elevation_hh12.heading()) * HEADING_MULTIPLIER); + elevation = int((360.0-elevation_hh12.heading())); #else - elevation = int(elevation_hh12.heading() * HEADING_MULTIPLIER); + elevation = int(elevation_hh12.heading()); #endif #ifdef DEBUG_HH12 if ((millis() - last_hh12_debug) > 5000) { debug.print(F("read_elevation: HH-12 from device: ")); debug.print(elevation_hh12.heading()); debug.print(F(" uncorrected: ")); - debug.println(elevation/HEADING_MULTIPLIER); + debug.println(elevation); // control_port->println(elevation); last_hh12_debug = millis(); } #endif // DEBUG_HH12 #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); - if (elevation > (180 * HEADING_MULTIPLIER)) { - elevation = elevation - (360 * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); + if (elevation > (180)) { + elevation = elevation - 360; } #endif // FEATURE_EL_POSITION_HH12_AS5045_SSI #ifdef FEATURE_EL_POSITION_INCREMENTAL_ENCODER - elevation = ((((el_incremental_encoder_position) / (EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0) * HEADING_MULTIPLIER); + elevation = ((((el_incremental_encoder_position) / (EL_POSITION_INCREMENTAL_ENCODER_PULSES_PER_REV*4.)) * 360.0)); #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif // FEATURE_ELEVATION_CORRECTION if (incremental_encoder_previous_elevation != elevation) { configuration.last_el_incremental_encoder_position = el_incremental_encoder_position; configuration_dirty = 1; incremental_encoder_previous_elevation = elevation; } - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); #endif // FEATURE_EL_POSITION_INCREMENTAL_ENCODER #ifdef FEATURE_EL_POSITION_MEMSIC_2125 @@ -7832,9 +7771,9 @@ void read_elevation(byte force_read){ debug.print(pulseY); debug.println(""); #endif //DEBUG_MEMSIC_2125 - elevation = Yangle * HEADING_MULTIPLIER; + elevation = Yangle; #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif //FEATURE_ELEVATION_CORRECTION #endif //FEATURE_EL_POSITION_MEMSIC_2125 @@ -7842,11 +7781,11 @@ void read_elevation(byte force_read){ } #ifdef FEATURE_EL_POSITION_A2_ABSOLUTE_ENCODER - elevation = el_a2_encoder * HEADING_MULTIPLIER; + elevation = el_a2_encoder; #ifdef FEATURE_ELEVATION_CORRECTION - elevation = (correct_elevation(elevation / (float) HEADING_MULTIPLIER) * HEADING_MULTIPLIER); + elevation = (correct_elevation(elevation)); #endif //FEATURE_ELEVATION_CORRECTION - elevation = elevation + (configuration.elevation_offset * HEADING_MULTIPLIER); + elevation = elevation + (configuration.elevation_offset); #endif //FEATURE_EL_POSITION_A2_ABSOLUTE_ENCODER @@ -9439,7 +9378,7 @@ void service_rotation(){ if ((az_state == SLOW_DOWN_CW) || (az_state == SLOW_DOWN_CCW)) { // is it time to do another step down? - if (abs((target_raw_azimuth - raw_azimuth) / HEADING_MULTIPLIER) <= (((float)SLOW_DOWN_BEFORE_TARGET_AZ * ((float)az_slow_down_step / (float)AZ_SLOW_DOWN_STEPS)))) { + if (abs((target_raw_azimuth - raw_azimuth)) <= (((float)SLOW_DOWN_BEFORE_TARGET_AZ * ((float)az_slow_down_step / (float)AZ_SLOW_DOWN_STEPS)))) { #ifdef DEBUG_SERVICE_ROTATION debug.print("service_rotation: step down: "); debug.print(az_slow_down_step); @@ -9456,7 +9395,7 @@ void service_rotation(){ // if slow down is enabled, see if we're ready to go into slowdown //if (((az_state == NORMAL_CW) || (az_state == SLOW_START_CW) || (az_state == NORMAL_CCW) || (az_state == SLOW_START_CCW)) && if (((az_state == NORMAL_CW) || (az_state == NORMAL_CCW)) && - (az_request_queue_state == IN_PROGRESS_TO_TARGET) && az_slowdown_active && (abs((target_raw_azimuth - raw_azimuth) / HEADING_MULTIPLIER) <= SLOW_DOWN_BEFORE_TARGET_AZ)) { + (az_request_queue_state == IN_PROGRESS_TO_TARGET) && az_slowdown_active && (abs((target_raw_azimuth - raw_azimuth)) <= SLOW_DOWN_BEFORE_TARGET_AZ)) { byte az_state_was = az_state; @@ -9498,10 +9437,10 @@ void service_rotation(){ // check rotation target -------------------------------------------------------------------------------------------------------- if ((az_state != IDLE) && (az_request_queue_state == IN_PROGRESS_TO_TARGET) ) { if ((az_state == NORMAL_CW) || (az_state == SLOW_START_CW) || (az_state == SLOW_DOWN_CW)) { - if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)) || ((raw_azimuth > target_raw_azimuth) && ((raw_azimuth - target_raw_azimuth) < ((AZIMUTH_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE)) || ((raw_azimuth > target_raw_azimuth) && ((raw_azimuth - target_raw_azimuth) < ((AZIMUTH_TOLERANCE + 5))))) { delay(50); read_azimuth(0); - if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)) || ((raw_azimuth > target_raw_azimuth) && ((raw_azimuth - target_raw_azimuth) < ((AZIMUTH_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE)) || ((raw_azimuth > target_raw_azimuth) && ((raw_azimuth - target_raw_azimuth) < ((AZIMUTH_TOLERANCE + 5))))) { rotator(DEACTIVATE, CW); rotator(DEACTIVATE, CCW); az_state = IDLE; @@ -9531,10 +9470,10 @@ void service_rotation(){ } } } else { - if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)) || ((raw_azimuth < target_raw_azimuth) && ((target_raw_azimuth - raw_azimuth) < ((AZIMUTH_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE)) || ((raw_azimuth < target_raw_azimuth) && ((target_raw_azimuth - raw_azimuth) < ((AZIMUTH_TOLERANCE + 5))))) { delay(50); read_azimuth(0); - if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)) || ((raw_azimuth < target_raw_azimuth) && ((target_raw_azimuth - raw_azimuth) < ((AZIMUTH_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE)) || ((raw_azimuth < target_raw_azimuth) && ((target_raw_azimuth - raw_azimuth) < ((AZIMUTH_TOLERANCE + 5))))) { rotator(DEACTIVATE, CW); rotator(DEACTIVATE, CCW); az_state = IDLE; @@ -9724,7 +9663,7 @@ void service_rotation(){ // slow down --------------------------------------------------------------------------------------------------------------- if ((el_state == SLOW_DOWN_UP) || (el_state == SLOW_DOWN_DOWN)) { // is it time to do another step down? - if (abs((target_elevation - elevation) / HEADING_MULTIPLIER) <= (((float)SLOW_DOWN_BEFORE_TARGET_EL * ((float)el_slow_down_step / (float)EL_SLOW_DOWN_STEPS)))) { + if (abs((target_elevation - elevation)) <= (((float)SLOW_DOWN_BEFORE_TARGET_EL * ((float)el_slow_down_step / (float)EL_SLOW_DOWN_STEPS)))) { #ifdef DEBUG_SERVICE_ROTATION debug.print("service_rotation: step down: "); debug.print(el_slow_down_step); @@ -9740,7 +9679,7 @@ void service_rotation(){ // normal ------------------------------------------------------------------------------------------------------------------- // if slow down is enabled, see if we're ready to go into slowdown if (((el_state == NORMAL_UP) || (el_state == SLOW_START_UP) || (el_state == NORMAL_DOWN) || (el_state == SLOW_START_DOWN)) && - (el_request_queue_state == IN_PROGRESS_TO_TARGET) && el_slowdown_active && (abs((target_elevation - elevation) / HEADING_MULTIPLIER) <= SLOW_DOWN_BEFORE_TARGET_EL)) { + (el_request_queue_state == IN_PROGRESS_TO_TARGET) && el_slowdown_active && (abs((target_elevation - elevation)) <= SLOW_DOWN_BEFORE_TARGET_EL)) { byte el_state_was = el_state; @@ -9784,12 +9723,12 @@ void service_rotation(){ if ((el_state != IDLE) && (el_request_queue_state == IN_PROGRESS_TO_TARGET) ) { read_elevation(0); if ((el_state == NORMAL_UP) || (el_state == SLOW_START_UP) || (el_state == SLOW_DOWN_UP)) { - if ((abs(elevation - target_elevation) < (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) || ((elevation > target_elevation) && ((elevation - target_elevation) < ((ELEVATION_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(elevation - target_elevation) < (ELEVATION_TOLERANCE)) || ((elevation > target_elevation) && ((elevation - target_elevation) < ((ELEVATION_TOLERANCE + 5))))) { #ifndef OPTION_NO_ELEVATION_CHECK_TARGET_DELAY delay(50); #endif //OPTION_NO_ELEVATION_CHECK_TARGET_DELAY read_elevation(0); - if ((abs(elevation - target_elevation) < (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) || ((elevation > target_elevation) && ((elevation - target_elevation) < ((ELEVATION_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(elevation - target_elevation) < (ELEVATION_TOLERANCE)) || ((elevation > target_elevation) && ((elevation - target_elevation) < ((ELEVATION_TOLERANCE + 5))))) { rotator(DEACTIVATE, UP); rotator(DEACTIVATE, DOWN); el_state = IDLE; @@ -9814,12 +9753,12 @@ void service_rotation(){ } } else { read_elevation(0); - if ((abs(elevation - target_elevation) <= (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) || ((elevation < target_elevation) && ((target_elevation - elevation) < ((ELEVATION_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(elevation - target_elevation) <= (ELEVATION_TOLERANCE)) || ((elevation < target_elevation) && ((target_elevation - elevation) < ((ELEVATION_TOLERANCE + 5))))) { #ifndef OPTION_NO_ELEVATION_CHECK_TARGET_DELAY delay(50); #endif //OPTION_NO_ELEVATION_CHECK_TARGET_DELAY read_elevation(0); - if ((abs(elevation - target_elevation) <= (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) || ((elevation < target_elevation) && ((target_elevation - elevation) < ((ELEVATION_TOLERANCE + 5) * HEADING_MULTIPLIER)))) { + if ((abs(elevation - target_elevation) <= (ELEVATION_TOLERANCE)) || ((elevation < target_elevation) && ((target_elevation - elevation) < ((ELEVATION_TOLERANCE + 5))))) { rotator(DEACTIVATE, UP); rotator(DEACTIVATE, DOWN); el_state = IDLE; @@ -9935,13 +9874,13 @@ void service_request_queue(){ #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print("REQUEST_AZIMUTH"); #endif // DEBUG_SERVICE_REQUEST_QUEUE - if ((az_request_parm >= 0) && (az_request_parm <= (360 * HEADING_MULTIPLIER))) { + if ((az_request_parm >= 0) && (az_request_parm <= 360)) { target_azimuth = az_request_parm; target_raw_azimuth = az_request_parm; - if (target_azimuth == (360 * HEADING_MULTIPLIER)) { + if (target_azimuth == 360) { target_azimuth = 0; } - if ((target_azimuth > (azimuth - (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER))) && (target_azimuth < (azimuth + (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)))) { + if ((target_azimuth > (azimuth - (AZIMUTH_TOLERANCE))) && (target_azimuth < (azimuth + (AZIMUTH_TOLERANCE)))) { #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print(" request within tolerance"); #endif // DEBUG_SERVICE_REQUEST_QUEUE @@ -9959,21 +9898,21 @@ void service_request_queue(){ work_target_raw_azimuth = target_azimuth; #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print(" work_target_raw_azimuth:"); - debug.print(work_target_raw_azimuth / HEADING_MULTIPLIER); + debug.print(work_target_raw_azimuth); debug.print(" azimuth_starting_point:"); debug.print(configuration.azimuth_starting_point); debug.print(" "); #endif // DEBUG_SERVICE_REQUEST_QUEUE - if (work_target_raw_azimuth < (configuration.azimuth_starting_point * HEADING_MULTIPLIER)) { - work_target_raw_azimuth = work_target_raw_azimuth + (360 * HEADING_MULTIPLIER); + if (work_target_raw_azimuth < (configuration.azimuth_starting_point)) { + work_target_raw_azimuth = work_target_raw_azimuth + 360; target_raw_azimuth = work_target_raw_azimuth; #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print("->B"); #endif // DEBUG_SERVICE_REQUEST_QUEUE } - if ((work_target_raw_azimuth + (360 * HEADING_MULTIPLIER)) < ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability) * HEADING_MULTIPLIER)) { // is there a second possible heading in overlap? - if (abs(raw_azimuth - work_target_raw_azimuth) < abs((work_target_raw_azimuth + (360 * HEADING_MULTIPLIER)) - raw_azimuth)) { // is second possible heading closer? + if ((work_target_raw_azimuth + 360) < ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability))) { // is there a second possible heading in overlap? + if (abs(raw_azimuth - work_target_raw_azimuth) < abs((work_target_raw_azimuth + 360) - raw_azimuth)) { // is second possible heading closer? #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print("->C"); #endif // DEBUG_SERVICE_REQUEST_QUEUE @@ -9992,8 +9931,8 @@ void service_request_queue(){ #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print("->D"); #endif // DEBUG_SERVICE_REQUEST_QUEUE - target_raw_azimuth = work_target_raw_azimuth + (360 * HEADING_MULTIPLIER); - if ((work_target_raw_azimuth + (360 * HEADING_MULTIPLIER)) > raw_azimuth) { + target_raw_azimuth = work_target_raw_azimuth + 360; + if ((work_target_raw_azimuth + 360) > raw_azimuth) { direction_to_go = CW; #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print("->CW!"); @@ -10020,8 +9959,8 @@ 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 <= ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability) * HEADING_MULTIPLIER))) { - target_azimuth = az_request_parm - (360 * HEADING_MULTIPLIER); + if ((az_request_parm > 360) && (az_request_parm <= ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability)))) { + target_azimuth = az_request_parm - 360; target_raw_azimuth = az_request_parm; if (az_request_parm > raw_azimuth) { direction_to_go = CW; @@ -10088,11 +10027,11 @@ void service_request_queue(){ #endif // DEBUG_SERVICE_REQUEST_QUEUE target_raw_azimuth = az_request_parm; target_azimuth = target_raw_azimuth; - if (target_azimuth >= (360 * HEADING_MULTIPLIER)) { - target_azimuth = target_azimuth - (360 * HEADING_MULTIPLIER); + if (target_azimuth >= 360) { + target_azimuth = target_azimuth - 360; } - if (((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER))) && (az_state == IDLE)) { + if (((abs(raw_azimuth - target_raw_azimuth) < (AZIMUTH_TOLERANCE))) && (az_state == IDLE)) { #ifdef DEBUG_SERVICE_REQUEST_QUEUE debug.print(" request within tolerance"); #endif // DEBUG_SERVICE_REQUEST_QUEUE @@ -10246,8 +10185,8 @@ void service_request_queue(){ #endif // DEBUG_SERVICE_REQUEST_QUEUE target_elevation = el_request_parm; - if (target_elevation > (ELEVATION_MAXIMUM_DEGREES * HEADING_MULTIPLIER)) { - target_elevation = ELEVATION_MAXIMUM_DEGREES * HEADING_MULTIPLIER; + if (target_elevation > (ELEVATION_MAXIMUM_DEGREES)) { + target_elevation = ELEVATION_MAXIMUM_DEGREES; #ifdef DEBUG_SERVICE_REQUEST_QUEUE if (debug_mode) { debug.print(F("REQUEST_ELEVATION: target_elevation > ELEVATION_MAXIMUM_DEGREES")); @@ -10256,16 +10195,16 @@ void service_request_queue(){ } #ifdef OPTION_EL_MANUAL_ROTATE_LIMITS - if (target_elevation < (EL_MANUAL_ROTATE_DOWN_LIMIT * HEADING_MULTIPLIER)) { - target_elevation = EL_MANUAL_ROTATE_DOWN_LIMIT * HEADING_MULTIPLIER; + if (target_elevation < (EL_MANUAL_ROTATE_DOWN_LIMIT)) { + target_elevation = EL_MANUAL_ROTATE_DOWN_LIMIT; #ifdef DEBUG_SERVICE_REQUEST_QUEUE if (debug_mode) { debug.print(F("REQUEST_ELEVATION: target_elevation < EL_MANUAL_ROTATE_DOWN_LIMIT")); } #endif // DEBUG_SERVICE_REQUEST_QUEUE } - if (target_elevation > (EL_MANUAL_ROTATE_UP_LIMIT * HEADING_MULTIPLIER)) { - target_elevation = EL_MANUAL_ROTATE_UP_LIMIT * HEADING_MULTIPLIER; + if (target_elevation > (EL_MANUAL_ROTATE_UP_LIMIT)) { + target_elevation = EL_MANUAL_ROTATE_UP_LIMIT; #ifdef DEBUG_SERVICE_REQUEST_QUEUE if (debug_mode) { debug.print(F("REQUEST_ELEVATION: target_elevation > EL_MANUAL_ROTATE_UP_LIMIT")); @@ -10274,7 +10213,7 @@ void service_request_queue(){ } #endif // OPTION_EL_MANUAL_ROTATE_LIMITS - if (abs(target_elevation - elevation) < (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) { + if (abs(target_elevation - elevation) < (ELEVATION_TOLERANCE)) { #ifdef DEBUG_SERVICE_REQUEST_QUEUE if (debug_mode) { debug.print(F("requested elevation within tolerance\n")); @@ -11363,13 +11302,13 @@ void initiate_park(){ stop_all_tracking(); - if (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)) { + if (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE)) { submit_request(AZ, REQUEST_AZIMUTH_RAW, PARK_AZIMUTH, 7); park_initiated = 1; } #ifdef FEATURE_ELEVATION_CONTROL - if (abs(elevation - PARK_ELEVATION) > (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) { + if (abs(elevation - PARK_ELEVATION) > (ELEVATION_TOLERANCE)) { submit_request(EL, REQUEST_ELEVATION, PARK_ELEVATION, 8); park_initiated = 1; } @@ -11395,7 +11334,7 @@ void service_park(){ if (park_status == PARKED) { #if !defined(FEATURE_ELEVATION_CONTROL) - if (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)) { + if (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE)) { if (time_first_detect_not_parked == 0){ time_first_detect_not_parked = millis(); } else { @@ -11411,7 +11350,7 @@ void service_park(){ #else - if ((abs(elevation - PARK_ELEVATION) > (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) || (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER))){ + if ((abs(elevation - PARK_ELEVATION) > (ELEVATION_TOLERANCE)) || (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE))){ if (time_first_detect_not_parked == 0){ time_first_detect_not_parked = millis(); } else { @@ -11431,14 +11370,14 @@ void service_park(){ // if (park_status == PARKED) { - // if (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE * HEADING_MULTIPLIER)) { + // if (abs(raw_azimuth - PARK_AZIMUTH) > (AZIMUTH_TOLERANCE)) { // park_status = NOT_PARKED; // #ifdef DEBUG_PARK // debug.println(F("service_park: az NOT_PARKED")); // #endif // DEBUG_PARK // } // #ifdef FEATURE_ELEVATION_CONTROL - // if (abs(elevation - PARK_ELEVATION) > (ELEVATION_TOLERANCE * HEADING_MULTIPLIER)) { + // if (abs(elevation - PARK_ELEVATION) > (ELEVATION_TOLERANCE)) { // park_status = NOT_PARKED; // #ifdef DEBUG_PARK // debug.println(F("service_park: el NOT_PARKED")); @@ -11884,7 +11823,7 @@ char *coordinates_to_maidenhead(float latitude_degrees,float longitude_degrees){ void service_analog_output_pins(){ static int last_azimith_voltage_out = 0; - int azimuth_voltage_out = map(azimuth/HEADING_MULTIPLIER,0,360,0,255); + int azimuth_voltage_out = map(azimuth,0,360,0,255); if (last_azimith_voltage_out != azimuth_voltage_out){ analogWriteEnhanced(pin_analog_az_out,azimuth_voltage_out); last_azimith_voltage_out = azimuth_voltage_out; @@ -11892,7 +11831,7 @@ void service_analog_output_pins(){ #ifdef FEATURE_ELEVATION_CONTROL static int last_elevation_voltage_out = 0; - int elevation_voltage_out = map(elevation/HEADING_MULTIPLIER,0,ANALOG_OUTPUT_MAX_EL_DEGREES,0,255); + int elevation_voltage_out = map(elevation,0,ANALOG_OUTPUT_MAX_EL_DEGREES,0,255); if (last_elevation_voltage_out != elevation_voltage_out){ analogWriteEnhanced(pin_analog_el_out,elevation_voltage_out); last_elevation_voltage_out = elevation_voltage_out; @@ -12044,16 +11983,16 @@ byte calibrate_az_el(float new_az, float new_el){ #ifdef DEBUG_OFFSET debug.print("calibrate_az_el: az:"); - debug.print(azimuth / LCD_HEADING_MULTIPLIER, 2); + debug.print(azimuth , 2); debug.print(" el:"); - control_port->println(elevation / LCD_HEADING_MULTIPLIER, 2); + control_port->println(elevation , 2); #endif // DEBUG_OFFSET - configuration.azimuth_offset = new_az - (float(raw_azimuth) / float(HEADING_MULTIPLIER)); + configuration.azimuth_offset = new_az - raw_azimuth; configuration.azimuth_starting_point = configuration.azimuth_starting_point + abs(configuration.azimuth_offset); #if defined(FEATURE_ELEVATION_CONTROL) - configuration.elevation_offset = new_el - (float(elevation) / float(HEADING_MULTIPLIER)); + configuration.elevation_offset = new_el - elevation; #endif configuration_dirty = 1; return 1; @@ -12074,11 +12013,11 @@ char * az_el_calibrated_string(){ read_azimuth(1); read_elevation(1); strcpy(return_string, "Heading calibrated. Az: "); - dtostrf((azimuth / LCD_HEADING_MULTIPLIER), 0, LCD_DECIMAL_PLACES, tempstring); + dtostrf((azimuth ), 0, LCD_DECIMAL_PLACES, tempstring); strcat(return_string, tempstring); #ifdef FEATURE_ELEVATION_CONTROL strcat(return_string, " El: "); - dtostrf((elevation / LCD_HEADING_MULTIPLIER), 0, LCD_DECIMAL_PLACES, tempstring); + dtostrf((elevation ), 0, LCD_DECIMAL_PLACES, tempstring); strcat(return_string, tempstring); #endif //FEATURE_ELEVATION_CONTROL return return_string; @@ -12766,13 +12705,8 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte int new_elevation = 9999; #endif - #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 + float new_azimuth_starting_point; + float new_azimuth_rotation_capability; byte brake_az_disabled; @@ -12795,9 +12729,9 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte break; } if ((new_azimuth >= 0) && (new_azimuth < 360)) { - azimuth = new_azimuth * HEADING_MULTIPLIER; + azimuth = new_azimuth; configuration.last_azimuth = new_azimuth; - raw_azimuth = new_azimuth * HEADING_MULTIPLIER; + raw_azimuth = new_azimuth; configuration_dirty = 1; strcpy(return_string, "Azimuth set to "); dtostrf(new_azimuth, 0, 0, temp_string); @@ -12823,7 +12757,7 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte if ((tempfloat >= 0) && (tempfloat <= 360)) { configuration.azimuth_offset = 0; read_azimuth(1); - configuration.azimuth_offset = tempfloat - float(raw_azimuth / HEADING_MULTIPLIER); + configuration.azimuth_offset = tempfloat - raw_azimuth; configuration.azimuth_starting_point = configuration.azimuth_starting_point + abs(configuration.azimuth_offset); configuration_dirty = 1; strcpy(return_string, "Azimuth calibrated to "); @@ -12932,7 +12866,7 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte break; } if ((new_elevation >= 0) && (new_elevation <= 180)) { - elevation = new_elevation * HEADING_MULTIPLIER; + elevation = new_elevation; configuration.last_elevation = new_elevation; configuration_dirty = 1; strcpy(return_string, "Elevation set to "); @@ -12959,7 +12893,7 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte if ((tempfloat >= 0) && (tempfloat <= 180)) { configuration.elevation_offset = 0; read_elevation(1); - configuration.elevation_offset = tempfloat - float(elevation / HEADING_MULTIPLIER); + configuration.elevation_offset = tempfloat - elevation; configuration_dirty = 1; strcpy(return_string, "Elevation calibrated to "); dtostrf(tempfloat, 0, 2, temp_string); @@ -13085,10 +13019,10 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte break; case 'L': // \L - rotate to long path - if (azimuth < (180 * HEADING_MULTIPLIER)) { - submit_request(AZ, REQUEST_AZIMUTH, (azimuth + (180 * HEADING_MULTIPLIER)), 15); + if (azimuth < (180)) { + submit_request(AZ, REQUEST_AZIMUTH, (azimuth + (180)), 15); } else { - submit_request(AZ, REQUEST_AZIMUTH, (azimuth - (180 * HEADING_MULTIPLIER)), 16); + submit_request(AZ, REQUEST_AZIMUTH, (azimuth - (180)), 16); } break; @@ -13251,7 +13185,7 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte break; #endif // FEATURE_MOON_TRACKING case '0': - configuration.azimuth_starting_point = configuration.azimuth_starting_point + abs(configuration.azimuth_offset); + configuration.azimuth_starting_point = configuration.azimuth_starting_point - abs(configuration.azimuth_offset); configuration.azimuth_offset = 0; configuration.elevation_offset = 0; configuration_dirty = 1; @@ -13436,29 +13370,29 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte if ((input_buffer[2] == 'F') && (input_buffer[3] == 'S')) { // \?FS - Full Status strcpy(return_string, "\\!OKFS"); // AZ - if ((raw_azimuth/HEADING_MULTIPLIER) < 100) { + if (raw_azimuth < 100) { strcat(return_string,"0"); } - if ((raw_azimuth/HEADING_MULTIPLIER) < 10) { + if (raw_azimuth < 10) { strcat(return_string,"0"); } - dtostrf(float(raw_azimuth/(float)HEADING_MULTIPLIER),0,6,temp_string); + dtostrf(raw_azimuth,0,6,temp_string); strcat(return_string,temp_string); strcat(return_string,","); // EL #if defined(FEATURE_ELEVATION_CONTROL) - if ((elevation/HEADING_MULTIPLIER) >= 0) { + if (elevation >= 0) { strcat(return_string,"+"); } else { strcat(return_string,"-"); } - if (abs(elevation/HEADING_MULTIPLIER) < 100) { + if (abs(elevation) < 100) { strcat(return_string,"0"); } - if (abs(elevation/HEADING_MULTIPLIER) < 10) { + if (abs(elevation) < 10) { strcat(return_string,"0"); } - dtostrf(float(abs(elevation/(float)HEADING_MULTIPLIER)),0,6,temp_string); + dtostrf(float(abs(elevation)),0,6,temp_string); strcat(return_string,temp_string); #endif // FEATURE_ELEVATION_CONTROL strcat(return_string,","); @@ -13506,30 +13440,30 @@ byte process_backslash_command(byte input_buffer[], int input_buffer_index, byte } if ((input_buffer[2] == 'A') && (input_buffer[3] == 'Z')) { // \?AZ - query AZ strcpy(return_string, "\\!OKAZ"); - if ((raw_azimuth/HEADING_MULTIPLIER) < 100) { + if (raw_azimuth < 100) { strcat(return_string,"0"); } - if ((raw_azimuth/HEADING_MULTIPLIER) < 10) { + if (raw_azimuth < 10) { strcat(return_string,"0"); } - dtostrf(float(raw_azimuth/(float)HEADING_MULTIPLIER),0,6,temp_string); + dtostrf(raw_azimuth,0,6,temp_string); strcat(return_string,temp_string); } if ((input_buffer[2] == 'E') && (input_buffer[3] == 'L')) { // \?EL - query EL #ifdef FEATURE_ELEVATION_CONTROL strcpy(return_string, "\\!OKEL"); - if ((elevation/HEADING_MULTIPLIER) >= 0) { + if (elevation >= 0) { strcat(return_string,"+"); } else { strcat(return_string,"-"); } - if (abs(elevation/HEADING_MULTIPLIER) < 100) { + if (abs(elevation) < 100) { strcat(return_string,"0"); } - if (abs(elevation/HEADING_MULTIPLIER) < 10) { + if (abs(elevation) < 10) { strcat(return_string,"0"); } - dtostrf(float(abs(elevation/(float)HEADING_MULTIPLIER)),0,6,temp_string); + dtostrf(float(abs(elevation)),0,6,temp_string); strcat(return_string,temp_string); #else // FEATURE_ELEVATION_CONTROL strcpy(return_string, "\\!??EL"); @@ -13822,7 +13756,7 @@ Not implemented yet: // debug.print("process_backslash_command: heading:"); // debug.println(heading); if ((heading >= 0) && (heading < 451)) { - submit_request(AZ, REQUEST_AZIMUTH, (heading * HEADING_MULTIPLIER), 136); + submit_request(AZ, REQUEST_AZIMUTH, (heading), 136); strcpy(return_string,"\\!OKGA"); } else { strcpy(return_string,"\\!??GA"); @@ -13846,7 +13780,7 @@ Not implemented yet: // debug.print("process_backslash_command: heading:"); // debug.println(heading); if ((heading >= 0) && (heading < 181)) { - submit_request(EL, REQUEST_ELEVATION, (heading * HEADING_MULTIPLIER), 37); + submit_request(EL, REQUEST_ELEVATION, (heading), 37); strcpy(return_string,"\\!OKGE"); } else { strcpy(return_string,"\\!??GE"); @@ -13863,7 +13797,7 @@ Not implemented yet: // if ((input_buffer[2] == 'G') && (input_buffer[3] == 'A')) { // \?GAxxx.x - go to AZ xxx.x // heading = ((input_buffer[4] - 48) * 100.) + ((input_buffer[5] - 48) * 10.) + (input_buffer[6] - 48.) + ((input_buffer[8] - 48) / 10.); // if (((heading >= 0) && (heading < 451)) && (input_buffer[7] == '.')) { - // submit_request(AZ, REQUEST_AZIMUTH, (heading * HEADING_MULTIPLIER), 136); + // submit_request(AZ, REQUEST_AZIMUTH, (heading), 136); // strcpy(return_string,"\\!OKGA"); // } else { // strcpy(return_string,"\\!??GA"); @@ -13873,7 +13807,7 @@ Not implemented yet: // #ifdef FEATURE_ELEVATION_CONTROL // heading = ((input_buffer[4] - 48) * 100.) + ((input_buffer[5] - 48) * 10.) + (input_buffer[5] - 48) + ((input_buffer[8] - 48) / 10.); // if (((heading >= 0) && (heading < 181)) && (input_buffer[7] == '.')) { - // submit_request(EL, REQUEST_ELEVATION, (heading * HEADING_MULTIPLIER), 37); + // submit_request(EL, REQUEST_ELEVATION, (heading), 37); // strcpy(return_string,"\\!OKGE"); // } else { // strcpy(return_string,"\\!??GE"); @@ -13973,13 +13907,13 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ case 'Z': //strcpy(return_string,"+"); strcpy(return_string,"AZ"); - dtostrf((float)azimuth/(float)HEADING_MULTIPLIER,0,1,tempstring); + dtostrf(azimuth,0,1,tempstring); strcat(return_string,tempstring); //if (elevation >= 0){ //strcat(return_string,"+"); strcat(return_string," EL"); //} - dtostrf((float)elevation/(float)HEADING_MULTIPLIER,0,1,tempstring); + dtostrf(elevation,0,1,tempstring); strcat(return_string,tempstring); break; #endif //OPTION_HAMLIB_EASYCOM_AZ_EL_COMMAND_HACK @@ -13990,7 +13924,7 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ case 2: //strcpy(return_string,"AZ"); strcpy(return_string,"+"); - dtostrf((float)azimuth/(float)HEADING_MULTIPLIER,0,1,tempstring); + dtostrf(azimuth,0,1,tempstring); strcat(return_string,tempstring); return; break; @@ -14007,7 +13941,7 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ // default: control_port->println("?"); break; } if (((heading >= 0) && (heading < 451)) && (easycom_command_buffer[easycom_command_buffer_index - 2] == '.')) { - submit_request(AZ, REQUEST_AZIMUTH, (heading * HEADING_MULTIPLIER), 36); + submit_request(AZ, REQUEST_AZIMUTH, (heading), 36); } else { strcpy(return_string,"?"); } @@ -14025,7 +13959,7 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ if (elevation >= 0){ strcpy(return_string,"+"); } - dtostrf((float)elevation/(float)HEADING_MULTIPLIER,0,1,tempstring); + dtostrf(elevation,0,1,tempstring); strcat(return_string,tempstring); return; break; @@ -14042,7 +13976,7 @@ void process_easycom_command(byte * easycom_command_buffer, int easycom_command_ // default: control_port->println("?"); break; } if (((heading >= 0) && (heading < 181)) && (easycom_command_buffer[easycom_command_buffer_index - 2] == '.')) { - submit_request(EL, REQUEST_ELEVATION, (heading * HEADING_MULTIPLIER), 37); + submit_request(EL, REQUEST_ELEVATION, (heading), 37); } else { strcpy(return_string,"?"); } @@ -14132,7 +14066,7 @@ void process_dcu_1_command(byte * dcu_1_command_buffer, int dcu_1_command_buffer } } if ((dcu_1_command_buffer[1] == 'M') && (dcu_1_command_buffer[2] == '1') && (dcu_1_command_buffer_index == 3)){ - submit_request(AZ, REQUEST_AZIMUTH, (dcu_1_azimuth_target_set * HEADING_MULTIPLIER), 233); + submit_request(AZ, REQUEST_AZIMUTH, (dcu_1_azimuth_target_set), 233); strcpy(return_string,"OK"); return; } @@ -14280,37 +14214,37 @@ void process_remote_slave_command(byte * slave_command_buffer, int slave_command } // RB - reboot if ((slave_command_buffer[0] == 'A') && (slave_command_buffer[1] == 'Z')) { strcpy(return_string,"AZ"); - //if ((raw_azimuth/HEADING_MULTIPLIER) < 1000) { + //if (raw_azimuth < 1000) { // strcat(return_string,"0"); //} - if ((raw_azimuth/HEADING_MULTIPLIER) < 100) { + if (raw_azimuth < 100) { strcat(return_string,"0"); } - if ((raw_azimuth/HEADING_MULTIPLIER) < 10) { + if (raw_azimuth < 10) { strcat(return_string,"0"); } - dtostrf(float(raw_azimuth/(float)HEADING_MULTIPLIER),0,6,tempstring); + dtostrf(raw_azimuth,0,6,tempstring); strcat(return_string,tempstring); command_good = 1; } #ifdef FEATURE_ELEVATION_CONTROL if ((slave_command_buffer[0] == 'E') && (slave_command_buffer[1] == 'L')) { strcpy(return_string,"EL"); - if ((elevation/HEADING_MULTIPLIER) >= 0) { + if (elevation >= 0) { strcat(return_string,"+"); } else { strcat(return_string,"-"); } - //if (abs(elevation/HEADING_MULTIPLIER) < 1000) { + //if (abs(elevation) < 1000) { // strcat(return_string,"0"); //} - if (abs(elevation/HEADING_MULTIPLIER) < 100) { + if (abs(elevation) < 100) { strcat(return_string,"0"); } - if (abs(elevation/HEADING_MULTIPLIER) < 10) { + if (abs(elevation) < 10) { strcat(return_string,"0"); } - dtostrf(float(abs(elevation/(float)HEADING_MULTIPLIER)),0,6,tempstring); + dtostrf(abs(elevation),0,6,tempstring); strcat(return_string,tempstring); command_good = 1; } @@ -14576,11 +14510,11 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer #else strcat(return_string,"AZ="); #endif - dtostrf(int(azimuth / HEADING_MULTIPLIER),0,0,tempstring); - if (int(azimuth / HEADING_MULTIPLIER) < 10) { + dtostrf(int(azimuth),0,0,tempstring); + if (int(azimuth) < 10) { strcat(return_string,"0"); } - if (int(azimuth / HEADING_MULTIPLIER) < 100) { + if (int(azimuth) < 100) { strcat(return_string,"0"); } strcat(return_string,tempstring); @@ -14603,11 +14537,11 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer strcat(return_string,"EL="); #endif - dtostrf(int(elevation / HEADING_MULTIPLIER),0,0,tempstring); - if (int(elevation / HEADING_MULTIPLIER) < 10) { + dtostrf(int(elevation),0,0,tempstring); + if (int(elevation) < 10) { strcat(return_string,("0")); } - if (int(elevation / HEADING_MULTIPLIER) < 100) { + if (int(elevation) < 100) { strcat(return_string,"0"); } strcat(return_string,tempstring); @@ -14870,7 +14804,7 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer for (int x = 5; x < yaesu_command_buffer_index; x = x + 4) { parsed_value = ((int(yaesu_command_buffer[x]) - 48) * 100) + ((int(yaesu_command_buffer[x + 1]) - 48) * 10) + (int(yaesu_command_buffer[x + 2]) - 48); if ((parsed_value >= 0) && (parsed_value <= (configuration.azimuth_starting_point + configuration.azimuth_rotation_capability))) { // is it a valid azimuth? - timed_buffer_azimuths[timed_buffer_number_entries_loaded] = parsed_value * HEADING_MULTIPLIER; + timed_buffer_azimuths[timed_buffer_number_entries_loaded] = parsed_value; timed_buffer_number_entries_loaded++; timed_buffer_status = LOADED_AZIMUTHS; if (timed_buffer_number_entries_loaded > TIMED_INTERVAL_ARRAY_SIZE) { // is the array full? @@ -14902,10 +14836,10 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer #endif // FEATURE_TIMED_BUFFER if ((parsed_value >= 0) && (parsed_value <= (configuration.azimuth_starting_point + configuration.azimuth_rotation_capability))) { #if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP) - submit_request(AZ, REQUEST_AZIMUTH, (parsed_value * HEADING_MULTIPLIER), 28); + submit_request(AZ, REQUEST_AZIMUTH, (parsed_value), 28); #else if (millis() > ROTATIONAL_AND_CONFIGURATION_CMD_IGNORE_TIME_MS){ - submit_request(AZ, REQUEST_AZIMUTH, (parsed_value * HEADING_MULTIPLIER), 28); + submit_request(AZ, REQUEST_AZIMUTH, (parsed_value), 28); } #endif return; @@ -15059,11 +14993,11 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer #else strcat(return_string,"EL="); #endif //OPTION_GS_232B_EMULATION - dtostrf(int(elevation / HEADING_MULTIPLIER),0,0,tempstring); - if (int(elevation / HEADING_MULTIPLIER) < 10) { + dtostrf(int(elevation),0,0,tempstring); + if (int(elevation) < 10) { strcat(return_string,("0")); } - if (int(elevation / HEADING_MULTIPLIER) < 100) { + if (int(elevation) < 100) { strcat(return_string,"0"); } strcat(return_string,tempstring); @@ -15096,8 +15030,8 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer parsed_value = ((int(yaesu_command_buffer[x]) - 48) * 100) + ((int(yaesu_command_buffer[x + 1]) - 48) * 10) + (int(yaesu_command_buffer[x + 2]) - 48); parsed_value2 = ((int(yaesu_command_buffer[x + 4]) - 48) * 100) + ((int(yaesu_command_buffer[x + 5]) - 48) * 10) + (int(yaesu_command_buffer[x + 6]) - 48); if ((parsed_value > -1) && (parsed_value < 361) && (parsed_value2 > -1) && (parsed_value2 < 181)) { // is it a valid azimuth? - timed_buffer_azimuths[timed_buffer_number_entries_loaded] = (parsed_value * HEADING_MULTIPLIER); - timed_buffer_elevations[timed_buffer_number_entries_loaded] = (parsed_value2 * HEADING_MULTIPLIER); + timed_buffer_azimuths[timed_buffer_number_entries_loaded] = (parsed_value); + timed_buffer_elevations[timed_buffer_number_entries_loaded] = (parsed_value2); timed_buffer_number_entries_loaded++; timed_buffer_status = LOADED_AZIMUTHS_ELEVATIONS; if (timed_buffer_number_entries_loaded > TIMED_INTERVAL_ARRAY_SIZE) { // is the array full? @@ -15120,14 +15054,14 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer #endif // FEATURE_TIMED_BUFFER FEATURE_ELEVATION_CONTROL } else { // this is a short form W command, just parse the azimuth and elevation and initiate rotation - parsed_value = (((int(yaesu_command_buffer[1]) - 48) * 100) + ((int(yaesu_command_buffer[2]) - 48) * 10) + (int(yaesu_command_buffer[3]) - 48)) * HEADING_MULTIPLIER; - parsed_elevation = (((int(yaesu_command_buffer[5]) - 48) * 100) + ((int(yaesu_command_buffer[6]) - 48) * 10) + (int(yaesu_command_buffer[7]) - 48)) * HEADING_MULTIPLIER; + parsed_value = (((int(yaesu_command_buffer[1]) - 48) * 100) + ((int(yaesu_command_buffer[2]) - 48) * 10) + (int(yaesu_command_buffer[3]) - 48)); + parsed_elevation = (((int(yaesu_command_buffer[5]) - 48) * 100) + ((int(yaesu_command_buffer[6]) - 48) * 10) + (int(yaesu_command_buffer[7]) - 48)); } #ifndef FEATURE_ELEVATION_CONTROL - if ((parsed_value >= 0) && (parsed_value <= ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability)* HEADING_MULTIPLIER))) { - //if ((parsed_value >= 0) && (parsed_value <= (360 * HEADING_MULTIPLIER))) { + if ((parsed_value >= 0) && (parsed_value <= ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability)))) { + //if ((parsed_value >= 0) && (parsed_value <= 360)) { submit_request(AZ, REQUEST_AZIMUTH, parsed_value, 32); } else { #ifdef DEBUG_PROCESS_YAESU @@ -15139,7 +15073,7 @@ void process_yaesu_command(byte * yaesu_command_buffer, int yaesu_command_buffer } #else - if ((parsed_value >= 0) && (parsed_value <= ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability)* HEADING_MULTIPLIER)) && (parsed_elevation >= 0) && (parsed_elevation <= (ELEVATION_MAXIMUM_DEGREES * HEADING_MULTIPLIER))) { + if ((parsed_value >= 0) && (parsed_value <= ((configuration.azimuth_starting_point + configuration.azimuth_rotation_capability))) && (parsed_elevation >= 0) && (parsed_elevation <= (ELEVATION_MAXIMUM_DEGREES))) { #if defined(OPTION_ALLOW_ROTATIONAL_AND_CONFIGURATION_CMDS_AT_BOOT_UP) submit_request(AZ, REQUEST_AZIMUTH, parsed_value, 33); submit_request(EL, REQUEST_ELEVATION, parsed_elevation, 34); @@ -15566,8 +15500,8 @@ void service_moon_tracking(){ #endif // DEBUG_MOON_TRACKING if ((moon_azimuth >= MOON_AOS_AZIMUTH_MIN) && (moon_azimuth <= MOON_AOS_AZIMUTH_MAX) && (moon_elevation >= MOON_AOS_ELEVATION_MIN) && (moon_elevation <= MOON_AOS_ELEVATION_MAX)) { - submit_request(AZ, REQUEST_AZIMUTH, moon_azimuth * HEADING_MULTIPLIER, 11); - submit_request(EL, REQUEST_ELEVATION, moon_elevation * HEADING_MULTIPLIER, 12); + submit_request(AZ, REQUEST_AZIMUTH, moon_azimuth, 11); + submit_request(EL, REQUEST_ELEVATION, moon_elevation, 12); if (!moon_visible) { moon_visible = 1; #ifdef DEBUG_MOON_TRACKING @@ -15648,8 +15582,8 @@ void service_sun_tracking(){ #endif // DEBUG_SUN_TRACKING if ((sun_azimuth >= SUN_AOS_AZIMUTH_MIN) && (sun_azimuth <= SUN_AOS_AZIMUTH_MAX) && (sun_elevation >= SUN_AOS_ELEVATION_MIN) && (sun_elevation <= SUN_AOS_ELEVATION_MAX)) { - submit_request(AZ, REQUEST_AZIMUTH, sun_azimuth * HEADING_MULTIPLIER, 13); - submit_request(EL, REQUEST_ELEVATION, sun_elevation * HEADING_MULTIPLIER, 14); + submit_request(AZ, REQUEST_AZIMUTH, sun_azimuth, 13); + submit_request(EL, REQUEST_ELEVATION, sun_elevation, 14); if (!sun_visible) { sun_visible = 1; #ifdef DEBUG_SUN_TRACKING diff --git a/k3ng_rotator_controller/rotator_features.h b/k3ng_rotator_controller/rotator_features.h index b5ab1df..f248a07 100755 --- a/k3ng_rotator_controller/rotator_features.h +++ b/k3ng_rotator_controller/rotator_features.h @@ -119,8 +119,6 @@ #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_AZ_ROTATION_STALL_DETECTION // Azimuth rotation stall detection - pin: az_rotation_stall_detected diff --git a/k3ng_rotator_controller/rotator_features_m0upu.h b/k3ng_rotator_controller/rotator_features_m0upu.h index 2f5c8f4..f22b855 100755 --- a/k3ng_rotator_controller/rotator_features_m0upu.h +++ b/k3ng_rotator_controller/rotator_features_m0upu.h @@ -113,8 +113,6 @@ #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_AZ_ROTATION_STALL_DETECTION // Azimuth rotation stall detection - pin: az_rotation_stall_detected diff --git a/k3ng_rotator_controller/rotator_features_test.h b/k3ng_rotator_controller/rotator_features_test.h index 1a71103..7a88160 100755 --- a/k3ng_rotator_controller/rotator_features_test.h +++ b/k3ng_rotator_controller/rotator_features_test.h @@ -125,8 +125,6 @@ #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_AZ_ROTATION_STALL_DETECTION // Azimuth rotation stall detection - pin: az_rotation_stall_detected diff --git a/k3ng_rotator_controller/rotator_features_wb6kcn.h b/k3ng_rotator_controller/rotator_features_wb6kcn.h index d3e73a8..22e8d5e 100755 --- a/k3ng_rotator_controller/rotator_features_wb6kcn.h +++ b/k3ng_rotator_controller/rotator_features_wb6kcn.h @@ -112,8 +112,6 @@ #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 diff --git a/k3ng_rotator_controller/rotator_hardware.h b/k3ng_rotator_controller/rotator_hardware.h index 190c5ef..609b237 100755 --- a/k3ng_rotator_controller/rotator_hardware.h +++ b/k3ng_rotator_controller/rotator_hardware.h @@ -8,7 +8,7 @@ #define rotator_hardware_h // can't touch this // #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_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 // #define HARDWARE_TEST // customize rotator_features_test.h, rotators_pins_test.h, rotator_settings_test.h diff --git a/k3ng_rotator_controller/rotator_settings.h b/k3ng_rotator_controller/rotator_settings.h index acfeeeb..7814cf6 100755 --- a/k3ng_rotator_controller/rotator_settings.h +++ b/k3ng_rotator_controller/rotator_settings.h @@ -159,24 +159,7 @@ You can tweak these, but read the online documentation! #define EEPROM_MAGIC_NUMBER 110 #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 diff --git a/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h b/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h index 07e9c1d..5ff8a51 100755 --- a/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h +++ b/k3ng_rotator_controller/rotator_settings_ea4tx_ars_usb.h @@ -155,24 +155,7 @@ You can tweak these, but read the online documentation! #define EEPROM_MAGIC_NUMBER 109 #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 diff --git a/k3ng_rotator_controller/rotator_settings_m0upu.h b/k3ng_rotator_controller/rotator_settings_m0upu.h index 4c6cd2c..5490f4c 100755 --- a/k3ng_rotator_controller/rotator_settings_m0upu.h +++ b/k3ng_rotator_controller/rotator_settings_m0upu.h @@ -155,24 +155,7 @@ You can tweak these, but read the online documentation! #define EEPROM_MAGIC_NUMBER 109 #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 diff --git a/k3ng_rotator_controller/rotator_settings_test.h b/k3ng_rotator_controller/rotator_settings_test.h index 096a61f..c4381a7 100755 --- a/k3ng_rotator_controller/rotator_settings_test.h +++ b/k3ng_rotator_controller/rotator_settings_test.h @@ -173,24 +173,7 @@ You can tweak these, but read the online documentation! #define EEPROM_MAGIC_NUMBER 109 #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 @@ -198,8 +181,8 @@ You can tweak these, but read the online documentation! #define AZ_POSITION_PULSE_DEG_PER_PULSE 0.5 #define EL_POSITION_PULSE_DEG_PER_PULSE 0.5 -#define PARK_AZIMUTH 0.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 PARK_AZIMUTH 0.0 // 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 // replace the 0.0 with your park elevation #define NOT_PARKED_DETECT_TIME_MS 1000 #define COMMAND_BUFFER_SIZE 50 diff --git a/k3ng_rotator_controller/rotator_settings_wb6kcn.h b/k3ng_rotator_controller/rotator_settings_wb6kcn.h index 3543254..eb7b412 100755 --- a/k3ng_rotator_controller/rotator_settings_wb6kcn.h +++ b/k3ng_rotator_controller/rotator_settings_wb6kcn.h @@ -156,24 +156,7 @@ You can tweak these, but read the online documentation! #define EEPROM_MAGIC_NUMBER 109 #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