add update and battery settings

This commit is contained in:
sharandac
2020-07-31 14:29:04 +02:00
parent 194c7deb02
commit a5aafb885e
22 changed files with 938 additions and 189 deletions

View File

@@ -29,11 +29,13 @@
#include "gui/statusbar.h"
EventGroupHandle_t bma_event_handle = NULL;
void IRAM_ATTR bma_irq( void );
bma_config_t bma_config[ BMA_CONFIG_NUM ];
__NOINIT_ATTR uint32_t stepcounter_valid;
__NOINIT_ATTR uint32_t stepcounter;
void IRAM_ATTR bma_irq( void );
/*
*
*/
@@ -45,6 +47,12 @@ void bma_setup( TTGOClass *ttgo ) {
bma_config[ i ].enable = true;
}
if ( stepcounter_valid != 0xa5a5a5a5 ) {
stepcounter = 0;
stepcounter_valid = 0xa5a5a5a5;
log_e("stepcounter not valid. reset");
}
bma_read_config();
ttgo->bma->begin();
@@ -101,7 +109,8 @@ void bma_loop( TTGOClass *ttgo ) {
}
if ( !powermgm_get_event( POWERMGM_STANDBY ) && xEventGroupGetBitsFromISR( bma_event_handle ) & BMA_EVENT_INT ) {
statusbar_update_stepcounter( ttgo->bma->getCounter() );
stepcounter =+ ttgo->bma->getCounter();
statusbar_update_stepcounter( stepcounter );
xEventGroupClearBitsFromISR( bma_event_handle, BMA_EVENT_INT );
}
}