Version 1.3.1.

This commit is contained in:
GuruSR 2021-11-17 21:28:22 -05:00 committed by GitHub
parent 37867adf2b
commit ec50c4a493
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 20 deletions

View File

@ -7,7 +7,7 @@
//display //display
#define SOFTWARE_VERSION_MAJOR 1 #define SOFTWARE_VERSION_MAJOR 1
#define SOFTWARE_VERSION_MINOR 3 #define SOFTWARE_VERSION_MINOR 3
#define SOFTWARE_VERSION_PATCH 0 #define SOFTWARE_VERSION_PATCH 1
#define HARDWARE_VERSION_MAJOR 1 #define HARDWARE_VERSION_MAJOR 1
#define HARDWARE_VERSION_MINOR 0 #define HARDWARE_VERSION_MINOR 0
@ -72,14 +72,15 @@
#define MENU_FEED 17 #define MENU_FEED 17
#define MENU_TRBO 18 #define MENU_TRBO 18
#define MENU_DARK 19 #define MENU_DARK 19
#define MENU_TRBL 20 #define MENU_SAVE 20
#define MENU_SYNC 21 #define MENU_TRBL 21
#define MENU_WIFI 22 #define MENU_SYNC 22
#define MENU_OTAU 23 #define MENU_WIFI 23
#define MENU_OTAM 24 #define MENU_OTAU 24
#define MENU_SCRN 25 #define MENU_OTAM 25
#define MENU_RSET 26 #define MENU_SCRN 26
#define MENU_TOFF 27 // Time Diff offset. #define MENU_RSET 27
#define MENU_TOFF 28 // Time Diff offset.
// Menu segments. // Menu segments.
#define MENU_INNORMAL 0 #define MENU_INNORMAL 0

View File

@ -1,4 +1,3 @@
#include "Watchy_GSR.h" #include "Watchy_GSR.h"
WatchyGSR watchy; WatchyGSR watchy;

View File

@ -55,6 +55,7 @@ RTC_DATA_ATTR struct Optional {
uint8_t SleepMode; // Turns screen off (black, won't show any screen unless a button is pressed) uint8_t SleepMode; // Turns screen off (black, won't show any screen unless a button is pressed)
uint8_t SleepStart; // Hour when you go to bed. uint8_t SleepStart; // Hour when you go to bed.
uint8_t SleepEnd; // Hour when you wake up. uint8_t SleepEnd; // Hour when you wake up.
uint8_t Performance; // Performance style, "Turbo", "Normal", "Battery Saving"
bool NeedsSaving; // NVS code to tell it things have been updated, so save to NVS. bool NeedsSaving; // NVS code to tell it things have been updated, so save to NVS.
} Options; } Options;
@ -225,6 +226,7 @@ void WatchyGSR::init(){
LastButton = 0; LastButton = 0;
Darkness.Last = 0; Darkness.Last = 0;
TurboTime = 0; TurboTime = 0;
CPUSet.Freq=getCpuFrequencyMhz();
switch (wakeup_reason) switch (wakeup_reason)
{ {
@ -248,15 +250,15 @@ void WatchyGSR::init(){
Button = getButtonMaskToID(wakeupBit); Button = getButtonMaskToID(wakeupBit);
break; break;
default: //reset default: //reset
RefreshCPU(CPUMAX);
setupDefaults();
initZeros(); initZeros();
setupDefaults();
_rtcConfig(); _rtcConfig();
_bmaConfig(); _bmaConfig();
UpdateUTC(); UpdateUTC();
B = NVS.getString("GSR-TZ",S); B = NVS.getString("GSR-TZ",S);
if (S.length() > 0) strcpy(WatchTime.POSIX,S.c_str()); if (S.length() > 0) strcpy(WatchTime.POSIX,S.c_str());
RetrieveSettings(); RetrieveSettings();
RefreshCPU(CPUMAX);
WatchTime.WatchyRTC = esp_timer_get_time() + ((60 - WatchTime.UTC.Second) * 1000000); WatchTime.WatchyRTC = esp_timer_get_time() + ((60 - WatchTime.UTC.Second) * 1000000);
WatchTime.EPSMS = (millis() + (1000 * (60 - WatchTime.UTC.Second))); WatchTime.EPSMS = (millis() + (1000 * (60 - WatchTime.UTC.Second)));
UpdateUTC(); UpdateUTC();
@ -595,7 +597,7 @@ void WatchyGSR::init(){
} }
void WatchyGSR::showWatchFace(){ void WatchyGSR::showWatchFace(){
if (!WatchTime.DeadRTC || Battery.Direction == 1) RefreshCPU(CPUMID); if (Options.Performance > 0) RefreshCPU((Options.Performance == 1 ? CPUMID : CPUMAX));
if (Darkness.Went) display.init(0,false); // Force it here so it fixes the border. if (Darkness.Went) display.init(0,false); // Force it here so it fixes the border.
display.epd2.setDarkBorder(Options.Border); display.epd2.setDarkBorder(Options.Border);
drawWatchFace(); drawWatchFace();
@ -808,6 +810,9 @@ void WatchyGSR::drawMenu(){
O = "Sleeping Ends"; O = "Sleeping Ends";
} }
break; break;
case MENU_SAVE:
O = "Performance";
break;
case MENU_TRBL: case MENU_TRBL:
O = "Troubleshoot"; O = "Troubleshoot";
break; break;
@ -1023,6 +1028,9 @@ void WatchyGSR::drawMenu(){
case 4: case 4:
O = MakeHour(Options.SleepStart) + MakeTOD(Options.SleepStart, true) + " to [" + MakeHour(Options.SleepEnd) + MakeTOD(Options.SleepEnd, true) + "]"; O = MakeHour(Options.SleepStart) + MakeTOD(Options.SleepStart, true) + " to [" + MakeHour(Options.SleepEnd) + MakeTOD(Options.SleepEnd, true) + "]";
} }
}else if (Menu.Item == MENU_SAVE){ // Performance
if (Options.Performance == 2 || WatchTime.DeadRTC) O = "Battery Saving";
else O = ((Options.Performance == 1) ? "Normal" : "Turbo");
}else if (Menu.Item == MENU_TRBL){ // Troubleshooting. }else if (Menu.Item == MENU_TRBL){ // Troubleshooting.
O = "MENU to Enter"; O = "MENU to Enter";
}else if (Menu.Item == MENU_SYNC){ // NTP }else if (Menu.Item == MENU_SYNC){ // NTP
@ -1533,6 +1541,13 @@ void WatchyGSR::handleButtonPress(uint8_t Pressed){
UpdateDisp = true; // Quick Update. UpdateDisp = true; // Quick Update.
SetTurbo(); SetTurbo();
} }
}else if (Menu.Item == MENU_SAVE && !WatchTime.DeadRTC){ // Battery Saver.
Options.Performance = roller(Options.Performance + 1,0,2);
Options.NeedsSaving = true;
Menu.LastItem=""; // Forces a redraw.
DoHaptic = true;
UpdateDisp = true; // Quick Update.
SetTurbo();
}else if (Menu.Item == MENU_SYNC){ // Sync Time }else if (Menu.Item == MENU_SYNC){ // Sync Time
if (Menu.SubItem == 0){ if (Menu.SubItem == 0){
Menu.SubItem++; Menu.SubItem++;
@ -2822,7 +2837,8 @@ String WatchyGSR::GetSettings(){
// Versuib 128. // Versuib 128.
I[J] = (Options.Drift & 255); J++; I[J] = (Options.Drift & 255); J++;
I[J] = ((Options.Drift >> 8) & 255); J++; I[J] = ((Options.Drift >> 8) & 255); J++;
I[J] = (Options.SleepStyle); J++; W = ((Options.Performance & 15) << 4);
I[J] = (Options.SleepStyle | W); J++;
I[J] = (Options.SleepMode); J++; I[J] = (Options.SleepMode); J++;
I[J] = (Options.SleepStart); J++; I[J] = (Options.SleepStart); J++;
I[J] = (Options.SleepEnd); J++; I[J] = (Options.SleepEnd); J++;
@ -2906,7 +2922,10 @@ void WatchyGSR::StoreSettings(String FromUser){
WatchTime.DeadRTC = true; WatchTime.DeadRTC = true;
}else WatchTime.DeadRTC = false; }else WatchTime.DeadRTC = false;
} }
J++; if (L > J) Options.SleepStyle = clamp(O[J],(WatchTime.DeadRTC ? 1 : 0),2); J++; if (L > J){
V = ((O[J] & 240) >> 4); Options.Performance = clamp(V,0,2);
Options.SleepStyle = clamp((V & 3),(WatchTime.DeadRTC ? 1 : 0),2);
}
J++; if (L > J) Options.SleepMode = clamp(O[J],1,10); J++; if (L > J) Options.SleepMode = clamp(O[J],1,10);
J++; if (L > J) Options.SleepStart = clamp(O[J],0,23); J++; if (L > J) Options.SleepStart = clamp(O[J],0,23);
J++; if (L > J) Options.SleepEnd = clamp(O[J],0,23); J++; if (L > J) Options.SleepEnd = clamp(O[J],0,23);
@ -3018,13 +3037,12 @@ bool WatchyGSR::Showing() {
void WatchyGSR::RefreshCPU(){ RefreshCPU(0); } void WatchyGSR::RefreshCPU(){ RefreshCPU(0); }
void WatchyGSR::RefreshCPU(int Value){ void WatchyGSR::RefreshCPU(int Value){
uint32_t C; uint32_t C;
bool B; if (WatchTime.DeadRTC || Options.Performance == 2) C = 80;
CPUSet.Freq=getCpuFrequencyMhz(); else C = (InTurbo() || Value == CPUMID) ? 160 : 80;
C = (InTurbo() || Value == CPUMID) ? 160 : 80;
if (Value == CPUMAX) CPUSet.Locked = true; if (Value == CPUMAX) CPUSet.Locked = true;
if (Value == CPUDEF) CPUSet.Locked = false; if (Value == CPUDEF) CPUSet.Locked = false;
if (WatchyAPOn || OTAUpdate || GSRWiFi.Requests > 0 || CPUSet.Locked) C = 240; if (WatchyAPOn || OTAUpdate || GSRWiFi.Requests > 0 || CPUSet.Locked || (Options.Performance == 0 && !WatchTime.DeadRTC)) C = 240;
if (C != CPUSet.Freq) B = setCpuFrequencyMhz(C); if (C != CPUSet.Freq) if (setCpuFrequencyMhz(C)); CPUSet.Freq = C;
} }
// Debugging here. // Debugging here.