Version 1.4.2.
This commit is contained in:
parent
46f3da2a02
commit
338dadb41a
@ -32,13 +32,13 @@
|
|||||||
#define WATCHON 0
|
#define WATCHON 0
|
||||||
#define MENUON 1
|
#define MENUON 1
|
||||||
|
|
||||||
|
// Maximum styles possible.
|
||||||
|
#define MaxStyles 25
|
||||||
|
|
||||||
// Nenu size defines.
|
// Nenu size defines.
|
||||||
#define MenuWidth 200
|
#define MenuWidth 200
|
||||||
#define MenuHeight 83
|
#define MenuHeight 83
|
||||||
|
|
||||||
// Max number of WatchStyles
|
|
||||||
#define MaxStyles 1
|
|
||||||
|
|
||||||
// Menu offsets so I don't have to statically entere them everywhere.
|
// Menu offsets so I don't have to statically entere them everywhere.
|
||||||
#define MENU_STEPS 0
|
#define MENU_STEPS 0
|
||||||
#define MENU_ALARMS 1
|
#define MENU_ALARMS 1
|
||||||
|
|||||||
@ -105,9 +105,16 @@ RTC_DATA_ATTR struct Designing final {
|
|||||||
} Status;
|
} Status;
|
||||||
} Design;
|
} Design;
|
||||||
|
|
||||||
|
RTC_DATA_ATTR struct DesignStyles final {
|
||||||
|
uint8_t Count;
|
||||||
|
char Style[32 * MaxStyles];
|
||||||
|
} WatchStyles;
|
||||||
|
|
||||||
RTC_DATA_ATTR int GuiMode;
|
RTC_DATA_ATTR int GuiMode;
|
||||||
RTC_DATA_ATTR bool VibeMode; // Vibe Motor is On=True/Off=False, used for the Haptic and Alarms.
|
RTC_DATA_ATTR bool VibeMode; // Vibe Motor is On=True/Off=False, used for the Haptic and Alarms.
|
||||||
RTC_DATA_ATTR String WatchyStatus; // Used for the indicator in the bottom left, so when it changes, it asks for a screen refresh, if not, it doesn't.
|
RTC_DATA_ATTR String WatchyStatus; // Used for the indicator in the bottom left, so when it changes, it asks for a screen refresh, if not, it doesn't.
|
||||||
|
RTC_DATA_ATTR int BasicWatchStyles;
|
||||||
|
RTC_DATA_ATTR bool DefaultWatchStyles; // States that the original 2 Watch Styles are to be added.
|
||||||
|
|
||||||
RTC_DATA_ATTR struct TimeData final {
|
RTC_DATA_ATTR struct TimeData final {
|
||||||
time_t UTC_RAW; // Copy of the UTC on init.
|
time_t UTC_RAW; // Copy of the UTC on init.
|
||||||
@ -249,6 +256,7 @@ void WatchyGSR::init(String datetime){
|
|||||||
int AlarmIndex, Pushed; // Alarm being played.
|
int AlarmIndex, Pushed; // Alarm being played.
|
||||||
bool WaitForNext, Pulse, DoOnce, B, Up;
|
bool WaitForNext, Pulse, DoOnce, B, Up;
|
||||||
unsigned long Since, APLoop;
|
unsigned long Since, APLoop;
|
||||||
|
uint8_t I;
|
||||||
String S;
|
String S;
|
||||||
esp_sleep_wakeup_cause_t wakeup_reason;
|
esp_sleep_wakeup_cause_t wakeup_reason;
|
||||||
|
|
||||||
@ -307,12 +315,26 @@ void WatchyGSR::init(String datetime){
|
|||||||
SRTC.resetWake();
|
SRTC.resetWake();
|
||||||
break;
|
break;
|
||||||
default: //reset
|
default: //reset
|
||||||
|
WatchStyles.Count = 0;
|
||||||
|
BasicWatchStyles = -1;
|
||||||
SRTC.init();
|
SRTC.init();
|
||||||
initZeros();
|
initZeros();
|
||||||
setupDefaults();
|
setupDefaults();
|
||||||
Rebooted=true;
|
Rebooted=true;
|
||||||
Darkness.Woke=true;
|
Darkness.Woke=true;
|
||||||
_bmaConfig();
|
_bmaConfig();
|
||||||
|
if (DefaultWatchStyles){
|
||||||
|
I = AddWatchStyle("Classic GSR");
|
||||||
|
I = AddWatchStyle("Ballsy");
|
||||||
|
BasicWatchStyles = I;
|
||||||
|
}
|
||||||
|
InsertAddWatchStyles();
|
||||||
|
if (WatchStyles.Count == 0){
|
||||||
|
I = AddWatchStyle("Classic GSR");
|
||||||
|
I = AddWatchStyle("Ballsy");
|
||||||
|
BasicWatchStyles = I;
|
||||||
|
DefaultWatchStyles = true;
|
||||||
|
}
|
||||||
UpdateUTC();
|
UpdateUTC();
|
||||||
if (OkNVS(GName)) B = NVS.getString(GTZ,S);
|
if (OkNVS(GName)) B = NVS.getString(GTZ,S);
|
||||||
OP.setCurrentPOSIX(S);
|
OP.setCurrentPOSIX(S);
|
||||||
@ -369,8 +391,10 @@ void WatchyGSR::init(String datetime){
|
|||||||
ManageTime(); // Handle Time method.
|
ManageTime(); // Handle Time method.
|
||||||
Up=SBMA.IsUp();
|
Up=SBMA.IsUp();
|
||||||
// Wrist Tilt delay, keep screen on during this until you put your wrist down.
|
// Wrist Tilt delay, keep screen on during this until you put your wrist down.
|
||||||
if (Darkness.Woke && Up) Darkness.Last = millis();
|
if (Options.SleepStyle == 1 || Options.SleepStyle > 2){
|
||||||
if ((Options.SleepStyle == 1 || Options.SleepStyle > 2) && Darkness.Went && Up && !WatchTime.BedTime) { Darkness.Last = millis(); Darkness.Woke = true; UpdateDisp=Showing(); }
|
if (Darkness.Woke && Up) Darkness.Last = millis();
|
||||||
|
if (Darkness.Went && Up && !WatchTime.BedTime) { Darkness.Last = millis(); Darkness.Woke = true; UpdateDisp=Showing(); }
|
||||||
|
}
|
||||||
processWiFiRequest(); // Process any WiFi requests.
|
processWiFiRequest(); // Process any WiFi requests.
|
||||||
if (!Sensitive){
|
if (!Sensitive){
|
||||||
if (currentWiFi() == WL_CONNECTED && NTPData.State == 0 && !OTAUpdate && !WatchyAPOn && !NTPData.TimeTest) InsertWiFi();
|
if (currentWiFi() == WL_CONNECTED && NTPData.State == 0 && !OTAUpdate && !WatchyAPOn && !NTPData.TimeTest) InsertWiFi();
|
||||||
@ -990,14 +1014,9 @@ void WatchyGSR::drawMenu(){
|
|||||||
}else if (Menu.Item == MENU_OPTIONS){ // Options Menu
|
}else if (Menu.Item == MENU_OPTIONS){ // Options Menu
|
||||||
O = "MENU to Enter";
|
O = "MENU to Enter";
|
||||||
}else if (Menu.Item == MENU_STYL){ // Switch Watch Style
|
}else if (Menu.Item == MENU_STYL){ // Switch Watch Style
|
||||||
switch (Options.WatchFaceStyle){
|
O = "";
|
||||||
case 1:
|
for (x1 = 0; x1 < 32; x1++)
|
||||||
O = "Ballsy";
|
O = O + WatchStyles.Style[Options.WatchFaceStyle * 32 + x1];
|
||||||
break;
|
|
||||||
default:
|
|
||||||
O = "Original";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}else if (Menu.Item == MENU_DISP){ // Switch Mode
|
}else if (Menu.Item == MENU_DISP){ // Switch Mode
|
||||||
if (Options.LightMode){
|
if (Options.LightMode){
|
||||||
O = "Light";
|
O = "Light";
|
||||||
@ -1657,7 +1676,7 @@ void WatchyGSR::handleButtonPress(uint8_t Pressed){
|
|||||||
AskForWiFi();
|
AskForWiFi();
|
||||||
}
|
}
|
||||||
}else if (Menu.Item == MENU_STYL){ // Switch Watch Face
|
}else if (Menu.Item == MENU_STYL){ // Switch Watch Face
|
||||||
Options.WatchFaceStyle = roller(Options.WatchFaceStyle + 1,0,MaxStyles);
|
Options.WatchFaceStyle = roller(Options.WatchFaceStyle + 1,0,WatchStyles.Count - 1);
|
||||||
initWatchFaceStyle();
|
initWatchFaceStyle();
|
||||||
Options.NeedsSaving = true;
|
Options.NeedsSaving = true;
|
||||||
DoHaptic = true;
|
DoHaptic = true;
|
||||||
@ -2385,6 +2404,19 @@ void WatchyGSR::InsertDefaults() {}
|
|||||||
void WatchyGSR::InsertOnMinute() {}
|
void WatchyGSR::InsertOnMinute() {}
|
||||||
void WatchyGSR::InsertWiFi() {}
|
void WatchyGSR::InsertWiFi() {}
|
||||||
void WatchyGSR::InsertWiFiEnding() {}
|
void WatchyGSR::InsertWiFiEnding() {}
|
||||||
|
void WatchyGSR::InsertAddWatchStyles() {}
|
||||||
|
void WatchyGSR::InsertInitWatchStyle(uint8_t StyleID) {}
|
||||||
|
void WatchyGSR::InsertDrawWatchStyle(uint8_t StyleID) {}
|
||||||
|
uint8_t WatchyGSR::AddWatchStyle(String StyleName){
|
||||||
|
if (WatchStyles.Count >= MaxStyles || StyleName.length() > 30) return 255; // Full / too long..
|
||||||
|
for (int I = 0; I < WatchStyles.Count; I++)
|
||||||
|
if (String(WatchStyles.Style[I * 32]) == StyleName) return 255; // Error, alrady there.
|
||||||
|
|
||||||
|
strcpy(&WatchStyles.Style[WatchStyles.Count * 32], StyleName.c_str());
|
||||||
|
WatchStyles.Count++;
|
||||||
|
return WatchStyles.Count;
|
||||||
|
}
|
||||||
|
void WatchyGSR::AllowDefaultWatchStyles(bool Allow) { DefaultWatchStyles = Allow; }
|
||||||
|
|
||||||
bool WatchyGSR::IsDark(){ return Darkness.Went; }
|
bool WatchyGSR::IsDark(){ return Darkness.Went; }
|
||||||
|
|
||||||
@ -2886,6 +2918,7 @@ void WatchyGSR::initZeros(){
|
|||||||
TimerDown.Hours = 0;
|
TimerDown.Hours = 0;
|
||||||
TimerDown.MaxTones = 0;
|
TimerDown.MaxTones = 0;
|
||||||
TimerDown.Active = false;
|
TimerDown.Active = false;
|
||||||
|
DefaultWatchStyles = true;
|
||||||
AskForWiFi();
|
AskForWiFi();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3024,7 +3057,7 @@ void WatchyGSR::StoreSettings(String FromUser){
|
|||||||
J++; if (L > J){ V = O[J]; Options.BedTimeOrientation = (V & 1) ? true : false; }
|
J++; if (L > J){ V = O[J]; Options.BedTimeOrientation = (V & 1) ? true : false; }
|
||||||
}
|
}
|
||||||
if (NewV > 130){
|
if (NewV > 130){
|
||||||
J++; if (L > J){ V = constrain(O[J],0,MaxStyles); Options.WatchFaceStyle = V; }
|
J++; if (L > J){ V = constrain(O[J],0,WatchStyles.Count - 1); Options.WatchFaceStyle = V; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (WatchTime.DeadRTC) Options.Feedback = false;
|
if (WatchTime.DeadRTC) Options.Feedback = false;
|
||||||
@ -3231,7 +3264,11 @@ void WatchyGSR::getAngle(uint16_t Angle, uint8_t Away, uint8_t &X, uint8_t &Y){
|
|||||||
// Watch Face designs are here.
|
// Watch Face designs are here.
|
||||||
|
|
||||||
void WatchyGSR::initWatchFaceStyle(){
|
void WatchyGSR::initWatchFaceStyle(){
|
||||||
switch (Options.WatchFaceStyle){
|
uint8_t Style = Options.WatchFaceStyle;
|
||||||
|
if (DefaultWatchStyles) { if (Style > BasicWatchStyles && Style != 255) { InsertDrawWatchStyle(Style); return; } }
|
||||||
|
else if (WatchStyles.Count > 0 && BasicWatchStyles == -1) { InsertDrawWatchStyle(Style); return; }
|
||||||
|
else Style = 0;
|
||||||
|
switch (Style){
|
||||||
case 1: // Ballsy
|
case 1: // Ballsy
|
||||||
Design.Menu.Top = 117;
|
Design.Menu.Top = 117;
|
||||||
Design.Menu.Header = 25;
|
Design.Menu.Header = 25;
|
||||||
@ -3294,8 +3331,12 @@ void WatchyGSR::initWatchFaceStyle(){
|
|||||||
void WatchyGSR::drawWatchFaceStyle(){
|
void WatchyGSR::drawWatchFaceStyle(){
|
||||||
uint8_t X, Y;
|
uint8_t X, Y;
|
||||||
uint16_t A;
|
uint16_t A;
|
||||||
switch (Options.WatchFaceStyle){
|
uint8_t Style = Options.WatchFaceStyle;
|
||||||
case 1: // Ballsy
|
if (DefaultWatchStyles) { if (Style > BasicWatchStyles && Style != 255) { InsertDrawWatchStyle(Style); return; } }
|
||||||
|
else if (WatchStyles.Count > 0 && BasicWatchStyles == -1) { InsertDrawWatchStyle(Style); return; }
|
||||||
|
else Style = 0;
|
||||||
|
switch (Style){
|
||||||
|
case 1: // Ballsy
|
||||||
drawDay();
|
drawDay();
|
||||||
drawDate();
|
drawDate();
|
||||||
if (SafeToDraw()){
|
if (SafeToDraw()){
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class WatchyGSR{
|
|||||||
static SmallRTC SRTC;
|
static SmallRTC SRTC;
|
||||||
static SmallNTP SNTP;
|
static SmallNTP SNTP;
|
||||||
static GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display;
|
static GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display;
|
||||||
static constexpr const char* Build = "1.4.1";
|
static constexpr const char* Build = "1.4.2";
|
||||||
enum DesOps {dSTATIC, dLEFT, dRIGHT, dCENTER};
|
enum DesOps {dSTATIC, dLEFT, dRIGHT, dCENTER};
|
||||||
public:
|
public:
|
||||||
WatchyGSR();
|
WatchyGSR();
|
||||||
@ -69,6 +69,11 @@ class WatchyGSR{
|
|||||||
void InsertOnMinute();
|
void InsertOnMinute();
|
||||||
void InsertWiFi();
|
void InsertWiFi();
|
||||||
void InsertWiFiEnding();
|
void InsertWiFiEnding();
|
||||||
|
void InsertAddWatchStyles();
|
||||||
|
void InsertDrawWatchStyle(uint8_t StyleID);
|
||||||
|
void InsertInitWatchStyle(uint8_t StyleID);
|
||||||
|
virtual uint8_t AddWatchStyle(String StyleName) final;
|
||||||
|
virtual void AllowDefaultWatchStyles(bool Allow = true) final;
|
||||||
virtual void AskForWiFi() final;
|
virtual void AskForWiFi() final;
|
||||||
virtual wl_status_t currentWiFi() final;
|
virtual wl_status_t currentWiFi() final;
|
||||||
virtual void endWiFi() final;
|
virtual void endWiFi() final;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user