From 235582519affd011a92c47c526d5734900b776a4 Mon Sep 17 00:00:00 2001 From: Cellie Date: Thu, 25 Jul 2019 16:37:14 +0200 Subject: [PATCH] Get in sync with 'moonPhase'. --- aquacontrol32.ino | 6 +++--- moonSimtask.ino | 9 +-------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/aquacontrol32.ino b/aquacontrol32.ino index bd18cac..c223e55 100644 --- a/aquacontrol32.ino +++ b/aquacontrol32.ino @@ -13,7 +13,7 @@ #include /* Install 1.3 via 'Manage Libraries' in Arduino IDE */ #include /* Reports as 1.0.3 https://github.com/me-no-dev/AsyncTCP */ #include /* Reports as 1.2.2 https://github.com/me-no-dev/ESPAsyncWebServer */ -#include /* https://github.com/CelliesProjects/MoonPhase */ +#include /* https://github.com/CelliesProjects/moonPhase */ #include /* https://github.com/CelliesProjects/FFatSensor */ #include /* https://github.com/CelliesProjects/Task */ #include "ledState.h" @@ -103,7 +103,7 @@ ledState leds; FFatSensor logger; -MoonPhase MoonPhase; +moonPhase moonPhase; XPT2046_Touchscreen touch( TOUCH_CS_PIN, TOUCH_IRQ_PIN ); @@ -151,7 +151,7 @@ const uint8_t moonSimtaskPriority = 0; **************************************************************************/ channelData_t channel[NUMBER_OF_CHANNELS]; -MoonPhase::moonData moonData; +moonData_t moonData; TaskHandle_t xDimmerTaskHandle = NULL; TaskHandle_t xTftTaskHandle = NULL; diff --git a/moonSimtask.ino b/moonSimtask.ino index 37a131a..5dda4a6 100644 --- a/moonSimtask.ino +++ b/moonSimtask.ino @@ -4,14 +4,7 @@ void IRAM_ATTR moonSimtask ( void * pvParameters ) while (1) { - time_t now; - time( &now ); - struct tm timeinfo; - gmtime_r( &now, &timeinfo ); /* moon phase is calculated using UTC! */ - - double hour = timeinfo.tm_hour + mapFloat( ( timeinfo.tm_min * 60 ) + timeinfo.tm_sec, 0, 3600, 0, 1 ); - - moonData = MoonPhase.getInfo( 1900 + timeinfo.tm_year, timeinfo.tm_mon + 1, timeinfo.tm_mday, hour ); + moonData = moonPhase.getInfo(); ESP_LOGI( TAG, "Moon phase updated: %i degrees %.6f%% lit", moonData.angle, moonData.percentLit * 100 );