mirror of https://github.com/sqfmi/Watchy.git
add arduino_pins.h
- switch to ArduinoJSON - include arduino_pins.h from config.hpull/150/head
parent
cd17d2046d
commit
b358aed0d1
|
@ -17,7 +17,7 @@
|
||||||
"platforms": ["espressif32"],
|
"platforms": ["espressif32"],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
{ "name": "Adafruit GFX Library" },
|
{ "name": "Adafruit GFX Library" },
|
||||||
{ "name": "Arduino_JSON" },
|
{ "name": "ArduinoJSON" },
|
||||||
{ "name": "DS3232RTC" },
|
{ "name": "DS3232RTC" },
|
||||||
{ "name": "NTPClient" },
|
{ "name": "NTPClient" },
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GxEPD2",
|
"name": "GxEPD2",
|
||||||
"version": "https://github.com/ZinggJM/GxEPD2.git#master"
|
"version": "https://github.com/DarkZeros/GxEPD2.git#watchy"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "WiFiManager",
|
"name": "WiFiManager",
|
||||||
|
|
|
@ -584,10 +584,15 @@ weatherData Watchy::getWeatherData(String cityID, String units, String lang, Str
|
||||||
int httpResponseCode = http.GET();
|
int httpResponseCode = http.GET();
|
||||||
if(httpResponseCode == 200) {
|
if(httpResponseCode == 200) {
|
||||||
String payload = http.getString();
|
String payload = http.getString();
|
||||||
JSONVar responseObject = JSON.parse(payload);
|
DynamicJsonDocument doc(1024);
|
||||||
currentWeather.temperature = int(responseObject["main"]["temp"]);
|
auto error = deserializeJson(doc, payload);
|
||||||
currentWeather.weatherConditionCode = int(responseObject["weather"][0]["id"]);
|
if (!error) {
|
||||||
currentWeather.weatherDescription = responseObject["weather"][0]["main"];
|
currentWeather.temperature = doc["main"]["temp"].as<int>();
|
||||||
|
currentWeather.weatherConditionCode = doc["weather"][0]["id"].as<int>();
|
||||||
|
currentWeather.weatherDescription = doc["weather"][0]["main"].as<const char *>();
|
||||||
|
} else {
|
||||||
|
Serial.println(error.c_str());
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
//http error
|
//http error
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include <HTTPClient.h>
|
#include <HTTPClient.h>
|
||||||
#include <NTPClient.h>
|
#include <NTPClient.h>
|
||||||
#include <WiFiUdp.h>
|
#include <WiFiUdp.h>
|
||||||
#include <Arduino_JSON.h>
|
#include <ArduinoJson.h>
|
||||||
#include <GxEPD2_BW.h>
|
#include <GxEPD2_BW.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Fonts/FreeMonoBold9pt7b.h>
|
#include <Fonts/FreeMonoBold9pt7b.h>
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#ifndef ARDUINO_PINS_H
|
||||||
|
#define ARDUINO_PINS_H
|
||||||
|
|
||||||
|
//pins
|
||||||
|
#define SDA 21
|
||||||
|
#define SCL 22
|
||||||
|
#define BATT_ADC_PIN 35 //v1.5 Watchy with PCF8563 RTC
|
||||||
|
#define RTC_INT_PIN GPIO_NUM_27
|
||||||
|
#define DISPLAY_CS 5
|
||||||
|
#define DISPLAY_DC 10
|
||||||
|
#define DISPLAY_RES 9
|
||||||
|
#define DISPLAY_BUSY 19
|
||||||
|
#define VIB_MOTOR_PIN 13
|
||||||
|
#define MENU_BTN_PIN 26
|
||||||
|
#define BACK_BTN_PIN 25
|
||||||
|
#define UP_BTN_PIN 32
|
||||||
|
#define DOWN_BTN_PIN 4
|
||||||
|
#define MENU_BTN_MASK GPIO_SEL_26
|
||||||
|
#define BACK_BTN_MASK GPIO_SEL_25
|
||||||
|
#define UP_BTN_MASK GPIO_SEL_32
|
||||||
|
#define DOWN_BTN_MASK GPIO_SEL_4
|
||||||
|
#define ACC_INT_MASK GPIO_SEL_14
|
||||||
|
#define BTN_PIN_MASK MENU_BTN_MASK|BACK_BTN_MASK|UP_BTN_MASK|DOWN_BTN_MASK
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef CONFIG_H
|
#ifndef CONFIG_H
|
||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "arduino_pins.h"
|
||||||
|
|
||||||
//display
|
//display
|
||||||
#define DISPLAY_WIDTH 200
|
#define DISPLAY_WIDTH 200
|
||||||
#define DISPLAY_HEIGHT 200
|
#define DISPLAY_HEIGHT 200
|
||||||
|
@ -31,4 +33,5 @@
|
||||||
#define HARDWARE_VERSION_MINOR 0
|
#define HARDWARE_VERSION_MINOR 0
|
||||||
//Versioning
|
//Versioning
|
||||||
#define WATCHY_LIB_VER "1.4.0"
|
#define WATCHY_LIB_VER "1.4.0"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue