OpenDTU-old/include/SunPosition.h
helgeerbe f7bd4a40d8 revert Revert "Merge remote-tracking branch 'tbnobody/OpenDTU/master' into development"
merge of v23.9.11 broke the system. As a workaround upgrade espressif32 from 6.3.2 to 6.4.0 is skipped. See #440
2023-09-14 13:45:23 +02:00

32 lines
631 B
C++

// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <sunset.h>
#define SUNPOS_UPDATE_INTERVAL 60000l
class SunPositionClass {
public:
SunPositionClass();
void init();
void loop();
bool isDayPeriod();
bool isSunsetAvailable();
bool sunsetTime(struct tm* info);
bool sunriseTime(struct tm* info);
private:
void updateSunData();
SunSet _sun;
bool _isDayPeriod = true;
bool _isSunsetAvailable = true;
uint32_t _sunriseMinutes = 0;
uint32_t _sunsetMinutes = 0;
uint32_t _lastUpdate = 0;
bool _isValidInfo = false;
};
extern SunPositionClass SunPosition;