Skip to content

Commit

Permalink
2022.02.20.01
Browse files Browse the repository at this point in the history
        FEATURE_SATELLITE_TRACKING: Updated P13 library to have observer.update_location function.  Controller code now uses update_location rather than instantiating new Observer objects
        Updated hardcoded AO17TEST TLE
  • Loading branch information
k3ng committed Feb 21, 2022
1 parent 921280c commit 51bf768
Show file tree
Hide file tree
Showing 9 changed files with 1,152 additions and 1,403 deletions.
2,417 changes: 1,041 additions & 1,376 deletions k3ng_rotator_controller/k3ng_rotator_controller.ino

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions k3ng_rotator_controller/rotator.h
Expand Up @@ -116,8 +116,8 @@
#define ROTATING_DOWN 4

#define REMOTE_UNIT_NO_COMMAND 0
#define REMOTE_UNIT_AZ_COMMAND 1
#define REMOTE_UNIT_EL_COMMAND 2
// #define REMOTE_UNIT_AZ_COMMAND 1
// #define REMOTE_UNIT_EL_COMMAND 2
#define REMOTE_UNIT_OTHER_COMMAND 3
#define REMOTE_UNIT_AW_COMMAND 4
#define REMOTE_UNIT_DHL_COMMAND 5
Expand All @@ -132,7 +132,7 @@
#define REMOTE_UNIT_RA_COMMAND 14
#define REMOTE_UNIT_RE_COMMAND 15
#define REMOTE_UNIT_RS_COMMAND 16
#define REMOTE_UNIT_PG_COMMAND 17
#define REMOTE_UNIT_PM_COMMAND 17

#define NOT_PARKED 0
#define PARK_INITIATED 1
Expand Down Expand Up @@ -334,6 +334,7 @@
#define NEXTION_TRANSIENT_MESSAGE_REQUESTED 1
#define NEXTION_TRANSIENT_MESSAGE_IN_PROGRESS 2


#define MASTER_REMOTE_LINK_DOWN 0
#define MASTER_REMOTE_LINK_UP 1

/* ------end of macros ------- */
2 changes: 1 addition & 1 deletion k3ng_rotator_controller/rotator_debug_log_activation.h
Expand Up @@ -80,4 +80,4 @@
// #define DEBUG_SATELLITE_POPULATE_LIST_ARRAY
// #define DEBUG_SATELLITE_LIST_EXTRA_INFO
// #define DEBUG_SATELLITE_CALC_RESET
// #define DEBUG_SATELLITE_USE_OLD_OBSERVER_OBJECT
// #define DEBUG_SATELLITE_USE_OLD_OBSERVER_OBJECT // Deprecated 2022-02-20
6 changes: 3 additions & 3 deletions k3ng_rotator_controller/rotator_features_wb6kcn_k3ng.h
Expand Up @@ -7,7 +7,7 @@
/* main features */

#define FEATURE_ELEVATION_CONTROL // uncomment this for AZ/EL rotators
// #define FEATURE_YAESU_EMULATION // uncomment this for Yaesu GS-232 emulation on control port
#define FEATURE_YAESU_EMULATION // uncomment this for Yaesu GS-232 emulation on control port
// #define FEATURE_EASYCOM_EMULATION // Easycom protocol emulation on control port
// #define FEATURE_DCU_1_EMULATION // DCU-1 protocol emulation on control port (only supports azimuth only systems)

Expand All @@ -23,7 +23,7 @@
// #define FEATURE_TEST_DISPLAY_AT_STARTUP
// #define FEATURE_CALIBRATION // under development - this will get rid of azimuth and elevation offsets and replace with runtime calibration tables

// #define FEATURE_SATELLITE_TRACKING // https://github.com/k3ng/k3ng_rotator_controller/wiki/707-Satellite-Tracking
#define FEATURE_SATELLITE_TRACKING // https://github.com/k3ng/k3ng_rotator_controller/wiki/707-Satellite-Tracking

#define LANGUAGE_ENGLISH // all languages customized in rotator_language.h
// #define LANGUAGE_SPANISH
Expand All @@ -36,7 +36,7 @@
// #define LANGUAGE_NORWEGIAN_BOKMAAL

/* master and remote slave unit functionality */
#define FEATURE_REMOTE_UNIT_SLAVE // uncomment this to make this unit a remote unit controlled by a host unit
// #define FEATURE_REMOTE_UNIT_SLAVE // uncomment this to make this unit a remote unit controlled by a host unit

// #define FEATURE_MASTER_WITH_SERIAL_SLAVE // [master]{remote_port}<-------serial-------->{control_port}[slave]
// #define FEATURE_MASTER_WITH_ETHERNET_SLAVE // [master]<-------------------ethernet--------------------->[slave]
Expand Down
2 changes: 1 addition & 1 deletion k3ng_rotator_controller/rotator_settings.h
Expand Up @@ -111,7 +111,7 @@ You can tweak these, but read the online documentation!
#define ELEVATION_TOLERANCE 0.1 //1.0

#define OPERATION_TIMEOUT 120000 // timeout for any rotation operation in mS ; 120 seconds is usually enough unless you have the speed turned down
#define REMOTE_UNIT_ROTATION_TIMEOUT 5000 // timeout any remote unit rotation operation if a ping (PG) is not receive within 5 seconds
#define MASTER_REMOTE_LINK_PING_TIME_MS 5000

#define TIMED_INTERVAL_ARRAY_SIZE 20

Expand Down
10 changes: 5 additions & 5 deletions k3ng_rotator_controller/rotator_settings_test.h
Expand Up @@ -121,7 +121,7 @@ You can tweak these, but read the online documentation!
#define ELEVATION_TOLERANCE 5.0

#define OPERATION_TIMEOUT 120000 // timeout for any rotation operation in mS ; 120 seconds is usually enough unless you have the speed turned down
#define REMOTE_UNIT_ROTATION_TIMEOUT 5000 // timeout any remote unit rotation operation if a ping (PG) is not receive within 5 seconds
#define MASTER_REMOTE_LINK_PING_TIME_MS 5000

#define TIMED_INTERVAL_ARRAY_SIZE 20

Expand Down Expand Up @@ -181,9 +181,9 @@ You can tweak these, but read the online documentation!
#define COMMAND_BUFFER_SIZE 50

#define REMOTE_BUFFER_TIMEOUT_MS 250
#define REMOTE_UNIT_COMMAND_TIMEOUT_MS 2000
#define AZ_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for azimuth
#define EL_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for elevation
// #define REMOTE_UNIT_COMMAND_TIMEOUT_MS 2000
// #define AZ_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for azimuth
// #define EL_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for elevation

#define AZIMUTH_SMOOTHING_FACTOR 0 // value = 0 to 99.9
#define ELEVATION_SMOOTHING_FACTOR 0 // value = 0 to 99.9
Expand Down Expand Up @@ -354,7 +354,7 @@ You can tweak these, but read the online documentation!
#define CONTROL_PORT_MAPPED_TO &Serial // change this line to map the control port to a different serial port (Serial1, Serial2, etc.)
#define CONTROL_PORT_BAUD_RATE 115200
#define REMOTE_PORT Serial3 // used to control remote unit
#define REMOTE_UNIT_PORT_BAUD_RATE 9600
#define REMOTE_UNIT_PORT_BAUD_RATE 57600
#define GPS_PORT Serial2
#define GPS_PORT_BAUD_RATE 9600
// #define GPS_MIRROR_PORT Serial1 // use this to mirror output from a GPS unit into the Arduino out another port (uncomment to enable)
Expand Down
20 changes: 10 additions & 10 deletions k3ng_rotator_controller/rotator_settings_wb6kcn_k3ng.h
Expand Up @@ -111,7 +111,7 @@ You can tweak these, but read the online documentation!
#define ELEVATION_TOLERANCE 0.01 //1.0

#define OPERATION_TIMEOUT 120000 // timeout for any rotation operation in mS ; 120 seconds is usually enough unless you have the speed turned down
#define REMOTE_UNIT_ROTATION_TIMEOUT 5000 // timeout any remote unit rotation operation if a ping (PG) is not receive within 5 seconds
#define MASTER_REMOTE_LINK_PING_TIME_MS 5000

#define REMOTE_UNIT_ROTATION_COMMAND_REPEAT_MS 500 // used by the master unit; this need to be less than OPERATION_TIMEOUT on the remote unit

Expand Down Expand Up @@ -173,9 +173,9 @@ You can tweak these, but read the online documentation!
#define COMMAND_BUFFER_SIZE 50

#define REMOTE_BUFFER_TIMEOUT_MS 250
#define REMOTE_UNIT_COMMAND_TIMEOUT_MS 2000
#define AZ_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for azimuth
#define EL_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for elevation
// #define REMOTE_UNIT_COMMAND_TIMEOUT_MS 2000
// #define AZ_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for azimuth
// #define EL_REMOTE_UNIT_QUERY_TIME_MS 150 // how often we query the remote remote for elevation

#define AZIMUTH_SMOOTHING_FACTOR 0 // value = 0 to 99.9
#define ELEVATION_SMOOTHING_FACTOR 0 // value = 0 to 99.9
Expand All @@ -197,10 +197,10 @@ You can tweak these, but read the online documentation!

#define SERIAL_LED_TIME_MS 250

// #define DEFAULT_LATITUDE 1.0
// #define DEFAULT_LONGITUDE -2.0
#define DEFAULT_LATITUDE 40.889958
#define DEFAULT_LONGITUDE -75.585972
#define DEFAULT_LATITUDE 1.0
#define DEFAULT_LONGITUDE -2.0
// #define DEFAULT_LATITUDE 40.889958
// #define DEFAULT_LONGITUDE -75.585972

#define MOON_TRACKING_CHECK_INTERVAL 5000 // This is only written to the configuration upon first boot of the code or when EEPROM_MAGIC_NUMBER is changed in rotator.h
#define MOON_AOS_AZIMUTH_MIN 0
Expand Down Expand Up @@ -348,8 +348,8 @@ You can tweak these, but read the online documentation!

// Changed in 2020.06.26.02
// Serial Port Settings
#define CONTROL_PORT_MAPPED_TO &Serial3 // change this line to map the control port to a different serial port (Serial1, Serial2, etc.)
#define CONTROL_PORT_BAUD_RATE 9600 //115200
#define CONTROL_PORT_MAPPED_TO &Serial // change this line to map the control port to a different serial port (Serial1, Serial2, etc.)
#define CONTROL_PORT_BAUD_RATE 115200 //57600
#define REMOTE_PORT Serial3 // used to control remote unit
#define REMOTE_UNIT_PORT_BAUD_RATE 9600
#define GPS_PORT Serial2
Expand Down
77 changes: 77 additions & 0 deletions libraries/P13/P13.cpp
Expand Up @@ -24,6 +24,44 @@
// So, here it is!
//

/*
Copyright 2011, Mark VandeWettering. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY MARK VANDEWETTERING ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation
are those of the authors and should not be interpreted as representing
official policies, either expressed or implied, of Mark VandeWettering
*/

// Modification by Anthony Good, K3NG 2020-07-24: Changed DateTime to SatDateTime to avoid a conflict with an RTC library I'm using

// Modification by Anthony Good, K3NG 2022-02-20: Added Observer.update_location function

#include "P13.h"

double
Expand Down Expand Up @@ -184,6 +222,45 @@ Observer::Observer(const char *nm, double lat, double lng, double hgt)
V[2] = 0 ;
}

// START - 2022-02-20 Added by Goody K3NG
void
Observer::update_location(const char *nm, double lat, double lng, double hgt)
{
this->name = nm ;
LA = RADIANS(lat) ;
LO = RADIANS(lng) ;
HT = hgt / 1000 ;

U[0] = cos(LA)*cos(LO) ;
U[1] = cos(LA)*sin(LO) ;
U[2] = sin(LA) ;

E[0] = -sin(LO) ;
E[1] = cos(LO) ;
E[2] = 0. ;

N[0] = -sin(LA)*cos(LO) ;
N[1] = -sin(LA)*sin(LO) ;
N[2] = cos(LA) ;

double RP = RE * (1 - FL) ;
double XX = RE * RE ;
double ZZ = RP * RP ;
double D = sqrt(XX*cos(LA)*cos(LA) +
ZZ*sin(LA)*sin(LA)) ;
double Rx = XX / D + HT ;
double Rz = ZZ / D + HT ;

O[0] = Rx * U[0] ;
O[1] = Rx * U[1] ;
O[2] = Rz * U[2] ;

V[0] = -O[1] * W0 ;
V[1] = O[0] * W0 ;
V[2] = 0 ;
}
// END - 2022-02-20 Added by Goody K3NG

//----------------------------------------------------------------------
// _ ___ _ _ _ _ _
// __| |__ _ ______ / __| __ _| |_ ___| | (_) |_ ___
Expand Down
12 changes: 9 additions & 3 deletions libraries/P13/P13.h
Expand Up @@ -58,7 +58,9 @@ official policies, either expressed or implied, of Mark VandeWettering
*/

// Modification by Anthony Good, K3NG 2020-07-24: Change DateTime to SatDateTime to avoid a conflict with an RTC library I'm using
// Modification by Anthony Good, K3NG 2020-07-24: Changed DateTime to SatDateTime to avoid a conflict with an RTC library I'm using

// Modification by Anthony Good, K3NG 2022-02-20: Added Observer.update_location function

//----------------------------------------------------------------------

Expand Down Expand Up @@ -139,6 +141,8 @@ class Observer {

Observer(const char *, double, double, double) ;
~Observer() { } ;

void update_location(const char *nm, double lat, double lng, double hgt); // 2022-02-20 Added by Goody K3NG
} ;

//----------------------------------------------------------------------
Expand All @@ -147,7 +151,7 @@ class Observer {
class Satellite {
long N ;
long YE ;
long DE ;
long DE ;
double TE ;
double IN ;
double RA ;
Expand All @@ -171,7 +175,9 @@ class Satellite {
double RS ;

public:
const char *name ;

const char *name ;

Vec3 SAT, VEL ; // celestial coordinates
Vec3 S, V ; // geocentric coordinates

Expand Down

0 comments on commit 51bf768

Please sign in to comment.