yan zhang
/
NB_CLOCK_180505
clock
main.cpp@1:013b9fdc4e78, 2018-05-12 (annotated)
- Committer:
- donghuoyinzi
- Date:
- Sat May 12 03:03:14 2018 +0000
- Revision:
- 1:013b9fdc4e78
- Parent:
- 0:17e9016529cf
- Child:
- 2:e54d9d87c6cb
180512
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
donghuoyinzi | 0:17e9016529cf | 1 | #include "main.h" |
donghuoyinzi | 0:17e9016529cf | 2 | |
donghuoyinzi | 0:17e9016529cf | 3 | /******************************* |
donghuoyinzi | 0:17e9016529cf | 4 | Fun.:Desc.:whattime/where runing |
donghuoyinzi | 0:17e9016529cf | 5 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 6 | Auth. Date.:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 7 | *******************************/ |
donghuoyinzi | 0:17e9016529cf | 8 | int main() |
donghuoyinzi | 0:17e9016529cf | 9 | { |
donghuoyinzi | 0:17e9016529cf | 10 | tm *tim; |
donghuoyinzi | 0:17e9016529cf | 11 | |
donghuoyinzi | 0:17e9016529cf | 12 | string strx,stry, strz; |
donghuoyinzi | 0:17e9016529cf | 13 | int n,f; |
donghuoyinzi | 0:17e9016529cf | 14 | |
donghuoyinzi | 0:17e9016529cf | 15 | f401Act::init(); //映射平台初始化 |
donghuoyinzi | 0:17e9016529cf | 16 | |
donghuoyinzi | 0:17e9016529cf | 17 | maiAct::init_scorp(); //增强硬件初始化 |
donghuoyinzi | 0:17e9016529cf | 18 | |
donghuoyinzi | 0:17e9016529cf | 19 | f401Act::put_rwdg(); //Refresh iwdg |
donghuoyinzi | 0:17e9016529cf | 20 | |
donghuoyinzi | 0:17e9016529cf | 21 | maiAct::init_dat(); //data initialization |
donghuoyinzi | 0:17e9016529cf | 22 | maiAct::init_star(); //start initialization |
donghuoyinzi | 0:17e9016529cf | 23 | |
donghuoyinzi | 0:17e9016529cf | 24 | while(1){ |
donghuoyinzi | 1:013b9fdc4e78 | 25 | if(know::polSta[46]=="1"){ //state of tick2S |
donghuoyinzi | 0:17e9016529cf | 26 | time_t seconds=time(NULL); |
donghuoyinzi | 0:17e9016529cf | 27 | tim=localtime(&seconds); |
donghuoyinzi | 0:17e9016529cf | 28 | |
donghuoyinzi | 0:17e9016529cf | 29 | strx=know::task[0]; |
donghuoyinzi | 0:17e9016529cf | 30 | stry=strx.substr(13,12); //提取时间,从索引13开始12个字符 |
donghuoyinzi | 0:17e9016529cf | 31 | //strz="yymmddhh"+to_string(tim->tm_min)+"ss"; |
donghuoyinzi | 0:17e9016529cf | 32 | if(stry == strz){ //bc95动作 |
donghuoyinzi | 0:17e9016529cf | 33 | know::polDat[1]= tim->tm_hour; |
donghuoyinzi | 0:17e9016529cf | 34 | know::polDat[2]= tim->tm_min; |
donghuoyinzi | 0:17e9016529cf | 35 | know::polDat[3]= tim->tm_sec; |
donghuoyinzi | 0:17e9016529cf | 36 | |
donghuoyinzi | 0:17e9016529cf | 37 | bc95Act:: put(); |
donghuoyinzi | 0:17e9016529cf | 38 | } |
donghuoyinzi | 1:013b9fdc4e78 | 39 | if(know::polSta[16]=="1"&& know::polSta[15]=="0") bc95Act::get_knw(); // puts, getknwS |
donghuoyinzi | 1:013b9fdc4e78 | 40 | //if(know::polSta[4]=="1"&& know::polSta4[9]=="0") bc95Act::setrtc(); // setrtcS私有 |
donghuoyinzi | 1:013b9fdc4e78 | 41 | if(know::polSta[18]=="1"&& know::polSta[0]=="0") knowAct::buildtsk(); // buildtskS |
donghuoyinzi | 0:17e9016529cf | 42 | |
donghuoyinzi | 0:17e9016529cf | 43 | n=0; |
donghuoyinzi | 0:17e9016529cf | 44 | f=1; |
donghuoyinzi | 0:17e9016529cf | 45 | while(f==1){ |
donghuoyinzi | 0:17e9016529cf | 46 | n++; |
donghuoyinzi | 0:17e9016529cf | 47 | strx=know::task[n]; |
donghuoyinzi | 1:013b9fdc4e78 | 48 | stry= strx.substr(13,12); //提取时间,从索引13开始12个字符 |
donghuoyinzi | 0:17e9016529cf | 49 | //strz= "yymmdd"+ to_string (tim->tm_hour)+to_string (tim->tm_min)+"ss"; |
donghuoyinzi | 0:17e9016529cf | 50 | if(stry == strz){ |
donghuoyinzi | 0:17e9016529cf | 51 | stry= strx. substr(12,2); //提取语音编号 |
donghuoyinzi | 0:17e9016529cf | 52 | //播放 |
donghuoyinzi | 0:17e9016529cf | 53 | f=0; |
donghuoyinzi | 0:17e9016529cf | 54 | } |
donghuoyinzi | 0:17e9016529cf | 55 | } |
donghuoyinzi | 0:17e9016529cf | 56 | } |
donghuoyinzi | 0:17e9016529cf | 57 | //f401Act::sys_sleepy(); //cpu sleep |
donghuoyinzi | 0:17e9016529cf | 58 | } |
donghuoyinzi | 0:17e9016529cf | 59 | } |
donghuoyinzi | 0:17e9016529cf | 60 | |
donghuoyinzi | 0:17e9016529cf | 61 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 62 | Fun.: initialization of scorp。 |
donghuoyinzi | 0:17e9016529cf | 63 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 64 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 65 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 66 | void maiAct::init_scorp(void) |
donghuoyinzi | 0:17e9016529cf | 67 | { |
donghuoyinzi | 0:17e9016529cf | 68 | bc95Act::init(); //基础初始化 |
donghuoyinzi | 0:17e9016529cf | 69 | cloDAct::init(); |
donghuoyinzi | 0:17e9016529cf | 70 | cloSAct::init(); |
donghuoyinzi | 0:17e9016529cf | 71 | } |
donghuoyinzi | 0:17e9016529cf | 72 | |
donghuoyinzi | 0:17e9016529cf | 73 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 74 | Fun.: initialization. of data |
donghuoyinzi | 0:17e9016529cf | 75 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 76 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 77 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 78 | void maiAct::init_dat(void) |
donghuoyinzi | 0:17e9016529cf | 79 | { |
donghuoyinzi | 0:17e9016529cf | 80 | bc95Act::data(); //基础初始化 |
donghuoyinzi | 0:17e9016529cf | 81 | } |
donghuoyinzi | 0:17e9016529cf | 82 | |
donghuoyinzi | 0:17e9016529cf | 83 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 84 | Fun.: initialization of ready。 |
donghuoyinzi | 0:17e9016529cf | 85 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 86 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 87 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 88 | void maiAct::init_ready(void) |
donghuoyinzi | 0:17e9016529cf | 89 | { |
donghuoyinzi | 0:17e9016529cf | 90 | set_time(1514806505);//自1970年1月1日0时0分0秒到2018年1月1日11时35分05秒 |
donghuoyinzi | 0:17e9016529cf | 91 | |
donghuoyinzi | 0:17e9016529cf | 92 | f401Act::ready(); |
donghuoyinzi | 0:17e9016529cf | 93 | //cloDAct::ready(); |
donghuoyinzi | 0:17e9016529cf | 94 | cloSAct::ready(); |
donghuoyinzi | 0:17e9016529cf | 95 | } |
donghuoyinzi | 0:17e9016529cf | 96 | |
donghuoyinzi | 0:17e9016529cf | 97 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 98 | Fun.: initialization of start。 |
donghuoyinzi | 0:17e9016529cf | 99 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 100 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 101 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 102 | void maiAct::init_star(void) |
donghuoyinzi | 0:17e9016529cf | 103 | { |
donghuoyinzi | 0:17e9016529cf | 104 | |
donghuoyinzi | 0:17e9016529cf | 105 | } |
donghuoyinzi | 0:17e9016529cf | 106 | |
donghuoyinzi | 0:17e9016529cf | 107 | /***************************************** |
donghuoyinzi | 0:17e9016529cf | 108 | Fun.: Seep judge。 |
donghuoyinzi | 0:17e9016529cf | 109 | Desc.: |
donghuoyinzi | 0:17e9016529cf | 110 | Auth. Vesion:2017.7.2 |
donghuoyinzi | 0:17e9016529cf | 111 | *****************************************/ |
donghuoyinzi | 0:17e9016529cf | 112 | void maiAct::judg_sleep(void) |
donghuoyinzi | 0:17e9016529cf | 113 | { |
donghuoyinzi | 0:17e9016529cf | 114 | //if(all Flag==0) deepsleep(); |
donghuoyinzi | 0:17e9016529cf | 115 | } |