mirror of
https://github.com/rvtr/ctr_mcu.git
synced 2025-10-31 13:51:10 -04:00
強制電源OFFのやり方変更
WiFiボタンで電源ONするかもと残していたコード削除 OFF時、バッテリ残量ICをスリープに入れ忘れていた スリープ中に電池を食うモードに入ってしまうことがあったのを回避(確認中) git-svn-id: file:///Volumes/Transfer/gigaleak_20231201/2020-05-23%20-%20ctr.7z%20+%20svn_v1.068.zip/ctr/svn/ctr_mcu@72 013db118-44a6-b54f-8bf7-843cb86687b1
This commit is contained in:
parent
a5671d2f4e
commit
c73799ebe4
@ -208,7 +208,7 @@ void hdwinit2( )
|
|||||||
PU4 = 0b00000000; // 外部でプルアップしてほしいtool0,1)
|
PU4 = 0b00000000; // 外部でプルアップしてほしいtool0,1)
|
||||||
PU5 = 0b00000011;
|
PU5 = 0b00000011;
|
||||||
PU7 = 0b00011001;
|
PU7 = 0b00011001;
|
||||||
PU12 = 0b00000100;
|
PU12 = 0b00000000;
|
||||||
PU14 = 0b00000000;
|
PU14 = 0b00000000;
|
||||||
|
|
||||||
#ifdef _MCU_BSR_
|
#ifdef _MCU_BSR_
|
||||||
|
|||||||
@ -82,7 +82,8 @@ __interrupt void int_rtc( )
|
|||||||
vreg_ctr[VREG_C_IRQ1] |= REG_BIT_RTC_ALARM;
|
vreg_ctr[VREG_C_IRQ1] |= REG_BIT_RTC_ALARM;
|
||||||
IRQ0_ast;
|
IRQ0_ast;
|
||||||
// マスクをしてあったら、電源を入れません
|
// マスクをしてあったら、電源を入れません
|
||||||
if( system_status.pwr_state == BT_CHARGE )
|
if(( system_status.pwr_state == BT_CHARGE ) ||
|
||||||
|
( system_status.pwr_state == OFF ))
|
||||||
{
|
{
|
||||||
system_status.poweron_reason = RTC_ALARM;
|
system_status.poweron_reason = RTC_ALARM;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
//=========================================================
|
//=========================================================
|
||||||
#define INTERVAL_TSK_SW 16
|
#define INTERVAL_TSK_SW 16
|
||||||
#define CLICK_THRESHOLD 2
|
#define CLICK_THRESHOLD 1
|
||||||
#define HOLD_THREASHOLD (u8)( 600 / INTERVAL_TSK_SW )
|
#define HOLD_THREASHOLD (u8)( 600 / INTERVAL_TSK_SW )
|
||||||
|
|
||||||
|
|
||||||
@ -114,12 +114,8 @@ void tsk_sw( )
|
|||||||
cnt_force_off += 1;
|
cnt_force_off += 1;
|
||||||
if( cnt_force_off >= 13 )
|
if( cnt_force_off >= 13 )
|
||||||
{ // …返事がない。強制的に切る。
|
{ // …返事がない。強制的に切る。
|
||||||
vreg_ctr[VREG_C_LED_POW] = LED_POW_ILM_OFF;
|
|
||||||
if( ( LED_duty_pow_H == 0 ) && ( LED_duty_pow_L == 0 ) )
|
|
||||||
{
|
|
||||||
system_status.pwr_state = OFF_TRIG;
|
system_status.pwr_state = OFF_TRIG;
|
||||||
renge_task_interval_run_force = 1;
|
renge_task_interval_run_force = 1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -130,7 +126,7 @@ void tsk_sw( )
|
|||||||
// HOME スイッチ //
|
// HOME スイッチ //
|
||||||
if( SW_HOME_n )
|
if( SW_HOME_n )
|
||||||
{
|
{
|
||||||
if( ( CLICK_THRESHOLD < SW_home_count ) && ( SW_home_count < HOLD_THREASHOLD ) )
|
if( ( CLICK_THRESHOLD < SW_home_count ) && ( SW_home_count <= HOLD_THREASHOLD ) )
|
||||||
{
|
{
|
||||||
set_irq( VREG_C_IRQ0, REG_BIT_SW_HOME_CLICK );
|
set_irq( VREG_C_IRQ0, REG_BIT_SW_HOME_CLICK );
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,8 @@ void tsk_sys( )
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
// スイッチで電源on
|
// スイッチで電源on
|
||||||
if( ( SW_pow_count != 0 ) || ( SW_wifi_count != 0 ) )
|
|
||||||
|
if( SW_pow_count != 0 )
|
||||||
{
|
{
|
||||||
timeout = 0;
|
timeout = 0;
|
||||||
}
|
}
|
||||||
@ -58,7 +59,8 @@ void tsk_sys( )
|
|||||||
renge_task_interval_run_force = 1;
|
renge_task_interval_run_force = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( ( SW_pow_count < 3 ) && ( SW_wifi_count < 3 ) )
|
|
||||||
|
if( SW_pow_count < 3 )
|
||||||
{
|
{
|
||||||
// もう少しスイッチの様子を見る
|
// もう少しスイッチの様子を見る
|
||||||
return;
|
return;
|
||||||
@ -181,10 +183,16 @@ void tsk_sys( )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OFF_TRIG: //---------------------------------------
|
case OFF_TRIG: //---------------------------------------
|
||||||
|
// LED消灯を待つ
|
||||||
|
vreg_ctr[VREG_C_LED_POW] = LED_POW_ILM_OFF;
|
||||||
|
if(( LED_duty_pow_H != 0 ) || ( LED_duty_pow_L != 0 ))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LED_stop( );
|
LED_stop( );
|
||||||
IIC_ctr_Stop( );
|
IIC_ctr_Stop( );
|
||||||
IIC_twl_Stop( );
|
IIC_twl_Stop( );
|
||||||
iic_mcu_stop( );
|
|
||||||
RTC_32k_off();
|
RTC_32k_off();
|
||||||
|
|
||||||
vreg_ctr[VREG_C_IRQ0] = 0;
|
vreg_ctr[VREG_C_IRQ0] = 0;
|
||||||
@ -250,8 +258,9 @@ void tsk_sys( )
|
|||||||
// 省電力へ移行
|
// 省電力へ移行
|
||||||
BT_TEMP_P = 0;
|
BT_TEMP_P = 0;
|
||||||
while( RWST )
|
while( RWST )
|
||||||
{;
|
{;}
|
||||||
}
|
|
||||||
|
iic_mcu_stop( );
|
||||||
|
|
||||||
// 割り込み待ちで寝る //
|
// 割り込み待ちで寝る //
|
||||||
RTCIMK = 1;
|
RTCIMK = 1;
|
||||||
|
|||||||
@ -78,10 +78,10 @@ Symbol Type=OFF
|
|||||||
Language=C
|
Language=C
|
||||||
Kanji=SJIS
|
Kanji=SJIS
|
||||||
[Source]
|
[Source]
|
||||||
Geometry=235, 74, 1025, 1014
|
Geometry=202, 65, 1025, 1014
|
||||||
Window=Normal
|
Window=Normal
|
||||||
DispStart=33
|
DispStart=103
|
||||||
CaretPos=89,0
|
CaretPos=104,0
|
||||||
Mode=Normal
|
Mode=Normal
|
||||||
DispFile=
|
DispFile=
|
||||||
Address1=
|
Address1=
|
||||||
@ -139,27 +139,11 @@ SaveRange=Screen
|
|||||||
SaveStart=
|
SaveStart=
|
||||||
SaveEnd=
|
SaveEnd=
|
||||||
Accumulative=ON
|
Accumulative=ON
|
||||||
[Source1]
|
|
||||||
Geometry=34, 50, 1025, 1014
|
|
||||||
Window=Normal
|
|
||||||
DispStart=73
|
|
||||||
CaretPos=94,0
|
|
||||||
Mode=Normal
|
|
||||||
DispFile=vreg_ctr.c
|
|
||||||
Accumulative=ON
|
|
||||||
[Source2]
|
|
||||||
Geometry=135, 144, 1025, 1014
|
|
||||||
Window=Normal
|
|
||||||
DispStart=111
|
|
||||||
CaretPos=200,0
|
|
||||||
Mode=Normal
|
|
||||||
DispFile=task_misc.c
|
|
||||||
Accumulative=ON
|
|
||||||
[Assemble]
|
[Assemble]
|
||||||
Geometry=605, 2, 600, 400
|
Geometry=605, 2, 600, 400
|
||||||
Window=Normal
|
Window=Normal
|
||||||
DispStart=687
|
DispStart=12558
|
||||||
CaretPos=687,27
|
CaretPos=12558,27
|
||||||
Address1=
|
Address1=
|
||||||
Address2=
|
Address2=
|
||||||
Address3=
|
Address3=
|
||||||
@ -272,8 +256,8 @@ Window=Normal
|
|||||||
Boundary=13762687
|
Boundary=13762687
|
||||||
Mode=Proper
|
Mode=Proper
|
||||||
[Sfr]
|
[Sfr]
|
||||||
Geometry=0, 0, 0, 0
|
Geometry=-3, -6, 457, 827
|
||||||
Window=Hide
|
Window=Normal
|
||||||
Address1=
|
Address1=
|
||||||
Address2=
|
Address2=
|
||||||
Address3=
|
Address3=
|
||||||
@ -290,13 +274,13 @@ Address13=
|
|||||||
Address14=
|
Address14=
|
||||||
Address15=
|
Address15=
|
||||||
Address16=
|
Address16=
|
||||||
Boundary=0, 0
|
Boundary=239, 52
|
||||||
Mode=Hex
|
Mode=Bin
|
||||||
Attribute=Show
|
Attribute=Show
|
||||||
Sort=Unsort
|
Sort=Unsort
|
||||||
Pickup=OFF
|
Pickup=OFF
|
||||||
SelectSort=Address
|
SelectSort=Address
|
||||||
Last Name=
|
Last Name=P0
|
||||||
Line=429
|
Line=429
|
||||||
L1=P0
|
L1=P0
|
||||||
L2=P1
|
L2=P1
|
||||||
@ -871,80 +855,54 @@ Detail=OFF
|
|||||||
Last Name=
|
Last Name=
|
||||||
Count=0
|
Count=0
|
||||||
[Variable]
|
[Variable]
|
||||||
Geometry=1225, 6, 354, 1082
|
Geometry=1225, 6, 354, 910
|
||||||
Window=Normal
|
Window=Normal
|
||||||
Boundary=13762700
|
Boundary=13762700
|
||||||
0=.P0.0,P,S,A,+,1
|
0=.P7,B,S,A,+,1
|
||||||
1=.p3.0,P,S,A,+,1
|
1=.p5,B,S,A,+,1
|
||||||
2=.P0.1,P,S,A,+,1
|
Line=2
|
||||||
3=.rtcen,P,S,A,+,1
|
|
||||||
4=.rtcif,P,S,A,+,1
|
|
||||||
5=.RTCIMK,P,S,A,+,1
|
|
||||||
6=.tasks,P,N,A,+,1
|
|
||||||
7=.new_task,.,N,A,+,1
|
|
||||||
8=.SEC,P,S,A,+,1
|
|
||||||
9=.wdte,P,S,A,+,1
|
|
||||||
10=.system_status,.,N,A,+,1
|
|
||||||
11=.last_task_id,P,N,A,+,1
|
|
||||||
12=.i,P,N,A,+,1
|
|
||||||
13=.j,P,N,A,+,1
|
|
||||||
14=.list_id,P,N,A,+,1
|
|
||||||
15=.renge_flg_interval,P,N,A,+,1
|
|
||||||
16=+vreg_twl,P,N,A,-,1
|
|
||||||
17=+vreg_ctr,P,N,A,-,1
|
|
||||||
18=.tasks_immed,P,N,A,+,1
|
|
||||||
19=.reg_shadow,P,N,A,+,1
|
|
||||||
Line=20
|
|
||||||
[Quick Watch]
|
[Quick Watch]
|
||||||
0=list_id,P,A,1
|
0=rtcen,P,A,1
|
||||||
1=p[14,P,A,1
|
1=renge_flg_interval,P,A,1
|
||||||
2=p14,P,A,1
|
2=rtccmk,P,A,1
|
||||||
3=p3.0,P,A,1
|
3=rtciimk,P,A,1
|
||||||
4=new_task,P,A,1
|
4=wdte,P,A,1
|
||||||
5=tasks,P,A,1
|
5=SEC,P,A,1
|
||||||
6=RTCIMK,P,A,1
|
6=rtcif,P,A,1
|
||||||
7=rtcen,P,A,1
|
7=vreg_ctr,P,A,1
|
||||||
8=renge_flg_interval,P,A,1
|
8=vreg_twl,P,A,1
|
||||||
9=rtccmk,P,A,1
|
9=pm0,P,A,1
|
||||||
10=rtciimk,P,A,1
|
10=data,P,A,1
|
||||||
11=wdte,P,A,1
|
11=P5.3,P,A,1
|
||||||
12=SEC,P,A,1
|
12=p4.3,P,A,1
|
||||||
13=rtcif,P,A,1
|
13=pu0,P,A,1
|
||||||
14=vreg_ctr,P,A,1
|
14=p5,B,A,1
|
||||||
15=vreg_twl,P,A,1
|
15=P7,B,A,1
|
||||||
[Software Break]
|
[Software Break]
|
||||||
Geometry=1204, 674, 500, 428
|
Geometry=1204, 674, 500, 428
|
||||||
Window=Normal
|
Window=Normal
|
||||||
Width=150 30 200 100
|
Width=150 30 200 100
|
||||||
Name0=Swb00001
|
Name0=Swb00003
|
||||||
Address0=task_misc.c#_do_command+0x15
|
Address0=renge.c#_renge_task_immed_add+0x3c
|
||||||
Window0=ASM
|
Window0=ASM
|
||||||
Status0=ON
|
Status0=ON
|
||||||
Name1=Swb00002
|
Name1=Swb00004
|
||||||
Address1=task_misc.c#_do_command+0x37
|
Address1=renge.c#_renge_task_immed_add+0x34
|
||||||
Window1=ASM
|
Window1=ASM
|
||||||
Status1=ON
|
Status1=ON
|
||||||
Name2=Swb00003
|
Name2=Swb00001
|
||||||
Address2=task_misc.c#_do_command+0x4a
|
Address2=task_misc.c#_do_command0+0x15
|
||||||
Window2=ASM
|
Window2=ASM
|
||||||
Status2=ON
|
Status2=ON
|
||||||
Name3=Swb00005
|
Name3=Swb00005
|
||||||
Address3=task_misc.c#_do_command+0x8
|
Address3=task_misc.c#_do_command0+0x0
|
||||||
Window3=ASM
|
Window3=ASM
|
||||||
Status3=ON
|
Status3=ON
|
||||||
Name4=Swb00004
|
Name4=Swb00002
|
||||||
Address4=vreg_twl.c#_vreg_twl_write+0x43
|
Address4=task_sys.c#_tsk_sys+0x193
|
||||||
Window4=ASM
|
Window4=ASM
|
||||||
Status4=ON
|
Status4=ON
|
||||||
Name5=Swb00007
|
Count=5
|
||||||
Address5=vreg_ctr.c#_vreg_ctr_write+0x10d
|
|
||||||
Window5=ASM
|
|
||||||
Status5=ON
|
|
||||||
Name6=Swb00006
|
|
||||||
Address6=vreg_ctr.c#_vreg_ctr_write+0x11c
|
|
||||||
Window6=ASM
|
|
||||||
Status6=ON
|
|
||||||
Count=7
|
|
||||||
[Reset]
|
[Reset]
|
||||||
Debugger=ON
|
Debugger=ON
|
||||||
Symbol=OFF
|
Symbol=OFF
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
[ProjectManager]
|
[ProjectManager]
|
||||||
FrameMax=1
|
FrameMax=1
|
||||||
FrameX=-1187
|
FrameX=0
|
||||||
FrameY=33
|
FrameY=33
|
||||||
FrameCX=1299
|
FrameCX=1299
|
||||||
FrameCY=1043
|
FrameCY=1043
|
||||||
@ -20,7 +20,7 @@ OpenFile12=adc.c,0,220,220,1199,856,0,73,0,0
|
|||||||
OpenFile13=accero.c,0,272,165,1516,922,0,114,13,0
|
OpenFile13=accero.c,0,272,165,1516,922,0,114,13,0
|
||||||
OpenFile14=main.c,0,66,66,1034,691,0,70,0,0
|
OpenFile14=main.c,0,66,66,1034,691,0,70,0,0
|
||||||
OpenFile15=renge\renge.c,0,285,287,1264,923,15,225,0,0
|
OpenFile15=renge\renge.c,0,285,287,1264,923,15,225,0,0
|
||||||
OpenFile16=task_misc.c,0,88,88,1056,713,0,147,0,0
|
OpenFile16=task_misc.c,0,88,88,1056,713,5,159,5,0
|
||||||
OpenFile17=OutputWindow
|
OpenFile17=OutputWindow
|
||||||
OutputPos=0,79,487,55,1164
|
OutputPos=0,79,487,55,1164
|
||||||
ActivePRJ=yav_mcu_bsr.prj
|
ActivePRJ=yav_mcu_bsr.prj
|
||||||
|
|||||||
@ -11,18 +11,18 @@ T=4b3081f8
|
|||||||
7=rtc.h
|
7=rtc.h
|
||||||
8=reboot.h
|
8=reboot.h
|
||||||
[pm.c]
|
[pm.c]
|
||||||
T=4b333a0b
|
T=4b34233a
|
||||||
1=incs.h
|
1=incs.h
|
||||||
2=adc.h
|
2=adc.h
|
||||||
3=led.h
|
3=led.h
|
||||||
4=pm.h
|
4=pm.h
|
||||||
5=renge\renge.h
|
5=renge\renge.h
|
||||||
[i2c_ctr.c]
|
[i2c_ctr.c]
|
||||||
T=4b2611c9
|
T=4b346598
|
||||||
1=incs.h
|
1=incs.h
|
||||||
2=accero.h
|
2=accero.h
|
||||||
[main.c]
|
[main.c]
|
||||||
T=4b3321f7
|
T=4b3421b2
|
||||||
1=incs_loader.h
|
1=incs_loader.h
|
||||||
2=WDT.h
|
2=WDT.h
|
||||||
3=rtc.h
|
3=rtc.h
|
||||||
@ -31,7 +31,7 @@ T=4b3321f7
|
|||||||
6=led.h
|
6=led.h
|
||||||
7=adc.h
|
7=adc.h
|
||||||
[magic.c]
|
[magic.c]
|
||||||
T=4b333500
|
T=4b3465a1
|
||||||
1=config.h
|
1=config.h
|
||||||
[WDT.c]
|
[WDT.c]
|
||||||
T=4afd21ca
|
T=4afd21ca
|
||||||
@ -52,10 +52,10 @@ T=4b307b06
|
|||||||
1=incs.h
|
1=incs.h
|
||||||
2=led.h
|
2=led.h
|
||||||
[rtc.c]
|
[rtc.c]
|
||||||
T=4b305de2
|
T=4b34233a
|
||||||
1=incs.h
|
1=incs.h
|
||||||
[vreg_ctr.c]
|
[vreg_ctr.c]
|
||||||
T=4b309cbf
|
T=4b34616d
|
||||||
1=incs.h
|
1=incs.h
|
||||||
2=vreg_ctr.h
|
2=vreg_ctr.h
|
||||||
3=rtc.h
|
3=rtc.h
|
||||||
@ -78,7 +78,7 @@ T=4b308310
|
|||||||
3=pm.h
|
3=pm.h
|
||||||
4=led.h
|
4=led.h
|
||||||
[renge\renge.c]
|
[renge\renge.c]
|
||||||
T=4b333374
|
T=4b34616d
|
||||||
1=renge\renge_defs.h
|
1=renge\renge_defs.h
|
||||||
2=renge\renge_task_intval.h
|
2=renge\renge_task_intval.h
|
||||||
3=renge\renge_task_immediate.h
|
3=renge\renge_task_immediate.h
|
||||||
@ -115,13 +115,13 @@ T=4b3056a4
|
|||||||
3=pm.h
|
3=pm.h
|
||||||
4=accero.h
|
4=accero.h
|
||||||
[task_misc.c]
|
[task_misc.c]
|
||||||
T=4b333a0b
|
T=4b34648e
|
||||||
1=incs.h
|
1=incs.h
|
||||||
2=renge\renge.h
|
2=renge\renge.h
|
||||||
3=pm.h
|
3=pm.h
|
||||||
4=accero.h
|
4=accero.h
|
||||||
[task_sys.c]
|
[task_sys.c]
|
||||||
T=4b20b95f
|
T=4b345ee5
|
||||||
1=incs.h
|
1=incs.h
|
||||||
2=i2c_twl.h
|
2=i2c_twl.h
|
||||||
3=i2c_ctr.h
|
3=i2c_ctr.h
|
||||||
@ -145,7 +145,7 @@ T=4b25f1a9
|
|||||||
T=4b023fdb
|
T=4b023fdb
|
||||||
1=config.h
|
1=config.h
|
||||||
[user_define.h]
|
[user_define.h]
|
||||||
T=4b333a0b
|
T=4b343e4b
|
||||||
[config.h]
|
[config.h]
|
||||||
T=4b306830
|
T=4b306830
|
||||||
[bsr_system.h]
|
[bsr_system.h]
|
||||||
@ -157,7 +157,7 @@ T=4b32c168
|
|||||||
[renge\renge_defs.h]
|
[renge\renge_defs.h]
|
||||||
T=4b32f836
|
T=4b32f836
|
||||||
[renge\renge_task_immediate.h]
|
[renge\renge_task_immediate.h]
|
||||||
T=4b32f91f
|
T=4b345ef0
|
||||||
1=renge\renge_defs.h
|
1=renge\renge_defs.h
|
||||||
[vreg_ctr.h]
|
[vreg_ctr.h]
|
||||||
T=4b277ab7
|
T=4b277ab7
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user