cleanup powermgm and add haptic feedback

This commit is contained in:
sharandac
2020-08-03 09:04:33 +02:00
parent 69b9a54408
commit ae45eac491
24 changed files with 168 additions and 125 deletions

View File

@@ -22,6 +22,7 @@
#include "config.h"
#include "touch.h"
#include "powermgm.h"
#include "motor.h"
lv_indev_t *touch_indev = NULL;
@@ -37,6 +38,7 @@ void touch_setup( TTGOClass *ttgo ) {
static bool touch_getXY( int16_t &x, int16_t &y ) {
TTGOClass *ttgo = TTGOClass::getWatch();
TP_Point p;
static bool touch_press = false;
// disable touch when we are in standby or silence wakeup
if ( powermgm_get_event( POWERMGM_STANDBY | POWERMGM_SILENCE_WAKEUP ) ) {
@@ -44,9 +46,15 @@ static bool touch_getXY( int16_t &x, int16_t &y ) {
}
if ( !ttgo->touch->touched() ) {
touch_press = false;
return( false );
}
if ( !touch_press ) {
touch_press = true;
motor_vibe( 2 );
}
p = ttgo->touch->getPoint();
uint8_t rotation = ttgo->tft->getRotation();