#ifndef __astro_h #define __astro_h #include "../../global.h" #include "cfg.h" #include "koor.h" #ifndef PI #define PI 3.14159265358979323846 #endif //#define STARDAYSECONDS 86164.090538 #define HOURSECONDS 3600.0 #define HOUR24SECONDS 86400.0 #define STARDAYSECONDS 86164.09053090120141860097646713 #define NORMDAYSECONDS 86400.0 #define STARDAYSECONDS400 34465636.21236047893762588500976562 #define FACSTARTONORMTIME 1.00273790935 #define FACNORMTOSTARTIME 0.99726956632987506790044563 #define NORMSEC_0400_STPART 0.00000069634577038194443413 //calculate LAST with cCurrentStarTime when start-up, //or special ops ( new koor ?), //calculate long il_last ( interrupt variable ) //from this with: // a = (float)LAST / (float)NORMSEC_0400_STPART; // il_last = (long)a; // //the interrupt now have to increment every 1/400 second //( value timer18 ) the variable il_last, //and test if it is greater then STARDAYSEC400LASTLONG. //(defined in int.h) //( if so int have to set il_last to 0. // //the programloop has to calculate LAST from il_last //before calling cAzAlt. //LAST = (float)il_last * (float)NORMSEC_0400_STPART; //good for sparing the calculation of //current star-time during guiding, or goto. //so we have perhaps >= 150 cAzAlt calculations per //second. ( prec = 1/10 arcsecond ) //difference after 12 hours, to 64bit calculated //startime, is when using 32bit floats: //in seconds 0.01314272569175045646261424 //15arcsec * this 0.19714088537625684693921357 #define rad(x) ((x)*PI/180.0) #define deg(x) ((x)*180.0/PI ) #define hdeg(x) ((x)*15.0) #define degh(x) ((x)/15.0) #define hrad(x) rad(hdeg(x)) #define arctohs(a,s) ((a)/(s)) #define hstoarc(a,s) ((a)*(s)) #define degtoarc(x) ((x)*3600) #define arctodeg(x) ((x)/3600) #define degtoarc10(x) ((x)*36000) #define arc10todeg(x) ((x)/36000) #define degtoarc100(x) ((x)*360000) #define arc100todeg(x) ((x)/360000) #define hourstosecs(x) ((x)*3600.0) #define hourstomillis(x) ((x)*3600.0*1000.0) #define secstohours(x) ((x)/3600.0) #define millistohours(x) ((x)/3600.0/1000.0) #define circle_radius(x,y) (sqrt(((x)*(x))+((y)*(y)))); #define circle_circumf(r) ((r)*2.0*PI) #define circle_angle(b,u) (((b)/(u))*360.0) #define ARC0 0.0 #define ARC45 162000.0 #define ARC90 324000.0 #define ARC135 486000.0 #define ARC180 648000.0 #define ARC225 810000.0 #define ARC270 972000.0 #define ARC315 1134000.0 #define ARC360 1296000.0 #define ARC10_000 0 #define ARC10_045 1620000 #define ARC10_090 3240000 #define ARC10_135 4860000 #define ARC10_180 6480000 #define ARC10_225 8100000 #define ARC10_270 9720000 #define ARC10_315 11340000 #define ARC10_360 12960000 //these are set in astro.c //instead KOOR_RA, KOOR_DEC extern volatile struct RADECKOOR KOOR; extern volatile double KOOR_AZ; extern volatile double KOOR_ALT; extern volatile double LAST; /* This calculates and sets GAST,and LAST. YEAR,MONTH,DAY,MINUTE,SECOND,MSECOND must contain correct time before. Also LONGITUTE must contain correct value. */ extern void cCurrentStarTime( void ); /* Calculates Rektazension/Declination-kooordinates to azimuth/altitude-koordinates for the local time, and place. This sets KOOR_AZ, KOOR_ALT ( as floatnumbers of degrees ) KOOR_RA must be set as hours KOOR_DEC dec as degrees. the current local startime ( LAST ), must be set before by calling cCurrentStartTime Also LATITUDE must contain correct value. */ extern void cAzAlt( void ); /* Calculates Azimut/Altitude-kooordinates to Rectaszension/Declination-koordinates for the local time, and place. This KOOR_RA, KOOR_DEC ( as floatnumbers of Hours/degrees ) KOOR_AZ, and KOOR_ALT must be set as floatnumber of degrees. The current startime LAST must be set before by calling cCurrentStarTime, also the LATITUDE. */ extern void cRaDec( void ); #endif