diff --git a/trunk/accero.c b/trunk/accero.c index 06ebfb9..bc35257 100644 --- a/trunk/accero.c +++ b/trunk/accero.c @@ -65,17 +65,33 @@ task_status tsk_soft_int( ); task_status_immed tsk_cbk_accero( ) { // (疑似)isrから登録されます - if( system_status.pwr_state == ON ) +/* + if(( system_status.pwr_state == OFF ) || ( system_status.pwr_state == BT_CHARGE ) ) { + return ( ERR_SUCCESS ); + } + else + { +*/ // 加速度センサデータレジスタへの反映 if( iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, &vreg_ctr[VREG_C_ACC_XL] ) - == ERR_SUCCESS ) + != ERR_SUCCESS ) + { + // 加速度センサが異常になったので止める + vreg_ctr[VREG_C_ACC_CONFIG] &= ~( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ); +// vreg_ctr[ VREG_C_STATUS_1 ] |= REG_BIT_ACCERO_ERR; + acc_hosu_set(); + return ( ERR_SUCCESS ); // タスクの削除は必要 + } + else { - if( ( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_ACQ ) != 0 ) + // 正常時パス // + // 加速度更新&割り込み + if( (( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_ACQ ) != 0 ) && + ( system_status.pwr_state == ON ) + ) { set_irq( VREG_C_IRQ1, REG_BIT_ACC_DAT_RDY ); - } - // ゴミデータのカラ読み if( ACC_VALID == 1 ) { @@ -83,19 +99,16 @@ task_status_immed tsk_cbk_accero( ) iic_mcu_read( IIC_SLA_ACCEL, ( ACC_REG_X | 0x80 ), 6, temp ); } } - else + if(( system_status.pwr_state != OFF ) && + ( system_status.pwr_state != BT_CHARGE ) && + ( ( vreg_ctr[VREG_C_ACC_CONFIG] & VREG_BITMASK_ACC_CONF_HOSU ) != 0 ) + ) { - // 加速度センサが異常になったので止める - vreg_ctr[VREG_C_ACC_CONFIG] &= ~( VREG_BITMASK_ACC_CONF_HOSU | VREG_BITMASK_ACC_CONF_ACQ ); - acc_hosu_set(); - return ( ERR_SUCCESS ); // タスクの削除は必要 - } - } - DBG_LED_WIFI_2_on; pedometer(); // 歩数計 DBG_LED_WIFI_2_off; - + } + } return ( ERR_SUCCESS ); } diff --git a/trunk/config.h b/trunk/config.h index 656cd5a..cd1f51d 100644 --- a/trunk/config.h +++ b/trunk/config.h @@ -2,7 +2,7 @@ #define __config__ #define _debug_ -#define _debug_led_ +//#define _debug_led_ #define MCU_VER_MAJOR 0x00