3kmenu2.c
来自「嵌入式开发 嵌入式开发 嵌入式开发」· C语言 代码 · 共 1,816 行 · 第 1/5 页
C
1,816 行
{
if( unit[t].submenu1.unitworksnum.i==iSER &&
unit[t].submenu1.unitworksnum.j )
{
bTurns=((iSER==1) ? unit[t].submenu1.bitTurns.turnsoflabsA : unit[t].submenu1.bitTurns.turnsoflabsB);
if( bTurns==2 || bTurns==5 )
{ revCnt++;}
else
{ forCnt++;}
}
}
if( revCnt && forCnt ) { return 0;}
if( forCnt ) { return 1;}
return 2;
}
/***
主执行菜单OK按钮下发所有设置
***/
void ConfirmOK(void)
{
int t,Busrmsg=0,BEntireTurns,BEntireIntelligent,BEntireAuto;
unsigned sXms,hXms; // sXms=size of xms left. hXms=handle of xms be allocated.
Button(780, 550, 100, 50, 0x91, "OK", 192, 192, 192); // 按钮呈现按下的效果
sXms = GetFreeXMSMem();
if( sXms>=600 )
{
sXms=600;
hXms=AllocXMSMem(sXms);
if( hXms ) { Busrmsg=1;}
}
HideMouse();
if( Busrmsg )
{
GetImage_xms(337, 380, 350, 120, hXms, 0);
xpbar(337, 380, 349, 120, 0);
Rect(337, 380, 349, 120, 0);
ShowGB2312X(448, 420, 1, 2, "通讯中,请等待!", 0, 0, 0);
}
#ifndef ST3000_TMODE
/*
I/O: 302H;
bit1=1 A系属; =0 B系属
bit0=1 4000采样; =0 2000采样
*/
OUT7&=0xFC; // [1111 1100] ; bit1bit0=00
if( VarST3000.jobAB==1 )
{
OUT7|=0x02;
if( SysSet.CofBanA>=5000 ) { OUT7|=0x01;}
}
else
{
if( SysSet.CofBanB>=5000 ) { OUT7|=0x01;}
}
outportb(0x302, OUT7);
delay(5);
/*
如果通道在手动工作方式下
并且通道的智能状态为打开的时候需要关闭智能状态
*/
for(t=1; t<VarST3000.UnitCounts; t++)
{
if( unit[t].submenu1.unitworksnum.i==VarST3000.jobAB &&
unit[t].submenu1.unitworksnum.j )
{
if( !WhetherCUAuto(t) )
{ // 通道手动状态
if( unit[t].submenu1.bitfield.autowork )
{
unit[t].submenu1.bitfield.autowork=0;
SetwjrSearAddrFlags(t, 0);
REC_Sub1(t, 8);
}
}
}
}
GetEntireAuto(VarST3000.jobAB); // 获取当前系属的整机自/手动
GetEntireIntelligent(VarST3000.jobAB); // 获取当前系属的智能状态
BEntireTurns=GetEntireTurns(VarST3000.jobAB); // 获取整机标记排列形式
BEntireIntelligent = ((VarST3000.jobAB==1) ? EntireStatus.EntireIntelligent_A : EntireStatus.EntireIntelligent_B);
BEntireAuto=((VarST3000.jobAB==1) ? EntireStatus.EntireAuto_A : EntireStatus.EntireAuto_B);
NotifyCU789AB(VarST3000.jobAB); // 发送7#~B#命令
for(t=1; t<VarST3000.UnitCounts; t++)
{
if( unit[t].submenu1.unitworksnum.i==VarST3000.jobAB &&
unit[t].submenu1.unitworksnum.j )
{
ReUpdateCmd6(t, BEntireIntelligent, BEntireAuto, BEntireTurns);
SendCnlData(t, 0x06); CmdFlags[t].B=0;
}
}
ConfirmREC_Scr();
#endif
if( Busrmsg )
{
PutImage_xms(337, 380, 350, 120, hXms, 0);
FreeXMSMem(hXms); hXms=0;
}
Button(780, 550, 100, 50, 0x81, "OK", 192, 192, 192); // 按钮呈现弹起效果
ShowMouse();
ClearCmdFlags(); // 清除命令改动状态标志
}
/***
控制单元开关设置
-iCNL; 通道ID
***/
void CtrlUnitOnOff22(const int iCNL)
{
int t,BEntireIntelligent,BEntireAuto,BEntireTurns;
char szChar[10]={0};
unsigned char bTurns,bShape;
sprintf(szChar, "%dU", iCNL+1);
//Button(50, 95+45*iCNL, 90, 35, 0x10, NULL, 192, 192, 192);
Rect(50, 95+45*iCNL, 90, 35,1);//2007-4-12 9:26
delay(10);
Button(50, 95+45*iCNL, 90, 35, 0x81, szChar, 192, 192, 192);
if( unit[iCNL].submenu1.unitworksnum.i==VarST3000.jobAB )
{ // OFF -CtrlUnit
unit[iCNL].submenu1.unitworksnum.i=0; // Dismissed this Channel
unit[iCNL].submenu1.bitfield.autowork=0;
unit[iCNL].submenu1.bitfield.hand_auto=0;
unit[iCNL].submenu1.bitfield.h_motorruning=0;
CommandData[iCNL].Cmd6[0]=CommandData[iCNL].Cmd6[5]=0x00;
CommandData[iCNL].Cmd6[1]&=0x01; // Work Lonely. Not Aptitude.
CommandData[iCNL].Cmd6[2]=0x00; // VertMotor . WholeMachine ManualOperate.
CommandData[iCNL].Cmd6[6]&=0xdf; // HorzMotor ShutDown.
SendCnlData(iCNL, 0x06);
Edit(160, 95+45*iCNL, 125, 35, 0x00, NULL);
Circle(22, 113+45*iCNL, 7, 192, 192, 192);
if( VarST3000.jobAB==1 )
{ SetEntireFlags(iCNL, 0x10, 0); SetEntireFlags(iCNL, 0x20, 0); SetEntireFlags(iCNL, 0x30, 0);}
else
{ SetEntireFlags(iCNL, 0x11, 0); SetEntireFlags(iCNL, 0x21, 0); SetEntireFlags(iCNL, 0x31, 0);}
}
else
{ // ON-CtrlUnit.
unit[iCNL].submenu1.unitworksnum.i=VarST3000.jobAB; // Arrange Channel to Current JOB.SER
if( VarST3000.jobAB==1 )
{ unit[iCNL].submenu1.bitTurns.turnsoflabsA=SysSet.bitTurns.TurnofLabsA;}
else
{ unit[iCNL].submenu1.bitTurns.turnsoflabsB=SysSet.bitTurns.TurnofLabsB;}
SyncTurnsDISP(iCNL, (VarST3000.jobAB==1 ? unit[iCNL].submenu1.bitTurns.turnsoflabsA : unit[iCNL].submenu1.bitTurns.turnsoflabsB));
Circle(22, 113+45*iCNL, 7, 128, 255, 128);
}
// 重新排列最新的标准色序
ReOrderCtrlUnit();
// 整个系属的整机状态
GetEntireAuto(VarST3000.jobAB); // 整个系属的自/手动
GetEntireIntelligent(VarST3000.jobAB); // 整个系属的智能
BEntireTurns=GetEntireTurns(VarST3000.jobAB); // 整机的正/逆序
BEntireIntelligent=((VarST3000.jobAB==1) ? EntireStatus.EntireIntelligent_A : EntireStatus.EntireIntelligent_B);
BEntireAuto=((VarST3000.jobAB==1) ? EntireStatus.EntireAuto_A : EntireStatus.EntireAuto_B);
NotifyCU789AB(VarST3000.jobAB);
for(t=1; t<VarST3000.UnitCounts; t++)
{
if( unit[t].submenu1.unitworksnum.i==VarST3000.jobAB &&
unit[t].submenu1.unitworksnum.j )
{
ReUpdateCmd6(t, BEntireIntelligent, BEntireAuto, BEntireTurns);
SendCnlData(t, 0x06); CmdFlags[t].bits.bit0=0;
}
}
}
/***
主执行菜单
***/
void menu2(void)
{
int ytzA,ytzB,jcnl,DO_ONCE_FLAG=0;
unsigned char counTime=0,counTime1=0;
adresult=0;
if( CountJOBCU(1) || CountJOBCU(2) )
{ // 至少存在一个或以上可以使用的通道
ytzA=GetJOB_ytz(1);
ytzB=GetJOB_ytz(2);
if( (ytzA==1) && (ytzB==1) ) // A/B系都在预套准 定位A系 并且在预套准工作页面
{ VarST3000.jobAB=1; VarST3000.SubIDSEL=1;}
else if( (ytzA==1) && (ytzB==2) ) // A系预套准 B系没有通道
{ VarST3000.jobAB=1; VarST3000.SubIDSEL=1;}
else if( (ytzB==1) && (ytzA==2) ) // B系预套准 A系没有通道
{ VarST3000.jobAB=2; VarST3000.SubIDSEL=1;}
else if(CountJOBCU(1) )
{ VarST3000.jobAB=1; VarST3000.SubIDSEL=3;}//2007-3-5 13:29
else if(CountJOBCU(2))
{ VarST3000.jobAB=2; VarST3000.SubIDSEL=3;}
else
{ VarST3000.jobAB=1; VarST3000.SubIDSEL=3;}
}
else
{ // 没有一个可以使用的通道 进入设置页面
VarST3000.jobAB=1;
VarST3000.SubIDSEL=2;
}
DrawM2fr( VarST3000.SubIDSEL );
// 开始进入操作
ShowMouse();
while( (VarST3000.MenuIDSEL==2) && (VarST3000.AppAlive) )
{
MouseKeyClick();
if( MouseClickFlag )
{
MouseClickFlag=0;
HideMouse();
if( (ClickRow>=10) && (ClickRow<=60) )
{ // 标题栏
if( ClickCol>=2 && ClickCol<=120 )
{ menu8(); goto subexit_matrixmenu2;}
else if( ClickCol>=130 && ClickCol<=230 )
{ // 退出
if( wrkMsgBox(1)==1 )
{ VarST3000.AppAlive=0; break;}
else
{ goto subexit_matrixmenu2;}
}
else if( (ClickCol>=240 && ClickCol<=340) && (VarST3000.CtrlMenuStatus) )
{ // 参数屏幕1
ytzA=GetJOB_ytz(1);
ytzB=GetJOB_ytz(2);
if( (ytzA==1) || (ytzB==1) )
{
if( wrkMsgBox(0)==1 )
{
if( ytzA==1 ) { StopYtz(1, 0);}
if( ytzB==1 ) { StopYtz(2, 0);}
VarST3000.MenuIDSEL=7;
}
}
else
{ VarST3000.MenuIDSEL=7;}
goto subexit_matrixmenu2;
}
else if( (ClickCol>=350 && ClickCol<=450) && (VarST3000.CtrlMenuStatus) )
{ // 参数屏幕2
ytzA=GetJOB_ytz(1);
ytzB=GetJOB_ytz(2);
if( (ytzA==1) || (ytzB==1) )
{
if( wrkMsgBox(0)==1 )
{
if( ytzA==1 ) { StopYtz(1, 0);}
if( ytzB==1 ) { StopYtz(2, 0);}
VarST3000.MenuIDSEL=6;
}
}
else
{ VarST3000.MenuIDSEL=6;}
goto subexit_matrixmenu2;
}
else if( (ClickCol>=460 && ClickCol<=560) && VarST3000.CtrlMenuStatus )
{ // 参数屏幕3
ytzA=GetJOB_ytz(1);
ytzB=GetJOB_ytz(2);
if( (ytzA==1) || (ytzB==1) )
{
if( wrkMsgBox(0)==1 )
{
if( ytzA==1 ) { StopYtz(1, 0);}
if( ytzB==1 ) { StopYtz(2, 0);}
VarST3000.MenuIDSEL=5;
}
}
else
{ VarST3000.MenuIDSEL=5;}
goto subexit_matrixmenu2;
}
else if( ClickCol>=570 && ClickCol<=670 ) // 误差历史曲线
{ VarST3000.MenuIDSEL=4; goto subexit_matrixmenu2;}
else if( ClickCol>=680 && ClickCol<=780 ) // 误差综合调节
{ VarST3000.MenuIDSEL=3; goto subexit_matrixmenu2;}
#ifdef CAPTURE_SCR
else if( ClickCol>=790 && ClickCol<=890 )
{ SaveScrRGB(2, VarST3000.SubIDSEL);}
#endif
else if( ClickCol>=900 && ClickCol<=1000 )
{ // 静止画面
ytzA=GetJOB_ytz(1);
ytzB=GetJOB_ytz(2);
if( (ytzA==1) || (ytzB==1) )
{
if( wrkMsgBox(0)==1 )
{
if( ytzA==1 ) { StopYtz(1, 0);}
if( ytzB==1 ) { StopYtz(2, 0);}
VarST3000.MenuIDSEL=1;
}
}
else
{ VarST3000.MenuIDSEL=1;}
goto subexit_matrixmenu2;
}
}
else if( ClickRow>=710 && ClickRow<=760 )
{ // 判断是否在主界面中切换功能屏幕
if( (ClickCol>=212 && ClickCol<=312) && (VarST3000.SubIDSEL!=1) )
{ // 预套准功能屏幕
if( VarST3000.SubIDSEL==3 )
{ // 从波形界面切换过来
if( UnitSEL )
{
CommandData[UnitSEL-1].Cmd6[6]&=0xfe;
SendCnlData(UnitSEL-1, 0x06);
}
}
if( GetJOB_ytz(1)==1 ) { VarST3000.jobAB=1;}
else if( GetJOB_ytz(2)==1 ) { VarST3000.jobAB=2;} // +else 是为了A系优先
VarST3000.SubIDSEL=1;
DrawM2fr(1);
}
else if( (ClickCol>=462 && ClickCol<=562) && (VarST3000.SubIDSEL!=2) )
{ // 基本设置功能屏幕
if( VarST3000.SubIDSEL==3 )
{ // 从波形界面切换过来
if( UnitSEL )
{
CommandData[UnitSEL-1].Cmd6[6]&=0xfe;
SendCnlData(UnitSEL-1, 0x06);
}
ytzA=GetJOB_ytz(1);
ytzB=GetJOB_ytz(2);
if( (ytzA==1) && (ytzB==1) )
{ // 两个系同时在作预套准
if( wrkMsgBox(0)==1 )
{
StopYtz(1, 0);
StopYtz(2, 0);
VarST3000.SubIDSEL=2;
DrawM2fr(2);
}
}
else if( ytzA==1 )
{ // 如果A系预套准
VarST3000.jobAB=2;
VarST3000.SubIDSEL=2;
DrawM2fr(2);
}
else if( ytzB==1 )
{ // 如果B系预套准
VarST3000.jobAB=1;
VarST3000.SubIDSEL=2;
DrawM2fr(2);
}
else
{ // 没有任何预套准
VarST3000.SubIDSEL=2;
DrawM2fr(2);
}
goto subexit_matrixmenu2;
}
else if( VarST3000.SubIDSEL==1 )
{ // 从预套准界面切换进入
ytzA=GetJOB_ytz(1);
ytzB=GetJOB_ytz(2);
if( (ytzA==1) && (ytzB==1) )
{ // 两个系同时在作预套准
if( wrkMsgBox(0)==1 )
{
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?