Check code for Mega/E32
Po Szerokość: | Wysokość: | Rozmiar: 4.3 MiB |
Po Szerokość: | Wysokość: | Rozmiar: 25 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 37 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 356 KiB |
Po Szerokość: | Wysokość: | Rozmiar: 74 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 254 KiB Po Szerokość: | Wysokość: | Rozmiar: 254 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 148 KiB Po Szerokość: | Wysokość: | Rozmiar: 148 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 280 KiB Po Szerokość: | Wysokość: | Rozmiar: 356 KiB |
|
@ -232,10 +232,35 @@ vm.runtime.compiler.allow_library_debugging=false
|
|||
serial.port.file=COM11
|
||||
serial.port=COM11
|
||||
serial.port.num=11
|
||||
extra.time.local=1551271724
|
||||
extra.time.utc=1551235724
|
||||
extra.time.local=1552836570
|
||||
extra.time.utc=1552800570
|
||||
extra.time.dst=36000
|
||||
extra.time.zone=-36000
|
||||
serial.port.caption=COM11 - Silicon Labs CP210x USB to UART Bridge
|
||||
serial.Caption=Silicon Labs CP210x USB to UART Bridge (COM11)
|
||||
serial.ClassGuid={4d36e978-e325-11ce-bfc1-08002be10318}
|
||||
serial.CompatibleID.value0=USB\Class_FF
|
||||
serial.ConfigManagerErrorCode=0
|
||||
serial.ConfigManagerUserConfig=False
|
||||
serial.CreationClassName=Win32_PnPEntity
|
||||
serial.Description=Silicon Labs CP210x USB to UART Bridge
|
||||
serial.DeviceID=USB\VID_10C4&PID_EA60\0001
|
||||
serial.HardwareID.value0=USB\VID_10C4&PID_EA60
|
||||
serial.Manufacturer=Silicon Labs
|
||||
serial.Name=Silicon Labs CP210x USB to UART Bridge (COM11)
|
||||
serial.PNPClass=Ports
|
||||
serial.PNPDeviceID=USB\VID_10C4&PID_EA60\0001
|
||||
serial.Present=True
|
||||
serial.Service=silabser
|
||||
serial.Status=OK
|
||||
serial.SystemCreationClassName=Win32_ComputerSystem
|
||||
serial.SystemName=JOHNWIN10PRO
|
||||
serial.vid=0x10C4
|
||||
serial.pid=0xEA60
|
||||
serial.vidpid=10C4EA60
|
||||
serial.vid_pid=0x10C4_0xEA60
|
||||
serial.iserial=0001
|
||||
serial.port.iserial=0001
|
||||
build.project_name=EQG2HBXE32.ino
|
||||
build.project_path=C:\Users\John\Documents\GitHub\EQMOD-ETX\Software\EQG2HBX-ESP32
|
||||
sketch_path=C:\Users\John\Documents\GitHub\EQMOD-ETX\Software\EQG2HBX-ESP32
|
||||
|
@ -251,97 +276,97 @@ vm.build.verbose_build_properties=false
|
|||
vm.build.export_binary=false
|
||||
build.source.path=C:\Users\John\Documents\GitHub\EQMOD-ETX\Software\EQG2HBX-ESP32\EQG2HBXE32.ino
|
||||
PreProcessor.HeaderCount=1
|
||||
PreProcessor.PrototypeCount=76
|
||||
PreProcessor.PrototypeCount=79
|
||||
vm.last.preproc.file.0.file=EQG2HBXE32.ino
|
||||
vm.last.preproc.file.0.offset=1
|
||||
vm.last.preproc.file.0.length=8952
|
||||
vm.last.preproc.file.0.linecount=278
|
||||
vm.last.preproc.file.0.length=8964
|
||||
vm.last.preproc.file.0.linecount=280
|
||||
vm.last.preproc.file.0.linestart=0
|
||||
vm.last.preproc.file.0.lineend=278
|
||||
vm.last.preproc.file.0.lineend=280
|
||||
vm.last.preproc.file.0.prefix_lines=0
|
||||
vm.last.preproc.file.1.file=EQG2HBX.h
|
||||
vm.last.preproc.file.1.offset=0
|
||||
vm.last.preproc.file.1.length=8888
|
||||
vm.last.preproc.file.1.linecount=192
|
||||
vm.last.preproc.file.1.linestart=278
|
||||
vm.last.preproc.file.1.lineend=470
|
||||
vm.last.preproc.file.1.length=9129
|
||||
vm.last.preproc.file.1.linecount=203
|
||||
vm.last.preproc.file.1.linestart=280
|
||||
vm.last.preproc.file.1.lineend=483
|
||||
vm.last.preproc.file.1.prefix_lines=0
|
||||
vm.last.preproc.file.2.file=EQGProtocol.h
|
||||
vm.last.preproc.file.2.offset=0
|
||||
vm.last.preproc.file.2.length=9819
|
||||
vm.last.preproc.file.2.length=9817
|
||||
vm.last.preproc.file.2.linecount=288
|
||||
vm.last.preproc.file.2.linestart=470
|
||||
vm.last.preproc.file.2.lineend=758
|
||||
vm.last.preproc.file.2.linestart=483
|
||||
vm.last.preproc.file.2.lineend=771
|
||||
vm.last.preproc.file.2.prefix_lines=0
|
||||
vm.last.preproc.file.3.file=EQGProtocol.ino
|
||||
vm.last.preproc.file.3.offset=279
|
||||
vm.last.preproc.file.3.length=39743
|
||||
vm.last.preproc.file.3.linecount=969
|
||||
vm.last.preproc.file.3.linestart=758
|
||||
vm.last.preproc.file.3.lineend=1727
|
||||
vm.last.preproc.file.3.offset=281
|
||||
vm.last.preproc.file.3.length=40883
|
||||
vm.last.preproc.file.3.linecount=990
|
||||
vm.last.preproc.file.3.linestart=771
|
||||
vm.last.preproc.file.3.lineend=1761
|
||||
vm.last.preproc.file.3.prefix_lines=0
|
||||
vm.last.preproc.file.4.file=ETXProtocol.h
|
||||
vm.last.preproc.file.4.offset=0
|
||||
vm.last.preproc.file.4.length=3259
|
||||
vm.last.preproc.file.4.linecount=83
|
||||
vm.last.preproc.file.4.linestart=1727
|
||||
vm.last.preproc.file.4.lineend=1810
|
||||
vm.last.preproc.file.4.length=3473
|
||||
vm.last.preproc.file.4.linecount=91
|
||||
vm.last.preproc.file.4.linestart=1761
|
||||
vm.last.preproc.file.4.lineend=1852
|
||||
vm.last.preproc.file.4.prefix_lines=0
|
||||
vm.last.preproc.file.5.file=ETXProtocol.ino
|
||||
vm.last.preproc.file.5.offset=1248
|
||||
vm.last.preproc.file.5.length=32301
|
||||
vm.last.preproc.file.5.linecount=723
|
||||
vm.last.preproc.file.5.linestart=1810
|
||||
vm.last.preproc.file.5.lineend=2533
|
||||
vm.last.preproc.file.5.offset=1271
|
||||
vm.last.preproc.file.5.length=37121
|
||||
vm.last.preproc.file.5.linecount=840
|
||||
vm.last.preproc.file.5.linestart=1852
|
||||
vm.last.preproc.file.5.lineend=2692
|
||||
vm.last.preproc.file.5.prefix_lines=0
|
||||
vm.last.preproc.file.6.file=HBXComms.h
|
||||
vm.last.preproc.file.6.offset=0
|
||||
vm.last.preproc.file.6.length=1597
|
||||
vm.last.preproc.file.6.linecount=52
|
||||
vm.last.preproc.file.6.linestart=2533
|
||||
vm.last.preproc.file.6.lineend=2585
|
||||
vm.last.preproc.file.6.linestart=2692
|
||||
vm.last.preproc.file.6.lineend=2744
|
||||
vm.last.preproc.file.6.prefix_lines=0
|
||||
vm.last.preproc.file.7.file=HBXComms.ino
|
||||
vm.last.preproc.file.7.offset=1971
|
||||
vm.last.preproc.file.7.offset=2111
|
||||
vm.last.preproc.file.7.length=9104
|
||||
vm.last.preproc.file.7.linecount=335
|
||||
vm.last.preproc.file.7.linestart=2585
|
||||
vm.last.preproc.file.7.lineend=2920
|
||||
vm.last.preproc.file.7.linestart=2744
|
||||
vm.last.preproc.file.7.lineend=3079
|
||||
vm.last.preproc.file.7.prefix_lines=0
|
||||
vm.last.preproc.file.8.file=HBXFileSystem.h
|
||||
vm.last.preproc.file.8.offset=0
|
||||
vm.last.preproc.file.8.length=262
|
||||
vm.last.preproc.file.8.linecount=13
|
||||
vm.last.preproc.file.8.linestart=2920
|
||||
vm.last.preproc.file.8.lineend=2933
|
||||
vm.last.preproc.file.8.linestart=3079
|
||||
vm.last.preproc.file.8.lineend=3092
|
||||
vm.last.preproc.file.8.prefix_lines=0
|
||||
vm.last.preproc.file.9.file=HBXFileSystem.ino
|
||||
vm.last.preproc.file.9.offset=2306
|
||||
vm.last.preproc.file.9.offset=2446
|
||||
vm.last.preproc.file.9.length=2332
|
||||
vm.last.preproc.file.9.linecount=101
|
||||
vm.last.preproc.file.9.linestart=2933
|
||||
vm.last.preproc.file.9.lineend=3034
|
||||
vm.last.preproc.file.9.linestart=3092
|
||||
vm.last.preproc.file.9.lineend=3193
|
||||
vm.last.preproc.file.9.prefix_lines=0
|
||||
vm.last.preproc.file.10.file=HBXWiFiServer.h
|
||||
vm.last.preproc.file.10.offset=0
|
||||
vm.last.preproc.file.10.length=3074
|
||||
vm.last.preproc.file.10.linecount=117
|
||||
vm.last.preproc.file.10.linestart=3034
|
||||
vm.last.preproc.file.10.lineend=3151
|
||||
vm.last.preproc.file.10.linestart=3193
|
||||
vm.last.preproc.file.10.lineend=3310
|
||||
vm.last.preproc.file.10.prefix_lines=0
|
||||
vm.last.preproc.file.11.file=HBXWiFiServer.ino
|
||||
vm.last.preproc.file.11.offset=2407
|
||||
vm.last.preproc.file.11.length=16146
|
||||
vm.last.preproc.file.11.offset=2547
|
||||
vm.last.preproc.file.11.length=16150
|
||||
vm.last.preproc.file.11.linecount=488
|
||||
vm.last.preproc.file.11.linestart=3151
|
||||
vm.last.preproc.file.11.lineend=3639
|
||||
vm.last.preproc.file.11.linestart=3310
|
||||
vm.last.preproc.file.11.lineend=3798
|
||||
vm.last.preproc.file.11.prefix_lines=0
|
||||
vm.last.preproc.file.12.file=Hardware.h
|
||||
vm.last.preproc.file.12.offset=0
|
||||
vm.last.preproc.file.12.length=1406
|
||||
vm.last.preproc.file.12.linecount=49
|
||||
vm.last.preproc.file.12.linestart=3639
|
||||
vm.last.preproc.file.12.lineend=3688
|
||||
vm.last.preproc.file.12.linestart=3798
|
||||
vm.last.preproc.file.12.lineend=3847
|
||||
vm.last.preproc.file.12.prefix_lines=0
|
||||
vm.sketch_source_path=C:\Users\Anne\AppData\Local\Temp\VMBuilds\EQG2HBXE32\espressif_esp32doit-devkit-v1\Release
|
||||
vm.build_use_temp=1
|
||||
|
|
|
@ -96,6 +96,7 @@ typedef struct {
|
|||
|
||||
unsigned char HBXBitCount; // #bits left to process
|
||||
unsigned char Command; // Current command
|
||||
unsigned char Flip; // Axis flipped - Alt for negative, Az probably never
|
||||
unsigned char HBXData; // Data byte from HBX Bus
|
||||
unsigned char HBXP1; // HBX status/data - MSB
|
||||
unsigned char HBXP2; // HBX status/data - LSB
|
||||
|
@ -108,11 +109,12 @@ typedef struct {
|
|||
char HBXSnapPort; // Snap port
|
||||
char LEDValue; // Polar LED brightness
|
||||
char ETXSpeedCommand; // Current ETX Speed command
|
||||
long Speed; // Move speed
|
||||
long EQGSpeed; // Move speed
|
||||
long ETXSpeed; // Move speed
|
||||
long TargetSpeed; // Target Move speed
|
||||
char SpeedState; // Slowdown/speedup state
|
||||
long Position; // Current position
|
||||
long Target; // Current target delta
|
||||
long Target; // Current target
|
||||
long Increment; // Change in position for motor speed calcs
|
||||
long SlowDown; // Point to change to lower speed
|
||||
long Offset; // Current adjustment
|
||||
|
@ -134,11 +136,13 @@ typedef struct {
|
|||
// SOLARRATE = (SOLARSECS/SIDEREALSECS) * SIDEREALRATE
|
||||
// LUNARRATE = (SOLARSECS/SIDEREALSECS) * SIDEREALRATE
|
||||
// DEGREERATE1 = 240 * SIDEREALRATE
|
||||
// BASERATE = (b * arcsec360) / a
|
||||
|
||||
unsigned long SIDEREALRATE; // Constants
|
||||
unsigned long SOLARRATE;
|
||||
unsigned long LUNARRATE;
|
||||
unsigned long DEGREERATE1;
|
||||
unsigned long BASERATE;
|
||||
unsigned long DEGREERATE1;
|
||||
|
||||
// PEC = a-VALUE / WormTeeth;
|
||||
unsigned long PEC; // PEC period (period of worm tooth)
|
||||
|
@ -163,6 +167,13 @@ unsigned char protocol = 0; // Default protocol (UDP)
|
|||
unsigned char station = 0; // Default station (AP)
|
||||
char scope[16] = "ETX60";
|
||||
|
||||
char * axis_name[3] =
|
||||
{
|
||||
"Bad",
|
||||
"Az ",
|
||||
"Alt"
|
||||
};
|
||||
|
||||
axis_values ratio[16][2] = // 16 scopes, Az, Alt
|
||||
{
|
||||
{{36, 91.1458333, 1, 94, "ETX60"}, {36, 157.5, 1, 58, "ETX60"}}, // ETX60/70/80
|
||||
|
|
|
@ -131,13 +131,12 @@ void setup()
|
|||
protocol = (preferences.getUChar("STATION", 0));
|
||||
}
|
||||
dbgSerial.print("Station: ");
|
||||
dbgSerial.print(station);
|
||||
dbgSerial.print(", ");
|
||||
dbgSerial.println(station);
|
||||
preferences.end();
|
||||
|
||||
AzInitialise(telescope);
|
||||
AltInitialise(telescope);
|
||||
PrintRatioValues(telescope);
|
||||
//PrintRatioValues(telescope);
|
||||
PrintHbxValues(AzMotor);
|
||||
PrintHbxValues(AltMotor);
|
||||
|
||||
|
@ -239,6 +238,9 @@ void loop()
|
|||
if (StateSelect) CheckETXState(AzMotor);
|
||||
else CheckETXState(AltMotor);
|
||||
}
|
||||
|
||||
//jma CheckAltFlipReqd();
|
||||
|
||||
if ((micros() - StatusTimer) > (STATUSDELAY * 1000)) { // ~50mS
|
||||
if (StatusSelect) StatusSelect = false;
|
||||
else StatusSelect = true;
|
||||
|
|
|
@ -211,7 +211,7 @@ enum SkywatcherSetFeatureCmd
|
|||
#define AAZEQ6 0x00B008 // WiFi, !:J3, PolarLED ; AZ/EQ
|
||||
|
||||
// Motor firmware versions
|
||||
#define VEQ6 0x000204 // Pretend EQ6 V 2.04 yyyy.mm.dd
|
||||
#define VEQ6 0x000402 // Pretend EQ6 V 2.04 yyyy.mm.dd
|
||||
#define VHEQ5 0x010204 // Pretend HEQ5 V 2.04 yyyy.mm.dd
|
||||
#define VEQ5 0x020207 // Pretend EQ5 V 2.07 yyyy.mm.dd
|
||||
#define VEQ3 0x030207 // Pretend EQ3 V 2.07 yyyy.mm.dd
|
||||
|
@ -223,19 +223,19 @@ enum SkywatcherSetFeatureCmd
|
|||
#define EQGASSETS AEQ6
|
||||
|
||||
|
||||
// :I := ( :b * 1296000 / :a ) / Speed ( where Speed is in arcsec/sec )
|
||||
// :I := ( :b * (360*60*60) / :a ) / Speed ( where Speed is in arcsec/sec )
|
||||
// If :I is greater than about 10, then the slew will need to use :G = LoSpeed mode
|
||||
// If :I is less than 10, then the slew will need :G = HiRate, and :I := I * :g
|
||||
// a-AxxValue (Ticks/rev) := AxxVanes * 4 * AxxGbxRatio * ( Axx Transfer ) * AxxWormTeeth
|
||||
// b-AxxValue := 6460.09 * AxxRatio * a-AxxValue * 15.041069 / 1,296,000
|
||||
// b-AxxValue := 6460.09 * AxxRatio * a-AxxValue * 15.041069 / (360*60*60)
|
||||
|
||||
// Speed = g*(b*129600/a)/I
|
||||
// Speed = g*(b*(360*60*60)/a)/I
|
||||
// ==============================
|
||||
// IVALUE = (axis[EQGMOTOR].bVALUE * 1296000) / axis[EQGMOTOR].STEPSPER360)
|
||||
// IVALUE = (axis[EQGMOTOR].bVALUE * (360*60*60)) / axis[EQGMOTOR].STEPSPER360)
|
||||
|
||||
#define EQG_gVALUE 0x000010
|
||||
|
||||
#define EQGMAXIMUMSPEED 12 // 0x0C
|
||||
#define EQGMAXIMUMSPEED 12
|
||||
|
||||
// EQG 'G' Command - SET move parameters
|
||||
#define DIRECTION 0x00000001 // Increasing(0) Decreasing(1)
|
||||
|
|
|
@ -228,9 +228,9 @@ In HiSpeed mode, you must issue a stop, resend :G, reset :I then restart.
|
|||
// ===============================
|
||||
void EQGState(void) {
|
||||
while ((EQGRxiPtr != EQGRxoPtr) && (EQGDone == 0)) {
|
||||
if (dbgFlag == 1) {
|
||||
// if (EQGRxBuffer[EQGRxoPtr] == 'j')
|
||||
// dbgFlag = 0;
|
||||
/* if (dbgFlag == 1) {
|
||||
if (EQGRxBuffer[EQGRxoPtr] == 'j')
|
||||
dbgFlag = 0;
|
||||
}
|
||||
if (EQGRxBuffer[EQGRxoPtr] == ':') {
|
||||
dbgSerial.println("");
|
||||
|
@ -240,7 +240,7 @@ void EQGState(void) {
|
|||
if (dbgFlag) {
|
||||
dbgSerial.write(EQGRxBuffer[EQGRxoPtr]);
|
||||
}
|
||||
|
||||
*/
|
||||
EQGRxChar = EQGRxBuffer[EQGRxoPtr++]; // Get a character
|
||||
if ((EQGRxState < EQG_WAITFORCR) && (EQGRxChar < ' ')) {
|
||||
EQGRxState = EQG_INTERPRET; // Terminate on non-alpha
|
||||
|
@ -497,12 +497,12 @@ void EQGState(void) {
|
|||
}
|
||||
|
||||
void EQGError(unsigned char errorbyte) {
|
||||
EQGTx('!') ; // Failure - Bad Parameters
|
||||
EQGTx('!') ; // Failure - Bad Parameters
|
||||
EQGTx(errorbyte);
|
||||
EQGTx(CR);
|
||||
EQGDone = 0; // Process errors
|
||||
EQGDone = 0; // Process errors
|
||||
EQGRxState = EQG_CMNDSTART;
|
||||
EQGRxCount = 0; // Count for # parameters
|
||||
EQGRxCount = 0; // Count for # parameters
|
||||
EQGErrorValue = 0;
|
||||
}
|
||||
|
||||
|
@ -562,12 +562,12 @@ void EQGAction(void) {
|
|||
EQGTxHex6(axis[EQGMOTOR].Position);
|
||||
break;
|
||||
|
||||
case 'm': // GET Point at which to change from fast to slow
|
||||
case 'm': // GET Point at which to change from fast to slow
|
||||
EQGTxHex6(axis[EQGMOTOR].SlowDown);
|
||||
break;
|
||||
|
||||
case 'q': // GET mount capabilities
|
||||
EQGTxHex6(EQGASSETS); // Say EQ and AZ
|
||||
case 'q': // GET mount capabilities
|
||||
EQGTxHex6(EQGASSETS); // Say EQ and AZ
|
||||
break;
|
||||
|
||||
case 's': // PEC period
|
||||
|
@ -575,50 +575,56 @@ void EQGAction(void) {
|
|||
break;
|
||||
|
||||
case 'E': // Set current motor position
|
||||
axis[EQGMOTOR].Position = EQGP1;
|
||||
break;
|
||||
if ((EQGP1 == 0x800000) || (EQGP1 == 0x85049c))
|
||||
break;
|
||||
else axis[EQGMOTOR].Position = EQGP1;
|
||||
break;
|
||||
|
||||
case 'F': // Initialize and activate motors
|
||||
axis[EQGMOTOR].EQGMotorStatus |= MOVEACTIVE;
|
||||
axis[EQGMOTOR].ETXMotorStatus |= MOVEACTIVE;
|
||||
break;
|
||||
|
||||
case 'G': // EQG 'G' Command :GxAB[0D]
|
||||
case 'G': // EQG 'G' Command :GxAB[0D]
|
||||
|
||||
// See below for A
|
||||
// See below for A
|
||||
// ===============
|
||||
// B nibble
|
||||
// B = '0' +CW and Nthn Hemi
|
||||
// '1' -CCW and Nthn Hemi
|
||||
// '2' +CW and Sthn Hemi
|
||||
// '3' -CCW and Sthn Hemi
|
||||
// xxx0 0 means +ve, 1 = -ve "motor" direction, ie code takes care of whats N/S/E/W etc
|
||||
// +ve speed in RA is Axis moves CW when viewed from pole
|
||||
// +ve speed in DEC is Axis moves CCW when viewed from above
|
||||
// xx0x 0 means Nthn Hemi else Sthn Hemi ( ST4 guiding related ) ?????
|
||||
// Note! when using :S type gotos, the direction bit here "appears" to be ignored
|
||||
// Also note that EQMOD does not appear to send the Hemisphere bit
|
||||
//
|
||||
// xxx0 CW(0) CCW(1) DIRECTION
|
||||
// xx0x North(0) South(1) HEMISPHERE
|
||||
// --------
|
||||
// B = '0' +CW and Nthn Hemi
|
||||
// '1' -CCW and Nthn Hemi
|
||||
// '2' +CW and Sthn Hemi
|
||||
// '3' -CCW and Sthn Hemi
|
||||
// xxx0 0 means +ve, 1 = -ve "motor" direction, ie code takes care of whats N/S/E/W etc
|
||||
// +ve speed in RA is Axis moves CW when viewed from pole
|
||||
// +ve speed in DEC is Axis moves CCW when viewed from above (OTA horizontal, facing E->W ?)
|
||||
// xx0x 0 means Nthn Hemi else Sthn Hemi ( ST4 guiding related ) ?????
|
||||
// Note! when using :S type gotos, the direction bit here "appears" to be ignored
|
||||
// Also note that EQMOD does not appear to send the Hemisphere bit
|
||||
//
|
||||
// xxx0 CW(0) CCW(1) DIRECTION
|
||||
// xx0x North(0) South(1) HEMISPHERE
|
||||
|
||||
axis[EQGMOTOR].DirnSpeed = (int)EQGP1; // Save the command value
|
||||
switch (axis[EQGMOTOR].DirnSpeed & 0x03) {
|
||||
case 0x00:
|
||||
case 0x02:
|
||||
axis[EQGMOTOR].EQGMotorStatus &= ~MOVEDECR;
|
||||
// dbgSerial.print(" +CW ");
|
||||
dbgSerial.print(" +CW ");
|
||||
break;
|
||||
case 0x01:
|
||||
case 0x03:
|
||||
axis[EQGMOTOR].EQGMotorStatus |= MOVEDECR;
|
||||
// dbgSerial.print(" -CCW ");
|
||||
dbgSerial.print(" -CCW ");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// When setting "Slew" data, it also requires a set procedure
|
||||
// G sets direction and speed "range", and must be sent when stopped.
|
||||
// A nibble
|
||||
// A = '0' high speed GOTO slewing, doesnt make "bitmapped" sense, but it is as coded by SkyWatcher????? ?????
|
||||
// A = '0' high speed GOTO slewing, doesnt make "bitmapped" sense, but it is as coded by SkyWatcher
|
||||
// '1' low speed slewing mode, all other bytes use bitmapping ( incl :f ), this doesnt
|
||||
// '2' low speed GOTO mode,
|
||||
// '3' high speed slewing mode
|
||||
|
@ -631,27 +637,27 @@ void EQGAction(void) {
|
|||
case 00: // 0 HIGH SPEED GOTO
|
||||
axis[EQGMOTOR].EQGMotorStatus &= ~MOVESLEW; // GoTo target
|
||||
axis[EQGMOTOR].EQGMotorStatus |= MOVEHIGH; // Enable high speed multiplier
|
||||
// dbgSerial.print("HIGH SPEED GOTO");
|
||||
dbgSerial.print("HIGH SPEED GOTO ");
|
||||
break;
|
||||
case 01: // 1 LOW SPEED SLEW
|
||||
axis[EQGMOTOR].EQGMotorStatus |= MOVESLEW; // Just move the axis
|
||||
axis[EQGMOTOR].EQGMotorStatus &= ~MOVEHIGH; // Disable high speed multiplier
|
||||
// dbgSerial.print("LOW SPEED SLEW");
|
||||
dbgSerial.print("LOW SPEED SLEW ");
|
||||
break;
|
||||
case 02: // 2 LOW SPEED GOTO
|
||||
axis[EQGMOTOR].EQGMotorStatus &= ~MOVESLEW; // GoTo target
|
||||
axis[EQGMOTOR].EQGMotorStatus &= ~MOVEHIGH; // Disable high speed multiplier
|
||||
// dbgSerial.print("LOW SPEED GOTO");
|
||||
dbgSerial.print("LOW SPEED GOTO ");
|
||||
break;
|
||||
case 03: // 3 HIGH SPEED SLEW
|
||||
axis[EQGMOTOR].EQGMotorStatus |= MOVESLEW; // Just move the axis
|
||||
axis[EQGMOTOR].EQGMotorStatus |= MOVEHIGH; // Enable high speed multiplier
|
||||
// dbgSerial.print("HIGH SPEED SLEW");
|
||||
dbgSerial.print("HIGH SPEED SLEW ");
|
||||
break;
|
||||
}
|
||||
dbgSerial.print(axis[EQGMOTOR].TargetSpeed);
|
||||
|
||||
axis[EQGMOTOR].ETXMotorStatus = axis[EQGMOTOR].EQGMotorStatus; // Copy the status for ETXProtocol
|
||||
|
||||
break;
|
||||
|
||||
case 'H': // Set the goto target increment
|
||||
|
@ -661,10 +667,22 @@ void EQGAction(void) {
|
|||
else
|
||||
axis[EQGMOTOR].Target = axis[EQGMOTOR].Position + axis[EQGMOTOR].Increment; // add the relative target
|
||||
axis[EQGMOTOR].MotorControl |= GoToHBX;
|
||||
|
||||
break;
|
||||
|
||||
case 'I': // Set motor speed
|
||||
/*
|
||||
:I is used to set the speed.
|
||||
The value used is basically the number of timer interrupts per microstep
|
||||
------------------------------------------------------------------------
|
||||
:I = (:b * ArcSecs360 / :a) / Speed (where Speed is in arcsec/sec, ArcSecs360=360*60*60=129600)
|
||||
Speed = :g * (:b * ArcSecs360 / :a) / I
|
||||
=======================================
|
||||
If :I is greater than about 10, then the slew will need to use :G = LoSpeed mode
|
||||
If :I is less than 10, then the slew will need :G = HiRate, and :I = :I * :g
|
||||
In LoSpeed mode, once moving, simply resending a new :I will cause the speed to change.
|
||||
In HiSpeed mode, you must issue a stop, resend :G, reset :I then restart.
|
||||
:b = :I * Speed / g * :a / ArcSecs360
|
||||
*/
|
||||
|
||||
// From EQMOD
|
||||
// Multiplier = EQGSidereal / :I
|
||||
|
@ -675,14 +693,16 @@ void EQGAction(void) {
|
|||
// SpeedHi = ETXSidereal * MultiplierHi
|
||||
|
||||
// Calculation
|
||||
// Speed = SiderealRate * (:ISidereal / )
|
||||
// Speed = SiderealRate * (Sidereal / :I)
|
||||
// SpeedHi = SiderealRate * ((Sidereal*g) / :I)
|
||||
|
||||
axis[EQGMOTOR].TargetSpeed = EQGP1; // Set the target speed
|
||||
break;
|
||||
|
||||
axis[EQGMOTOR].EQGSpeed = EQGP1; // Set EQG speed value
|
||||
axis[EQGMOTOR].TargetSpeed = EQGP1; // Set ETX target speed
|
||||
break;
|
||||
|
||||
case 'J': // Tell motor to Go
|
||||
axis[EQGMOTOR].ETXMotorStatus |= MOVEAXIS; // Signal moving
|
||||
axis[EQGMOTOR].ETXMotorStatus |= MOVEAXIS; // Signal moving
|
||||
axis[EQGMOTOR].ETXMotorState = ETXCheckStartup; // General entry
|
||||
|
||||
break;
|
||||
|
@ -696,7 +716,8 @@ void EQGAction(void) {
|
|||
|
||||
case 'L': // Tell motor to stop immediately
|
||||
axis[EQGMOTOR].EQGMotorStatus |= MOVESLEW; // Clear speed change
|
||||
axis[EQGMOTOR].TargetSpeed = 0;
|
||||
axis[EQGMOTOR].ETXMotorStatus |= MOVESLEW; // Set slew as default
|
||||
axis[EQGMOTOR].TargetSpeed = 0;
|
||||
axis[EQGMOTOR].ETXMotorState = ETXStopMotor; // Immediate stop
|
||||
break;
|
||||
|
||||
|
@ -833,7 +854,7 @@ void debugEQG() {
|
|||
dbgSerial.print(" Tgt: ");
|
||||
dbgSerial.print(axis[AzMotor].Target, HEX);
|
||||
dbgSerial.print(" Speed: ");
|
||||
dbgSerial.print(axis[AzMotor].Speed, HEX);
|
||||
dbgSerial.print(axis[AzMotor].ETXSpeed, HEX);
|
||||
|
||||
dbgSerial.print(", Alt:<");
|
||||
dbgSerial.print(axis[AltMotor].EQGMotorStatus, HEX);
|
||||
|
@ -844,7 +865,7 @@ void debugEQG() {
|
|||
dbgSerial.print(" Tgt: ");
|
||||
dbgSerial.print(axis[AltMotor].Target, HEX);
|
||||
dbgSerial.print(" Speed: ");
|
||||
dbgSerial.print(axis[AltMotor].Speed, HEX);
|
||||
dbgSerial.print(axis[AltMotor].ETXSpeed, HEX);
|
||||
/*
|
||||
while (dbgRxoPtr != dbgRxiPtr) {
|
||||
dbgCommand[dbgIndex] = dbgRxBuffer[dbgRxoPtr]; // Copy character
|
||||
|
|
|
@ -49,13 +49,20 @@
|
|||
#define ETXCheckStop 7
|
||||
#define ETXStopMotor 8
|
||||
#define ETXMotorEnd 9
|
||||
// ETX axis State Machine
|
||||
#define NORMAL 0
|
||||
#define FLIP 1
|
||||
#define FLIPPED 2
|
||||
#define UNFLIP 3
|
||||
#define FLIPPING 4
|
||||
#define UNFLIPPING 5
|
||||
|
||||
const float ETX60PERIOD = 152.587891; // (1/6.5536mS)
|
||||
|
||||
const unsigned long ETX_CENTRE = 0x00800000; // RA, DEC;
|
||||
|
||||
const float MeadeSidereal = 6460.0900; // Refer Andrew Johansen - Roboscope
|
||||
const float SiderealArcSecs = 15.041069; // Sidereal arcsecs/sec
|
||||
const float SiderealArcSecs = 15.041069; // Sidereal arcsecs/sec (ArcSec360/Sidereal secs)
|
||||
const float ArcSecs360 = 1296000; // Arcsecs / 360
|
||||
|
||||
|
||||
|
@ -71,12 +78,13 @@ const float ArcSecs360 = 1296000; // Arcsecs / 360
|
|||
|
||||
#define ETXSLOWPOSN 0x00000800 // Point at which to start slowdown
|
||||
|
||||
bool HBXGetStatus(unsigned char);
|
||||
// bool HBXGetStatus(unsigned char);
|
||||
|
||||
/*
|
||||
bool HBXSetMotorState(unsigned char);
|
||||
bool HBXCheckTargetStatus(unsigned char);
|
||||
bool HBXUpdatePosn(void);
|
||||
bool HBXStartMotor(unsigned char);
|
||||
bool HBXStopMotor(unsigned char);
|
||||
void PositionPoll(unsigned char);
|
||||
|
||||
*/
|
||||
|
|
|
@ -17,67 +17,64 @@ bool ETXState(unsigned char Motor) {
|
|||
break;
|
||||
|
||||
case ETXCheckStartup:
|
||||
if (axis[Motor].ETXMotorStatus & MOVEAXIS) { // Start moving
|
||||
if (axis[Motor].ETXMotorStatus & MOVEAXIS) { // Start moving
|
||||
//jma CheckAltFlip(Motor);
|
||||
|
||||
//dbgSerial.println(""); dbgSerial.print("ETXCheckStartup - Motor: "); dbgSerial.print(Motor); dbgSerial.print(" MOVE");
|
||||
dbgSerial.println(""); dbgSerial.print("ETXCheckStartup - Motor: "); dbgSerial.print(axis_name[Motor]); dbgSerial.print(" MOVING");
|
||||
|
||||
distance = axis[Motor].Target - axis[Motor].Position; // Distance to target
|
||||
if (axis[Motor].ETXMotorStatus & MOVEDECR) // If it is decreasing
|
||||
distance = TwosComplement(distance);
|
||||
if (axis[Motor].ETXMotorStatus & MOVESLEW) {
|
||||
axis[Motor].ETXMotorState = ETXSlewMotor; // Move axis using high speed multiplier
|
||||
if (axis[Motor].ETXMotorStatus & MOVEHIGH) {
|
||||
dbgSerial.print(" HIGH SLEW");
|
||||
}
|
||||
else {
|
||||
axis[Motor].ETXMotorState = ETXCheckSpeed;
|
||||
dbgSerial.print(" LOW SLEW");
|
||||
}
|
||||
}
|
||||
else { // GoTo or Low Speed Slew
|
||||
axis[Motor].ETXMotorState = ETXCheckSpeed;
|
||||
dbgSerial.print(" GOTO");
|
||||
}
|
||||
|
||||
//dbgSerial.print(" Distance: "); dbgSerial.print(distance);
|
||||
if (axis[Motor].MotorControl & GoToHBX) { // Check GoTo?
|
||||
distance = axis[Motor].Target - axis[Motor].Position; // Distance to target
|
||||
if (axis[Motor].ETXMotorStatus & MOVEDECR) // If it is decreasing
|
||||
distance = TwosComplement(distance);
|
||||
dbgSerial.print(" Distance: "); dbgSerial.print(distance);
|
||||
if (axis[Motor].MotorControl & SlewHBX) { // May need to slew for large changes
|
||||
axis[Motor].ETXMotorState = ETXSlewMotor; // Slew to M-point
|
||||
}
|
||||
else {
|
||||
axis[Motor].ETXMotorState = ETXCheckSpeed;
|
||||
axis[Motor].TargetSpeed = axis[Motor].DEGREERATE1; // Set initial speed for 'HIGH SPEED GOTO'
|
||||
if (distance < axis[Motor].OneDegree)
|
||||
axis[Motor].TargetSpeed = (axis[Motor].TargetSpeed >> 1);
|
||||
if (distance < (axis[Motor].OneDegree >> 2))
|
||||
axis[Motor].TargetSpeed = (axis[Motor].TargetSpeed >> 1);
|
||||
axis[Motor].ETXSpeed = 0; // Starting from 0
|
||||
|
||||
if (axis[Motor].ETXMotorStatus & MOVEHIGH) { // High Speed Slew ?
|
||||
if (axis[Motor].ETXMotorStatus & MOVESLEW) {
|
||||
axis[Motor].ETXMotorState = ETXSlewMotor; // Move axis using high speed multiplier
|
||||
dbgSerial.print(" GoToSTEP");
|
||||
}
|
||||
if (distance < OffsetMax) { // Check for really small moves (< 16 steps)
|
||||
axis[Motor].ETXMotorState = ETXMotorEnd; // Use Adjust offset
|
||||
|
||||
//dbgSerial.print(" HIGH SLEW");
|
||||
|
||||
}
|
||||
}
|
||||
else { // GoTo or Low Speed Slew
|
||||
axis[Motor].ETXMotorState = ETXCheckSpeed;
|
||||
|
||||
//dbgSerial.print(" GOTO");
|
||||
|
||||
}
|
||||
|
||||
if (axis[Motor].MotorControl & GoToHBX) { // Check GoTo?
|
||||
if (axis[Motor].MotorControl & SlewHBX) { // May need to slew for large changes
|
||||
axis[Motor].ETXMotorState = ETXSlewMotor; // Slew to M-point
|
||||
|
||||
//dbgSerial.print(" SLEW");
|
||||
|
||||
}
|
||||
else {
|
||||
axis[Motor].ETXMotorState = ETXCheckSpeed;
|
||||
axis[Motor].TargetSpeed = axis[Motor].DEGREERATE1; // Set initial speed for 'HIGH SPEED GOTO'
|
||||
if (distance < axis[Motor].OneDegree)
|
||||
axis[Motor].TargetSpeed = (axis[Motor].TargetSpeed >> 1);
|
||||
if (distance < (axis[Motor].OneDegree >> 2))
|
||||
axis[Motor].TargetSpeed = (axis[Motor].TargetSpeed >> 1);
|
||||
axis[Motor].Speed = 0; // Starting from 0
|
||||
|
||||
//dbgSerial.print(" STEP");
|
||||
}
|
||||
if (distance < OffsetMax) { // Check for really small moves (< 16 steps)
|
||||
axis[Motor].ETXMotorState = ETXMotorEnd; // Use Adjust offset
|
||||
|
||||
//dbgSerial.print(" OFFSET");
|
||||
}
|
||||
if (distance > (axis[Motor].OneDegree << 3)) { // Always slew for > 8 degrees
|
||||
axis[Motor].ETXMotorState = ETXSlewMotor;
|
||||
//dbgSerial.print(" GoToSLEW");
|
||||
}
|
||||
}
|
||||
}
|
||||
dbgSerial.print(" GoToOFFSET");
|
||||
}
|
||||
if (distance > (axis[Motor].OneDegree << 3)) { // Always slew for > 8 degrees
|
||||
axis[Motor].ETXMotorState = ETXSlewMotor;
|
||||
dbgSerial.print(" GoToSLEW");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ETXSlewMotor:
|
||||
|
||||
//dbgSerial.println(""); dbgSerial.print("ETXSlewMotor Motor: "); dbgSerial.print(Motor); dbgSerial.print(" SLEW Cmd: ");
|
||||
//dbgSerial.println(""); dbgSerial.print("ETXSlewMotor Motor: "); dbgSerial.print(axis_name[Motor]); dbgSerial.print(" SLEW Cmd: ");
|
||||
|
||||
digitalWrite(SCOPELED, HIGH); // Turn on the LED
|
||||
digitalWrite(SCOPELED, HIGH); // Turn on the LED
|
||||
HBXSendCommand(Stop, Motor); // Stop the motor
|
||||
|
||||
if (axis[Motor].ETXMotorStatus & MOVEDECR) // -ve i.e. -CCW
|
||||
|
@ -90,7 +87,7 @@ bool ETXState(unsigned char Motor) {
|
|||
HBXSendCommand(axis[Motor].Command, Motor); // SLEW
|
||||
|
||||
axis[Motor].EQGMotorStatus |= MOVEAXIS; // Tell EQx
|
||||
axis[Motor].Speed = axis[Motor].DEGREERATE1; // Set "current speed" for later speed checks
|
||||
axis[Motor].ETXSpeed = axis[Motor].DEGREERATE1; // Set "current speed" for later speed checks
|
||||
|
||||
if (axis[Motor].MotorControl & GoToHBX) { // Check if slew was caused by a high speed long distance GoTo
|
||||
distance = axis[Motor].Target - axis[Motor].Position; // Check Distance to target
|
||||
|
@ -101,32 +98,42 @@ bool ETXState(unsigned char Motor) {
|
|||
axis[Motor].ETXMotorState = ETXStepMotor;
|
||||
axis[Motor].MotorControl |= SpeedHBX; // Use 0x01 command for next speed
|
||||
axis[Motor].TargetSpeed = axis[Motor].DEGREERATE1; // Set initial speed
|
||||
axis[Motor].Speed = axis[Motor].DEGREERATE1;
|
||||
axis[Motor].ETXSpeed = axis[Motor].DEGREERATE1;
|
||||
axis[Motor].SpeedState = 0;
|
||||
//dbgSerial.print(" GoToSLEW END");
|
||||
}
|
||||
}
|
||||
if (axis[Motor].MotorControl & SlewHBX) { // Slewing to M-point
|
||||
axis[Motor].Speed = axis[Motor].DEGREERATE1; // Indicate current speed (approx)
|
||||
axis[Motor].ETXSpeed = axis[Motor].DEGREERATE1; // Indicate current speed (approx)
|
||||
axis[Motor].ETXMotorState = ETXCheckSlowDown; // Slew until SlowDown
|
||||
}
|
||||
|
||||
/*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXSlewMotor Motor: "); dbgSerial.print(Motor);
|
||||
//*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXSlewMotor Motor: "); dbgSerial.print(axis_name[Motor]);
|
||||
dbgSerial.print(" <sts: "); dbgSerial.print(axis[Motor].ETXMotorStatus, HEX); dbgSerial.print("> ");
|
||||
dbgSerial.print(", Cmd: "); dbgSerial.print(axis[Motor].Command, HEX);
|
||||
dbgSerial.print(", Pos: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
dbgSerial.print(", Inc: "); dbgSerial.print(axis[Motor].Increment, HEX);
|
||||
dbgSerial.print("->Tgt: "); dbgSerial.print(axis[Motor].Target, HEX);
|
||||
dbgSerial.print(" Speed: "); dbgSerial.print(axis[Motor].Speed, HEX);
|
||||
dbgSerial.print(" Speed: "); dbgSerial.print(axis[Motor].ETXSpeed, HEX);
|
||||
dbgSerial.print(" TargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX);
|
||||
dbgSerial.print(" SpeedState: "); dbgSerial.println(axis[Motor].SpeedState, HEX);
|
||||
*/
|
||||
//*/
|
||||
break;
|
||||
|
||||
case ETXStepMotor:
|
||||
|
||||
//dbgSerial.println(""); dbgSerial.print("ETXStepMotor Motor: "); dbgSerial.print(Motor); dbgSerial.print(" STEP Cmd: ");
|
||||
//*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXStepMotor Motor: "); dbgSerial.print(axis_name[Motor]);
|
||||
dbgSerial.print(" <sts: "); dbgSerial.print(axis[Motor].ETXMotorStatus, HEX); dbgSerial.print("> ");
|
||||
dbgSerial.print(", Cmd: "); dbgSerial.print(axis[Motor].Command, HEX);
|
||||
dbgSerial.print(", Pos: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
dbgSerial.print(", Inc: "); dbgSerial.print(axis[Motor].Increment, HEX);
|
||||
dbgSerial.print("->Tgt: "); dbgSerial.print(axis[Motor].Target, HEX);
|
||||
dbgSerial.print(" Speed: "); dbgSerial.print(axis[Motor].ETXSpeed, HEX);
|
||||
dbgSerial.print(" TargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX);
|
||||
dbgSerial.print(" SpeedState: "); dbgSerial.println(axis[Motor].SpeedState, HEX);
|
||||
//*/
|
||||
|
||||
digitalWrite(SCOPELED, HIGH); // Turn on the LED
|
||||
if (axis[Motor].MotorControl & SpeedHBX) // Stepping, High or Low speed
|
||||
|
@ -137,7 +144,7 @@ dbgSerial.print(" SpeedState: "); dbgSerial.println(axis[Motor].SpeedState, HEX)
|
|||
axis[Motor].MotorControl &= ~SpeedHBX; // Clear flag
|
||||
// Set the speed, and direction
|
||||
// ----------------------------
|
||||
P1 = axis[Motor].Speed;
|
||||
P1 = axis[Motor].ETXSpeed;
|
||||
if (axis[Motor].ETXMotorStatus & MOVEDECR) // If negative, change P
|
||||
P1 = TwosComplement(P1); // to 2's complement
|
||||
|
||||
|
@ -149,19 +156,21 @@ dbgSerial.print(" SpeedState: "); dbgSerial.println(axis[Motor].SpeedState, HEX)
|
|||
|
||||
// Send the command
|
||||
// ----------------
|
||||
if (HBXSendCommand(axis[Motor].Command, Motor)) // Command OK?
|
||||
HBXSend3Bytes(Motor); // Send the speed
|
||||
axis[Motor].EQGMotorStatus |= MOVEAXIS; // Tell EQx
|
||||
if (HBXSendCommand(axis[Motor].Command, Motor)) { // Send Command, check OK?
|
||||
HBXSend3Bytes(Motor); // Send the speed
|
||||
axis[Motor].EQGMotorStatus |= MOVEAXIS; // Tell EQx
|
||||
}
|
||||
else break;
|
||||
|
||||
axis[Motor].ETXMotorState = ETXCheckSpeed; // Make sure we are up to target speed
|
||||
if (axis[Motor].MotorControl & GoToHBX) { // If it is a GoTo and up to speed, check position
|
||||
if (axis[Motor].Speed == axis[Motor].TargetSpeed)
|
||||
axis[Motor].ETXMotorState = ETXCheckSpeed; // Preset Checkspeed, & if needed, make sure we are up to target speed
|
||||
if (axis[Motor].MotorControl & GoToHBX) { // If it is a GoTo and up to speed, check position
|
||||
if (axis[Motor].ETXSpeed == axis[Motor].TargetSpeed)
|
||||
axis[Motor].ETXMotorState = ETXCheckPosition;
|
||||
}
|
||||
else if (axis[Motor].Speed == 0) { // Stop issued
|
||||
else if (axis[Motor].ETXSpeed == 0) { // Stop issued
|
||||
axis[Motor].ETXMotorState = ETXStopMotor;
|
||||
}
|
||||
else if (axis[Motor].Speed == axis[Motor].TargetSpeed) { // Else slewing at speed
|
||||
else if (axis[Motor].ETXSpeed == axis[Motor].TargetSpeed) { // Else slewing at speed
|
||||
axis[Motor].ETXMotorState = ETXIdle;
|
||||
}
|
||||
break;
|
||||
|
@ -171,16 +180,16 @@ dbgSerial.print(" SpeedState: "); dbgSerial.println(axis[Motor].SpeedState, HEX)
|
|||
// Calculate absolute distance to slowdown
|
||||
// ---------------------------------------
|
||||
|
||||
/*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXCheckSlowDown Motor: "); dbgSerial.print(Motor);
|
||||
///*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXCheckSlowDown Motor: "); dbgSerial.print(axis_name[Motor]);
|
||||
dbgSerial.print(" <sts: "); dbgSerial.print(axis[Motor].ETXMotorStatus, HEX); dbgSerial.print("> ");
|
||||
dbgSerial.print(", Cmd: "); dbgSerial.print(axis[Motor].Command, HEX);
|
||||
dbgSerial.print(", Pos: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
dbgSerial.print(", SD: "); dbgSerial.print(axis[Motor].SlowDown, HEX);
|
||||
dbgSerial.print("->Tgt: "); dbgSerial.print(axis[Motor].Target, HEX);
|
||||
dbgSerial.print(" Speed: "); dbgSerial.print(axis[Motor].Speed, HEX);
|
||||
dbgSerial.print(" Speed: "); dbgSerial.print(axis[Motor].ETXSpeed, HEX);
|
||||
dbgSerial.print(" TargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX);
|
||||
*/
|
||||
//*/
|
||||
// distance = axis[Motor].SlowDown - axis[Motor].Position;
|
||||
distance = (axis[Motor].Target - 0x1000) - axis[Motor].Position; // Distance to target
|
||||
if (axis[Motor].Target < axis[Motor].Position) // If it is decreasing
|
||||
|
@ -214,46 +223,45 @@ ETXSlew8 600 // 150 arc-min/sec or 2.5°/sec
|
|||
ETXSlew9 1080 // 270 arc-min/sec or 4.5°/sec
|
||||
*/
|
||||
|
||||
/*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXCheckSpeed Motor: "); dbgSerial.print(Motor);
|
||||
///*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXCheckSpeed Motor: "); dbgSerial.print(axis_name[Motor]);
|
||||
dbgSerial.print(" <sts: "); dbgSerial.print(axis[Motor].ETXMotorStatus, HEX); dbgSerial.print("> ");
|
||||
dbgSerial.print(", Pos: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
dbgSerial.print(", Inc: "); dbgSerial.print(axis[Motor].Increment, HEX);
|
||||
dbgSerial.print("->Tgt: "); dbgSerial.print(axis[Motor].Target, HEX);
|
||||
dbgSerial.print(" iSpeed: "); dbgSerial.print(axis[Motor].Speed, HEX);
|
||||
dbgSerial.print(" iSpeed: "); dbgSerial.print(axis[Motor].ETXSpeed, HEX);
|
||||
dbgSerial.print(" iTargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX);
|
||||
*/
|
||||
//*/
|
||||
axis[Motor].ETXMotorState = ETXStepMotor; // Preset set speed as next action
|
||||
|
||||
// Ramp up to speed
|
||||
if ((axis[Motor].TargetSpeed != 0) && (axis[Motor].TargetSpeed > axis[Motor].Speed)) {
|
||||
if ((axis[Motor].TargetSpeed - axis[Motor].Speed) > (axis[Motor].SIDEREALRATE << 6)) { // 64x sidereal
|
||||
axis[Motor].Speed += ((axis[Motor].TargetSpeed - axis[Motor].Speed) >> 1); // Ramp up approx .5 difference
|
||||
// while(!(HBXSendCommand(Stop, Motor))); // Stop the motor command
|
||||
if ((axis[Motor].TargetSpeed != 0) && (axis[Motor].TargetSpeed > axis[Motor].ETXSpeed)) {
|
||||
if ((axis[Motor].TargetSpeed - axis[Motor].ETXSpeed) > (axis[Motor].SIDEREALRATE << 6)) { // 64x sidereal
|
||||
axis[Motor].ETXSpeed += ((axis[Motor].TargetSpeed - axis[Motor].ETXSpeed) >> 1); // Ramp up approx .5 difference
|
||||
axis[Motor].MotorControl &= ~SpeedHBX; // Use 0x00 command
|
||||
}
|
||||
else {
|
||||
axis[Motor].Speed = axis[Motor].TargetSpeed;
|
||||
axis[Motor].ETXSpeed = axis[Motor].TargetSpeed;
|
||||
while(!(HBXSendCommand(Stop, Motor))); // Stop the motor command
|
||||
axis[Motor].MotorControl |= SpeedHBX; // Use 0x01 command
|
||||
}
|
||||
}
|
||||
// Ramp down to speed
|
||||
else if ((axis[Motor].TargetSpeed != 0) && (axis[Motor].Speed > axis[Motor].TargetSpeed)) {
|
||||
axis[Motor].Speed -= ((axis[Motor].Speed - axis[Motor].TargetSpeed) >> 2); // Approx .75
|
||||
if ((axis[Motor].Speed - axis[Motor].TargetSpeed) <= (axis[Motor].SIDEREALRATE << 7)) {
|
||||
axis[Motor].Speed = axis[Motor].TargetSpeed; // Close enough at 128x sidereal, so set the speed
|
||||
else if ((axis[Motor].TargetSpeed != 0) && (axis[Motor].ETXSpeed > axis[Motor].TargetSpeed)) {
|
||||
axis[Motor].ETXSpeed -= ((axis[Motor].ETXSpeed - axis[Motor].TargetSpeed) >> 2); // Approx .75
|
||||
if ((axis[Motor].ETXSpeed - axis[Motor].TargetSpeed) <= (axis[Motor].SIDEREALRATE << 7)) {
|
||||
axis[Motor].ETXSpeed = axis[Motor].TargetSpeed; // Close enough at 128x sidereal, so set the speed
|
||||
// while(!(HBXSendCommand(Stop, Motor))); // Stop the motor command
|
||||
axis[Motor].MotorControl &= ~SpeedHBX; // Use 0x00 command
|
||||
}
|
||||
}
|
||||
// Ramp down to stop
|
||||
else if ((axis[Motor].TargetSpeed == 0) && (axis[Motor].Speed != 0)) {
|
||||
else if ((axis[Motor].TargetSpeed == 0) && (axis[Motor].ETXSpeed != 0)) {
|
||||
if (axis[Motor].ETXMotorStatus & MOVESLEW) {
|
||||
axis[Motor].ETXMotorState = ETXStopMotor;
|
||||
}
|
||||
else if (axis[Motor].Speed >= (axis[Motor].SIDEREALRATE << 7)) { // Ramp down to 128x sidereal
|
||||
axis[Motor].Speed -= (axis[Motor].Speed >> 2); // Approximately .75
|
||||
else if (axis[Motor].ETXSpeed >= (axis[Motor].SIDEREALRATE << 7)) { // Ramp down to 128x sidereal
|
||||
axis[Motor].ETXSpeed -= (axis[Motor].ETXSpeed >> 2); // Approximately .75
|
||||
while(!(HBXSendCommand(Stop, Motor))); // Stop the motor command
|
||||
axis[Motor].MotorControl |= SpeedHBX; // Use 0x01 command
|
||||
}
|
||||
|
@ -263,7 +271,7 @@ dbgSerial.print(" iTargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX
|
|||
|
||||
// Switch to position check, when we are at speed - check done in ETXStepMotor
|
||||
|
||||
//dbgSerial.print(" oSpeed: "); dbgSerial.print(axis[Motor].Speed, HEX);
|
||||
//dbgSerial.print(" oSpeed: "); dbgSerial.print(axis[Motor].ETXSpeed, HEX);
|
||||
//dbgSerial.print(" oTargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX);
|
||||
|
||||
break;
|
||||
|
@ -275,16 +283,16 @@ dbgSerial.print(" iTargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX
|
|||
// Calculate absolute distance to target
|
||||
// -------------------------------------
|
||||
|
||||
/*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXCheckPosition Motor: "); dbgSerial.print(Motor);
|
||||
///*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXCheckPosition Motor: "); dbgSerial.print(axis_name[Motor]);
|
||||
dbgSerial.print(" <sts: "); dbgSerial.print(axis[Motor].ETXMotorStatus, HEX); dbgSerial.print("> ");
|
||||
dbgSerial.print(", Pos: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
dbgSerial.print(", Inc: "); dbgSerial.print(axis[Motor].Increment, HEX);
|
||||
dbgSerial.print("->Tgt: "); dbgSerial.print(axis[Motor].Target, HEX);
|
||||
dbgSerial.print(" Speed: "); dbgSerial.print(axis[Motor].Speed, HEX);
|
||||
dbgSerial.print(" Speed: "); dbgSerial.print(axis[Motor].ETXSpeed, HEX);
|
||||
dbgSerial.print(" TargetSpeed: "); dbgSerial.print(axis[Motor].TargetSpeed, HEX);
|
||||
dbgSerial.print(" SpeedState: "); dbgSerial.print(axis[Motor].SpeedState, HEX);
|
||||
*/
|
||||
//*/
|
||||
if (!(axis[Motor].MotorControl & GoToHBX)) { // Slewing so update position
|
||||
break;
|
||||
}
|
||||
|
@ -309,19 +317,19 @@ dbgSerial.print(" SpeedState: "); dbgSerial.print(axis[Motor].SpeedState, HEX);
|
|||
axis[Motor].SpeedState += 1;
|
||||
}
|
||||
else if ((distance <= 0x100) && (axis[Motor].SpeedState == 2)) {
|
||||
axis[Motor].TargetSpeed = axis[Motor].Speed >> 2; // 1/16
|
||||
axis[Motor].TargetSpeed = axis[Motor].ETXSpeed >> 2; // 1/16
|
||||
axis[Motor].MotorControl &= ~SpeedHBX; // Use 0x00 command
|
||||
axis[Motor].ETXMotorState = ETXStepMotor; // Change speed
|
||||
axis[Motor].SpeedState += 1;
|
||||
}
|
||||
else if ((distance <= 0x200) && (axis[Motor].SpeedState == 1)) {
|
||||
axis[Motor].TargetSpeed = axis[Motor].Speed >> 1; // 1/4
|
||||
axis[Motor].TargetSpeed = axis[Motor].ETXSpeed >> 1; // 1/4
|
||||
axis[Motor].MotorControl &= ~SpeedHBX; // Use 0x00 command
|
||||
axis[Motor].ETXMotorState = ETXStepMotor; // Change speed
|
||||
axis[Motor].SpeedState += 1;
|
||||
}
|
||||
else if ((distance <= 0x400) && (axis[Motor].SpeedState == 0)) {
|
||||
axis[Motor].TargetSpeed = axis[Motor].Speed >> 1; // 1/2
|
||||
axis[Motor].TargetSpeed = axis[Motor].ETXSpeed >> 1; // 1/2
|
||||
while(!(HBXSendCommand(Stop, Motor))); // Stop the motor command
|
||||
axis[Motor].MotorControl |= SpeedHBX; // Use 0x01 command
|
||||
axis[Motor].ETXMotorState = ETXStepMotor; // Change speed
|
||||
|
@ -350,10 +358,10 @@ dbgSerial.print(" SpeedState: "); dbgSerial.print(axis[Motor].SpeedState, HEX);
|
|||
|
||||
case ETXStopMotor:
|
||||
|
||||
//dbgSerial.println(""); dbgSerial.print("ETXStopMotor Motor: "); dbgSerial.print(Motor);
|
||||
dbgSerial.println(""); dbgSerial.print("ETXStopMotor Motor: "); dbgSerial.print(axis_name[Motor]);
|
||||
|
||||
while(!(HBXSendCommand(Stop, Motor))); // Stop the motor
|
||||
axis[Motor].ETXMotorStatus |= MOVESLEW; // ETX Set slewing mode
|
||||
axis[Motor].ETXMotorStatus |= MOVESLEW; // ETX Set slewing mode
|
||||
axis[Motor].ETXMotorStatus &= ~MOVEHIGH; // and speed
|
||||
axis[Motor].ETXMotorStatus &= ~MOVEAXIS; // Clear the motor moving flag
|
||||
axis[Motor].MotorControl &= ~GoToHBX; // Clear the GoTo flag
|
||||
|
@ -362,18 +370,22 @@ dbgSerial.print(" SpeedState: "); dbgSerial.print(axis[Motor].SpeedState, HEX);
|
|||
axis[Motor].EQGMotorStatus &= ~MOVEHIGH; // and speed
|
||||
axis[Motor].EQGMotorStatus &= ~MOVEAXIS; // Clear the motor moving flag
|
||||
axis[Motor].ETXMotorState = ETXCheckStartup;
|
||||
axis[Motor].TargetSpeed = axis[Motor].Speed; // For any subsequent move
|
||||
axis[Motor].Speed = 0;
|
||||
// axis[Motor].TargetSpeed = axis[Motor].ETXSpeed; // For any subsequent move
|
||||
axis[Motor].TargetSpeed = 0;
|
||||
axis[Motor].ETXSpeed = 0;
|
||||
|
||||
//jma CheckAltFlipState();
|
||||
|
||||
break;
|
||||
|
||||
case ETXMotorEnd:
|
||||
/*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXMotorEnd Motor: "); dbgSerial.print(Motor);
|
||||
///*
|
||||
dbgSerial.println(""); dbgSerial.print("ETXMotorEnd Motor: "); dbgSerial.print(axis_name[Motor]);
|
||||
dbgSerial.print(" <sts: "); dbgSerial.print(axis[Motor].ETXMotorStatus, HEX); dbgSerial.print("> ");
|
||||
dbgSerial.print(", Pos: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
dbgSerial.print(", Inc: "); dbgSerial.print(axis[Motor].Increment, HEX);
|
||||
dbgSerial.print("->Tgt: "); dbgSerial.print(axis[Motor].Target, HEX);
|
||||
*/
|
||||
//*/
|
||||
digitalWrite(SCOPELED, LOW); // Turn off the LED
|
||||
distance = axis[Motor].Target - axis[Motor].Position; // Distance to target
|
||||
if (axis[Motor].Target < axis[Motor].Position) // If it is decreasing
|
||||
|
@ -389,13 +401,13 @@ dbgSerial.print("->Tgt: "); dbgSerial.print(axis[Motor].Target, HEX);
|
|||
if (HBXSendCommand(axis[Motor].Command, Motor)) // Command OK?
|
||||
HBXSend2Bytes(Motor); // Send the offset
|
||||
|
||||
/*
|
||||
///*
|
||||
dbgSerial.print(" OFFSET");
|
||||
dbgSerial.print(" "); dbgSerial.print(axis[Motor].Command, HEX);
|
||||
dbgSerial.print(" "); dbgSerial.print(axis[Motor].HBXP1, HEX);
|
||||
dbgSerial.print(" "); dbgSerial.print(axis[Motor].HBXP2, HEX);
|
||||
dbgSerial.print(" "); dbgSerial.print(axis[Motor].HBXP3, HEX);
|
||||
*/
|
||||
//*/
|
||||
}
|
||||
axis[Motor].Position = axis[Motor].Target;
|
||||
axis[Motor].MotorControl &= ~GoToHBX; // Clear the flag
|
||||
|
@ -412,7 +424,7 @@ dbgSerial.print(" "); dbgSerial.print(axis[Motor].HBXP3, HEX);
|
|||
|
||||
bool HBXGetStatus(unsigned char Motor) {
|
||||
if (!HBXSendCommand(GetStatus, Motor)) {
|
||||
dbgSerial.println(""); dbgSerial.print("HBXGetStatus Motor: "); dbgSerial.print(Motor); dbgSerial.println(" Cmd Fail");
|
||||
dbgSerial.println(""); dbgSerial.print("HBXGetStatus Motor: "); dbgSerial.print(axis_name[Motor]); dbgSerial.println(" Cmd Fail");
|
||||
return(false);
|
||||
}
|
||||
HBXGet3Bytes(Motor);
|
||||
|
@ -431,7 +443,7 @@ bool HBXGetStatus(unsigned char Motor) {
|
|||
|
||||
if (StatusCount++ > 51) {
|
||||
StatusCount = 0;
|
||||
dbgSerial.println(""); dbgSerial.print("Motor: "); dbgSerial.print(Motor); dbgSerial.print(", Posn: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
dbgSerial.println(""); dbgSerial.print("Motor: "); dbgSerial.print(axis_name[Motor]); dbgSerial.print(", Posn: "); dbgSerial.print(axis[Motor].Position, HEX);
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
|
@ -537,10 +549,11 @@ void AzInitialise(unsigned char scope) {
|
|||
axis[AzMotor].GbxRatio = ratio[scope][AzMotor-1].GbxRatio;
|
||||
axis[AzMotor].XferRatio = ratio[scope][AzMotor-1].XferRatio;
|
||||
axis[AzMotor].WormTeeth = ratio[scope][AzMotor-1].WormTeeth;
|
||||
// EQMOD values
|
||||
// EQMOD
|
||||
axis[AzMotor].aVALUE = axis[AzMotor].Vanes * (float)4 * axis[AzMotor].GbxRatio * axis[AzMotor].XferRatio * axis[AzMotor].WormTeeth;
|
||||
axis[AzMotor].MeadeRatio = axis[AzMotor].aVALUE / ArcSecs360; // Distance for one arcsec
|
||||
axis[AzMotor].bVALUE = (MeadeSidereal * axis[AzMotor].MeadeRatio * axis[AzMotor].aVALUE * SiderealArcSecs) / ArcSecs360;
|
||||
axis[AzMotor].bVALUE = (MeadeSidereal * axis[AzMotor].MeadeRatio * axis[AzMotor].aVALUE * SiderealArcSecs) / ArcSecs360;
|
||||
axis[AzMotor].BASERATE = axis[AzMotor].bVALUE / axis[AzMotor].MeadeRatio;
|
||||
axis[AzMotor].SIDEREALRATE = MeadeSidereal * axis[AzMotor].MeadeRatio;
|
||||
axis[AzMotor].SOLARRATE = axis[AzMotor].SIDEREALRATE * SOLARSECS / SIDEREALSECS;
|
||||
axis[AzMotor].LUNARRATE = axis[AzMotor].SIDEREALRATE * LUNARSECS / SIDEREALSECS;
|
||||
|
@ -550,7 +563,10 @@ void AzInitialise(unsigned char scope) {
|
|||
axis[AzMotor].HBXP1 = 0x00;
|
||||
axis[AzMotor].HBXP2 = 0x00;
|
||||
axis[AzMotor].HBXP3 = 0x00;
|
||||
axis[AzMotor].HBXP4 = 0x00;
|
||||
axis[AzMotor].HBXP4 = 0x00;
|
||||
axis[AzMotor].ETXSpeed = 0x00;
|
||||
axis[AzMotor].SpeedState = 0x00;
|
||||
axis[AzMotor].TargetSpeed = 0x00;
|
||||
axis[AzMotor].Position = ETX_CENTRE; // ETX RA initially at 0 hours
|
||||
axis[AzMotor].OneDegree = axis[AzMotor].aVALUE / (float)360; // Distance for one degree
|
||||
axis[AzMotor].Target = axis[AzMotor].Position;
|
||||
|
@ -567,29 +583,129 @@ void AltInitialise(unsigned char scope) {
|
|||
axis[AltMotor].GbxRatio = ratio[scope][AltMotor-1].GbxRatio;
|
||||
axis[AltMotor].XferRatio = ratio[scope][AltMotor-1].XferRatio;
|
||||
axis[AltMotor].WormTeeth = ratio[scope][AltMotor-1].WormTeeth;
|
||||
// EQMOD values
|
||||
// EQMOD
|
||||
axis[AltMotor].aVALUE = axis[AltMotor].Vanes * (float)4 * axis[AltMotor].GbxRatio * axis[AltMotor].XferRatio * axis[AltMotor].WormTeeth;
|
||||
axis[AltMotor].MeadeRatio = axis[AltMotor].aVALUE / ArcSecs360; // Distance for one arcsec
|
||||
axis[AltMotor].MeadeRatio = axis[AltMotor].aVALUE / ArcSecs360; // Counts for one arcsec
|
||||
axis[AltMotor].bVALUE = MeadeSidereal * axis[AltMotor].MeadeRatio * axis[AltMotor].aVALUE * SiderealArcSecs / ArcSecs360;
|
||||
axis[AltMotor].SIDEREALRATE = MeadeSidereal * axis[AltMotor].MeadeRatio;
|
||||
axis[AltMotor].SOLARRATE = axis[AltMotor].SIDEREALRATE * SOLARSECS / SIDEREALSECS;
|
||||
axis[AltMotor].BASERATE = axis[AltMotor].bVALUE / axis[AltMotor].MeadeRatio;
|
||||
axis[AltMotor].SIDEREALRATE = MeadeSidereal * axis[AltMotor].MeadeRatio;
|
||||
axis[AltMotor].SOLARRATE = axis[AltMotor].SIDEREALRATE * SOLARSECS / SIDEREALSECS;
|
||||
axis[AltMotor].LUNARRATE = axis[AltMotor].SIDEREALRATE * LUNARSECS / SIDEREALSECS;
|
||||
axis[AltMotor].DEGREERATE1 = axis[AltMotor].SIDEREALRATE * ETXSlew7;
|
||||
axis[AltMotor].PEC = axis[AltMotor].aVALUE / axis[AltMotor].WormTeeth;
|
||||
axis[AltMotor].EQGMotorStatus = MOVESLEW;
|
||||
// ETX
|
||||
axis[AltMotor].HBXP1 = 0x00;
|
||||
axis[AltMotor].HBXP2 = 0x00;
|
||||
axis[AltMotor].HBXP3 = 0x00;
|
||||
axis[AltMotor].HBXP4 = 0x00;
|
||||
axis[AltMotor].Position = ETX_CENTRE - (axis[AltMotor].aVALUE >> 2); // Initially at -90 degrees
|
||||
axis[AltMotor].OneDegree = axis[AltMotor].aVALUE / (float)360; // Distance for one degree
|
||||
axis[AltMotor].HBXP4 = 0x00;
|
||||
axis[AltMotor].ETXSpeed = 0x00;
|
||||
axis[AltMotor].SpeedState = 0x00;
|
||||
axis[AltMotor].TargetSpeed = 0x00;
|
||||
axis[AltMotor].Position = ETX_CENTRE + (axis[AltMotor].aVALUE >> 2); // Initially at +90 degrees
|
||||
axis[AltMotor].OneDegree = axis[AltMotor].aVALUE / (float)360; // Distance for one degree
|
||||
axis[AltMotor].Target = axis[AltMotor].Position;
|
||||
axis[AltMotor].DirnSpeed = 0x000;
|
||||
axis[AltMotor].ETXMotorStatus = MOVESLEW;
|
||||
axis[AltMotor].EQGMotorStatus = MOVESLEW;
|
||||
|
||||
axis[AltMotor].ETXMotorState = ETXCheckStartup;
|
||||
}
|
||||
|
||||
/*
|
||||
// Check if ETX mount will hit fork physical limits
|
||||
// When used as GEM, ETX mounts cannot go past vertical
|
||||
// This means E in Sthn, W in Nthn, for East side pointing West
|
||||
// So rotate 180 degrees in Az and flip the Alt destination
|
||||
*/
|
||||
void CheckAltFlip(unsigned char Motor) {
|
||||
long distance;
|
||||
distance = axis[Motor].Target - axis[Motor].Position; // Distance to target
|
||||
if ((telescope < 3) && (Motor == AltMotor)) { // ETXn0 series
|
||||
long p;
|
||||
if (distance > 0) {
|
||||
// GoTo
|
||||
if (axis[AltMotor].Target >= (ETX_CENTRE + (axis[AltMotor].aVALUE >> 2))) { // E[Sthn] (or W[Nthn])
|
||||
dbgSerial.println(""); dbgSerial.print("Flip: target "); dbgSerial.print(axis[AltMotor].Target); // Set Target
|
||||
p = axis[AltMotor].Target - (ETX_CENTRE + (axis[AltMotor].aVALUE >> 2)); // Offset from EQG midpoint
|
||||
axis[AltMotor].Target -= (p << 1); // Swap to other side
|
||||
distance = axis[Motor].Target - axis[Motor].Position; // Distance to target
|
||||
dbgSerial.print(", new "); dbgSerial.print(axis[AltMotor].Target);
|
||||
// Flip direction
|
||||
if (axis[AltMotor].ETXMotorStatus & MOVEDECR) axis[AltMotor].ETXMotorStatus &= ~MOVEDECR;
|
||||
else axis[AltMotor].ETXMotorStatus |= MOVEDECR;
|
||||
// Set SlowDown
|
||||
p = axis[AltMotor].SlowDown - (ETX_CENTRE + (axis[AltMotor].aVALUE >> 2));
|
||||
axis[AltMotor].SlowDown -= (p << 1);
|
||||
dbgSerial.print(", Slowdown "); dbgSerial.print(p);
|
||||
if (axis[AltMotor].Flip == NORMAL) {
|
||||
axis[AltMotor].Flip = FLIP;
|
||||
dbgSerial.print(", Type "); dbgSerial.print("ALREADY FLIPPED");
|
||||
}
|
||||
else {
|
||||
dbgSerial.print(", Type "); dbgSerial.print("NORMAL");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (axis[AltMotor].Flip == FLIPPED) {
|
||||
axis[AltMotor].Flip = UNFLIP;
|
||||
dbgSerial.print(", Action "); dbgSerial.print("UNFLIP");
|
||||
}
|
||||
else {
|
||||
dbgSerial.print(", Action "); dbgSerial.print("NOTHING");
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// SLEW
|
||||
if (axis[AltMotor].ETXMotorStatus & MOVEDECR) {
|
||||
axis[AltMotor].ETXMotorStatus &= ~MOVEDECR;
|
||||
if (axis[AltMotor].Flip == NORMAL) {
|
||||
axis[AltMotor].Flip = FLIP;
|
||||
dbgSerial.print(", Action "); dbgSerial.print("FLIP");
|
||||
}
|
||||
else {
|
||||
dbgSerial.print(", Action "); dbgSerial.print("NOTHING");
|
||||
}
|
||||
}
|
||||
if (axis[AltMotor].Flip == FLIPPED) {
|
||||
axis[AltMotor].Flip = UNFLIP;
|
||||
dbgSerial.print(", Action "); dbgSerial.print("FLIP");
|
||||
}
|
||||
else {
|
||||
dbgSerial.print(", Action "); dbgSerial.print("NOTHING");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CheckAltFlipState(void) {
|
||||
if ((axis[AltMotor].Flip == FLIPPING) || (axis[AltMotor].Flip == UNFLIPPING)) {
|
||||
dbgSerial.println(""); dbgSerial.print("Stop Motor: ");
|
||||
if (axis[AltMotor].Flip == FLIPPING) {
|
||||
axis[AltMotor].Flip = FLIPPED; dbgSerial.print("FLIPPING");
|
||||
}
|
||||
else {
|
||||
axis[AltMotor].Flip = NORMAL; dbgSerial.print("NORMAl");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CheckAltFlipReqd(void) {
|
||||
if (axis[AltMotor].ETXMotorState == ETXIdle) {
|
||||
if ((axis[AltMotor].Flip == FLIP) || (axis[AltMotor].Flip == UNFLIP)) {
|
||||
if (axis[AltMotor].Flip == FLIP) axis[AltMotor].Flip = FLIPPING;
|
||||
else axis[AltMotor].Flip = UNFLIPPING;
|
||||
// Rotate 180 degrees in RA
|
||||
if (axis[AzMotor].Target > ETX_CENTRE) axis[AzMotor].Target -= (axis[AzMotor].aVALUE >> 1);
|
||||
else axis[AzMotor].Target += (axis[AzMotor].aVALUE >> 1);
|
||||
axis[AzMotor].ETXMotorStatus |= (MOVEAXIS || MOVEHIGH);
|
||||
axis[AzMotor].ETXMotorStatus &= ~MOVESLEW;
|
||||
axis[AzMotor].MotorControl |= GoToHBX;
|
||||
CheckETXState(AzMotor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PrintHbxValues(unsigned char Motor) {
|
||||
if (Motor == AzMotor)
|
||||
dbgSerial.println("AzMotor");
|
||||
|
@ -607,8 +723,9 @@ void PrintHbxValues(unsigned char Motor) {
|
|||
dbgSerial.print(", bVALUE 0x"); dbgSerial.print(axis[Motor].bVALUE, HEX);
|
||||
dbgSerial.print(", PEC 0x"); dbgSerial.println(axis[Motor].PEC, HEX);
|
||||
|
||||
dbgSerial.print("SIDEREALRATE 0x"); dbgSerial.print(axis[Motor].SIDEREALRATE, HEX);
|
||||
dbgSerial.print(", SOLARRATE 0x"); dbgSerial.print(axis[Motor].SOLARRATE, HEX);
|
||||
dbgSerial.print("BASERATE 0x"); dbgSerial.print(axis[Motor].BASERATE, HEX);
|
||||
dbgSerial.print(", SIDEREALRATE 0x"); dbgSerial.print(axis[Motor].SIDEREALRATE, HEX);
|
||||
dbgSerial.print(", SOLARRATE 0x"); dbgSerial.print(axis[Motor].SOLARRATE, HEX);
|
||||
dbgSerial.print(", LUNARRATE 0x"); dbgSerial.print(axis[Motor].LUNARRATE, HEX);
|
||||
dbgSerial.print(", DEGREERATE1 0x"); dbgSerial.println(axis[Motor].DEGREERATE1, HEX);
|
||||
|
||||
|
@ -638,7 +755,7 @@ void HBXPrintStatus(unsigned char Motor) {
|
|||
|
||||
/* dbgSerial.println("");
|
||||
dbgSerial.print("Motor: ");
|
||||
dbgSerial.print(Motor);
|
||||
dbgSerial.print(axis_name[Motor]);
|
||||
dbgSerial.print(", Cmnd: ");
|
||||
dbgSerial.print(axis[Motor].Command, HEX);
|
||||
dbgSerial.print(" - ");
|
||||
|
|
|
@ -87,7 +87,7 @@ void putRxDataIntoMountInputBuffer(void) {
|
|||
// Data in sendWiFi.text, length sendWiFi.len
|
||||
void getTxDataFromMountOutputBuffer(void) {
|
||||
while (EQGTxoPtr != EQGTxiPtr) {
|
||||
dbgSerial.write(EQGTxBuffer[EQGTxoPtr]);
|
||||
//jma dbgSerial.write(EQGTxBuffer[EQGTxoPtr]);
|
||||
sendWiFi.text[TxDIndex++] = EQGTxBuffer[EQGTxoPtr++];
|
||||
EQGTxoPtr &= EQGMASK;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
.pio
|
||||
.vscode/.browse.c_cpp.db*
|
||||
.vscode/c_cpp_properties.json
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
]
|
||||
}
|