📄 menu_t.cpp
字号:
}
for(t=2;t<=6;t++){
ivp[count].current=ivp[count].current+inv[t];
}
ivp[count].current=ivp[count].current/5;
ivp[count].scan_v=ivp[count].scan_v-spara.pulse+spara.slope;
da_v(ivp[count].scan_v);
selinsist(sel_R);
ivp[count].insist=insist_set[sel_R];
ivp[count-1].current=(ivp[count-1].current-ivp[count].current);
ivp[count-1].current=(ivp[count-1].current)/ivp[count-1].insist*1E+5;
drascreen(ivp[count-1].scan_v,ivp[count-1].current/cur_flag,0);
if(kbhit()){
key=bioskey(0);
switch(key){
case 283:
bell(400,0);
goto BRK_ZJ;
case 18688:
if(cur_flag>0.01){
cls_right_scrn();
dra_screen(0,1);
cur_flag=cur_flag/10;
for(i=0;i<count;i++)
drascreen(ivp[i].scan_v,ivp[i].current/cur_flag,0);
}
break;
case 20736:
if(cur_flag<1000000){
cls_right_scrn();
dra_screen(0,1);
cur_flag=cur_flag*10;
for(i=0;i<count;i++)
drascreen(ivp[i].scan_v,ivp[i].current/cur_flag,0);
}
break;
case 18432:
sel_R++;
if(sel_R>15) sel_R=15;
selinsist(sel_R);
break;
case 20480:
sel_R--;
if(sel_R<0) sel_R=0;
selinsist(sel_R);
break;
default:
button("PgUp:放大;PgDn:缩小;↑、↓:换档;ESC:返回! ",0,0,1,0);
break;
}
spara.sel_R=sel_R;
}
}while(ivp[count].scan_v <= spara.end_v);
bell(400,1);
BRK_ZJ: da_v(spara.brush_v);
return;
}
void mcrcfa()
{
int t,i,sel_R,scanv,key;
float inv[11];
int jg_time=0;
char *spara_c_hz[7]={
"系统正在工作",
"扫描电位",
"正在清洗",
"准备好后按任一键",
"正在通气",
"正在富集",
"溶液静止,请稍候",
};
cls_all_scrn();
dra_screen(0,1);
board(1,4,20,7,0,7);
disp_shadow_str(16,96,spara_c_hz[2],0);
bell(400,1);
outportb(0x220,0x18);
da_v(spara.brush_v);
if(watch(50,169,30,15,spara.brush_t)==283){
cls_all_scrn();
outportb(0x220,0x00);
bell(400,0);
return;
}
bell(400,1);
cls_left_scrn();
if(mc_flag==0){
board(1,4,20,7,0,7);
disp_shadow_str(16,96,spara_c_hz[5],0);
outportb(0x220,0x08);
da_v(spara.fuji_v);
if(watch(50,169,30,15,spara.fuji_t)==283){
cls_all_scrn();
outportb(0x220,0x00);
bell(400,0);
return;
}
bell(400,1);
cls_left_scrn();
}
outportb(0x220,0x00);
board(1,4,20,7,0,7);
disp_shadow_str(14,92,spara_c_hz[6],0);
for(i=0;i<spara.stat_t;i++){
if(kbhit()){
if(bioskey(0)==283){
cls_all_scrn();
bell(400,0);
return;
}
else break;
}
sleep(1);
}
sel_R=spara.sel_R;
if(sel_R>15) sel_R=15;
else if(sel_R<0) sel_R=0;
cls_left_scrn();
board(1,4,17,10,20,7);
disp_shadow_str(16,106,spara_c_hz[0],0);
disp_shadow_str(16,142,spara_c_hz[1],0);
bell(400,1);
count=1;
ivp[count].scan_v=spara.first_v;
for(i=0;i<=11;i++){inv[i]=0.;}
ivp[count].scan_v=spara.first_v;
ivp[count].insist=insist_set[sel_R];
selinsist(sel_R);
ivp[count].current=0;
da_v(spara.first_v);
if(spara.t_width==0) jg_time=500;
else jg_time=spara.t_width*1000;
// dra_screen(0,1);
do{
scanv=ivp[count].scan_v;
itoa_text(90,148,scanv,0,7);
for(t=1;t<=(jg_time-spara.p_width-30);t++)
{
delay(1);
}
for(t=1;t<=3;t++){
delay(4);
//inv[t]=ad_v();
}
/* for(t=1;t<=6;t++){
for(i=t+1;i<=7;i++){
if(inv[t]>inv[i]){ inv[t]=inv[i];}
}
}*/
//for(t=1;t<=3;t++){
do{
ivp[count].current=ad_v();//inv[t];
if(ivp[count].current<-2000){
bell(400,1);
//outportb(0x280,0x00); delay(10);
}
}while(ivp[count].current<-2000);
//}
// ivp[count].current=ivp[count].current/3;
count=count+1;
ivp[count].scan_v=ivp[count-1].scan_v+spara.pulse;
da_v(ivp[count].scan_v);
for(t=1;t<=(spara.p_width);t++) delay(1);
for(t=1;t<=3;t++){
delay(4);
//inv[t]=ad_v();
}
/* for(t=1;t<=6;t++){
for(i=t+1;i<=7;i++){
if(inv[t]>inv[i]){inv[t]=inv[i];}
}
}*/
// for(t=1;t<=3;t++){
do{
ivp[count].current=ad_v();//inv[t];
if(ivp[count].current<-2000){
bell(400,1);
//outportb(0x280,0x00); delay(10);
}
}while(ivp[count].current<-2000);
//}
//ivp[count].current=ivp[count].current/3;
// printf("current: %f ",ivp[count].current);
ivp[count].scan_v=ivp[count].scan_v-spara.pulse+spara.slope;
da_v(ivp[count].scan_v);
sel_R=spara.sel_R;
selinsist(sel_R);
ivp[count].insist=insist_set[sel_R];
ivp[count-1].current=(ivp[count-1].current-ivp[count].current);
ivp[count-1].current=(ivp[count-1].current)/ivp[count-1].insist*1E+6;
drascreen(ivp[count-1].scan_v,ivp[count-1].current/cur_flag,0);
// printf("current0: %f insist %f\n",ivp[count-1].current,ivp[count-1].insist);
printf("scan_v %d current %f\n",ivp[count-1].scan_v,ivp[count-1].current);
if(kbhit()){
key=bioskey(0);
switch(key){
case 283:
bell(400,0);
goto BRK_MC;
case 18688:
if(cur_flag>0.01){
cls_right_scrn();
dra_screen(0,1);
cur_flag=cur_flag/10;
for(i=0;i<count;i++)
drascreen(ivp[i].scan_v,ivp[i].current/cur_flag,0);
}
break;
case 20736:
if(cur_flag<1000000){
cls_right_scrn();
dra_screen(0,1);
cur_flag=cur_flag*10;
for(i=0;i<count;i++)
drascreen(ivp[i].scan_v,ivp[i].current/cur_flag,0);
}
break;
case 18432:
sel_R++;
if(sel_R>15) sel_R=15;
selinsist(sel_R);
break;
case 20480:
sel_R--;
if(sel_R<0) sel_R=0;
selinsist(sel_R);
break;
default:
button("PgUp:放大;PgDn:缩小;↑、↓:换档;ESC:返回! ",0,0,1,0);
break;
}
spara.sel_R=sel_R;
}
}while(ivp[count].scan_v <= spara.end_v);
bell(400,1);
BRK_MC: da_v(spara.brush_v);
for(i=0;i<6;i++){
smooth();
smooth1();
}
cls_all_scrn();
maxfind1();
board(1,4,16,7,0,7);
if(sz_sys.IE==1) drascr(rate_flag,1,0);
diffrance();
maxfind();
if(sz_sys.QD==1){
board(1,4,16,7,0,7);
diffdrascr();
diffcalpeak();
}
return;
}
void yjrcfa()
{
int t,i,sel_R,scanv,key;
int jg_time=0;
float inv[11];
char *spara_c_hz[7]={
"系统正在工作",
"扫描电位",
"正在清洗",
"准备好后按任一键",
"正在通气",
"正在富集",
"溶液静止,请稍候",
};
cls_all_scrn();
board(1,4,20,7,0,7);
dra_screen(0,0);
disp_shadow_str(16,96,spara_c_hz[2],0);
bell(400,1);
outportb(0x220,0x18);
da_v(spara.brush_v);
if(watch(50,169,30,15,spara.brush_t)==283){
cls_all_scrn();
outportb(0x220,0x00);
bell(400,0);
return;
}
bell(400,1);
cls_left_scrn();
if(mc_flag==0){
board(1,4,20,7,0,7);
disp_shadow_str(16,96,spara_c_hz[5],0);
outportb(0x220,0x08);
da_v(spara.fuji_v);
if(watch(50,169,30,15,spara.fuji_t)==283){
cls_all_scrn();
outportb(0x220,0x00);
bell(400,0);
return;
}
bell(400,1);
cls_left_scrn();
}
outportb(0x220,0x00);
board(1,4,20,7,0,7);
disp_shadow_str(16,92,spara_c_hz[6],0);
for(i=0;i<spara.stat_t;i++){
if(kbhit()){
if(bioskey(0)==283){
cls_all_scrn();
bell(400,0);
return;
}
else break;
}
sleep(1);
}
sel_R=spara.sel_R;
if(sel_R>15) sel_R=15;
else if(sel_R<0) sel_R=0;
cls_left_scrn();
board(1,4,17,10,20,7);
disp_shadow_str(16,106,spara_c_hz[0],0);
disp_shadow_str(16,142,spara_c_hz[1],0);
bell(400,1);
count=1;
ivp[count].scan_v=spara.first_v;
for(i=0;i<=11;i++){inv[i]=0.;}
ivp[count].scan_v=spara.first_v;
ivp[count].insist=insist_set[sel_R];
selinsist(sel_R);
ivp[count].current=0;
if(spara.t_width==0) jg_time=500;
else jg_time=spara.t_width*1000;
// dra_screen(0,0);
do{
scanv=ivp[count].scan_v;
itoa_text(90,148,scanv,0,7);
for(t=1;t<=(jg_time-spara.p_width-30);t++)
{
delay(1);
}
for(t=1;t<=7;t++){
delay(2);
inv[t]=ad_v();
}
for(t=1;t<=6;t++){
for(i=t+1;i<=7;i++){
if(inv[t]>inv[i]){inv[t]=inv[i];}
}
}
for(t=2;t<=6;t++){
ivp[count].current=ivp[count].current+inv[t];
}
ivp[count].current=ivp[count].current/5;
count=count+1;
ivp[count].scan_v=ivp[count-1].scan_v+spara.pulse;
da_v(ivp[count].scan_v);
for(t=1;t<=(spara.p_width);t++) delay(1);
for(t=1;t<=7;t++){
delay(2);
inv[t]=ad_v();
}
for(t=1;t<=6;t++){
for(i=t+1;i<=7;i++){
if(inv[t]>inv[i]){inv[t]=inv[i];}
}
}
for(t=2;t<=6;t++){
ivp[count].current=ivp[count].current+inv[t];
}
ivp[count].current=ivp[count].current/5;
ivp[count].scan_v=ivp[count].scan_v-spara.pulse-spara.slope;
da_v(ivp[count].scan_v);
sel_R=spara.sel_R;
selinsist(sel_R);
ivp[count].insist=insist_set[sel_R];
ivp[count-1].current=(ivp[count-1].current-ivp[count].current);
ivp[count-1].current=(ivp[count-1].current)/ivp[count-1].insist*1E+6;
yjdrascreen(ivp[count-1].scan_v,ivp[count-1].current/cur_flag,0);
if(kbhit()){
key=bioskey(0);
switch(key){
case 283:
bell(400,0);
goto BRK_YJ;
case 18688:
if(cur_flag>0.01){
cls_right_scrn();
dra_screen(0,0);
cur_flag=cur_flag/10;
for(i=0;i<count;i++)
yjdrascreen(ivp[i].scan_v,ivp[i].current/cur_flag,0);
}
break;
case 20736:
if(cur_flag<1000000){
cls_right_scrn();
dra_screen(0,0);
cur_flag=cur_flag*10;
for(i=0;i<count;i++)
yjdrascreen(ivp[i].scan_v,ivp[i].current/cur_flag,0);
}
break;
case 18432:
sel_R++;
if(sel_R>15) sel_R=15;
selinsist(sel_R);
break;
case 20480:
sel_R--;
if(sel_R<0) sel_R=0;
selinsist(sel_R);
break;
default:
button("PgUp:放大;PgDn:缩小;↑、↓:换档;ESC:返回! ",0,0,1,0);
break;
}
spara.sel_R=sel_R;
}
}while(ivp[count].scan_v >= spara.end_v);
bell(400,1);
BRK_YJ: da_v(spara.brush_v);
for(i=0;i<6;i++){
smooth();
smooth1();
}
cls_all_scrn();
maxfind1();
board(1,4,16,7,0,7);
if(sz_sys.IE==1) drascr(rate_flag,0,0);
diffrance();
maxfind();
if(sz_sys.QD==1){
board(1,4,16,7,0,7);
diffyjdrascr();
diffyjcalpeak();
}
return;
}
void selinsist(int dw)
{
int i,temp,temp_226;
float insist;
temp=temp_226&0x00;
dw=temp|dw;
outportb(0x226,dw);
}
float datasmoothweights(float *dataset,int numdat,int smoothnum,
float *weights,float wdivisor,float *smoothdata)
{
int i;
int j;
int k;
int smoothdeg;
int startconv;
int stopconv;
int numcpef;
if((smoothnum>=1)&&(fmod(smoothnum,2)!=0)){
smoothdeg=smoothnum/2;
startconv=smoothdeg ;
stopconv=numdat-smoothdeg-1;
for(i=0;i<=numdat-1;++i){
smoothdata[i]=0;
}
for(i=startconv;i<=stopconv;++i){
for(j=0;j<=smoothnum-1;++j){
smoothdata[i]=smoothdata[i]+dataset[i-smoothdeg+j]*weights[j];
}
smoothdata[i]=smoothdata[i]/wdivisor;
}
j=smoothdeg-1;
k=numdat-smoothdeg;
for(i=1;i<=smoothdeg;++i){
smoothdata[j]=smoothdata[j+1];
smoothdata[k]=smoothdata[k-1];
j=j-1;
k=k+1;
}
}
return 0;
}
float smooth(void)
{
float smoothdata[2000],dataset[2000];
int i,numdat,smoothnum;
float weights[5],wdivisor;
numdat=count;smoothnum=5;
weights[0]=1;weights[1]=2;weights[2]=3;weights[3]=2;weights[4]=1;
wdivisor=9;
for(i=0;i<=count-1;++i){
dataset[i]=ivp[i+1].current;
}
datasmoothweights(dataset,numdat,smoothnum,weights,wdivisor,smoothdata);
for(i=0;i<=count-1;++i){
ivp[i+1].current=smoothdata[i];
}
return 0;
}
float smooth1(void)
{
float smoothdata[2000],dataset[2000];
int i,numdat,smoothnum;
float weights[5],wdivisor;
numdat=count-2;smoothnum=5;
weights[0]=1;weights[1]=2;weights[2]=3;weights[3]=2;weights[4]=1;
wdivisor=9;
for(i=0;i<=count-3;i++){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -