remove hardware ref from display and
add touch handler to reset standby timer
This commit is contained in:
parent
92c559df5e
commit
86edbbc541
3 changed files with 10 additions and 17 deletions
|
@ -71,9 +71,12 @@ void HardwareRevX::init() {
|
|||
// Make sure ESP32 is running at full speed
|
||||
setCpuFrequencyMhz(240);
|
||||
|
||||
mDisplay = Display::getInstance(std::shared_ptr<HardwareAbstract>());
|
||||
mDisplay = Display::getInstance();
|
||||
mBattery = std::make_shared<Battery>(ADC_BAT,CRG_STAT);
|
||||
mWifiHandler = wifiHandler::getInstance();
|
||||
|
||||
mDisplay->onTouch([this]([[maybe_unused]] auto touchPoint){ standbyTimer = SLEEP_TIMEOUT;});
|
||||
|
||||
wakeup_reason = getWakeReason();
|
||||
initIO();
|
||||
setupBacklight();
|
||||
|
@ -301,15 +304,7 @@ void HardwareRevX::setupIMU() {
|
|||
}
|
||||
|
||||
void HardwareRevX::slowDisplayWakeup() {
|
||||
// Slowly charge the VSW voltage to prevent a brownout
|
||||
// Workaround for hardware rev 1!
|
||||
for (int i = 0; i < 100; i++) {
|
||||
digitalWrite(LCD_EN, HIGH); // LCD Logic off
|
||||
delayMicroseconds(1);
|
||||
digitalWrite(LCD_EN, LOW); // LCD Logic on
|
||||
}
|
||||
|
||||
delay(100); // Wait for the LCD driver to power on
|
||||
}
|
||||
|
||||
void HardwareRevX::setupIR() {
|
||||
|
|
|
@ -3,21 +3,20 @@
|
|||
#include "omoteconfig.h"
|
||||
#include "Wire.h"
|
||||
|
||||
std::shared_ptr<Display> Display::getInstance(std::shared_ptr<HardwareAbstract> aHardware)
|
||||
std::shared_ptr<Display> Display::getInstance()
|
||||
{
|
||||
if (DisplayAbstract::mInstance == nullptr)
|
||||
{
|
||||
DisplayAbstract::mInstance = std::shared_ptr<Display>(new Display(LCD_EN, LCD_BL, aHardware));
|
||||
DisplayAbstract::mInstance = std::shared_ptr<Display>(new Display(LCD_EN, LCD_BL));
|
||||
}
|
||||
return std::static_pointer_cast<Display>(mInstance);
|
||||
}
|
||||
|
||||
Display::Display(int backlight_pin, int enable_pin, std::shared_ptr<HardwareAbstract> aHardware): DisplayAbstract(),
|
||||
Display::Display(int backlight_pin, int enable_pin): DisplayAbstract(),
|
||||
mBacklightPin(backlight_pin),
|
||||
mEnablePin(enable_pin),
|
||||
tft(TFT_eSPI()),
|
||||
touch(Adafruit_FT6206()),
|
||||
mHardware(aHardware)
|
||||
touch(Adafruit_FT6206())
|
||||
{
|
||||
pinMode(mEnablePin, OUTPUT);
|
||||
digitalWrite(mEnablePin, HIGH);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
class Display: public DisplayAbstract
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<Display> getInstance(std::shared_ptr<HardwareAbstract> aHardware);
|
||||
static std::shared_ptr<Display> getInstance();
|
||||
|
||||
virtual void setBrightness(uint8_t brightness) override;
|
||||
virtual void turnOff() override;
|
||||
|
@ -32,7 +32,7 @@ class Display: public DisplayAbstract
|
|||
virtual void screenInput(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) override;
|
||||
|
||||
private:
|
||||
Display(int backlight_pin, int enable_pin, std::shared_ptr<HardwareAbstract> aHardware);
|
||||
Display(int backlight_pin, int enable_pin);
|
||||
void setupTFT();
|
||||
void setupTouchScreen();
|
||||
|
||||
|
@ -43,6 +43,5 @@ class Display: public DisplayAbstract
|
|||
Adafruit_FT6206 touch;
|
||||
TS_Point touchPoint;
|
||||
TS_Point oldPoint;
|
||||
std::shared_ptr<HardwareAbstract> mHardware;
|
||||
Notification<TS_Point> mTouchEvent;
|
||||
};
|
Loading…
Add table
Reference in a new issue