commit
						b53574dbdc
					
				| 
						 | 
					@ -237,11 +237,11 @@ SensorData calcSunsetSunrise(GwApi *api, double time, double date, double latitu
 | 
				
			||||||
    int intminSS = 0;
 | 
					    int intminSS = 0;
 | 
				
			||||||
    bool sunDown = false;
 | 
					    bool sunDown = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//    api->getLogger()->logDebug(GwLog::DEBUG,"... calcSun: Lat %f, Lon  %f, at: %d, next SR: %d, next SS: %d", latitude, longitude, t, sunR, sunS);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!isnan(time) && !isnan(date) && !isnan(latitude) && !isnan(longitude) && !isnan(timezone)) {
 | 
					    if (!isnan(time) && !isnan(date) && !isnan(latitude) && !isnan(longitude) && !isnan(timezone)) {
 | 
				
			||||||
        // Calculate local time
 | 
					        
 | 
				
			||||||
        t = (date * secPerYear) + (time + int(timezone * secPerHour));    
 | 
					        // Calculate local epoch
 | 
				
			||||||
 | 
					        t = (date * secPerYear) + time;    
 | 
				
			||||||
 | 
					        // api->getLogger()->logDebug(GwLog::DEBUG,"... calcSun: Lat %f, Lon  %f, at: %d ", latitude, longitude, t);
 | 
				
			||||||
        sr.calculate(latitude, longitude, t);       // LAT, LON, EPOCH
 | 
					        sr.calculate(latitude, longitude, t);       // LAT, LON, EPOCH
 | 
				
			||||||
        // Sunrise
 | 
					        // Sunrise
 | 
				
			||||||
        if (sr.hasRise) {
 | 
					        if (sr.hasRise) {
 | 
				
			||||||
| 
						 | 
					@ -256,7 +256,7 @@ SensorData calcSunsetSunrise(GwApi *api, double time, double date, double latitu
 | 
				
			||||||
            intminSS = int((sunS - inthrSS * secPerHour)/60);      
 | 
					            intminSS = int((sunS - inthrSS * secPerHour)/60);      
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // Sun control (return value by sun on sky = false, sun down = true)
 | 
					        // Sun control (return value by sun on sky = false, sun down = true)
 | 
				
			||||||
        if ((t >= (sr.riseTime + int(timezone * secPerHour))) && (t <= (sr.setTime + int(timezone * secPerHour))))      
 | 
					        if ((t >= sr.riseTime) && (t <= sr.setTime))      
 | 
				
			||||||
             sunDown = false; 
 | 
					             sunDown = false; 
 | 
				
			||||||
        else sunDown = true;
 | 
					        else sunDown = true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -266,8 +266,6 @@ SensorData calcSunsetSunrise(GwApi *api, double time, double date, double latitu
 | 
				
			||||||
    returnset.sunriseHour = inthrSR;
 | 
					    returnset.sunriseHour = inthrSR;
 | 
				
			||||||
    returnset.sunriseMinute = intminSR;
 | 
					    returnset.sunriseMinute = intminSR;
 | 
				
			||||||
    returnset.sunDown = sunDown;
 | 
					    returnset.sunDown = sunDown;
 | 
				
			||||||
 | 
					 | 
				
			||||||
//    api->getLogger()->logDebug(GwLog::DEBUG,"... calcSun: at t: %d, hasRise: %d, next SR: %d, hasSet: %d, next SS: %d\n", t, sr.hasRise, sr.riseTime, sr.hasSet, sr.setTime);
 | 
					 | 
				
			||||||
    return returnset;
 | 
					    return returnset;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -169,8 +169,6 @@ public:
 | 
				
			||||||
            sunset = String(commonData.data.sunsetHour) + ":" +  String(commonData.data.sunsetMinute + 100).substring(1);
 | 
					            sunset = String(commonData.data.sunsetHour) + ":" +  String(commonData.data.sunsetMinute + 100).substring(1);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        LOG_DEBUG(GwLog::LOG,"sunrise: .%s., sunset: .%s.", String(commonData.data.sunriseMinute + 100), String(commonData.data.sunsetMinute + 100));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        display.setTextColor(textcolor);
 | 
					        display.setTextColor(textcolor);
 | 
				
			||||||
        display.setFont(&Ubuntu_Bold8pt7b);
 | 
					        display.setFont(&Ubuntu_Bold8pt7b);
 | 
				
			||||||
        display.setCursor(335, 250);
 | 
					        display.setCursor(335, 250);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,6 +22,6 @@ lib_deps =
 | 
				
			||||||
build_flags=
 | 
					build_flags=
 | 
				
			||||||
    -D BOARD_NODEMCU32S_OBP60
 | 
					    -D BOARD_NODEMCU32S_OBP60
 | 
				
			||||||
    ${env.build_flags}
 | 
					    ${env.build_flags}
 | 
				
			||||||
upload_port = COM3
 | 
					upload_port = COM6
 | 
				
			||||||
upload_protocol = esptool
 | 
					upload_protocol = esptool
 | 
				
			||||||
monitor_speed = 115200
 | 
					monitor_speed = 115200
 | 
				
			||||||
		Loading…
	
		Reference in New Issue