Please help me about Count timer Reset
Koreahk
Posts: 1
I need help about count timer... It works very well but I want to make reset but I coudn't make it.
Most buttons are working but when I push the 15,30,45 mins add button after push the Reset button these are not working.
This is actual my code. I trid to figure with 10min and 15min buttons as a diffrent way but it doesn't work.
Please help me~~~
define_variable
volatile integer nSetTime
volatile integer nHours //Track time left
volatile integer nMinutes //Track time left
long nTimes[1]={60000}
dev dvTP[]=
{
dvTP1 //List your Physical touch panels here!
//dvTP2,
//dvTP3
}
volatile integer nNumberBtns[]= //Touch Panel Button Channels (Hours)
{
78, //1
94, //2
95, //3
96, //4
97, //5
98, //6
99, //7
100, //8
101, //9
102, //10
119, //11
120 ,//12
121, //13
122, //14
123 //15
}
define_function fnUpdateTime(integer nHrs, integer nMins)
{
if(nMins>9)send_command dvTP,"'^TXT-',itoa(cMinutes),',0,',itoa(nMins)"
else send_command dvTP,"'^TXT-',itoa(cMinutes),',0,0',itoa(nMins)"
if(nHrs>9)send_command dvTP,"'^TXT-',itoa(cHours),',0,',itoa(nHrs)"
else send_command dvTP,"'^TXT-',itoa(cHours),',0,0',itoa(nHrs)"
}
(******************************************************************************************************)
define_start
(******************************************************************************************************)
define_event
button_event[dvTP,cOK]
{
push:
{
if(!timeline_active(cTL1))
timeline_create(cTL1,nTimes,1,timeline_absolute,timeline_repeat)
else
{
timeline_kill(cTL1)
timeline_create(cTL1,nTimes,1,timeline_absolute,timeline_repeat)
}
}
}
button_event[dvTP,nNumberBtns]
{
push:
{
nHours=get_last(nNumberBtns)-1
nMinutes=59
fnUpdateTime(nHours+1,0)
}
}
button_event[dvTP,124] // +10 mins
{
push:
{
IF(nHours == 0)
{
nHours=get_last(nNumberBtns)*0
nMinutes=10
fnUpdateTime(nHours,nMinutes)
}
else if(nHours > 0)
{
nHours=get_last(nNumberBtns)
nMinutes=10
fnUpdateTime(nHours,nMinutes)
}
}
}
button_event[dvTP,125] // +15 mins
{
push:
{
nHours=get_last(nNumberBtns)
nMinutes=15
fnUpdateTime(nHours,nMinutes)
}
}
button_event[dvTP,126] // +30 mins
{
push:
{
nHours=get_last(nNumberBtns)
nMinutes=30
fnUpdateTime(nHours,nMinutes)
}
}
button_event[dvTP,127] // +45 mins
{
push:
{
nHours=get_last(nNumberBtns)
nMinutes=45
fnUpdateTime(nHours,nMinutes)
}
}
button_event[dvTP,128] // Reset
{
push:
{
//nHours=get_last(nNumberBtns)*0
nhours=0
nMinutes=0
fnUpdateTime(nHours,nMinutes)
}
}
timeline_event[cTL1]
{
if(nHours > 0 || nMinutes > 0)
{
if(nMinutes>0)
{
nMinutes=nMinutes-1
fnUpdateTime(nHours,nMinutes)
}
else
{
nMinutes=59
nHours=nHours-1
fnUpdateTime(nHours,nMinutes)
}
}
else
{
call 'SYSTEM_OFF'
timeline_kill(cTL1)
}
}
Most buttons are working but when I push the 15,30,45 mins add button after push the Reset button these are not working.
This is actual my code. I trid to figure with 10min and 15min buttons as a diffrent way but it doesn't work.
Please help me~~~
define_variable
volatile integer nSetTime
volatile integer nHours //Track time left
volatile integer nMinutes //Track time left
long nTimes[1]={60000}
dev dvTP[]=
{
dvTP1 //List your Physical touch panels here!
//dvTP2,
//dvTP3
}
volatile integer nNumberBtns[]= //Touch Panel Button Channels (Hours)
{
78, //1
94, //2
95, //3
96, //4
97, //5
98, //6
99, //7
100, //8
101, //9
102, //10
119, //11
120 ,//12
121, //13
122, //14
123 //15
}
define_function fnUpdateTime(integer nHrs, integer nMins)
{
if(nMins>9)send_command dvTP,"'^TXT-',itoa(cMinutes),',0,',itoa(nMins)"
else send_command dvTP,"'^TXT-',itoa(cMinutes),',0,0',itoa(nMins)"
if(nHrs>9)send_command dvTP,"'^TXT-',itoa(cHours),',0,',itoa(nHrs)"
else send_command dvTP,"'^TXT-',itoa(cHours),',0,0',itoa(nHrs)"
}
(******************************************************************************************************)
define_start
(******************************************************************************************************)
define_event
button_event[dvTP,cOK]
{
push:
{
if(!timeline_active(cTL1))
timeline_create(cTL1,nTimes,1,timeline_absolute,timeline_repeat)
else
{
timeline_kill(cTL1)
timeline_create(cTL1,nTimes,1,timeline_absolute,timeline_repeat)
}
}
}
button_event[dvTP,nNumberBtns]
{
push:
{
nHours=get_last(nNumberBtns)-1
nMinutes=59
fnUpdateTime(nHours+1,0)
}
}
button_event[dvTP,124] // +10 mins
{
push:
{
IF(nHours == 0)
{
nHours=get_last(nNumberBtns)*0
nMinutes=10
fnUpdateTime(nHours,nMinutes)
}
else if(nHours > 0)
{
nHours=get_last(nNumberBtns)
nMinutes=10
fnUpdateTime(nHours,nMinutes)
}
}
}
button_event[dvTP,125] // +15 mins
{
push:
{
nHours=get_last(nNumberBtns)
nMinutes=15
fnUpdateTime(nHours,nMinutes)
}
}
button_event[dvTP,126] // +30 mins
{
push:
{
nHours=get_last(nNumberBtns)
nMinutes=30
fnUpdateTime(nHours,nMinutes)
}
}
button_event[dvTP,127] // +45 mins
{
push:
{
nHours=get_last(nNumberBtns)
nMinutes=45
fnUpdateTime(nHours,nMinutes)
}
}
button_event[dvTP,128] // Reset
{
push:
{
//nHours=get_last(nNumberBtns)*0
nhours=0
nMinutes=0
fnUpdateTime(nHours,nMinutes)
}
}
timeline_event[cTL1]
{
if(nHours > 0 || nMinutes > 0)
{
if(nMinutes>0)
{
nMinutes=nMinutes-1
fnUpdateTime(nHours,nMinutes)
}
else
{
nMinutes=59
nHours=nHours-1
fnUpdateTime(nHours,nMinutes)
}
}
else
{
call 'SYSTEM_OFF'
timeline_kill(cTL1)
}
}
0