astronomical calculations moved from double to float

This commit is contained in:
Bogdan Pilyugin 2024-05-14 10:50:17 +02:00
parent a64de4a0c5
commit 298c2e6534
2 changed files with 16 additions and 10 deletions

View File

@ -65,14 +65,20 @@ typedef struct
bool rise; /*!<If event is sunrise*/ bool rise; /*!<If event is sunrise*/
bool sensor_enab; /*!< Enable light sensor handle */ bool sensor_enab; /*!< Enable light sensor handle */
double sensor_angle; /*!<Sun angle start sensor checking*/ float sensor_angle; /*!<Sun angle start sensor checking*/
double main_angle;/*!<Sun angle unconditional event issue*/ float main_angle;/*!<Sun angle unconditional event issue*/
int sensor_time; int sensor_time;
int main_time; int main_time;
char exec[TIMER_EXECSTRING_LENGTH]; /*!< Cron command string */ char exec[TIMER_EXECSTRING_LENGTH]; /*!< Cron command string */
} astro_timer_t; } astro_timer_t;
typedef struct
{
} astro_handle_t;
esp_err_t InitCronSheduler(); esp_err_t InitCronSheduler();
esp_err_t ReloadCronSheduler(); esp_err_t ReloadCronSheduler();
char* GetCronError(); char* GetCronError();

View File

@ -165,11 +165,11 @@ esp_err_t ReloadCronSheduler()
static uint16_t srTime = 0; static uint16_t srTime = 0;
static uint16_t ssTime = 0; static uint16_t ssTime = 0;
static double Lat, Lon, Ang; static float Lat, Lon, Ang;
static double GetSunEvent(uint8_t event, uint16_t day); static float GetSunEvent(uint8_t event, uint16_t day);
uint16_t NumberDayFromUnix(uint32_t t) uint16_t NumberDayFromUnix(uint32_t t)
{ {
@ -221,15 +221,15 @@ uint16_t GetSunset(void)
} }
static double GetSunEvent(uint8_t event, uint16_t day) static float GetSunEvent(uint8_t event, uint16_t day)
{ {
double lngHour, t, M, L, RA, sinDec, cosDec, cosH, H, T, UT; float lngHour, t, M, L, RA, sinDec, cosDec, cosH, H, T, UT;
double Lquadrant, RAquadrant; float Lquadrant, RAquadrant;
double zen; float zen;
if (SUN_ANG == 0) if (SUN_ANG == 0)
zen = zenith + (double) SUN_ANG; //sunrise/set zen = zenith + (float) SUN_ANG; //sunrise/set
else else
zen = 90.0 + (double) SUN_ANG; //twilight zen = 90.0 + (float) SUN_ANG; //twilight
lngHour = LON / 15; lngHour = LON / 15;
if (event == 0) if (event == 0)
t = day + ((6 - lngHour) / 24); t = day + ((6 - lngHour) / 24);