Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 69 additions & 68 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions platformio/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.pio
.vscode
credentials.h
204 changes: 102 additions & 102 deletions platformio/include/api_response.h

Large diffs are not rendered by default.

19 changes: 10 additions & 9 deletions platformio/include/client_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,24 @@
#include "api_response.h"
#include "config.h"
#ifdef USE_HTTP
#include <WiFiClient.h>
#include <WiFiClient.h>
#else
#include <WiFiClientSecure.h>
#include <WiFiClientSecure.h>
#endif

wl_status_t startWiFi(int &wifiRSSI);
void killWiFi();
bool waitForSNTPSync(tm *timeInfo);
bool printLocalTime(tm *timeInfo);

#ifdef USE_HTTP
int getOWMonecall(WiFiClient &client, owm_resp_onecall_t &r);
int getOWMairpollution(WiFiClient &client, owm_resp_air_pollution_t &r);
int getOWMonecall(WiFiClient &client, owm_resp_onecall_t &r);
int getOWMairpollution(WiFiClient &client, owm_resp_air_pollution_t &r);
int getOMCall(WiFiClient &client, owm_resp_onecall_t &r);
#else
int getOWMonecall(WiFiClientSecure &client, owm_resp_onecall_t &r);
int getOWMairpollution(WiFiClientSecure &client, owm_resp_air_pollution_t &r);
#endif


int getOWMonecall(WiFiClientSecure &client, owm_resp_onecall_t &r);
int getOWMairpollution(WiFiClientSecure &client, owm_resp_air_pollution_t &r);
int getOMCall(WiFiClientSecure &client, owm_resp_onecall_t &r);
#endif

#endif
119 changes: 43 additions & 76 deletions platformio/include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#include <cstdint>
#include <Arduino.h>

#define INDOOR 0
#define AIR_POLLUTION 0

// E-PAPER PANEL
// This project supports the following E-Paper panels:
// DISP_BW_V2 - 7.5in e-Paper (v2) 800x480px Black/White
Expand All @@ -45,12 +48,12 @@
// 3 COLOR E-INK ACCENT COLOR
// Defines the 3rd color to be used when a 3+ color display is selected.
#if defined(DISP_3C_B) || defined(DISP_7C_F)
// #define ACCENT_COLOR GxEPD_BLACK
#define ACCENT_COLOR GxEPD_RED
// #define ACCENT_COLOR GxEPD_GREEN
// #define ACCENT_COLOR GxEPD_BLUE
// #define ACCENT_COLOR GxEPD_YELLOW
// #define ACCENT_COLOR GxEPD_ORANGE
// #define ACCENT_COLOR GxEPD_BLACK
#define ACCENT_COLOR GxEPD_RED
// #define ACCENT_COLOR GxEPD_GREEN
// #define ACCENT_COLOR GxEPD_BLUE
// #define ACCENT_COLOR GxEPD_YELLOW
// #define ACCENT_COLOR GxEPD_ORANGE
#endif

// LOCALE
Expand All @@ -69,6 +72,9 @@
// Portuguese (Brazil) pt_BR
#define LOCALE en_US

#define USE_OPEN_WEATHER_MAP
// #define USE_OPEN_METEO

// UNITS
// Define exactly one macro for each measurement type below.

Expand Down Expand Up @@ -247,7 +253,7 @@
// Extra information that can be displayed on the status bar. Set to 1 to
// enable.
#define STATUS_BAR_EXTRAS_BAT_VOLTAGE 0
#define STATUS_BAR_EXTRAS_WIFI_RSSI 0
#define STATUS_BAR_EXTRAS_WIFI_RSSI 0

// BATTERY MONITORING
// You may choose to power your weather display with or without a battery.
Expand Down Expand Up @@ -286,6 +292,7 @@ extern const unsigned HTTP_CLIENT_TCP_TIMEOUT;
extern const String OWM_APIKEY;
extern const String OWM_ENDPOINT;
extern const String OWM_ONECALL_VERSION;
extern const String OM_ENDPOINT;
extern const String LAT;
extern const String LON;
extern const String CITY_STRING;
Expand All @@ -311,99 +318,59 @@ extern const uint32_t MAX_BATTERY_VOLTAGE;
extern const uint32_t MIN_BATTERY_VOLTAGE;

// CONFIG VALIDATION - DO NOT MODIFY
#if !( defined(DISP_BW_V2) \
^ defined(DISP_3C_B) \
^ defined(DISP_7C_F) \
^ defined(DISP_BW_V1))
#error Invalid configuration. Exactly one display panel must be selected.
#if !(defined(DISP_BW_V2) ^ defined(DISP_3C_B) ^ defined(DISP_7C_F) ^ defined(DISP_BW_V1))
#error Invalid configuration. Exactly one display panel must be selected.
#endif
#if !( defined(DRIVER_WAVESHARE) \
^ defined(DRIVER_DESPI_C02))
#error Invalid configuration. Exactly one driver board must be selected.
#if !(defined(DRIVER_WAVESHARE) ^ defined(DRIVER_DESPI_C02))
#error Invalid configuration. Exactly one driver board must be selected.
#endif
#if !(defined(LOCALE))
#error Invalid configuration. Locale not selected.
#error Invalid configuration. Locale not selected.
#endif
#if !( defined(UNITS_TEMP_KELVIN) \
^ defined(UNITS_TEMP_CELSIUS) \
^ defined(UNITS_TEMP_FAHRENHEIT))
#error Invalid configuration. Exactly one temperature unit must be selected.
#if !(defined(UNITS_TEMP_KELVIN) ^ defined(UNITS_TEMP_CELSIUS) ^ defined(UNITS_TEMP_FAHRENHEIT))
#error Invalid configuration. Exactly one temperature unit must be selected.
#endif
#if !( defined(UNITS_SPEED_METERSPERSECOND) \
^ defined(UNITS_SPEED_FEETPERSECOND) \
^ defined(UNITS_SPEED_KILOMETERSPERHOUR) \
^ defined(UNITS_SPEED_MILESPERHOUR) \
^ defined(UNITS_SPEED_KNOTS) \
^ defined(UNITS_SPEED_BEAUFORT))
#error Invalid configuration. Exactly one wind speed unit must be selected.
#if !(defined(UNITS_SPEED_METERSPERSECOND) ^ defined(UNITS_SPEED_FEETPERSECOND) ^ defined(UNITS_SPEED_KILOMETERSPERHOUR) ^ defined(UNITS_SPEED_MILESPERHOUR) ^ defined(UNITS_SPEED_KNOTS) ^ defined(UNITS_SPEED_BEAUFORT))
#error Invalid configuration. Exactly one wind speed unit must be selected.
#endif
#if !( defined(UNITS_PRES_HECTOPASCALS) \
^ defined(UNITS_PRES_PASCALS) \
^ defined(UNITS_PRES_MILLIMETERSOFMERCURY) \
^ defined(UNITS_PRES_INCHESOFMERCURY) \
^ defined(UNITS_PRES_MILLIBARS) \
^ defined(UNITS_PRES_ATMOSPHERES) \
^ defined(UNITS_PRES_GRAMSPERSQUARECENTIMETER) \
^ defined(UNITS_PRES_POUNDSPERSQUAREINCH))
#error Invalid configuration. Exactly one pressure unit must be selected.
#if !(defined(UNITS_PRES_HECTOPASCALS) ^ defined(UNITS_PRES_PASCALS) ^ defined(UNITS_PRES_MILLIMETERSOFMERCURY) ^ defined(UNITS_PRES_INCHESOFMERCURY) ^ defined(UNITS_PRES_MILLIBARS) ^ defined(UNITS_PRES_ATMOSPHERES) ^ defined(UNITS_PRES_GRAMSPERSQUARECENTIMETER) ^ defined(UNITS_PRES_POUNDSPERSQUAREINCH))
#error Invalid configuration. Exactly one pressure unit must be selected.
#endif
#if !( defined(UNITS_DIST_KILOMETERS) \
^ defined(UNITS_DIST_MILES))
#error Invalid configuration. Exactly one distance unit must be selected.
#if !(defined(UNITS_DIST_KILOMETERS) ^ defined(UNITS_DIST_MILES))
#error Invalid configuration. Exactly one distance unit must be selected.
#endif
#if !( defined(UNITS_HOURLY_PRECIP_POP) \
^ defined(UNITS_HOURLY_PRECIP_MILLIMETERS) \
^ defined(UNITS_HOURLY_PRECIP_CENTIMETERS) \
^ defined(UNITS_HOURLY_PRECIP_INCHES))
#error Invalid configuration. Exactly one houly precipitation measurement must be selected.
#if !(defined(UNITS_HOURLY_PRECIP_POP) ^ defined(UNITS_HOURLY_PRECIP_MILLIMETERS) ^ defined(UNITS_HOURLY_PRECIP_CENTIMETERS) ^ defined(UNITS_HOURLY_PRECIP_INCHES))
#error Invalid configuration. Exactly one houly precipitation measurement must be selected.
#endif
#if !( defined(UNITS_DAILY_PRECIP_POP) \
^ defined(UNITS_DAILY_PRECIP_MILLIMETERS) \
^ defined(UNITS_DAILY_PRECIP_CENTIMETERS) \
^ defined(UNITS_DAILY_PRECIP_INCHES))
#error Invalid configuration. Exactly one daily precipitation measurement must be selected.
#if !(defined(UNITS_DAILY_PRECIP_POP) ^ defined(UNITS_DAILY_PRECIP_MILLIMETERS) ^ defined(UNITS_DAILY_PRECIP_CENTIMETERS) ^ defined(UNITS_DAILY_PRECIP_INCHES))
#error Invalid configuration. Exactly one daily precipitation measurement must be selected.
#endif
#if !( defined(USE_HTTP) \
^ defined(USE_HTTPS_NO_CERT_VERIF) \
^ defined(USE_HTTPS_WITH_CERT_VERIF))
#error Invalid configuration. Exactly one HTTP mode must be selected.
#if !(defined(USE_HTTP) ^ defined(USE_HTTPS_NO_CERT_VERIF) ^ defined(USE_HTTPS_WITH_CERT_VERIF))
#error Invalid configuration. Exactly one HTTP mode must be selected.
#endif
#if !( defined(WIND_INDICATOR_ARROW) \
|| ( \
defined(WIND_INDICATOR_NUMBER) \
^ defined(WIND_INDICATOR_CPN_CARDINAL) \
^ defined(WIND_INDICATOR_CPN_INTERCARDINAL) \
^ defined(WIND_INDICATOR_CPN_SECONDARY_INTERCARDINAL) \
^ defined(WIND_INDICATOR_CPN_TERTIARY_INTERCARDINAL) \
) \
^ defined(WIND_INDICATOR_NONE))
#error Invalid configuration. Illegal selction of wind indicator(s).
#if !(defined(WIND_INDICATOR_ARROW) || (defined(WIND_INDICATOR_NUMBER) ^ defined(WIND_INDICATOR_CPN_CARDINAL) ^ defined(WIND_INDICATOR_CPN_INTERCARDINAL) ^ defined(WIND_INDICATOR_CPN_SECONDARY_INTERCARDINAL) ^ defined(WIND_INDICATOR_CPN_TERTIARY_INTERCARDINAL)) ^ defined(WIND_INDICATOR_NONE))
#error Invalid configuration. Illegal selction of wind indicator(s).
#endif
#if defined(WIND_INDICATOR_ARROW) \
&& !( defined(WIND_ICONS_CARDINAL) \
^ defined(WIND_ICONS_INTERCARDINAL) \
^ defined(WIND_ICONS_SECONDARY_INTERCARDINAL) \
^ defined(WIND_ICONS_TERTIARY_INTERCARDINAL) \
^ defined(WIND_ICONS_360))
#error Invalid configuration. Exactly one wind direction icon precision level must be selected.
#if defined(WIND_INDICATOR_ARROW) && !(defined(WIND_ICONS_CARDINAL) ^ defined(WIND_ICONS_INTERCARDINAL) ^ defined(WIND_ICONS_SECONDARY_INTERCARDINAL) ^ defined(WIND_ICONS_TERTIARY_INTERCARDINAL) ^ defined(WIND_ICONS_360))
#error Invalid configuration. Exactly one wind direction icon precision level must be selected.
#endif
#if !(defined(FONT_HEADER))
#error Invalid configuration. Font not selected.
#error Invalid configuration. Font not selected.
#endif
#if !(defined(DISPLAY_DAILY_PRECIP))
#error Invalid configuration. DISPLAY_DAILY_PRECIP not defined.
#error Invalid configuration. DISPLAY_DAILY_PRECIP not defined.
#endif
#if !(defined(DISPLAY_HOURLY_ICONS))
#error Invalid configuration. DISPLAY_HOURLY_ICONS not defined.
#error Invalid configuration. DISPLAY_HOURLY_ICONS not defined.
#endif
#if !(defined(DISPLAY_ALERTS))
#error Invalid configuration. DISPLAY_ALERTS not defined.
#error Invalid configuration. DISPLAY_ALERTS not defined.
#endif
#if !(defined(BATTERY_MONITORING))
#error Invalid configuration. BATTERY_MONITORING not defined.
#error Invalid configuration. BATTERY_MONITORING not defined.
#endif
#if !(defined(DEBUG_LEVEL))
#error Invalid configuration. DEBUG_LEVEL not defined.
#error Invalid configuration. DEBUG_LEVEL not defined.
#endif

#endif
14 changes: 14 additions & 0 deletions platformio/include/credentials.h.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// WIFI
const char *WIFI_SSID = "ssid";
const char *WIFI_PASSWORD = "password";

// OPENWEATHERMAP API
const String OWM_APIKEY = "abcdefghijklmnopqrstuvwxyz012345";

// LOCATION
// Set your latitude and longitude.
// (used to get weather data as part of API requests to OpenWeatherMap)
const String LAT = "40.7128";
const String LON = "-74.0060";
// City name that will be shown in the top-right corner of the display.
const String CITY_STRING = "New York";
21 changes: 12 additions & 9 deletions platformio/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html


[platformio]
default_envs = dfrobot_firebeetle2_esp32e
; default_envs = firebeetle32


; default options for each '[env:**]'
[env]
platform = espressif32 @ 6.9.0
framework = arduino
Expand All @@ -31,18 +27,25 @@ lib_deps =
[env:dfrobot_firebeetle2_esp32e]
board = dfrobot_firebeetle2_esp32e
monitor_speed = 115200
; override default partition table
; https://github.com/espressif/arduino-esp32/tree/master/tools/partitions
board_build.partitions = huge_app.csv
; change MCU frequency, 240MHz -> 80MHz (for better power efficiency)
board_build.f_cpu = 80000000L


[env:firebeetle32]
board = firebeetle32
monitor_speed = 115200
; override default partition table
; https://github.com/espressif/arduino-esp32/tree/master/tools/partitions
board_build.partitions = huge_app.csv
; change MCU frequency, 240MHz -> 80MHz (for better power efficiency)
board_build.f_cpu = 80000000L

[env:esp32]
board = esp32dev
monitor_speed = 115200
board_build.partitions = huge_app.csv
board_build.f_cpu = 80000000L


[env:esp32c3pico]
board = lolin_c3_mini
monitor_speed = 115200
board_build.partitions = huge_app.csv
Loading