add docu and silence wakeup option

This commit is contained in:
sharandac
2020-08-10 20:33:13 +02:00
parent eb813a2799
commit 20d2daefce
13 changed files with 160 additions and 17 deletions

View File

@@ -36,14 +36,48 @@
#define BMA_COFIG_FILE "/bma.cfg"
/*
* @brief setup bma activity measurement
*
* @param ttgo pointer to an TTGOClass
*/
void bma_setup( TTGOClass *ttgo );
/*
* @brief loop function for activity measurement
*/
void bma_loop( TTGOClass *ttgo );
/*
* @brief put bma into standby, depending on ther config
*/
void bma_standby( void );
/*
* @brief wakeup activity measurement
*/
void bma_wakeup( void );
/*
* @brief reload config
*/
void bma_reload_settings( void );
/*
* @ brief save the config structure to SPIFF
*/
void bma_save_config( void );
/*
* @ brief read the config structure from SPIFF
*/
void bma_read_config( void );
/*
* @brief get config
*
* @param config configitem
*/
bool bma_get_config( int config );
/*
* @brief set config
*
* @param config configitem
* @param enable true or false
*/
void bma_set_config( int config, bool enable );
#endif // _BMA_H

View File

@@ -69,11 +69,15 @@ void pmu_standby( void ) {
TTGOClass *ttgo = TTGOClass::getWatch();
ttgo->power->clearTimerStatus();
if ( ttgo->power->isChargeing() ) {
ttgo->power->setTimer( 10 );
}
else {
ttgo->power->setTimer( 60 );
if ( pmu_get_silence_wakeup() ) {
if ( ttgo->power->isChargeing() || ttgo->power->isVBUSPlug() ) {
ttgo->power->setTimer( 3 );
log_i("enable silence wakeup timer, 3min");
}
else {
ttgo->power->setTimer( 60 );
log_i("enable silence wakeup timer, 60min");
}
}
if ( pmu_get_experimental_power_save() ) {
@@ -140,6 +144,14 @@ void pmu_read_config( void ) {
}
}
bool pmu_get_silence_wakeup( void ) {
return( pmu_config.silence_wakeup );
}
void pmu_set_silence_wakeup( bool value ) {
pmu_config.silence_wakeup = value;
pmu_save_config();
}
bool pmu_get_calculated_percent( void ) {
return( pmu_config.compute_percent );

View File

@@ -31,6 +31,7 @@
typedef struct {
bool compute_percent = false;
bool experimental_power_save = false;
bool silence_wakeup = true;
} pmu_config_t;
/*
@@ -54,13 +55,39 @@
* @return charge in percent or -1 if unknown
*/
int32_t pmu_get_battery_percent( TTGOClass *ttgo );
/*
* @brief set the axp202 in standby
*/
void pmu_standby( void );
/*
* @brief wakeup to axp202
*/
void pmu_wakeup( void );
/*
* @ brief save the config structure to SPIFF
*/
void pmu_save_config( void );
/*
* @ brief read the config structure from SPIFF
*/
void pmu_read_config( void );
/*
* @brief read the config for calculated mAh based on the axp202 coloumb counter
*/
bool pmu_get_calculated_percent( void );
/*
* @brief read the config for experimental power save
*/
bool pmu_get_experimental_power_save( void );
/*
* @brief set the config to use calculated mAh
*/
void pmu_set_calculated_percent( bool value );
/*
* @brief set experimental power save
*/
void pmu_set_experimental_power_save( bool value );
bool pmu_get_silence_wakeup( void );
void pmu_set_silence_wakeup( bool value );
#endif // _PMU_H

View File

@@ -84,8 +84,13 @@
* @param timezone timezone from UTC-12 to UTC+12
*/
void timesync_set_timezone( int32_t timezone );
/*
* @brief wrapper function to sync the system with rtc
*/
void timesyncToSystem( void );
/*
* @brief wrapper function to sync the rtc with system
*/
void timesyncToRTC( void );
#endif // _TIME_SYNC_H

View File

@@ -24,7 +24,11 @@
#define _TOUCH_H
#include "TTGO.h"
/*
* @brief setup touch
*
* @param ttgo pointer to an TTGOClass
*/
void touch_setup( TTGOClass *ttgo );
#endif // _TOUCH_H