Parse events every 3 hours. FIx variable types for proper calculations
This commit is contained in:
parent
1b18919543
commit
9c01dc2435
1 changed files with 9 additions and 5 deletions
14
monitor.ino
14
monitor.ino
|
@ -99,7 +99,8 @@ int adjustForTimezone(int epoch){
|
|||
return epoch + TIMEZONE_OFFSET;
|
||||
}
|
||||
|
||||
void parseEvents(String json){
|
||||
void parseEvents(){
|
||||
String json = getSolarEventJson();
|
||||
StaticJsonBuffer<1024> jsonBuffer;
|
||||
JsonObject &root = jsonBuffer.parseObject(json);
|
||||
|
||||
|
@ -135,8 +136,7 @@ void setup() {
|
|||
delay(2000);
|
||||
configTime(0, 0, NTP_POOL);
|
||||
|
||||
String json = getSolarEventJson();
|
||||
parseEvents(json);
|
||||
parseEvents();
|
||||
|
||||
FastLED.addLeds<WS2811, LIGHT_PIN, GRB>(_leds, LED_COUNT).setCorrection(TypicalSMD5050).setTemperature(Tungsten40W);
|
||||
}
|
||||
|
@ -180,8 +180,8 @@ void publishTemperature() {
|
|||
|
||||
float getIndexMultiplier(int now, int startTime, int endTime, bool swap){
|
||||
float indexMultiplier = 1;
|
||||
int a = swap ? endTime - now : now - startTime;
|
||||
int b = endTime - startTime;
|
||||
float a = swap ? endTime - now : now - startTime;
|
||||
float b = endTime - startTime;
|
||||
return constrain(a / b, 0, 1);
|
||||
}
|
||||
|
||||
|
@ -197,6 +197,10 @@ void doLighting() {
|
|||
fill_solid(_leds, LED_COUNT, colour);
|
||||
FastLED.show();
|
||||
}
|
||||
|
||||
EVERY_N_SECONDS(10800){
|
||||
parseEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void publishReadings(){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue