1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00
This commit is contained in:
norbert-walter
2022-04-01 18:41:58 +02:00
parent dca9d96957
commit 40b7daad16
3 changed files with 48 additions and 1 deletions

View File

@@ -391,6 +391,13 @@ void OBP60Task(GwApi *api){
setPortPin(OBP_FLASH_LED, true);
}
// Back light with sun control
if(String(backlight) == "Control by Sun"){
if(time->valid == true && date->valid == true && lat->valid == true && lon->valid == true){
setPortPin(OBP_BACKLIGHT_LED, sunControl(time->value, date->value, lat->value, lon->value, tz.toDouble()));
}
}
// Check the keyboard message
int keyboardMessage=0;
while (xQueueReceive(allParameters.queue,&keyboardMessage,0)){
@@ -441,11 +448,17 @@ void OBP60Task(GwApi *api){
LOG_DEBUG(GwLog::LOG,"set pagenumber to %d",pageNumber);
}
// Calculate sunrise and sunset all 1s
// Calculate sunrise, sunset and backlight control with sun status all 1s
if(millis() > starttime5 + 1000){
starttime5 = millis();
if(time->valid == true && date->valid == true && lat->valid == true && lon->valid == true){
commonData.data = calcSunsetSunrise(time->value , date->value, lat->value, lon->value, tz.toDouble());
// Backlight with sun control
if(String(backlight) == "Control by Sun"){
if(time->valid == true && date->valid == true && lat->valid == true && lon->valid == true){
setPortPin(OBP_BACKLIGHT_LED, sunControl(time->value, date->value, lat->value, lon->value, tz.toDouble()));
}
}
}
}