From 477cbf231db1a90393ab6202055ddd2a7adc2e92 Mon Sep 17 00:00:00 2001 From: N2232 Date: Wed, 26 May 2010 06:06:12 +0000 Subject: [PATCH] =?UTF-8?q?=E3=83=BB=E6=AD=A9=E6=95=B0=E3=81=AE=E8=AA=AD?= =?UTF-8?q?=E3=81=BF=E5=87=BA=E3=81=97=E3=81=8C=E3=81=8A=E3=81=8B=E3=81=97?= =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=20=E3=83=BBPOWER=E3=82=B9=E3=82=A4=E3=83=83=E3=83=81=E3=80=81?= =?UTF-8?q?=E3=81=A1=E3=82=87=E3=82=93=E6=8A=BC=E3=81=97=E3=81=A7=E3=81=A1?= =?UTF-8?q?=E3=82=87=E3=82=93=E6=8A=BC=E3=81=97=E5=89=B2=E3=82=8A=E8=BE=BC?= =?UTF-8?q?=E3=81=BF=E3=80=81=20=E3=80=80=E9=95=B7=E6=8A=BC=E3=81=97?= =?UTF-8?q?=E6=99=82=E3=80=81=E3=81=A1=E3=82=87=E3=82=93=E6=8A=BC=E3=81=97?= =?UTF-8?q?=E5=89=B2=E3=82=8A=E8=BE=BC=E3=81=BF=E3=81=AE=E5=BE=8C=E3=80=81?= =?UTF-8?q?=E9=95=B7=E6=8A=BC=E3=81=97=E5=89=B2=E3=82=8A=E8=BE=BC=E3=81=BF?= =?UTF-8?q?=E3=81=AE2=E5=9B=9E=E3=81=8C=E5=85=A5=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=20=E3=83=BBRTC=E3=81=AE=E6=97=A5=E4=BB=98?= =?UTF-8?q?=E3=81=8C=E5=A4=89=E6=9B=B4=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=8B?= =?UTF-8?q?=E3=81=A3=E3=81=9F=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=20?= =?UTF-8?q?=E3=83=BB=E9=9B=BB=E6=BA=90=E3=83=9C=E3=82=BF=E3=83=B3=E9=95=B7?= =?UTF-8?q?=E6=8A=BC=E3=81=97=E2=86=92=E5=BC=B7=E5=88=B6=E3=82=AA=E3=83=95?= =?UTF-8?q?=E3=81=A7=E5=AE=9F=E9=9A=9B=E3=81=AB=E3=82=AA=E3=83=95=E3=81=AB?= =?UTF-8?q?=E7=A7=BB=E8=A1=8C=E3=81=99=E3=82=8B=E3=81=BE=E3=81=A7=E3=81=AE?= =?UTF-8?q?=E6=99=82=E9=96=93=E3=81=8C=EF=BC=90=E3=81=A0=E3=81=A3=E3=81=9F?= =?UTF-8?q?=E3=81=AE=E3=82=92=E4=BF=AE=E6=AD=A3=20=E3=80=80=E3=81=93?= =?UTF-8?q?=E3=82=93=E3=81=AA=E3=83=9F=E3=82=B9=E3=80=81=E3=82=B3=E3=83=B3?= =?UTF-8?q?=E3=83=91=E3=82=A4=E3=83=A9=E3=81=8C=E6=8C=87=E6=91=98=E3=81=97?= =?UTF-8?q?=E3=81=A6=E3=81=8F=E3=82=8C=E3=82=8C=E3=81=B0=E3=81=84=E3=81=84?= =?UTF-8?q?=E3=81=AE=E3=81=AB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- trunk/pedo_alg_thre_det2.c | 36 +++++++++++++++++------------------- trunk/sw.c | 10 +++++----- trunk/vreg_ctr.c | 1 + trunk/yav_mcu_bsr.plg | 10 +++++----- 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/trunk/pedo_alg_thre_det2.c b/trunk/pedo_alg_thre_det2.c index 60cdb36..6d1fc00 100644 --- a/trunk/pedo_alg_thre_det2.c +++ b/trunk/pedo_alg_thre_det2.c @@ -47,11 +47,9 @@ void pedometer() static u8 interval_hh; // 山-山間の時間。短過ぎたらはじく。 static u8 time_l; // 前回の極小からの経過時間 static u16 peak_l; // 谷の深さ - static u16 peak_h; // 山の高さ 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) { diff --git a/trunk/sw.c b/trunk/sw.c index d9b599f..5086bc6 100644 --- a/trunk/sw.c +++ b/trunk/sw.c @@ -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; diff --git a/trunk/vreg_ctr.c b/trunk/vreg_ctr.c index 90d19fe..9b97c83 100644 --- a/trunk/vreg_ctr.c +++ b/trunk/vreg_ctr.c @@ -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; diff --git a/trunk/yav_mcu_bsr.plg b/trunk/yav_mcu_bsr.plg index 87f9030..2112441 100644 --- a/trunk/yav_mcu_bsr.plg +++ b/trunk/yav_mcu_bsr.plg @@ -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.