歩数計OFFでも加速度センサONで歩数カウントしていたのを修正

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@113 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
fujita_ryohei 2010-04-01 04:19:22 +00:00
parent 6dd8c5bc7d
commit 8946ed4b8c
2 changed files with 28 additions and 15 deletions

View File

@ -65,17 +65,33 @@ task_status tsk_soft_int( );
task_status_immed tsk_cbk_accero( ) task_status_immed tsk_cbk_accero( )
{ // 疑似isrから登録されます { // 疑似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] ) 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 ); set_irq( VREG_C_IRQ1, REG_BIT_ACC_DAT_RDY );
}
// ゴミデータのカラ読み // ゴミデータのカラ読み
if( ACC_VALID == 1 ) 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 ); 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; DBG_LED_WIFI_2_on;
pedometer(); // 歩数計 pedometer(); // 歩数計
DBG_LED_WIFI_2_off; DBG_LED_WIFI_2_off;
}
}
return ( ERR_SUCCESS ); return ( ERR_SUCCESS );
} }

View File

@ -2,7 +2,7 @@
#define __config__ #define __config__
#define _debug_ #define _debug_
#define _debug_led_ //#define _debug_led_
#define MCU_VER_MAJOR 0x00 #define MCU_VER_MAJOR 0x00