Ver Fonte

feat(core): implemented temp and graphic switch

sezuisa há 10 meses atrás
pai
commit
55405a055e
1 ficheiros alterados com 370 adições e 65 exclusões
  1. 370 65
      WeatherMatrix/WeatherMatrix.ino

+ 370 - 65
WeatherMatrix/WeatherMatrix.ino

@@ -4,6 +4,7 @@
 #include <ESP8266WiFi.h>
 #include <ESP8266WiFiMulti.h>
 #include <WiFiClient.h>
+#include <Array.h>
 
 #define LED_PIN  0
 
@@ -19,7 +20,7 @@
 
 const char* ssid = STASSID;
 const char* password = STAPSK;
- 
+
 // networking and json
 String apiUrl;
 int status = WL_IDLE_STATUS;
@@ -27,12 +28,17 @@ int status = WL_IDLE_STATUS;
 ESP8266WiFiMulti WiFiMulti;
 WiFiClient client;
 HTTPClient http;
+boolean tempView = false;
+int respCode = 0;
 
-unsigned long millisTime;
+unsigned long startMillis1; 
+unsigned long currentMillis1;
+unsigned long startMillis2; 
+unsigned long currentMillis2;
 boolean firstIteration = true;
 
 void connectWiFi() {
-  
+
   // We start by connecting to a WiFi network
   WiFi.mode(WIFI_STA);
   WiFiMulti.addAP(ssid, password);
@@ -58,7 +64,7 @@ String buildAPIUrl (double lat, double lon, const String& apiKey) {
   const String latStr(lat, 4);
   const String lonStr(lon, 4);
   return String("http://api.openweathermap.org/data/2.5/weather?lat=" +
-                latStr + "&lon=" + lonStr + "&appid=" + apiKey);
+                latStr + "&lon=" + lonStr + "&appid=" + apiKey + "&units=metric");
 }
 
 // Params for width and height
@@ -126,44 +132,209 @@ uint8_t cloud_yx[16][16] = {
 };
 
 uint8_t rain_yx[16][16] = {
-  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
-  {0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0},
-  {0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0},
-  {0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0},
-  {0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0},
-  {0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,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1, 0, 0, 0, 0, 0, 0},
+  {0, 1, 1, 1, 1, 1, 1, 0}
+};
+
+uint8_t three[11][8] = {
+  {0, 0, 1, 1, 1, 0, 0, 0},
+  {0, 1, 0, 0, 0, 1, 0, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 0, 0, 0, 0, 1, 0, 0},
+  {0, 0, 0, 1, 1, 0, 0, 0},
+  {0, 0, 0, 0, 0, 1, 0, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 1, 0, 0, 0, 1, 0, 0},
+  {0, 0, 1, 1, 1, 0, 0, 0}
+};
+
+uint8_t four[11][8] = {
+  {0, 1, 0, 0, 0, 0, 0, 0},
+  {0, 1, 0, 0, 0, 0, 0, 0},
+  {0, 1, 0, 0, 0, 0, 0, 0},
+  {0, 1, 0, 0, 1, 0, 0, 0},
+  {0, 1, 0, 0, 1, 0, 0, 0},
+  {0, 1, 0, 0, 1, 0, 0, 0},
+  {0, 1, 1, 1, 1, 1, 1, 0},
+  {0, 0, 0, 0, 1, 0, 0, 0},
+  {0, 0, 0, 0, 1, 0, 0, 0},
+  {0, 0, 0, 0, 1, 0, 0, 0},
+  {0, 0, 0, 0, 1, 0, 0, 0}
+};
+
+uint8_t five[11][8] = {
+  {0, 1, 1, 1, 1, 1, 1, 0},
+  {0, 1, 0, 0, 0, 0, 0, 0},
+  {0, 1, 0, 0, 0, 0, 0, 0},
+  {0, 1, 0, 0, 0, 0, 0, 0},
+  {0, 1, 0, 0, 0, 0, 0, 0},
+  {0, 0, 1, 1, 1, 1, 0, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 1, 0, 0, 0, 0, 1, 0},
+  {0, 0, 1, 1, 1, 1, 0, 0}
+};
+
+uint8_t six[11][8] = {
+  {0,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1, 0},
+  {0, 1, 0, 0, 0, 0, 1, 0},
+  {0, 1, 0, 0, 0, 0, 1, 0},
+  {0, 0, 1, 1, 1, 1, 1, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 0, 0, 0, 0, 0, 1, 0},
+  {0, 1, 0, 0, 0, 0, 1, 0},
+  {0, 1, 0, 0, 0, 0, 1, 0},
+  {0, 0, 1, 1, 1, 1, 0, 0}
 };
 
-void DrawFrame(uint8_t arr[][16], String identifier)
+uint8_t (*digitOne)[8];
+
+uint8_t (*digitTwo)[8];
+
+void drawFrame(uint8_t arr[][16], String identifier)
 {
   FastLED.clear();
   FastLED.show();
@@ -182,18 +353,18 @@ void DrawFrame(uint8_t arr[][16], String identifier)
         } else if (identifier == "Sun") {
           leds[ XYsafe(i, j)]  = CRGB::Yellow;
         } else if (identifier == "CloudSun") {
-          if ((((i >= 0) && (i <= 8)) 
-          && ((j >= 0) && (j <= 2))) 
-          || 
-          (((i >= 0) && (i <= 4)) 
-          && ((j >= 0) && (j <= 15)))) {
+          if ((((i >= 0) && (i <= 8))
+               && ((j >= 0) && (j <= 2)))
+              ||
+              (((i >= 0) && (i <= 4))
+               && ((j >= 0) && (j <= 15)))) {
             leds[ XYsafe(i, j)]  = CRGB::Yellow;
             Serial.println("Yellow!");
           } else {
             leds[ XYsafe(i, j)]  = CRGB::WhiteSmoke;
             Serial.println("White!");
           }
-          
+
         }
       }
     }
@@ -201,39 +372,171 @@ void DrawFrame(uint8_t arr[][16], String identifier)
   FastLED.show();
 }
 
+void drawTemp()
+{
+  FastLED.clear();
+  FastLED.show();
+  for (int i = 0; i < 5; i++) {
+    for (int j = 0; j < 16; j++) {
+      // Celsius Symbol
+      uint8_t elemCelsius = celsius[i][j];
+      if (elemCelsius == 1) {
+        leds[ XYsafe(i, j)]  = CRGB::WhiteSmoke;
+      }
+    }
+  }
+}
+
+void drawFirstDigit(int num) {
+  for (int i = 0; i < 11; i++) {
+    for (int j = 0; j < 8; j++) {
+      uint8_t elem;
+      switch (num) {
+        case 1:
+          elem = one[i][j];
+          break;
+        case 2:
+          elem = two[i][j];
+          break;
+        case 3:
+          elem = three[i][j];
+          break;
+        case 4:
+          elem = four[i][j];
+          break;
+        case 5:
+          elem = five[i][j];
+          break;
+        case 6:
+          elem = six[i][j];
+          break;
+        case 7:
+          elem = seven[i][j];
+          break;
+        case 8:
+          elem = eight[i][j];
+          break;
+        case 9:
+          elem = nine[i][j];
+          break;
+        default:
+          elem = 0;
+          break;
+      }
+      if (elem == 1) {
+        leds[ XYsafe(i + 5, j)]  = CRGB::WhiteSmoke;
+      }
+    }
+  }
+}
+
+void drawSecondDigit(int num) {
+  for (int i = 0; i < 11; i++) {
+    for (int j = 0; j < 8; j++) {
+      uint8_t elem;
+      switch (num) {
+        case 1:
+          elem = one[i][j];
+          break;
+        case 2:
+          elem = two[i][j];
+          break;
+        case 3:
+          elem = three[i][j];
+          break;
+        case 4:
+          elem = four[i][j];
+          break;
+        case 5:
+          elem = five[i][j];
+          break;
+        case 6:
+          elem = six[i][j];
+          break;
+        case 7:
+          elem = seven[i][j];
+          break;
+        case 8:
+          elem = eight[i][j];
+          break;
+        case 9:
+          elem = nine[i][j];
+          break;
+        default:
+          elem = zero[i][j];
+          break;
+      }
+      if (elem == 1) {
+        leds[ XYsafe(i + 5, j + 8)]  = CRGB::WhiteSmoke;
+      }
+    }
+  }
+  FastLED.show();
+}
 
+int extractDigit(int num, int i)
+{
+  return num / i % 10 ;
+}
 
 void loop()
 {
-  millisTime = millis();
+  currentMillis1 = millis();
+  currentMillis2 = millis();
 
-  if (firstIteration || millisTime % 60000 == 0) {
-    int respCode = http.GET();
+  if (firstIteration || (currentMillis1 - startMillis1 >= 10000)) {
+    respCode = http.GET();
+    firstIteration = false;
+    startMillis1 = currentMillis1;
+  }
 
+  if (respCode > 0) {
     JsonDocument payload;
+    const String response = http.getString();
+    deserializeJson(payload, response);
+    if (currentMillis2 - startMillis2 >= 3000) {
+      if (tempView) {
+        Serial.print("Response: ");
+        Serial.println(response);
+
+        int temp = (int) payload["main"]["temp"];
+
+        Serial.print("Temp: ");
+        Serial.println(temp);
 
-    if(respCode > 0){
-      const String response = http.getString();
-      deserializeJson(payload, response);
+        int firstDigit = extractDigit(temp, 10);
+        int secondDigit = extractDigit(temp, 1);
 
-      if (String("Clouds") == String(payload["weather"][0]["main"])) {
-        if (payload["weather"][0]["id"] >= 803) {
-          DrawFrame(cloud_yx, "Clouds");
+        Serial.print("First digit: ");
+        Serial.println(firstDigit);
+        Serial.print("Second digit: ");
+        Serial.println(secondDigit);
+
+        drawTemp();
+        drawFirstDigit(firstDigit);
+        drawSecondDigit(secondDigit);
+      } else {
+
+        if (String("Clouds") == String(payload["weather"][0]["main"])) {
+          if (payload["weather"][0]["id"] >= 803) {
+            drawFrame(cloud_yx, "Clouds");
+          } else {
+            drawFrame(cloudSun_yx, "CloudSun");
+          }
+        } else if (String("Rain") == String(payload["weather"][0]["main"]) || String("Drizzle") == String(payload["weather"][0]["main"])) {
+          drawFrame(rain_yx, "Rain");
+        } else if (String("Clear") == String(payload["weather"][0]["main"])) {
+          drawFrame(sun_yx, "Sun");
         } else {
-          DrawFrame(cloudSun_yx, "CloudSun");
+          drawFrame(cloudSun_yx, "CloudSun");
         }
-      } else if (String("Rain") == String(payload["weather"][0]["main"]) || String("Drizzle") == String(payload["weather"][0]["main"])) {
-        DrawFrame(rain_yx, "Rain");
-      } else if (String("Clear") == String(payload["weather"][0]["main"])) {
-        DrawFrame(sun_yx, "Sun");
-      } else {
-        DrawFrame(cloudSun_yx, "CloudSun");
       }
-    } else {
-      Serial.print("error ");
-      Serial.println(respCode);
+      tempView = !tempView;
+      startMillis2 = currentMillis2;
     }
-    firstIteration = false;
+  } else {
+    Serial.print("error ");
+    Serial.println(respCode);
   }
 }
 
@@ -241,6 +544,8 @@ void loop()
 
 
 void setup() {
+  startMillis1 = millis();
+  startMillis2 = millis();
   Serial.begin(115200);
 
   // weather api
@@ -249,12 +554,12 @@ void setup() {
   const String apiKey = "e471293b25fdb6697c0a862f2695df5f";
   apiUrl = buildAPIUrl(lat, lon, apiKey);
   connectWiFi();
-  
+
   if (WiFi.status() != WL_CONNECTED) {
     Serial.println(WiFi.status());
   }
   http.begin(client, apiUrl);
-  
+
   FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection(TypicalSMD5050);
   FastLED.setBrightness( BRIGHTNESS );
 }