mirror of https://github.com/sqfmi/Watchy.git
Trying to fix compatibility.
parent
cec4cfb49c
commit
9b6353d792
|
@ -23,7 +23,11 @@
|
||||||
{ "name": "Wire" },
|
{ "name": "Wire" },
|
||||||
{ "name": "WiFi" },
|
{ "name": "WiFi" },
|
||||||
{ "name": "ESP32 BLE Arduino" },
|
{ "name": "ESP32 BLE Arduino" },
|
||||||
{ "name": "espressif32" },
|
{ "name": "Update" },
|
||||||
|
{
|
||||||
|
"name": "WiFiSelector",
|
||||||
|
"version": "oatssss/WiFiSelector"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Rtc_Pcf8563",
|
"name": "Rtc_Pcf8563",
|
||||||
"version": "https://github.com/orbitalair/Rtc_Pcf8563.git#master"
|
"version": "https://github.com/orbitalair/Rtc_Pcf8563.git#master"
|
||||||
|
|
|
@ -148,6 +148,7 @@ int BLE::updateStatus(){
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int BLE::howManyBytes(){
|
int BLE::howManyBytes()
|
||||||
|
{
|
||||||
return bytesReceived;
|
return bytesReceived;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#ifndef _BLE_H_
|
#pragma once
|
||||||
#define _BLE_H_
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
@ -12,8 +11,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
class BLE;
|
|
||||||
|
|
||||||
class BLE
|
class BLE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -38,5 +35,3 @@ class BLE
|
||||||
BLECharacteristic * pOtaCharacteristic = NULL;
|
BLECharacteristic * pOtaCharacteristic = NULL;
|
||||||
BLECharacteristic * pWatchFaceNameCharacteristic = NULL;
|
BLECharacteristic * pWatchFaceNameCharacteristic = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
// Created by http://oleddisplay.squix.ch/ Consider a donation
|
// Created by http://oleddisplay.squix.ch/ Consider a donation
|
||||||
// In case of problems make sure that you are using the font file with the correct version!
|
// In case of problems make sure that you are using the font file with the correct version!
|
||||||
const uint8_t DSEG7_Classic_Bold_53Bitmaps[] PROGMEM = {
|
const uint8_t DSEG7_Classic_Bold_53Bitmaps[] PROGMEM = {
|
||||||
|
@ -196,4 +197,4 @@ const GFXglyph DSEG7_Classic_Bold_53Glyphs[] PROGMEM = {
|
||||||
{ 13675, 15, 36, 20, 2, -36 } // '}'
|
{ 13675, 15, 36, 20, 2, -36 } // '}'
|
||||||
};
|
};
|
||||||
const GFXfont DSEG7_Classic_Bold_53 PROGMEM = {
|
const GFXfont DSEG7_Classic_Bold_53 PROGMEM = {
|
||||||
(uint8_t *)DSEG7_Classic_Bold_53Bitmaps,(GFXglyph *)DSEG7_Classic_Bold_53Glyphs,0x20, 0x7E, 58};
|
(uint8_t *)DSEG7_Classic_Bold_53Bitmaps,(GFXglyph *)DSEG7_Classic_Bold_53Glyphs,0x20, 0x7E, 58};
|
||||||
|
|
|
@ -2,5 +2,6 @@
|
||||||
|
|
||||||
class CWatchFace
|
class CWatchFace
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
CWatchFace() = default;
|
||||||
};
|
};
|
||||||
|
|
|
@ -48,7 +48,7 @@ void Watchy::init(String datetime)
|
||||||
|
|
||||||
void Watchy::displayBusyCallback(const void*)
|
void Watchy::displayBusyCallback(const void*)
|
||||||
{
|
{
|
||||||
gpio_wakeup_enable((gpio_num_t)DISPLAY_BUSY, GPIO_INTR_LOW_LEVEL);
|
gpio_wakeup_enable((gpio_num_t)BUSY, GPIO_INTR_LOW_LEVEL);
|
||||||
esp_sleep_enable_gpio_wakeup();
|
esp_sleep_enable_gpio_wakeup();
|
||||||
esp_light_sleep_start();
|
esp_light_sleep_start();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,17 @@
|
||||||
// Wire
|
// Wire
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
|
||||||
|
// Fonts
|
||||||
|
#include <Fonts/FreeMonoBold9pt7b.h>
|
||||||
|
|
||||||
|
// Watchy
|
||||||
|
#include "WatchyRTC.h"
|
||||||
|
|
||||||
CWatchyExpanded::CWatchyExpanded() : m_display(GxEPD2_154_D67(DISPLAY_CS, DISPLAY_DC, DISPLAY_RES, DISPLAY_BUSY))
|
CWatchyExpanded::CWatchyExpanded() : m_display(GxEPD2_154_D67(DISPLAY_CS, DISPLAY_DC, DISPLAY_RES, DISPLAY_BUSY))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWatchyExpanded::AddWatchFace(Watchy* pFace)
|
void CWatchyExpanded::AddWatchFace(CWatchFace* pFace)
|
||||||
{
|
{
|
||||||
m_faces.push_back(pFace);
|
m_faces.push_back(pFace);
|
||||||
}
|
}
|
||||||
|
@ -23,44 +29,45 @@ void CWatchyExpanded::Init()
|
||||||
|
|
||||||
// Init the display here for all cases, if unused, it will do nothing
|
// Init the display here for all cases, if unused, it will do nothing
|
||||||
m_display.init(0, true, 10, true); // 10ms by spec, and fast pulldown reset
|
m_display.init(0, true, 10, true); // 10ms by spec, and fast pulldown reset
|
||||||
display.epd2.setBusyCallback(displayBusyCallback);
|
m_display.epd2.setBusyCallback(DisplayBusyCallback);
|
||||||
|
|
||||||
switch (wakeup_reason)
|
switch (wakeup_reason)
|
||||||
{
|
{
|
||||||
case ESP_SLEEP_WAKEUP_EXT0: //RTC Alarm
|
case ESP_SLEEP_WAKEUP_EXT0: //RTC Alarm
|
||||||
if(guiState == kWatchFace_State){
|
if(m_guiState == kWatchFace_State)
|
||||||
|
{
|
||||||
RTC.read(m_currentTime);
|
RTC.read(m_currentTime);
|
||||||
showWatchFace(true); //partial updates on tick
|
UpdateScreen(); //partial updates on tick
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
// case ESP_SLEEP_WAKEUP_EXT1: //button Press
|
// case ESP_SLEEP_WAKEUP_EXT1: //button Press
|
||||||
// handleButtonPress();
|
// handleButtonPress();
|
||||||
// break;
|
// break;
|
||||||
// default: //reset
|
default: //reset
|
||||||
// RTC.config(datetime);
|
//RTC.config(datetime);
|
||||||
// _bmaConfig();
|
//_bmaConfig();
|
||||||
// RTC.read(currentTime);
|
//RTC.read(currentTime);
|
||||||
// //showWatchFace(false); //full update on reset
|
//showWatchFace(false); //full update on reset
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//deepSleep();
|
DeepSleep();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Watchy::DisplayBusyCallback(const void*)
|
void CWatchyExpanded::DisplayBusyCallback(const void*)
|
||||||
{
|
{
|
||||||
gpio_wakeup_enable((gpio_num_t)DISPLAY_BUSY, GPIO_INTR_LOW_LEVEL);
|
gpio_wakeup_enable((gpio_num_t)BUSY, GPIO_INTR_LOW_LEVEL);
|
||||||
esp_sleep_enable_gpio_wakeup();
|
esp_sleep_enable_gpio_wakeup();
|
||||||
esp_light_sleep_start();
|
esp_light_sleep_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateScreen()
|
void CWatchyExpanded::UpdateScreen()
|
||||||
{
|
{
|
||||||
m_display.setFullWindow();
|
m_display.setFullWindow();
|
||||||
//drawWatchFace();
|
//drawWatchFace();
|
||||||
DrawBasicClock(); // Temp
|
DrawBasicClock(); // Temp
|
||||||
|
|
||||||
m_display.display(true); //partial refresh
|
m_display.display(true); //partial refresh
|
||||||
guiState = kWatchFace_State;
|
m_guiState = kWatchFace_State;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWatchyExpanded::DrawBasicClock()
|
void CWatchyExpanded::DrawBasicClock()
|
||||||
|
@ -90,7 +97,7 @@ void CWatchyExpanded::DrawBasicClock()
|
||||||
|
|
||||||
void CWatchyExpanded::DeepSleep()
|
void CWatchyExpanded::DeepSleep()
|
||||||
{
|
{
|
||||||
display.hibernate();
|
m_display.hibernate();
|
||||||
RTC.clearAlarm(); //resets the alarm flag in the RTC
|
RTC.clearAlarm(); //resets the alarm flag in the RTC
|
||||||
|
|
||||||
for(int i=0; i<40; i++) // Set pins 0-39 to input to avoid power leaking out
|
for(int i=0; i<40; i++) // Set pins 0-39 to input to avoid power leaking out
|
||||||
|
|
|
@ -9,6 +9,12 @@
|
||||||
// Time
|
// Time
|
||||||
#include <TimeLib.h>
|
#include <TimeLib.h>
|
||||||
|
|
||||||
|
// Watchy
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
// Expanded
|
||||||
|
#include "WatchFace.h"
|
||||||
|
|
||||||
// Defs
|
// Defs
|
||||||
class CWatchFace;
|
class CWatchFace;
|
||||||
|
|
||||||
|
@ -22,7 +28,8 @@ class CWatchyExpanded
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void DisplayBusyCallback(const void*);
|
static void DisplayBusyCallback(const void*);
|
||||||
|
|
||||||
void UpdateScreen();
|
void UpdateScreen();
|
||||||
void DeepSleep();
|
void DeepSleep();
|
||||||
|
|
||||||
|
@ -33,4 +40,5 @@ class CWatchyExpanded
|
||||||
|
|
||||||
GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> m_display;
|
GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> m_display;
|
||||||
tmElements_t m_currentTime;
|
tmElements_t m_currentTime;
|
||||||
|
std::int8_t m_guiState = kWatchFace_State;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
#ifndef CONFIG_H
|
#pragma once
|
||||||
#define CONFIG_H
|
|
||||||
|
|
||||||
//display
|
//display
|
||||||
#define DISPLAY_WIDTH 200
|
#define DISPLAY_WIDTH 200
|
||||||
#define DISPLAY_HEIGHT 200
|
#define DISPLAY_HEIGHT 200
|
||||||
|
#define BTN_PIN_MASK MENU_BTN_MASK|BACK_BTN_MASK|UP_BTN_MASK|DOWN_BTN_MASK
|
||||||
//wifi
|
//wifi
|
||||||
#define WIFI_AP_TIMEOUT 60
|
#define WIFI_AP_TIMEOUT 60
|
||||||
#define WIFI_AP_SSID "Watchy AP"
|
#define WIFI_AP_SSID "Watchy AP"
|
||||||
//menu
|
//menu
|
||||||
constexpr std::int8_t kWatchFace_State -1
|
constexpr std::int8_t kWatchFace_State{-1}
|
||||||
#define MAIN_MENU_STATE 0
|
#define MAIN_MENU_STATE 0
|
||||||
#define APP_STATE 1
|
#define APP_STATE 1
|
||||||
#define FW_UPDATE_STATE 2
|
#define FW_UPDATE_STATE 2
|
||||||
|
@ -31,4 +31,3 @@ constexpr std::int8_t kWatchFace_State -1
|
||||||
#define HARDWARE_VERSION_MINOR 0
|
#define HARDWARE_VERSION_MINOR 0
|
||||||
//Versioning
|
//Versioning
|
||||||
#define WATCHY_LIB_VER "1.4.0"
|
#define WATCHY_LIB_VER "1.4.0"
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in New Issue