Merge branch 'origin/HEAD' into Database
This commit is contained in:
commit
d7bb8207bb
@ -12,6 +12,7 @@ public:
|
||||
void loop();
|
||||
|
||||
bool isDayPeriod();
|
||||
bool isSunsetAvailable();
|
||||
bool sunsetTime(struct tm* info);
|
||||
bool sunriseTime(struct tm* info);
|
||||
|
||||
@ -20,6 +21,7 @@ private:
|
||||
|
||||
SunSet _sun;
|
||||
bool _isDayPeriod = true;
|
||||
bool _isSunsetAvailable = true;
|
||||
uint _sunriseMinutes = 0;
|
||||
uint _sunsetMinutes = 0;
|
||||
|
||||
|
||||
@ -29,6 +29,11 @@ bool SunPositionClass::isDayPeriod()
|
||||
return _isDayPeriod;
|
||||
}
|
||||
|
||||
bool SunPositionClass::isSunsetAvailable()
|
||||
{
|
||||
return _isSunsetAvailable;
|
||||
}
|
||||
|
||||
void SunPositionClass::updateSunData()
|
||||
{
|
||||
CONFIG_T const& config = Configuration.get();
|
||||
@ -37,7 +42,7 @@ void SunPositionClass::updateSunData()
|
||||
|
||||
struct tm timeinfo;
|
||||
if (!getLocalTime(&timeinfo, 5)) {
|
||||
_isDayPeriod = false;
|
||||
_isDayPeriod = true;
|
||||
_sunriseMinutes = 0;
|
||||
_sunsetMinutes = 0;
|
||||
_isValidInfo = false;
|
||||
@ -62,11 +67,26 @@ void SunPositionClass::updateSunData()
|
||||
break;
|
||||
}
|
||||
|
||||
_sunriseMinutes = static_cast<int>(_sun.calcCustomSunrise(sunset_type));
|
||||
_sunsetMinutes = static_cast<int>(_sun.calcCustomSunset(sunset_type));
|
||||
double sunriseRaw = _sun.calcCustomSunrise(sunset_type);
|
||||
double sunsetRaw = _sun.calcCustomSunset(sunset_type);
|
||||
|
||||
// If no sunset/sunrise exists (e.g. astronomical calculation in summer)
|
||||
// assume it's day period
|
||||
if (std::isnan(sunriseRaw) || std::isnan(sunsetRaw)) {
|
||||
_isDayPeriod = true;
|
||||
_isSunsetAvailable = false;
|
||||
_sunriseMinutes = 0;
|
||||
_sunsetMinutes = 0;
|
||||
_isValidInfo = false;
|
||||
return;
|
||||
}
|
||||
|
||||
_sunriseMinutes = static_cast<int>(sunriseRaw);
|
||||
_sunsetMinutes = static_cast<int>(sunsetRaw);
|
||||
uint minutesPastMidnight = timeinfo.tm_hour * 60 + timeinfo.tm_min;
|
||||
|
||||
_isDayPeriod = (minutesPastMidnight >= _sunriseMinutes) && (minutesPastMidnight < _sunsetMinutes);
|
||||
_isSunsetAvailable = true;
|
||||
_isValidInfo = true;
|
||||
}
|
||||
|
||||
|
||||
@ -52,14 +52,21 @@ void WebApiNtpClass::onNtpStatus(AsyncWebServerRequest* request)
|
||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
|
||||
root["ntp_localtime"] = timeStringBuff;
|
||||
|
||||
SunPosition.sunriseTime(&timeinfo);
|
||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
|
||||
if (SunPosition.sunriseTime(&timeinfo)) {
|
||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
|
||||
} else {
|
||||
strcpy(timeStringBuff, "--");
|
||||
}
|
||||
root["sun_risetime"] = timeStringBuff;
|
||||
|
||||
SunPosition.sunsetTime(&timeinfo);
|
||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
|
||||
if (SunPosition.sunsetTime(&timeinfo)) {
|
||||
strftime(timeStringBuff, sizeof(timeStringBuff), "%A, %B %d %Y %H:%M:%S", &timeinfo);
|
||||
} else {
|
||||
strcpy(timeStringBuff, "--");
|
||||
}
|
||||
root["sun_settime"] = timeStringBuff;
|
||||
|
||||
root["sun_isSunsetAvailable"] = SunPosition.isSunsetAvailable();
|
||||
root["sun_isDayPeriod"] = SunPosition.isDayPeriod();
|
||||
|
||||
response->setLength();
|
||||
|
||||
@ -37,8 +37,8 @@
|
||||
"eslint-plugin-vue": "^9.14.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"sass": "^1.62.1",
|
||||
"terser": "^5.17.6",
|
||||
"typescript": "^5.0.4",
|
||||
"terser": "^5.17.7",
|
||||
"typescript": "^5.1.3",
|
||||
"vite": "^4.3.9",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-plugin-css-injected-by-js": "^3.1.1",
|
||||
|
||||
@ -246,6 +246,7 @@
|
||||
"LocalTime": "Lokale Uhrzeit",
|
||||
"Sunrise": "Morgendämmerung",
|
||||
"Sunset": "Abenddämmerung",
|
||||
"NotAvailable": "Nicht verfügbar",
|
||||
"Mode": "Modus",
|
||||
"Day": "Tag",
|
||||
"Night": "Nacht"
|
||||
|
||||
@ -246,6 +246,7 @@
|
||||
"LocalTime": "Local Time",
|
||||
"Sunrise": "Sunrise",
|
||||
"Sunset": "Sunset",
|
||||
"NotAvailable": "Not Available",
|
||||
"Mode": "Mode",
|
||||
"Day": "Day",
|
||||
"Night": "Night"
|
||||
|
||||
@ -246,6 +246,7 @@
|
||||
"LocalTime": "Heure locale",
|
||||
"Sunrise": "Sunrise",
|
||||
"Sunset": "Sunset",
|
||||
"NotAvailable": "Not Available",
|
||||
"Mode": "Mode",
|
||||
"Day": "Day",
|
||||
"Night": "Night"
|
||||
|
||||
@ -7,4 +7,5 @@ export interface NtpStatus {
|
||||
sun_risetime: string;
|
||||
sun_settime: string;
|
||||
sun_isDayPeriod: boolean;
|
||||
sun_isSunsetAvailable: boolean;
|
||||
}
|
||||
@ -38,11 +38,13 @@
|
||||
|
||||
<tr>
|
||||
<th>{{ $t('ntpinfo.Sunrise') }}</th>
|
||||
<td>{{ ntpDataList.sun_risetime }}</td>
|
||||
<td v-if="ntpDataList.sun_isSunsetAvailable">{{ ntpDataList.sun_risetime }}</td>
|
||||
<td v-else>{{ $t('ntpinfo.NotAvailable') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('ntpinfo.Sunset') }}</th>
|
||||
<td>{{ ntpDataList.sun_settime }}</td>
|
||||
<td v-if="ntpDataList.sun_isSunsetAvailable">{{ ntpDataList.sun_settime }}</td>
|
||||
<td v-else>{{ $t('ntpinfo.NotAvailable') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ $t('ntpinfo.Mode') }}</th>
|
||||
|
||||
@ -284,10 +284,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
|
||||
integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==
|
||||
|
||||
"@jridgewell/source-map@^0.3.2":
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.2.tgz#f45351aaed4527a298512ec72f81040c998580fb"
|
||||
integrity sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==
|
||||
"@jridgewell/source-map@^0.3.3":
|
||||
version "0.3.3"
|
||||
resolved "https://registry.yarnpkg.com/@jridgewell/source-map/-/source-map-0.3.3.tgz#8108265659d4c33e72ffe14e33d6cc5eb59f2fda"
|
||||
integrity sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==
|
||||
dependencies:
|
||||
"@jridgewell/gen-mapping" "^0.3.0"
|
||||
"@jridgewell/trace-mapping" "^0.3.9"
|
||||
@ -772,16 +772,16 @@ acorn@^7.1.1, acorn@^7.4.1:
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
|
||||
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
|
||||
|
||||
acorn@^8.5.0, acorn@^8.8.2:
|
||||
version "8.8.2"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"
|
||||
integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==
|
||||
|
||||
acorn@^8.8.0:
|
||||
version "8.8.0"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8"
|
||||
integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==
|
||||
|
||||
acorn@^8.8.2:
|
||||
version "8.8.2"
|
||||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.2.tgz#1b2f25db02af965399b9776b0c2c391276d37c4a"
|
||||
integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==
|
||||
|
||||
ajv@^6.10.0, ajv@^6.12.4:
|
||||
version "6.12.6"
|
||||
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
|
||||
@ -2418,13 +2418,13 @@ supports-preserve-symlinks-flag@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
|
||||
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
|
||||
|
||||
terser@^5.17.6:
|
||||
version "5.17.6"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-5.17.6.tgz#d810e75e1bb3350c799cd90ebefe19c9412c12de"
|
||||
integrity sha512-V8QHcs8YuyLkLHsJO5ucyff1ykrLVsR4dNnS//L5Y3NiSXpbK1J+WMVUs67eI0KTxs9JtHhgEQpXQVHlHI92DQ==
|
||||
terser@^5.17.7:
|
||||
version "5.17.7"
|
||||
resolved "https://registry.yarnpkg.com/terser/-/terser-5.17.7.tgz#2a8b134826fe179b711969fd9d9a0c2479b2a8c3"
|
||||
integrity sha512-/bi0Zm2C6VAexlGgLlVxA0P2lru/sdLyfCVaRMfKVo9nWxbmz7f/sD8VPybPeSUJaJcwmCJis9pBIhcVcG1QcQ==
|
||||
dependencies:
|
||||
"@jridgewell/source-map" "^0.3.2"
|
||||
acorn "^8.5.0"
|
||||
"@jridgewell/source-map" "^0.3.3"
|
||||
acorn "^8.8.2"
|
||||
commander "^2.20.0"
|
||||
source-map-support "~0.5.20"
|
||||
|
||||
@ -2471,10 +2471,10 @@ type-fest@^0.20.2:
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
|
||||
integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
|
||||
|
||||
typescript@^5.0.4:
|
||||
version "5.0.4"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.0.4.tgz#b217fd20119bd61a94d4011274e0ab369058da3b"
|
||||
integrity sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==
|
||||
typescript@^5.1.3:
|
||||
version "5.1.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.1.3.tgz#8d84219244a6b40b6fb2b33cc1c062f715b9e826"
|
||||
integrity sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==
|
||||
|
||||
ufo@^1.1.2:
|
||||
version "1.1.2"
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user