Skip to content

Commit

Permalink
Get in sync with 'moonPhase'.
Browse files Browse the repository at this point in the history
  • Loading branch information
CelliesProjects committed Jul 25, 2019
1 parent 548dae3 commit 2355825
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
6 changes: 3 additions & 3 deletions aquacontrol32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <XPT2046_Touchscreen.h> /* Install 1.3 via 'Manage Libraries' in Arduino IDE */
#include <AsyncTCP.h> /* Reports as 1.0.3 https://github.com/me-no-dev/AsyncTCP */
#include <ESPAsyncWebServer.h> /* Reports as 1.2.2 https://github.com/me-no-dev/ESPAsyncWebServer */
#include <MoonPhase.h> /* https://github.com/CelliesProjects/MoonPhase */
#include <moonPhase.h> /* https://github.com/CelliesProjects/moonPhase */
#include <FFatSensor.h> /* https://github.com/CelliesProjects/FFatSensor */
#include <Task.h> /* https://github.com/CelliesProjects/Task */
#include "ledState.h"
Expand Down Expand Up @@ -103,7 +103,7 @@ ledState leds;

FFatSensor logger;

MoonPhase MoonPhase;
moonPhase moonPhase;

XPT2046_Touchscreen touch( TOUCH_CS_PIN, TOUCH_IRQ_PIN );

Expand Down Expand Up @@ -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;
Expand Down
9 changes: 1 addition & 8 deletions moonSimtask.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down

0 comments on commit 2355825

Please sign in to comment.