first commit
This commit is contained in:
68
ESP32_WAVESHARE_7x5/Meteo.h
Normal file
68
ESP32_WAVESHARE_7x5/Meteo.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef Meteo_h
|
||||
#define Meteo_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include "forecast_record.h"
|
||||
#include "Ecran.h"
|
||||
#include "Timer.h"
|
||||
//#include <WiFiClient.h>
|
||||
#include "HTTPClient.h"
|
||||
#include "common.h"
|
||||
#include "Connect.h"
|
||||
#include "Icons.h"
|
||||
|
||||
class Meteo {
|
||||
public:
|
||||
Meteo(Ecran * ecran, Connect * connect,Timer * timer, String apikey, String server, String City, String Country);
|
||||
bool loadData();
|
||||
void addsun(int x, int y, int scale, bool IconSize);
|
||||
void addcloud(int x, int y, int scale, int linesize);
|
||||
void addraindrop(int x, int y, int scale);
|
||||
void addrain(int x, int y, int scale, bool IconSize);
|
||||
void addsnow(int x, int y, int scale, bool IconSize);
|
||||
void addtstorm(int x, int y, int scale);
|
||||
void addfog(int x, int y, int scale, int linesize, bool IconSize);
|
||||
void Sunny(int x, int y, bool IconSize, String IconName);
|
||||
void MostlySunny(int x, int y, bool IconSize, String IconName);
|
||||
void Cloudy(int x, int y, bool IconSize, String IconName);
|
||||
void Rain(int x, int y, bool IconSize, String IconName);
|
||||
void ExpectRain(int x, int y, bool IconSize, String IconName);
|
||||
void ChanceRain(int x, int y, bool IconSize, String IconName);
|
||||
void Tstorms(int x, int y, bool IconSize, String IconName);
|
||||
void Snow(int x, int y, bool IconSize, String IconName);
|
||||
void Fog(int x, int y, bool IconSize, String IconName);
|
||||
void Haze(int x, int y, bool IconSize, String IconName);
|
||||
void CloudCover(int x, int y, int CCover);
|
||||
void Visibility(int x, int y, String Visi);
|
||||
void MostlyCloudy(int x, int y, bool IconSize, String IconName);
|
||||
void Convert_Readings_to_Imperial();
|
||||
bool DecodeWeather(WiFiClient& json, String Type);
|
||||
String ConvertUnixTime(int unix_time);
|
||||
bool getWeather(WiFiClient& client, const String& RequestType);
|
||||
String calculateTodayPhase();
|
||||
void drawMoon(int x, int y);
|
||||
void drawTodayMoon(int x, int y);
|
||||
double normalizedTodayPhase();
|
||||
void addMoon(int x, int y, int scale, bool largeIcon);
|
||||
public:
|
||||
Ecran *ecran;
|
||||
Connect * connect;
|
||||
Timer * timer;
|
||||
Forecast_record_type conditions[1];
|
||||
Forecast_record_type previsions[max_readings];
|
||||
float pressure_readings[max_readings] = {0};
|
||||
float temperature_readings[max_readings] = {0};
|
||||
float humidity_readings[max_readings] = {0};
|
||||
float rain_readings[max_readings] = {0};
|
||||
float snow_readings[max_readings] = {0};
|
||||
int phase;
|
||||
String apikey; // = "feba3f4d926db3b358a25ec782bd1c8b"; // See: https://openweathermap.org/ // It's free to get an API key, but don't take more than 60 readings/minute!
|
||||
//http://api.openweathermap.org/data/2.5/weather?q=Melksham,UK&APPID=your_OWM_API_key&mode=json&units=metric&cnt=1 // Example API call for weather data
|
||||
//http://api.openweathermap.org/data/2.5/forecast?q=Melksham,UK&APPID=your_OWM_API_key&mode=json&units=metric&cnt=40 // Example API call for forecast data
|
||||
//Set your location according to OWM locations
|
||||
String City; // = "La Gacilly"; // Your home city See: http://bulk.openweathermap.org/sample/
|
||||
String Country; // = "FR";
|
||||
String server; // = "api.openweathermap.org";
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user