・歩数の読み出しがおかしかったのを修正

・POWERスイッチ、ちょん押しでちょん押し割り込み、
 長押し時、ちょん押し割り込みの後、長押し割り込みの2回が入るように
・RTCの日付が変更できなかったのを修正
・電源ボタン長押し→強制オフで実際にオフに移行するまでの時間が0だったのを修正
 こんなミス、コンパイラが指摘してくれればいいのに。

git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@176 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
N2232 2010-05-26 06:06:12 +00:00
parent 21b34e899d
commit 477cbf231d
4 changed files with 28 additions and 29 deletions

View File

@ -47,11 +47,9 @@ void pedometer()
static u8 interval_hh; // 山-山間の時間。短過ぎたらはじく。
static u8 time_l; // 前回の極小からの経過時間
static u16 peak_l; // 谷の深さ
static u16 peak_h; // ŽRÌ<E2809A>³
static u16 norm_hist[TAP];
static u8 hist_indx;
static u8 t_rise;
signed long filterd;
@ -263,7 +261,7 @@ static void hosu_increment()
// 実際にインクリメント
{
u8 temp;
temp = p_record;
if( now_min < vreg_ctr[ VREG_C_ACC_HOSU_HOUR_BOUNDARY ] )
{
@ -302,7 +300,7 @@ void fill_hosu_hist_hours( u16 hours )
do
{
p_record += 1;
if( PEDOMETER_LOG_SIZE >= p_record )
if( p_record >= PEDOMETER_LOG_SIZE )
{
p_record = 0;
}
@ -385,21 +383,21 @@ u8 hosu_read( )
default:
temp = pool.vreg_c_ext.pedo_log[ p_record_buffer ];
if( record_read_msb_lsb == 0 )
{
dat = (u8)( temp & 0x00FF );
}
{
dat = (u8)( temp & 0x00FF );
}
else
{
dat = (u8)(( temp >> 8 ) & 0x00FF );
if( p_record_buffer == 0 )
{
dat = (u8)(( temp >> 8 ) & 0x00FF );
if( p_record_buffer == 0 )
{
p_record_buffer = PEDOMETER_LOG_SIZE-1;
}
else
{
p_record_buffer -= 1;
}
p_record_buffer = PEDOMETER_LOG_SIZE-1;
}
else
{
p_record_buffer -= 1;
}
}
record_read_msb_lsb += 1;
return( dat );
}
@ -502,15 +500,15 @@ unsigned long my_sqrt( unsigned long a )
x = s;
s /= t;
s += t;
s >>= 1; // -4.8e-4 < err <= 0
s >>= 1; // -4.8e-4 < err <= 0
t = x;
x /= s;
x += s;
x >>= 1; // -1.2e-7 < err <= 0
x >>= 1; // -1.2e-7 < err <= 0
s = x;
s++;
s *= x;
if (t > s) // adjust LSB
if (t > s) // adjust LSB
x++;
*/
if (scale) {

View File

@ -107,13 +107,12 @@ void tsk_sw( )
case ( BT_CHARGE ):
case ( OFF ):
// 電源スイッチの監視 //
if( ( SW_POW_n ) &&
( SW_pow_count >= CLICK_THRESHOLD ) )
if( SW_pow_count == CLICK_THRESHOLD )
{
#ifdef _SW_HOME_ENABLE_
set_irq( VREG_C_IRQ0, REG_BIT_SW_POW_CLICK );
set_irq( VREG_C_IRQ0, REG_BIT_SW_POW_CLICK );
#else
set_irq( VREG_C_IRQ0, REG_BIT_SW_HOME_CLICK );
set_irq( VREG_C_IRQ0, REG_BIT_SW_HOME_CLICK );
#endif
}
else if( SW_pow_count == HOLD_THREASHOLD )
@ -128,7 +127,8 @@ void tsk_sw( )
if( cnt_force_off != 0 )
{
if( ++cnt_force_off >= vreg_ctr[ VREG_C_OFF_DELAY ] * 6 );
cnt_force_off += 1;
if( cnt_force_off >= ( vreg_ctr[ VREG_C_OFF_DELAY ] * 8 ) )
{
// タイムアウトによる強制OFF
cnt_force_off = 0;

View File

@ -213,6 +213,7 @@ void vreg_ctr_write( u8 adrs, u8 data )
set_rtc( adrs - VREG_C_RTC_SEC, data & 0x7F );
break;
case ( VREG_C_RTC_DAY ):
case ( VREG_C_RTC_HOUR ):
set_rtc( adrs - VREG_C_RTC_SEC, data & 0x3F );
break;

View File

@ -6,12 +6,12 @@ magic.c(10) : CC78K0R warning W0871: Data aligned after 'MGC_LOAD'in 'MGC_LOAD s
Compilation complete, 0 error(s) and 3 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\magic.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2wt -sainter_asm -zpb -w2 -no task_sys.c
task_sys.c(177) : CC78K0R warning W0401: Conversion may lose significant digits
task_sys.c(425) : CC78K0R warning W0401: Conversion may lose significant digits
task_sys.c(473) : CC78K0R warning W0851: Data aligned in '@@INIT section'
"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\bin\cc78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -irenge -i"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\inc78k0r" -ms -qvjl2wt -sainter_asm -zpb -w2 -no sw.c
sw.c(100) : CC78K0R warning W0760: Double and long double are treated as IEEE 754 single format
sw.c(164) : CC78K0R warning W0851: Data aligned in '@@DATA section'
sw.c(164) : CC78K0R warning W0851: Data aligned in '@@INIT section'
Compilation complete, 0 error(s) and 3 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\task_sys.asm
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\ra78k0r.exe" -c9F0104 -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff inter_asm\sw.asm
Assembly complete, 0 error(s) and 0 warning(s) found.
"C:\Program Files\NEC Electronics Tools\RA78K0R\W1.31\bin\lk78k0r.exe" -y"C:\Program Files\NEC Electronics Tools\DEV" -_msgoff -obsr.lmf "..\..\..\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r\s0rm.rel" -go85h,0FC00h,1024 -gi0FFFFFFFFFFFFFFFFFFFFh -pbsr_k0r.map -nkd -gb7EFBFFh -b"C:\Program Files\NEC Electronics Tools\FSL78K0R_Type02ES\V1.20\lib78k0r\fsl.lib" -bcl0rdm.lib -bcl0rm.lib -bcl0rmf.lib -i"C:\Program Files\NEC Electronics Tools\CC78K0R\W2.10\lib78k0r" -dbsr_mcu.dr -s -w0 loader.rel pm.rel i2c_ctr.rel main.rel magic.rel WDT.rel i2c_mcu.rel i2c_twl.rel led.rel rtc.rel vreg_ctr.rel vreg_twl.rel adc.rel renge.rel accero.rel self_flash.rel sw.rel task_debug.rel task_misc.rel task_sys.rel pedo_alg_thre_det2.rel ini_VECT.rel task_status.rel
Link complete, 0 error(s) and 0 warning(s) found.