Corrected errors and added 1 new function.

This commit is contained in:
GuruSR 2021-10-08 00:30:42 -04:00 committed by GitHub
parent 80d49d9321
commit f226b239a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 14 deletions

View File

@ -60,15 +60,16 @@
#define MENU_BRDR 11 #define MENU_BRDR 11
#define MENU_SIDE 12 #define MENU_SIDE 12
#define MENU_SWAP 13 #define MENU_SWAP 13
#define MENU_MODE 14 #define MENU_ORNT 14
#define MENU_FEED 15 #define MENU_MODE 15
#define MENU_TRBO 16 #define MENU_FEED 16
#define MENU_SCRN 17 #define MENU_TRBO 17
#define MENU_SYNC 18 #define MENU_SCRN 18
#define MENU_WIFI 19 #define MENU_SYNC 19
#define MENU_OTAU 20 #define MENU_WIFI 20
#define MENU_OTAM 21 #define MENU_OTAU 21
#define MENU_RSET 22 #define MENU_OTAM 22
#define MENU_RSET 23
// Menu segments. // Menu segments.
#define MENU_INNORMAL 0 #define MENU_INNORMAL 0

View File

@ -9,8 +9,8 @@ static const char UserAgent[] PROGMEM = "Watchy";
// AlarmVBs[] = {"0111111110", "0011001100", "0110110110", "0101001010"}; // AlarmVBs[] = {"0111111110", "0011001100", "0110110110", "0101001010"};
int AlarmVBs[] = {0x01FE, 0x00CC, 0x01B6, 0x014A}; int AlarmVBs[] = {0x01FE, 0x00CC, 0x01B6, 0x014A};
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
const char *Headings[] = {"Steps", "Alarms", "Timers", "Options", "Alarm 1", "Alarm 2", "Alarm 3", "Alarm 4", "Countdown Timer", "Elapsed Timer", "Display Style", "Border Mode", "Dexterity", "Menu & Back", "Time Mode", "Feedback", "Turbo Time", "Reset Screen", "Sync Watchy", "Watchy Connect", "OTA Update", "OTA Website","Watchy Reboot"}; const char *Headings[] = {"Steps", "Alarms", "Timers", "Options", "Alarm 1", "Alarm 2", "Alarm 3", "Alarm 4", "Countdown Timer", "Elapsed Timer", "Display Style", "Border Mode", "Dexterity", "Menu & Back", "Orientation", "Time Mode", "Feedback", "Turbo Time", "Reset Screen", "Sync Watchy", "Watchy Connect", "OTA Update", "OTA Website","Watchy Reboot"};
const uint16_t Bits[10] = {1,2,4,8,16,32,64,128,256,512}; const uint16_t Bits[10] = {1,2,4,8,16,32,64,128,256,512};
@ -28,6 +28,7 @@ RTC_DATA_ATTR struct Optional {
bool Border; // True to set the border to black/white. bool Border; // True to set the border to black/white.
bool Lefty; // Swaps the buttons to the other side. bool Lefty; // Swaps the buttons to the other side.
bool Swapped; // Menu and Back buttons swap ends (vertically). bool Swapped; // Menu and Back buttons swap ends (vertically).
bool Orientated; // Set to false to not bother which way the buttons are.
uint8_t Turbo; // 0-10 seconds. uint8_t Turbo; // 0-10 seconds.
} Options; } Options;
@ -147,8 +148,8 @@ void WatchyGSR::setupDefaults(){
Options.Feedback = true; Options.Feedback = true;
Options.Border = false; Options.Border = false;
Options.Lefty = false; Options.Lefty = false;
Options.Turbo = 3;
Options.Swapped = false; Options.Swapped = false;
Options.Turbo = 3;
Steps.Hour = 6; Steps.Hour = 6;
Steps.Minutes = 0; Steps.Minutes = 0;
} }
@ -762,6 +763,12 @@ void WatchyGSR::drawMenu(){
}else { }else {
O = "Show"; O = "Show";
} }
}else if (Menu.Item == MENU_ORNT){ // Watchy Orientation.
if (Options.Orientated){
O = "Watchy UP";
}else {
O = "Ignore";
}
}else if (Menu.Item == MENU_MODE){ // 24hr Format Swap. }else if (Menu.Item == MENU_MODE){ // 24hr Format Swap.
if (Options.TwentyFour){ if (Options.TwentyFour){
O = "24 Hour"; O = "24 Hour";
@ -822,7 +829,7 @@ void WatchyGSR::drawMenu(){
} }
void WatchyGSR::deepSleep(){ void WatchyGSR::deepSleep(){
//display.hibernate(); display.hibernate();
#ifndef ESP_RTC #ifndef ESP_RTC
esp_sleep_enable_ext0_wakeup(RTC_PIN, 0); //enable deep sleep wake on RTC interrupt esp_sleep_enable_ext0_wakeup(RTC_PIN, 0); //enable deep sleep wake on RTC interrupt
@ -1078,7 +1085,7 @@ void WatchyGSR::handleButtonPress(uint8_t Pressed){
} }
*/ */
if (Direction != DIRECTION_DISP_UP && Direction != DIRECTION_TOP_EDGE) return; // Don't accept it. if (Options.Orientated) { if (Direction != DIRECTION_DISP_UP && Direction != DIRECTION_TOP_EDGE) return; } // Don't accept it.
switch (Pressed){ switch (Pressed){
case 1: case 1:
@ -1247,6 +1254,12 @@ void WatchyGSR::handleButtonPress(uint8_t Pressed){
DoHapatic = true; DoHapatic = true;
UpdateDisp = true; // Quick Update. UpdateDisp = true; // Quick Update.
SetTurbo(); SetTurbo();
}else if (Menu.Item == MENU_ORNT){ // Watchy Orientation
Options.Orientated = !Options.Orientated;
Menu.LastItem=""; // Forces a redraw.
DoHapatic = true;
UpdateDisp = true; // Quick Update.
SetTurbo();
}else if (Menu.Item == MENU_MODE){ // Switch Time Mode }else if (Menu.Item == MENU_MODE){ // Switch Time Mode
Options.TwentyFour = !Options.TwentyFour; Options.TwentyFour = !Options.TwentyFour;
Menu.LastItem=""; // Forces a redraw. Menu.LastItem=""; // Forces a redraw.
@ -2081,6 +2094,7 @@ String WatchyGSR::GetSettings(){
K |= Options.Border ? 8 : 0; K |= Options.Border ? 8 : 0;
K |= Options.Lefty ? 16 : 0; K |= Options.Lefty ? 16 : 0;
K |= Options.Swapped ? 32 : 0; K |= Options.Swapped ? 32 : 0;
K |= Options.Orientated ? 64 : 0;
I[2] = (K); I[3] = Options.Turbo; I[2] = (K); I[3] = Options.Turbo;
I[4] = (TimerDown.MaxHours); I[4] = (TimerDown.MaxHours);
@ -2124,6 +2138,7 @@ void WatchyGSR::StoreSettings(String FromUser){
Options.Border = (V & 8) ? true : false; Options.Border = (V & 8) ? true : false;
Options.Lefty = (V & 16) ? true : false; Options.Lefty = (V & 16) ? true : false;
Options.Swapped = (V & 32) ? true : false; Options.Swapped = (V & 32) ? true : false;
Options.Orientated = (V & 64) ? true : false;
} }
J++; if (L > J) Options.Turbo = clamp(O[J],0,10); J++; if (L > J) Options.Turbo = clamp(O[J],0,10);
J++; if (L > J) TimerDown.MaxHours = clamp(O[J],0,23); J++; if (L > J) TimerDown.MaxHours = clamp(O[J],0,23);

View File

@ -1,6 +1,7 @@
#ifndef WATCHY_GSR_H #ifndef WATCHY_GSR_H
#define WATCHY_GSR_H #define WATCHY_GSR_H
#include <Watchy.h>
#include "Defines_GSR.h" #include "Defines_GSR.h"
#include "Web-HTML.h" #include "Web-HTML.h"
#include <Arduino.h> #include <Arduino.h>