Version 1.3.1.
This commit is contained in:
parent
6b7c2c3d06
commit
37867adf2b
129
Defines_GSR.h
Normal file
129
Defines_GSR.h
Normal file
@ -0,0 +1,129 @@
|
||||
#ifndef DEFINES_GSR_H
|
||||
#define DEFINES_GSR_H
|
||||
|
||||
//debug
|
||||
#define USEDEBUG 1 // !0 is on, will not setup Serial OR print output if zero.
|
||||
|
||||
//display
|
||||
#define SOFTWARE_VERSION_MAJOR 1
|
||||
#define SOFTWARE_VERSION_MINOR 3
|
||||
#define SOFTWARE_VERSION_PATCH 1
|
||||
#define HARDWARE_VERSION_MAJOR 1
|
||||
#define HARDWARE_VERSION_MINOR 0
|
||||
|
||||
// WiFi
|
||||
#define WiFi_AP_SSID "Watchy Connect"
|
||||
#define WiFi_AP_PSWD "Watchy123"
|
||||
#define WiFi_AP_HIDE false
|
||||
#define WiFi_AP_MAXC 4
|
||||
#define WiFi_SSID_MAX 32
|
||||
#define WiFi_PASS_MAX 63
|
||||
// Use instead of Watchy Connect (if necessary)
|
||||
#define WiFi_DEF_SSID ""
|
||||
#define WiFi_DEF_PASS ""
|
||||
|
||||
// Battery
|
||||
#define MinBattery 3.58
|
||||
|
||||
// functions
|
||||
#define clamp(v,lo,hi) (((v)<(lo))?(lo):((v)>(hi))?(hi):(v))
|
||||
#define roller(v,lo,hi) (((v)<(lo))?(hi):((v)>(hi))?(lo):(v))
|
||||
#define gobig(v,lo) ((v)>(lo)?(v):(lo))
|
||||
#define golow(v,hi) ((v)<(hi)?(v):(hi))
|
||||
|
||||
// Watch face states.
|
||||
#define WATCHON 0
|
||||
#define MENUON 1
|
||||
|
||||
// Nenu offset defines.
|
||||
#define MenuTop 72
|
||||
#define MenuHeight 83
|
||||
#define HeaderY 97
|
||||
#define DataY 138
|
||||
|
||||
// Watchface offset defines.
|
||||
#define TimeY 56
|
||||
#define DayY 101
|
||||
#define DateY 143
|
||||
#define YearY 186
|
||||
|
||||
// NTP & TZ Offset defines.
|
||||
#define NTPY 193
|
||||
#define NTPX 5
|
||||
|
||||
// Menu offsets so I don't have to statically entere them everywhere.
|
||||
#define MENU_STEPS 0
|
||||
#define MENU_ALARMS 1
|
||||
#define MENU_TIMERS 2
|
||||
#define MENU_OPTIONS 3
|
||||
#define MENU_ALARM1 4
|
||||
#define MENU_ALARM2 5
|
||||
#define MENU_ALARM3 6
|
||||
#define MENU_ALARM4 7
|
||||
#define MENU_TONES 8
|
||||
#define MENU_TIMEDN 9
|
||||
#define MENU_TIMEUP 10
|
||||
#define MENU_DISP 11
|
||||
#define MENU_BRDR 12
|
||||
#define MENU_SIDE 13
|
||||
#define MENU_SWAP 14
|
||||
#define MENU_ORNT 15
|
||||
#define MENU_MODE 16
|
||||
#define MENU_FEED 17
|
||||
#define MENU_TRBO 18
|
||||
#define MENU_DARK 19
|
||||
#define MENU_SAVE 20
|
||||
#define MENU_TRBL 21
|
||||
#define MENU_SYNC 22
|
||||
#define MENU_WIFI 23
|
||||
#define MENU_OTAU 24
|
||||
#define MENU_OTAM 25
|
||||
#define MENU_SCRN 26
|
||||
#define MENU_RSET 27
|
||||
#define MENU_TOFF 28 // Time Diff offset.
|
||||
|
||||
// Menu segments.
|
||||
#define MENU_INNORMAL 0
|
||||
#define MENU_INALARMS 1
|
||||
#define MENU_INTIMERS 2
|
||||
#define MENU_INOPTIONS 3
|
||||
#define MENU_INTROUBLE 4
|
||||
|
||||
// Button debounce.
|
||||
#define KEYPAUSE 333
|
||||
|
||||
//ALARM flags.
|
||||
#define ALARM_REPEAT 128
|
||||
#define ALARM_ACTIVE 256
|
||||
#define ALARM_NOTRIGGER 511
|
||||
#define ALARM_TRIGGERED 512
|
||||
#define ALARM_DAYS 127
|
||||
#define ALARM_ALL 1023
|
||||
|
||||
// Setup lengths.
|
||||
#define AlarmSetup 1234567890
|
||||
|
||||
//pins
|
||||
#define ADC_PIN 33
|
||||
#define RTC_PIN GPIO_NUM_27
|
||||
#define CS 5
|
||||
#define DC 10
|
||||
#define RESET 9
|
||||
//#define 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
|
||||
|
||||
//SetCPU defines.
|
||||
#define CPUMAX 65280
|
||||
#define CPUDEF 65281
|
||||
#define CPUMID 65282
|
||||
#endif
|
||||
9
GSR.ino
Normal file
9
GSR.ino
Normal file
@ -0,0 +1,9 @@
|
||||
#include "Watchy_GSR.h"
|
||||
|
||||
WatchyGSR watchy;
|
||||
|
||||
void setup(){
|
||||
watchy.init();
|
||||
}
|
||||
|
||||
void loop(){}
|
||||
3064
Watchy_GSR.cpp
Normal file
3064
Watchy_GSR.cpp
Normal file
File diff suppressed because it is too large
Load Diff
116
Watchy_GSR.h
Normal file
116
Watchy_GSR.h
Normal file
@ -0,0 +1,116 @@
|
||||
#ifndef WATCHY_GSR_H
|
||||
#define WATCHY_GSR_H
|
||||
|
||||
#include <Watchy.h>
|
||||
#include "Defines_GSR.h"
|
||||
#include "Web-HTML.h"
|
||||
#include <Arduino.h>
|
||||
#include <FunctionalInterrupt.h>
|
||||
#include <ESPmDNS.h>
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <ArduinoOTA.h>
|
||||
#include <Update.h>
|
||||
#include <WiFiUdp.h>
|
||||
#include <WiFiManager.h>
|
||||
#include <HTTPClient.h>
|
||||
#include <Arduino_JSON.h>
|
||||
#include <DS3232RTC.h>
|
||||
#include "GxEPD2_BW.h"
|
||||
#include "mbedtls/base64.h"
|
||||
#include <Wire.h>
|
||||
#include "bma.h"
|
||||
|
||||
#include "icons.h"
|
||||
#include "Olsen2POSIX.h"
|
||||
#include "ArduinoNvs.h"
|
||||
|
||||
#include "aAntiCorona15pt7b.h"
|
||||
#include "Bronova_Regular13pt7b.h"
|
||||
#include "aAntiCorona16pt7b.h"
|
||||
#include "aAntiCorona36pt7b.h"
|
||||
#include "aAntiCorona12pt7b.h"
|
||||
|
||||
class WatchyGSR{
|
||||
public:
|
||||
static DS3232RTC RTC;
|
||||
static GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display;
|
||||
public:
|
||||
WatchyGSR();
|
||||
void init();
|
||||
void showWatchFace();
|
||||
void drawWatchFace(); //override this method for different watch faces
|
||||
void drawTime();
|
||||
void drawDay();
|
||||
void drawDate();
|
||||
void drawYear();
|
||||
void handleButtonPress(uint8_t Pressed);
|
||||
virtual void deepSleep();
|
||||
float getBatteryVoltage();
|
||||
bool IsDark();
|
||||
IRAM_ATTR void handleInterrupt();
|
||||
private:
|
||||
void drawChargeMe();
|
||||
void drawStatus();
|
||||
void setStatus(String Status);
|
||||
void drawMenu();
|
||||
void VibeTo(bool Mode);
|
||||
//void handleAccelerometer();
|
||||
void GoDark();
|
||||
void detectBattery();
|
||||
void ProcessNTP();
|
||||
void UpdateUTC();
|
||||
void UpdateClock();
|
||||
void ManageTime();
|
||||
void _rtcConfig();
|
||||
void _bmaConfig();
|
||||
static uint16_t _readRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len);
|
||||
static uint16_t _writeRegister(uint8_t address, uint8_t reg, uint8_t *data, uint16_t len);
|
||||
String MakeTime(int Hour, int Minutes, bool& Alarm);
|
||||
String MakeHour(uint8_t Hour);
|
||||
String MakeSeconds(uint8_t Seconds);
|
||||
String MakeTOD(uint8_t Hour, bool AddZeros);
|
||||
String MakeMinutes(uint8_t Minutes);
|
||||
String MakeSteps(uint32_t uSteps);
|
||||
void CheckAlarm(int I);
|
||||
void CheckCD();
|
||||
void CalculateTones();
|
||||
void StopCD();
|
||||
uint8_t getToneTimes(uint8_t ToneIndex);
|
||||
String getReduce(uint8_t Amount);
|
||||
void monitorSteps();
|
||||
uint8_t getButtonPins();
|
||||
uint8_t getButtonMaskToID(uint64_t HW);
|
||||
uint8_t getSwapped(uint8_t pIn);
|
||||
void ScreenRefresh();
|
||||
void AskForWiFi();
|
||||
void processWiFiRequest();
|
||||
String WiFiIndicator(uint8_t Index);
|
||||
wl_status_t currentWiFi();
|
||||
void endWiFi();
|
||||
static void WiFiStationDisconnected(WiFiEvent_t event, WiFiEventInfo_t info);
|
||||
String buildWiFiAPPage();
|
||||
void parseWiFiPageArg(String ARG, String DATA);
|
||||
void setupDefaults();
|
||||
String APIDtoString(uint8_t Index);
|
||||
String PASStoString(uint8_t Index);
|
||||
void initZeros();
|
||||
String GetSettings();
|
||||
void StoreSettings(String FromUser);
|
||||
String RetrieveSettings();
|
||||
void RecordSettings();
|
||||
void SetTurbo();
|
||||
bool InTurbo();
|
||||
bool DarkWait();
|
||||
bool Showing();
|
||||
void RefreshCPU();
|
||||
void RefreshCPU(int Value);
|
||||
void DBug(String Value);
|
||||
String ToHex(uint64_t Value);
|
||||
};
|
||||
|
||||
extern RTC_DATA_ATTR BMA423 sensor;
|
||||
extern RTC_DATA_ATTR bool WIFI_CONFIGURED;
|
||||
extern RTC_DATA_ATTR bool BLE_CONFIGURED;
|
||||
|
||||
#endif
|
||||
Loading…
x
Reference in New Issue
Block a user