stash
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
j3d1 2021-11-18 08:03:39 +01:00
parent 875b3a8999
commit f9b13d4c06
2 changed files with 10 additions and 9 deletions

View file

@ -77,7 +77,7 @@ void user_init(void) {
xTaskCreate(&httpd_task, "httpd_task", 2048, NULL, 2, NULL); xTaskCreate(&httpd_task, "httpd_task", 2048, NULL, 2, NULL);
xTaskCreate(&lux_task, "lux_task", 512, NULL, 1, NULL); //xTaskCreate(&lux_task, "lux_task", 512, NULL, 1, NULL);
xTaskCreate(&sntp_task, "sntp_task", 512, NULL, 1, NULL); xTaskCreate(&sntp_task, "sntp_task", 512, NULL, 1, NULL);

View file

@ -14,6 +14,7 @@
#include <semphr.h> #include <semphr.h>
#include "ntp.h" #include "ntp.h"
#include "log.h"
#define DAYTIME(h, m, s) (h*3600+m*60+s) #define DAYTIME(h, m, s) (h*3600+m*60+s)
@ -158,7 +159,7 @@ extern "C" void manual_switch() {
vTaskDelay(1000 / portTICK_PERIOD_MS); vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("START>\n"); syslog("START>\n");
while (true) { while (true) {
@ -193,15 +194,15 @@ extern "C" void manual_switch() {
if(s == BOOT_S) { if(s == BOOT_S) {
if(rt >= settings.sunrise_start) { if(rt >= settings.sunrise_start) {
s = SUNRISE_S; s = SUNRISE_S;
printf("SUNRISE_S\n"); syslog("SUNRISE_S\n");
} }
if(rt >= settings.sunrise_end) { if(rt >= settings.sunrise_end) {
s = MORNING_S; s = MORNING_S;
printf("MORNING_S\n"); syslog("MORNING_S\n");
} }
if(rt >= settings.sunset_time || rt < settings.sunrise_start) { if(rt >= settings.sunset_time || rt < settings.sunrise_start) {
s = NIGHT_S; s = NIGHT_S;
printf("NIGHT_S\n"); syslog("NIGHT_S\n");
} }
printf("%ld | %ld %ld %ld %ld\n", rt, printf("%ld | %ld %ld %ld %ld\n", rt,
@ -212,7 +213,7 @@ extern "C" void manual_switch() {
} else if(s == SUNRISE_S) { } else if(s == SUNRISE_S) {
if(rt >= settings.sunrise_end) { if(rt >= settings.sunrise_end) {
s = MORNING_S; s = MORNING_S;
printf("MORNING_S\n"); syslog("MORNING_S\n");
} else { } else {
int steps = (settings.sunrise_end - settings.sunrise_start) * (1000 / 50); int steps = (settings.sunrise_end - settings.sunrise_start) * (1000 / 50);
int t = (rt - settings.sunrise_start) * (1000 / 50); int t = (rt - settings.sunrise_start) * (1000 / 50);
@ -245,7 +246,7 @@ extern "C" void manual_switch() {
} else if(s == MORNING_S) { } else if(s == MORNING_S) {
if(rt >= settings.sunrise_shutdown) { if(rt >= settings.sunrise_shutdown) {
s = DAY_S; s = DAY_S;
printf("DAY_S\n"); syslog("DAY_S\n");
} else { } else {
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -259,7 +260,7 @@ extern "C" void manual_switch() {
} else if(s == DAY_S) { } else if(s == DAY_S) {
if(rt >= settings.sunset_time) { if(rt >= settings.sunset_time) {
s = NIGHT_S; s = NIGHT_S;
printf("NIGHT_S\n"); syslog("NIGHT_S\n");
} else { } else {
for (int j = 0; j < 4; j++) for (int j = 0; j < 4; j++)
for (int i = 0; i < 10; i++) { for (int i = 0; i < 10; i++) {
@ -274,7 +275,7 @@ extern "C" void manual_switch() {
} else if(s == NIGHT_S) { } else if(s == NIGHT_S) {
if(rt >= settings.sunrise_start && rt < settings.sunset_time) { if(rt >= settings.sunrise_start && rt < settings.sunset_time) {
s = SUNRISE_S; s = SUNRISE_S;
printf("SUNRISE_S\n"); syslog("SUNRISE_S\n");
} }
} }