mirror of https://github.com/sqfmi/Watchy.git
Add an "About Watchy" menu item.
This replaces "Check Battery" and adds the following info: * Firmware version * RTC chip type The firmware version is #defined in Watchy.h. There might be a way to do this that's friendlier to the library release process, but I'll leave that up to the people who actually build the releases. I plan to extend the About menu with some radio-related info as I work on getting BLE pairing working with my iPhone.pull/139/head
parent
26f5ac20c0
commit
bf7425c7dc
|
@ -72,7 +72,7 @@ void Watchy::handleButtonPress(){
|
|||
switch(menuIndex)
|
||||
{
|
||||
case 0:
|
||||
showBattery();
|
||||
showAbout();
|
||||
break;
|
||||
case 1:
|
||||
showBuzz();
|
||||
|
@ -154,7 +154,7 @@ void Watchy::handleButtonPress(){
|
|||
switch(menuIndex)
|
||||
{
|
||||
case 0:
|
||||
showBattery();
|
||||
showAbout();
|
||||
break;
|
||||
case 1:
|
||||
showBuzz();
|
||||
|
@ -223,7 +223,7 @@ void Watchy::showMenu(byte menuIndex, bool partialRefresh){
|
|||
uint16_t w, h;
|
||||
int16_t yPos;
|
||||
|
||||
const char *menuItems[] = {"Check Battery", "Vibrate Motor", "Show Accelerometer", "Set Time", "Setup WiFi", "Update Firmware", "Sync NTP"};
|
||||
const char *menuItems[] = {"About Watchy", "Vibrate Motor", "Show Accelerometer", "Set Time", "Setup WiFi", "Update Firmware", "Sync NTP"};
|
||||
for(int i=0; i<MENU_LENGTH; i++){
|
||||
yPos = MENU_HEIGHT+(MENU_HEIGHT*i);
|
||||
display.setCursor(0, yPos);
|
||||
|
@ -252,7 +252,7 @@ void Watchy::showFastMenu(byte menuIndex){
|
|||
uint16_t w, h;
|
||||
int16_t yPos;
|
||||
|
||||
const char *menuItems[] = {"Check Battery", "Vibrate Motor", "Show Accelerometer", "Set Time", "Setup WiFi", "Update Firmware", "Sync NTP"};
|
||||
const char *menuItems[] = {"About Watchy", "Vibrate Motor", "Show Accelerometer", "Set Time", "Setup WiFi", "Update Firmware", "Sync NTP"};
|
||||
for(int i=0; i<MENU_LENGTH; i++){
|
||||
yPos = MENU_HEIGHT+(MENU_HEIGHT*i);
|
||||
display.setCursor(0, yPos);
|
||||
|
@ -272,17 +272,30 @@ void Watchy::showFastMenu(byte menuIndex){
|
|||
guiState = MAIN_MENU_STATE;
|
||||
}
|
||||
|
||||
void Watchy::showBattery(){
|
||||
void Watchy::showAbout(){
|
||||
display.setFullWindow();
|
||||
display.fillScreen(GxEPD_BLACK);
|
||||
display.setFont(&FreeMonoBold9pt7b);
|
||||
display.setTextColor(GxEPD_WHITE);
|
||||
display.setCursor(20, 30);
|
||||
display.println("Battery Voltage:");
|
||||
display.setCursor(0, 20);
|
||||
|
||||
display.print("FW Ver: ");
|
||||
display.println(Watchy_Version);
|
||||
|
||||
const char *rtc_hw_type;
|
||||
switch (RTC.rtcType) {
|
||||
case 0: rtc_hw_type = "DS3231"; break;
|
||||
case 1: rtc_hw_type = "PCF8563"; break;
|
||||
default: rtc_hw_type = "<unknown>";
|
||||
}
|
||||
display.print("RTC: ");
|
||||
display.println(rtc_hw_type);
|
||||
|
||||
display.print("Batt: ");
|
||||
float voltage = getBatteryVoltage();
|
||||
display.setCursor(70, 80);
|
||||
display.print(voltage);
|
||||
display.println("V");
|
||||
|
||||
display.display(false); //full refresh
|
||||
|
||||
guiState = APP_STATE;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
#include "bma.h"
|
||||
#include "config.h"
|
||||
|
||||
#define Watchy_Version "1.3.1"
|
||||
|
||||
typedef struct weatherData{
|
||||
int8_t temperature;
|
||||
int16_t weatherConditionCode;
|
||||
|
@ -54,7 +56,7 @@ class Watchy {
|
|||
void handleButtonPress();
|
||||
void showMenu(byte menuIndex, bool partialRefresh);
|
||||
void showFastMenu(byte menuIndex);
|
||||
void showBattery();
|
||||
void showAbout();
|
||||
void showBuzz();
|
||||
void showAccelerometer();
|
||||
void showUpdateFW();
|
||||
|
@ -84,4 +86,4 @@ extern RTC_DATA_ATTR BMA423 sensor;
|
|||
extern RTC_DATA_ATTR bool WIFI_CONFIGURED;
|
||||
extern RTC_DATA_ATTR bool BLE_CONFIGURED;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -130,4 +130,4 @@ String WatchyRTC::_getValue(String data, char separator, int index)
|
|||
}
|
||||
|
||||
return found>index ? data.substring(strIndex[0], strIndex[1]) : "";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue