Merge pull request #2057 from adafruit/spdx-35
Added SPDX to 30 more files - spdx-35
This commit is contained in:
commit
f8a82d5a7e
30 changed files with 980 additions and 860 deletions
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Limor Fried for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
// Stream MP3s over WiFi on Metro M4 Express and play via music maker shield
|
// Stream MP3s over WiFi on Metro M4 Express and play via music maker shield
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import digitalio
|
import digitalio
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Anne Barela for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from adafruit_ble.uart_client import UARTClient
|
from adafruit_ble.uart_client import UARTClient
|
||||||
from adafruit_ble.scanner import Scanner
|
from adafruit_ble.scanner import Scanner
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Anne Barela for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from adafruit_ble.uart_server import UARTServer
|
from adafruit_ble.uart_server import UARTServer
|
||||||
from adafruit_bluefruit_connect.packet import Packet
|
from adafruit_bluefruit_connect.packet import Packet
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const uint8_t meteocons12pt7bBitmaps[] PROGMEM = {
|
const uint8_t meteocons12pt7bBitmaps[] PROGMEM = {
|
||||||
|
|
@ -312,4 +316,4 @@ const GFXfont meteocons12pt7b PROGMEM = {
|
||||||
(GFXglyph *)meteocons12pt7bGlyphs,
|
(GFXglyph *)meteocons12pt7bGlyphs,
|
||||||
0x20, 0x7E, 25 };
|
0x20, 0x7E, 25 };
|
||||||
|
|
||||||
// Approx. 3162 bytes
|
// Approx. 3162 bytes
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const uint8_t meteocons16pt7bBitmaps[] PROGMEM = {
|
const uint8_t meteocons16pt7bBitmaps[] PROGMEM = {
|
||||||
|
|
@ -446,4 +450,4 @@ const GFXfont meteocons16pt7b PROGMEM = {
|
||||||
(GFXglyph *)meteocons16pt7bGlyphs,
|
(GFXglyph *)meteocons16pt7bGlyphs,
|
||||||
0x20, 0x7E, 32 };
|
0x20, 0x7E, 32 };
|
||||||
|
|
||||||
// Approx. 4776 bytes
|
// Approx. 4776 bytes
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const uint8_t meteocons20pt7bBitmaps[] PROGMEM = {
|
const uint8_t meteocons20pt7bBitmaps[] PROGMEM = {
|
||||||
|
|
@ -642,4 +646,4 @@ const GFXfont meteocons20pt7b PROGMEM = {
|
||||||
(GFXglyph *)meteocons20pt7bGlyphs,
|
(GFXglyph *)meteocons20pt7bGlyphs,
|
||||||
0x20, 0x7E, 40 };
|
0x20, 0x7E, 40 };
|
||||||
|
|
||||||
// Approx. 7124 bytes
|
// Approx. 7124 bytes
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const uint8_t meteocons24pt7bBitmaps[] PROGMEM = {
|
const uint8_t meteocons24pt7bBitmaps[] PROGMEM = {
|
||||||
|
|
@ -891,4 +895,4 @@ const GFXfont meteocons24pt7b PROGMEM = {
|
||||||
(GFXglyph *)meteocons24pt7bGlyphs,
|
(GFXglyph *)meteocons24pt7bGlyphs,
|
||||||
0x20, 0x7E, 48 };
|
0x20, 0x7E, 48 };
|
||||||
|
|
||||||
// Approx. 10108 bytes
|
// Approx. 10108 bytes
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const uint8_t meteocons36pt7bBitmaps[] PROGMEM = {
|
const uint8_t meteocons36pt7bBitmaps[] PROGMEM = {
|
||||||
|
|
@ -1882,4 +1886,4 @@ const GFXfont meteocons36pt7b PROGMEM = {
|
||||||
(GFXglyph *)meteocons36pt7bGlyphs,
|
(GFXglyph *)meteocons36pt7bGlyphs,
|
||||||
0x20, 0x7E, 73 };
|
0x20, 0x7E, 73 };
|
||||||
|
|
||||||
// Approx. 22006 bytes
|
// Approx. 22006 bytes
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
const uint8_t meteocons48pt7bBitmaps[] PROGMEM = {
|
const uint8_t meteocons48pt7bBitmaps[] PROGMEM = {
|
||||||
|
|
@ -3242,4 +3246,4 @@ const GFXfont meteocons48pt7b PROGMEM = {
|
||||||
(GFXglyph *)meteocons48pt7bGlyphs,
|
(GFXglyph *)meteocons48pt7bGlyphs,
|
||||||
0x20, 0x7E, 96 };
|
0x20, 0x7E, 96 };
|
||||||
|
|
||||||
// Approx. 38323 bytes
|
// Approx. 38323 bytes
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
const uint8_t moon_phases12pt7bBitmaps[] PROGMEM = {
|
const uint8_t moon_phases12pt7bBitmaps[] PROGMEM = {
|
||||||
0x00, 0xFC, 0x00, 0x0F, 0xFE, 0x00, 0xFF, 0xFC, 0x07, 0xFF, 0xE8, 0x3F,
|
0x00, 0xFC, 0x00, 0x0F, 0xFE, 0x00, 0xFF, 0xFC, 0x07, 0xFF, 0xE8, 0x3F,
|
||||||
0xFF, 0xD0, 0xFF, 0xFF, 0xE7, 0xFF, 0xFE, 0x9F, 0xFF, 0xFE, 0xFF, 0xFF,
|
0xFF, 0xD0, 0xFF, 0xFF, 0xE7, 0xFF, 0xFE, 0x9F, 0xFF, 0xFE, 0xFF, 0xFF,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
const uint8_t moon_phases16pt7bBitmaps[] PROGMEM = {
|
const uint8_t moon_phases16pt7bBitmaps[] PROGMEM = {
|
||||||
0x00, 0x3F, 0xC0, 0x00, 0x0F, 0xFF, 0x00, 0x03, 0xFF, 0xEC, 0x00, 0x7F,
|
0x00, 0x3F, 0xC0, 0x00, 0x0F, 0xFF, 0x00, 0x03, 0xFF, 0xEC, 0x00, 0x7F,
|
||||||
0xFF, 0xE0, 0x0F, 0xFF, 0xFD, 0x01, 0xFF, 0xFF, 0xE8, 0x3F, 0xFF, 0xFE,
|
0xFF, 0xE0, 0x0F, 0xFF, 0xFD, 0x01, 0xFF, 0xFF, 0xE8, 0x3F, 0xFF, 0xFE,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
const uint8_t moon_phases20pt7bBitmaps[] PROGMEM = {
|
const uint8_t moon_phases20pt7bBitmaps[] PROGMEM = {
|
||||||
0x00, 0x07, 0xF8, 0x00, 0x00, 0x07, 0xFF, 0x60, 0x00, 0x03, 0xFF, 0xFF,
|
0x00, 0x07, 0xF8, 0x00, 0x00, 0x07, 0xFF, 0x60, 0x00, 0x03, 0xFF, 0xFF,
|
||||||
0x00, 0x00, 0xFF, 0xFF, 0xD8, 0x00, 0x7F, 0xFF, 0xFE, 0x80, 0x1F, 0xFF,
|
0x00, 0x00, 0xFF, 0xFF, 0xD8, 0x00, 0x7F, 0xFF, 0xFE, 0x80, 0x1F, 0xFF,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
const uint8_t moon_phases24pt7bBitmaps[] PROGMEM = {
|
const uint8_t moon_phases24pt7bBitmaps[] PROGMEM = {
|
||||||
0x00, 0x00, 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0x80, 0x00, 0x00,
|
0x00, 0x00, 0x7F, 0xC0, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0x80, 0x00, 0x00,
|
||||||
0x3F, 0xFE, 0xFC, 0x00, 0x00, 0x1F, 0xFF, 0xFB, 0xC0, 0x00, 0x07, 0xFF,
|
0x3F, 0xFE, 0xFC, 0x00, 0x00, 0x1F, 0xFF, 0xFB, 0xC0, 0x00, 0x07, 0xFF,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
const uint8_t moon_phases36pt7bBitmaps[] PROGMEM = {
|
const uint8_t moon_phases36pt7bBitmaps[] PROGMEM = {
|
||||||
0x00, 0x00, 0x00, 0x1F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
0x00, 0x00, 0x00, 0x1F, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
|
||||||
0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0x7E, 0x00, 0x00,
|
0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xFF, 0xFF, 0x7E, 0x00, 0x00,
|
||||||
|
|
|
||||||
|
|
@ -1,183 +1,187 @@
|
||||||
#include "OpenWeatherMap.h"
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
String AirliftOpenWeatherMap::buildUrlCurrent(String appId, String location) {
|
// SPDX-License-Identifier: MIT
|
||||||
String units = OWM_METRIC ? "metric" : "imperial";
|
|
||||||
return "http://api.openweathermap.org/data/2.5/weather?q=" + location + "&appid=" + appId + "&units=" + units + "&lang=" + String(OWM_LANGUAGE);
|
#include "OpenWeatherMap.h"
|
||||||
}
|
|
||||||
|
String AirliftOpenWeatherMap::buildUrlCurrent(String appId, String location) {
|
||||||
String AirliftOpenWeatherMap::buildUrlForecast(String appId, String location) {
|
String units = OWM_METRIC ? "metric" : "imperial";
|
||||||
String units = OWM_METRIC ? "metric" : "imperial";
|
return "http://api.openweathermap.org/data/2.5/weather?q=" + location + "&appid=" + appId + "&units=" + units + "&lang=" + String(OWM_LANGUAGE);
|
||||||
return "http://api.openweathermap.org/data/2.5/forecast?q=" + location + "&cnt=6&appid=" + appId + "&units=" + units + "&lang=" + String(OWM_LANGUAGE);
|
}
|
||||||
}
|
|
||||||
|
String AirliftOpenWeatherMap::buildUrlForecast(String appId, String location) {
|
||||||
String AirliftOpenWeatherMap::getMeteoconIcon(String icon) {
|
String units = OWM_METRIC ? "metric" : "imperial";
|
||||||
// clear sky
|
return "http://api.openweathermap.org/data/2.5/forecast?q=" + location + "&cnt=6&appid=" + appId + "&units=" + units + "&lang=" + String(OWM_LANGUAGE);
|
||||||
// 01d
|
}
|
||||||
if (icon == "01d") {
|
|
||||||
return "B";
|
String AirliftOpenWeatherMap::getMeteoconIcon(String icon) {
|
||||||
}
|
// clear sky
|
||||||
// 01n
|
// 01d
|
||||||
if (icon == "01n") {
|
if (icon == "01d") {
|
||||||
return "C";
|
return "B";
|
||||||
}
|
}
|
||||||
// few clouds
|
// 01n
|
||||||
// 02d
|
if (icon == "01n") {
|
||||||
if (icon == "02d") {
|
return "C";
|
||||||
return "H";
|
}
|
||||||
}
|
// few clouds
|
||||||
// 02n
|
// 02d
|
||||||
if (icon == "02n") {
|
if (icon == "02d") {
|
||||||
return "4";
|
return "H";
|
||||||
}
|
}
|
||||||
// scattered clouds
|
// 02n
|
||||||
// 03d
|
if (icon == "02n") {
|
||||||
if (icon == "03d") {
|
return "4";
|
||||||
return "N";
|
}
|
||||||
}
|
// scattered clouds
|
||||||
// 03n
|
// 03d
|
||||||
if (icon == "03n") {
|
if (icon == "03d") {
|
||||||
return "5";
|
return "N";
|
||||||
}
|
}
|
||||||
// broken clouds
|
// 03n
|
||||||
// 04d
|
if (icon == "03n") {
|
||||||
if (icon == "04d") {
|
return "5";
|
||||||
return "Y";
|
}
|
||||||
}
|
// broken clouds
|
||||||
// 04n
|
// 04d
|
||||||
if (icon == "04n") {
|
if (icon == "04d") {
|
||||||
return "%";
|
return "Y";
|
||||||
}
|
}
|
||||||
// shower rain
|
// 04n
|
||||||
// 09d
|
if (icon == "04n") {
|
||||||
if (icon == "09d") {
|
return "%";
|
||||||
return "R";
|
}
|
||||||
}
|
// shower rain
|
||||||
// 09n
|
// 09d
|
||||||
if (icon == "09n") {
|
if (icon == "09d") {
|
||||||
return "8";
|
return "R";
|
||||||
}
|
}
|
||||||
// rain
|
// 09n
|
||||||
// 10d
|
if (icon == "09n") {
|
||||||
if (icon == "10d") {
|
return "8";
|
||||||
return "Q";
|
}
|
||||||
}
|
// rain
|
||||||
// 10n
|
// 10d
|
||||||
if (icon == "10n") {
|
if (icon == "10d") {
|
||||||
return "7";
|
return "Q";
|
||||||
}
|
}
|
||||||
// thunderstorm
|
// 10n
|
||||||
// 11d
|
if (icon == "10n") {
|
||||||
if (icon == "11d") {
|
return "7";
|
||||||
return "P";
|
}
|
||||||
}
|
// thunderstorm
|
||||||
// 11n
|
// 11d
|
||||||
if (icon == "11n") {
|
if (icon == "11d") {
|
||||||
return "6";
|
return "P";
|
||||||
}
|
}
|
||||||
// snow
|
// 11n
|
||||||
// 13d
|
if (icon == "11n") {
|
||||||
if (icon == "13d") {
|
return "6";
|
||||||
return "W";
|
}
|
||||||
}
|
// snow
|
||||||
// 13n
|
// 13d
|
||||||
if (icon == "13n") {
|
if (icon == "13d") {
|
||||||
return "#";
|
return "W";
|
||||||
}
|
}
|
||||||
// mist
|
// 13n
|
||||||
// 50d
|
if (icon == "13n") {
|
||||||
if (icon == "50d") {
|
return "#";
|
||||||
return "M";
|
}
|
||||||
}
|
// mist
|
||||||
// 50n
|
// 50d
|
||||||
if (icon == "50n") {
|
if (icon == "50d") {
|
||||||
return "M";
|
return "M";
|
||||||
}
|
}
|
||||||
// Nothing matched: N/A
|
// 50n
|
||||||
return ")";
|
if (icon == "50n") {
|
||||||
|
return "M";
|
||||||
}
|
}
|
||||||
|
// Nothing matched: N/A
|
||||||
bool AirliftOpenWeatherMap::updateCurrent(OpenWeatherMapCurrentData &data, String json)
|
return ")";
|
||||||
{
|
|
||||||
Serial->println("updateCurrent()");
|
}
|
||||||
DynamicJsonDocument doc(2000);
|
|
||||||
//StaticJsonDocument<2000> doc;
|
bool AirliftOpenWeatherMap::updateCurrent(OpenWeatherMapCurrentData &data, String json)
|
||||||
|
{
|
||||||
DeserializationError error = deserializeJson(doc, json);
|
Serial->println("updateCurrent()");
|
||||||
if (error) {
|
DynamicJsonDocument doc(2000);
|
||||||
Serial->println(String("deserializeJson() failed: ") + (const char *)error.c_str());
|
//StaticJsonDocument<2000> doc;
|
||||||
Serial->println(json);
|
|
||||||
setError(String("deserializeJson() failed: ") + error.c_str());
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
return false;
|
if (error) {
|
||||||
}
|
Serial->println(String("deserializeJson() failed: ") + (const char *)error.c_str());
|
||||||
|
Serial->println(json);
|
||||||
int code = (int) doc["cod"];
|
setError(String("deserializeJson() failed: ") + error.c_str());
|
||||||
if(code != 200)
|
return false;
|
||||||
{
|
}
|
||||||
Serial->println(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
|
||||||
setError(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
int code = (int) doc["cod"];
|
||||||
return false;
|
if(code != 200)
|
||||||
}
|
{
|
||||||
|
Serial->println(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
||||||
data.lat = (float) doc["coord"]["lat"];
|
setError(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
||||||
data.lon = (float) doc["coord"]["lon"];
|
return false;
|
||||||
|
}
|
||||||
data.main = (const char*) doc["weather"][0]["main"];
|
|
||||||
data.description = (const char*) doc["weather"][0]["description"];
|
data.lat = (float) doc["coord"]["lat"];
|
||||||
data.icon = (const char*) doc["weather"][0]["icon"];
|
data.lon = (float) doc["coord"]["lon"];
|
||||||
|
|
||||||
data.cityName = (const char*) doc["name"];
|
data.main = (const char*) doc["weather"][0]["main"];
|
||||||
data.visibility = (uint16_t) doc["visibility"];
|
data.description = (const char*) doc["weather"][0]["description"];
|
||||||
data.timezone = (time_t) doc["timezone"];
|
data.icon = (const char*) doc["weather"][0]["icon"];
|
||||||
|
|
||||||
data.country = (const char*) doc["sys"]["country"];
|
data.cityName = (const char*) doc["name"];
|
||||||
data.observationTime = (time_t) doc["dt"];
|
data.visibility = (uint16_t) doc["visibility"];
|
||||||
data.sunrise = (time_t) doc["sys"]["sunrise"];
|
data.timezone = (time_t) doc["timezone"];
|
||||||
data.sunset = (time_t) doc["sys"]["sunset"];
|
|
||||||
|
data.country = (const char*) doc["sys"]["country"];
|
||||||
data.temp = (float) doc["main"]["temp"];
|
data.observationTime = (time_t) doc["dt"];
|
||||||
data.pressure = (uint16_t) doc["main"]["pressure"];
|
data.sunrise = (time_t) doc["sys"]["sunrise"];
|
||||||
data.humidity = (uint8_t) doc["main"]["humidity"];
|
data.sunset = (time_t) doc["sys"]["sunset"];
|
||||||
data.tempMin = (float) doc["main"]["temp_min"];
|
|
||||||
data.tempMax = (float) doc["main"]["temp_max"];
|
data.temp = (float) doc["main"]["temp"];
|
||||||
|
data.pressure = (uint16_t) doc["main"]["pressure"];
|
||||||
data.windSpeed = (float) doc["wind"]["speed"];
|
data.humidity = (uint8_t) doc["main"]["humidity"];
|
||||||
data.windDeg = (float) doc["wind"]["deg"];
|
data.tempMin = (float) doc["main"]["temp_min"];
|
||||||
return true;
|
data.tempMax = (float) doc["main"]["temp_max"];
|
||||||
}
|
|
||||||
|
data.windSpeed = (float) doc["wind"]["speed"];
|
||||||
bool AirliftOpenWeatherMap::updateForecast(OpenWeatherMapForecastData &data, String json, int day)
|
data.windDeg = (float) doc["wind"]["deg"];
|
||||||
{
|
return true;
|
||||||
Serial->println("updateForecast()");
|
}
|
||||||
DynamicJsonDocument doc(5000);
|
|
||||||
//StaticJsonDocument<5000> doc;
|
bool AirliftOpenWeatherMap::updateForecast(OpenWeatherMapForecastData &data, String json, int day)
|
||||||
|
{
|
||||||
DeserializationError error = deserializeJson(doc, json);
|
Serial->println("updateForecast()");
|
||||||
if (error) {
|
DynamicJsonDocument doc(5000);
|
||||||
Serial->println(String("deserializeJson() failed: ") + (const char *)error.c_str());
|
//StaticJsonDocument<5000> doc;
|
||||||
Serial->println(json);
|
|
||||||
setError(String("deserializeJson() failed: ") + error.c_str());
|
DeserializationError error = deserializeJson(doc, json);
|
||||||
return false;
|
if (error) {
|
||||||
}
|
Serial->println(String("deserializeJson() failed: ") + (const char *)error.c_str());
|
||||||
|
Serial->println(json);
|
||||||
int code = (int) doc["cod"];
|
setError(String("deserializeJson() failed: ") + error.c_str());
|
||||||
if(code != 200)
|
return false;
|
||||||
{
|
}
|
||||||
Serial->println(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
|
||||||
setError(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
int code = (int) doc["cod"];
|
||||||
return false;
|
if(code != 200)
|
||||||
}
|
{
|
||||||
|
Serial->println(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
||||||
data.observationTime = (time_t) doc["list"][day]["dt"];
|
setError(String("OpenWeatherMap error: ") + (const char *)doc["message"]);
|
||||||
|
return false;
|
||||||
data.temp = (float) doc["list"][day]["main"]["temp"];
|
}
|
||||||
data.pressure = (uint16_t) doc["list"][day]["main"]["pressure"];
|
|
||||||
data.humidity = (uint8_t) doc["list"][day]["main"]["humidity"];
|
data.observationTime = (time_t) doc["list"][day]["dt"];
|
||||||
data.tempMin = (float) doc["list"][day]["main"]["temp_min"];
|
|
||||||
data.tempMax = (float) doc["list"][day]["main"]["temp_max"];
|
data.temp = (float) doc["list"][day]["main"]["temp"];
|
||||||
|
data.pressure = (uint16_t) doc["list"][day]["main"]["pressure"];
|
||||||
data.main = (const char*) doc["list"][day]["weather"][0]["main"];
|
data.humidity = (uint8_t) doc["list"][day]["main"]["humidity"];
|
||||||
data.description = (const char*) doc["list"][day]["weather"][0]["description"];
|
data.tempMin = (float) doc["list"][day]["main"]["temp_min"];
|
||||||
data.icon = (const char*) doc["list"][day]["weather"][0]["icon"];
|
data.tempMax = (float) doc["list"][day]["main"]["temp_max"];
|
||||||
return true;
|
|
||||||
}
|
data.main = (const char*) doc["list"][day]["weather"][0]["main"];
|
||||||
|
data.description = (const char*) doc["list"][day]["weather"][0]["description"];
|
||||||
|
data.icon = (const char*) doc["list"][day]["weather"][0]["icon"];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "secrets.h"
|
#include "secrets.h"
|
||||||
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
|
#include <ArduinoJson.h> //https://github.com/bblanchon/ArduinoJson
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Dan Cogliano for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// secrets.h
|
// secrets.h
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 John Edgar Park for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
# FruitBox Sequencer
|
# FruitBox Sequencer
|
||||||
# for Adafruit Circuit Playground express
|
# for Adafruit Circuit Playground express
|
||||||
# with CircuitPython
|
# with CircuitPython
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2017 Phillip Burgess for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
#include <Adafruit_NeoPixel.h>
|
#include <Adafruit_NeoPixel.h>
|
||||||
|
|
||||||
#define PIN 1
|
#define PIN 1
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2017 Phillip Burgess for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import board
|
import board
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
from adafruit_ble import BLERadio
|
from adafruit_ble import BLERadio
|
||||||
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
|
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
|
||||||
from adafruit_ble.services.nordic import UARTService
|
from adafruit_ble.services.nordic import UARTService
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import board
|
import board
|
||||||
import neopixel
|
import neopixel
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
from adafruit_ble import BLERadio
|
from adafruit_ble import BLERadio
|
||||||
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
|
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
|
||||||
from adafruit_ble.services.nordic import UARTService
|
from adafruit_ble.services.nordic import UARTService
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
from adafruit_ble import BLERadio
|
from adafruit_ble import BLERadio
|
||||||
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
|
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
|
||||||
from adafruit_ble.services.nordic import UARTService
|
from adafruit_ble.services.nordic import UARTService
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2018 Dave Astels for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
"""
|
"""
|
||||||
HalloWing Interactive Cat Toy
|
HalloWing Interactive Cat Toy
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2018 Brent Rubell for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
"""
|
"""
|
||||||
'io_home_security.py'
|
'io_home_security.py'
|
||||||
=======================================
|
=======================================
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
# SPDX-FileCopyrightText: 2018 Limor Fried for Adafruit Industries
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import board
|
import board
|
||||||
import busio
|
import busio
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
// SPDX-FileCopyrightText: 2019 Anne Barela for Adafruit Industries
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* connect the COIN wire to digital 2
|
* connect the COIN wire to digital 2
|
||||||
* set the side switches to "FAST" "NC"
|
* set the side switches to "FAST" "NC"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue