⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3kmenu2x.c

📁 嵌入式开发 嵌入式开发 嵌入式开发
💻 C
📖 第 1 页 / 共 5 页
字号:
	}
}

/***
 响应调节按钮 UDLR
***/
void RespUDLR23(const int idxUDLR)
{
    unsigned char tTurns=( (unit[UnitSEL-1].submenu1.unitworksnum.i==1) ? unit[UnitSEL-1].submenu1.bitTurns.turnsoflabsA : unit[UnitSEL-1].submenu1.bitTurns.turnsoflabsB );
    switch( idxUDLR )
    {
    case TB_U:
        if( tTurns==2 || tTurns==5 )
        {
            if( unit[UnitSEL-1].submenu1.v_adjust<=(-2000) ) {   return;}
            else {   unit[UnitSEL-1].submenu1.v_adjust--;}
        }
        else
        {
            if( unit[UnitSEL-1].submenu1.v_adjust>=2000 ) {   return;}
            else {   unit[UnitSEL-1].submenu1.v_adjust++;}
        }
        wjrUAdj323(AlrAdjBox_M23_X+AlrAdjBox_M23_W/2-25, AlrAdjBox_M23_Y, BES_PRESS);
        DispVAdj_M23();
        REC_Sub1(UnitSEL-1, 4);
        SendCnlData(UnitSEL-1, 0x09);
        break;
    case TB_D:
        if( tTurns==2 || tTurns==5 )
        {
            if( unit[UnitSEL-1].submenu1.v_adjust>=2000 ) {   return;}
            else {   unit[UnitSEL-1].submenu1.v_adjust++;}
        }
        else
        {
            if( unit[UnitSEL-1].submenu1.v_adjust<=(-2000) ) {   return;}
            else {   unit[UnitSEL-1].submenu1.v_adjust--;}
        }
        wjrDAdj323(AlrAdjBox_M23_X+AlrAdjBox_M23_W/2-25, AlrAdjBox_M23_Y+AlrAdjBox_M23_H-25, BES_PRESS);
        DispVAdj_M23();
        REC_Sub1(UnitSEL-1, 4);
        SendCnlData(UnitSEL-1, 0x09);
        break;
    case TB_L:
        if( tTurns==2 || tTurns==5 )
        {
            if( unit[UnitSEL-1].submenu1.h_adjust<=(-2000) ) {   return;}
            else {   unit[UnitSEL-1].submenu1.h_adjust--;}
        }
        else
        {
            if( unit[UnitSEL-1].submenu1.h_adjust>=2000 ) {   return;}
            else {   unit[UnitSEL-1].submenu1.h_adjust++;}
        }
        wjrLAdj323(AlrAdjBox_M23_X, AlrAdjBox_M23_Y+AlrAdjBox_M23_H/2-25, BES_PRESS);
        DispHAdj_M23();
        REC_Sub1(UnitSEL-1, 6);
        SendCnlData(UnitSEL-1, 0x09);
        break;
    case TB_R:
        if( tTurns==2 || tTurns==5 )
        {
            if( unit[UnitSEL-1].submenu1.h_adjust>=2000 ) {   return;}
            else {   unit[UnitSEL-1].submenu1.h_adjust++;}
        }
        else
        {
            if( unit[UnitSEL-1].submenu1.h_adjust<=(-2000) ) {   return;}
            else {   unit[UnitSEL-1].submenu1.h_adjust--;}
        }
        wjrRAdj323(AlrAdjBox_M23_X+AlrAdjBox_M23_W-25, AlrAdjBox_M23_Y+AlrAdjBox_M23_H/2-25, BES_PRESS);
        DispHAdj_M23();
        REC_Sub1(UnitSEL-1, 6);
        SendCnlData(UnitSEL-1, 0x09);
        break;
    default:
        break;
    }
}

unsigned char hjSACmdBuffers[MAXCNL_3K]={0}; //用来记录通道的智能状态处理命令
/******************************
 描述: 智能工作响应       
       (单组智能也被设定为和整机智能状态相同)
 参考: 在命令中的位控制 B2. of command 0x06#.
       bit0=0 A系,bit0=1 B系
       bit1=0 本组智能关,bit1=1 本组智能
       bit2=0 整机智能关,bit2=1 整机智能
       bit3=0脱机工作    bit3=1 上位机控制
******************************/
void RespEntireINTEL23(void)
{
    int ico,jcnl;
    unsigned char tSTL,tEntireIntell;
    if( VarST3000.jobAB==1 )
    {
        if( EntireStatus.EntireIntelligent_A )
        {   ico=3; tSTL=0/*0x00*/; EntireStatus.EntireIntelligent_A=0;}
        else
        {   ico=4; tSTL=1/*0x10*/; EntireStatus.EntireIntelligent_A=1;}
        tEntireIntell=EntireStatus.EntireIntelligent_A;
    }
    else
    {
        if( EntireStatus.EntireIntelligent_B )
        {   ico=3; tSTL=0x00; EntireStatus.EntireIntelligent_B=0;}
        else
        {   ico=4; tSTL=0x10; EntireStatus.EntireIntelligent_B=1;}
        tEntireIntell=EntireStatus.EntireIntelligent_B;
    }
    Button(30, 240, 85, 45, tSTL, NULL, 192, 192, 192);
    ShowICO3232(ico, 53, 246);    
    // 设置系内的整机智能模式

    for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
    {
        if( unit[jcnl].submenu1.unitworksnum.i==VarST3000.jobAB &&
            unit[jcnl].submenu1.unitworksnum.j )
        {
            unit[jcnl].submenu1.bitfield.autowork=tEntireIntell;
            // 更新智能开关在命令缓冲区内的记录B2.bit1 bit2
            if( tEntireIntell )
            {
                hjSACmdBuffers[jcnl]=CommandData[jcnl].Cmd6[1]; // 记录缓冲
                hjSACmdBuffers[jcnl]|=0x06; // 置bit1.bit2
                
            }
            else
            {   CommandData[jcnl].Cmd6[1]&=0x09;} // 清bit1.bit2
            // wjrSearAddrFlags这个标志仅仅是为了标志
            // 这个通道的6号命令需要发 无论是做同步还是作寻址接收
            SetwjrSearAddrFlags(jcnl, tEntireIntell);
        }
    }
    if( !tEntireIntell )
    {   // 通知所有本系属内通道关掉智能寻址状态
    	CommandData[jcnl].Cmd6[1]&=0x09; // 清bit1.bit2
        for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
        {
            if( unit[jcnl].submenu1.unitworksnum.i==VarST3000.jobAB &&
                unit[jcnl].submenu1.unitworksnum.j )
            {   SendCnlData(jcnl, 0x06);}
        }
    }
    else
    {     
        for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
        {
            if( unit[jcnl].submenu1.unitworksnum.i==VarST3000.jobAB &&
                unit[jcnl].submenu1.unitworksnum.j )
            {   
            	CommandData[jcnl].Cmd6[1]=hjSACmdBuffers[jcnl];
            	CommandData[jcnl].Cmd6[1]|=0x06;
            	SendCnlData(jcnl, 0x06);
            }
        }
    	
    }
    _SetCnlSA_M23(); // Fresh Aptitude of Current Chanel.
}

/******************************
 描述: 操作当前通道的本组智能按钮
******************************/
void RespINTEL23(void)
{
	int jcnl,vICO;
	unsigned char vSyncSA,vStyle,vAptitudeFlag;
	unsigned char vSErRec=unit[UnitSEL-1].submenu1.unitworksnum.i;
	unit[UnitSEL-1].submenu1.bitfield.autowork++;
	_SetCnlSA_M23(); //___通道自动寻址图标
	if( unit[UnitSEL-1].submenu1.bitfield.autowork )
	{	hjSACmdBuffers[UnitSEL-1]=CommandData[UnitSEL-1].Cmd6[1];
		hjSACmdBuffers[UnitSEL-1]|=0x02; //__On Aptitude of Current Chanel.
		SetwjrSearAddrFlags(UnitSEL-1, 1);
	}
	else
	{	CommandData[UnitSEL-1].Cmd6[1]&=0xfd;} //__Off Aptitude of Current Chanel.
	//____________记录整机的智能状态发生改变了吗 并且记录下来
	vSyncSA=GetEntireIntelligent(vSErRec);	
	if(vSErRec==1)
	{	vAptitudeFlag=EntireStatus.EntireIntelligent_A;}
	else
	{	vAptitudeFlag=EntireStatus.EntireIntelligent_B;}
	//____________对智能改变同步下位机控制单元
	if(vSyncSA)
	{
		//整机智能发生改变需要通知所有通道
		
		if(!vAptitudeFlag)
		{	//____清整机智能
			for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
			{
				if( unit[jcnl].submenu1.unitworksnum.i==vSErRec &&
					unit[jcnl].submenu1.unitworksnum.j)
				{	
					CommandData[jcnl].Cmd6[1]&=0xfb; //bit2=0清整机智能
					SendCnlData(jcnl, 0x06);
				}
			}
			
			vICO=3; vStyle=0x00;
		}
		else 
		{	//____设整机智能工作
			
			for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
			{	
				if( unit[jcnl].submenu1.unitworksnum.i==vSErRec &&
					unit[jcnl].submenu1.unitworksnum.j)
				{
					CommandData[jcnl].Cmd6[1]=hjSACmdBuffers[jcnl]; //将要处理的智能状态更新下发
					CommandData[jcnl].Cmd6[1]|=0x06;
					SendCnlData(jcnl, 0x06);
					SetwjrSearAddrFlags(jcnl, 1);
				}
			}
			
			vICO=4; vStyle=0x10;						
		}		
		Button(30, 240, 85, 45, vStyle, NULL, 192, 192, 192);
		ShowICO3232(vICO, 53, 246);		
	}
	else
	{	//整机状态没有发生改变 仅仅通知当前这个通道
		if(unit[UnitSEL-1].submenu1.bitfield.autowork) //如果本机智能开 更新命令
		{	CommandData[UnitSEL-1].Cmd6[1]=hjSACmdBuffers[UnitSEL-1];}
		SendCnlData(UnitSEL-1, 0x06);			
	}
}

/******************************
 描述:	单通道手动与自动的转换
******************************/
void RespVertStatus23(void)
{
	int jcnl,vICO;
	unsigned char vMustSyncFlags[MAXCNL_3K]={0};
	unsigned char sty_b,vAWSflag,vWKSofCurSEr,vUCHAR;
	unsigned char vSErofCurCNL=unit[UnitSEL-1].submenu1.unitworksnum.i;
	unit[UnitSEL-1].submenu1.bitfield.hand_auto++;
	_SetVWS_M23(); //___纵向自动手动图标
	if( !unit[UnitSEL-1].submenu1.bitfield.hand_auto )
	{	OUT7|=0xc0; outportb(0x302, OUT7);}
	//____如果手动 检查本组的智能 如果开 则关掉本组的智能
	if(!unit[UnitSEL-1].submenu1.bitfield.hand_auto)
	{
		if(unit[UnitSEL-1].submenu1.bitfield.autowork)
		{	unit[UnitSEL-1].submenu1.bitfield.autowork=0;
			//___刷新显示
			//____本组智能关闭
			Button(870, 380, 85, 45, 0x00, NULL, 192, 192, 192);
			ShowICO3232(16, 894, 386);
			vUCHAR=((vSErofCurCNL==1) ? EntireStatus.EntireIntelligent_A : EntireStatus.EntireIntelligent_B);
			if(vUCHAR)
			{	//如果整机智能开 则关闭
				if(vSErofCurCNL==1)
				{	EntireStatus.EntireIntelligent_A=0;}
				else
				{	EntireStatus.EntireIntelligent_B=0;}
				//需要通知本系属内所有通道的整机智能为关
				for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
				{
					if( unit[jcnl].submenu1.unitworksnum.i==vSErofCurCNL &&
						unit[jcnl].submenu1.unitworksnum.j)
					{
						CommandData[jcnl].Cmd6[1]&=0x0b; //整机智能关
						vMustSyncFlags[jcnl]=1;
					}
				}
			}
		}
		if(VarST3000.jobAB==1)
		{	EntireStatus.EntireIntelligent_A=0;}
		else
		{	EntireStatus.EntireIntelligent_B=0;}
		//____整机智能关闭
		Button(30, 240, 85, 45, 0x00, NULL, 192, 192, 192);
		ShowICO3232(3, 53, 246);
	}
	//____检查整机状态是否发生改变
	vAWSflag=GetEntireAuto(vSErofCurCNL);
	vWKSofCurSEr=((vSErofCurCNL==1) ? EntireStatus.EntireAuto_A : EntireStatus.EntireAuto_B);
	if(vWKSofCurSEr)
	{	vICO=2; sty_b=0x10;}
	else
	{	vICO=1; sty_b=0x00;}
	Button(30, 170, 85, 45, sty_b, NULL, 192, 192, 192);
	ShowICO3232(vICO, 53, 176);
	//_____刷新工作指示灯
	SetWrkMark23(UnitSEL-1, 1);
	//_____发送命令
	if(unit[UnitSEL-1].submenu1.bitfield.hand_auto)
	{	//自动
		CommandData[UnitSEL-1].Cmd6[2]|=0x01; //B2.bit0=1 [AUTO]
		SendCnlData(UnitSEL-1, 0x07); delay(15);
		SendCnlData(UnitSEL-1, 0x08); delay(15);
		SendCnlData(UnitSEL-1, 0x09); delay(15);
		SendCnlData(UnitSEL-1, 0x0A); delay(15);
		if(unit[UnitSEL-1].submenu1.bitfield.hcontrol)
		{	SendCnlData(UnitSEL-1, 0x0B); delay(15);}
		vMustSyncFlags[UnitSEL-1]=1;
	}
	else
	{	//手动
		CommandData[UnitSEL-1].Cmd6[2]&=0xfc; //B2.bit0=1 bit1=1[HAND.AHAND]
		vMustSyncFlags[UnitSEL-1]=1;
	}
	if(vAWSflag)
	{	//整机工作状态发生改变
		//需要同步所有通道的整机工作状态 并且下发给控制单元
		for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
		{
			if( unit[jcnl].submenu1.unitworksnum.i==vSErofCurCNL &&
				unit[jcnl].submenu1.unitworksnum.j)
			{
				if(vWKSofCurSEr)
				{	CommandData[jcnl].Cmd6[2]|=0x03;}
				else
				{
					if(unit[jcnl].submenu1.bitfield.hand_auto)
					{	CommandData[jcnl].Cmd6[2]|=0x01;}
					else
					{	CommandData[jcnl].Cmd6[2]&=0xfe;}
					CommandData[jcnl].Cmd6[2]&=0xfd;	//1111 1101
				}
				vMustSyncFlags[jcnl]=1;
			}
		}
	}
	//
	for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
	{
		if( unit[jcnl].submenu1.unitworksnum.i==vSErofCurCNL &&
			unit[jcnl].submenu1.unitworksnum.j && vMustSyncFlags[jcnl])
		{	SendCnlData(jcnl, 0x06);}
	}
}

/******************************
 描述:	横向自手动按钮响应
******************************/
void RespHorzStatus23(void)
{
	int jcnl,vICO;
	unsigned char vMustSyncFlags[MAXCNL_3K]={0};
	unsigned char sty_b,vAWSflag,vWKSofCurSEr,vUCHAR;
	unsigned char vSErofCurCNL=unit[UnitSEL-1].submenu1.unitworksnum.i;
	unit[UnitSEL-1].submenu1.bitfield.h_motorruning++;
	_SetHWS_M23(); //___横向自动手动图标
	if( unit[UnitSEL-1].submenu1.bitfield.h_motorruning )
	{	CommandData[UnitSEL-1].Cmd6[6]|=0x20;} //On-HMotor
	else
	{	CommandData[UnitSEL-1].Cmd6[6]&=0xdf;} //Off-HMotor
	vMustSyncFlags[UnitSEL-1]=1; //要求需要通知给下位机控制单元 12/03/2005
	//____如果手动 检查本组的智能 如果开 则关掉本组的智能
	if(!unit[UnitSEL-1].submenu1.bitfield.h_motorruning)
	{
		if(unit[UnitSEL-1].submenu1.bitfield.autowork)
		{	unit[UnitSEL-1].submenu1.bitfield.autowork=0;
			//___刷新显示
			//____本组智能关闭
			Button(870, 380, 85, 45, 0x00, NULL, 192, 192, 192);
			ShowICO3232(16, 894, 386);
			vUCHAR=((vSErofCurCNL==1) ? EntireStatus.EntireIntelligent_A : EntireStatus.EntireIntelligent_B);//2007-2-28 15:05
			if(vUCHAR)
			{	//如果整机智能开 则关闭
				if(vSErofCurCNL==1)
				{	EntireStatus.EntireIntelligent_A=0;}
				else
				{	EntireStatus.EntireIntelligent_B=0;}
				//需要通知本系属内所有通道的整机智能为关
				for(jcnl=1; jcnl<VarST3000.UnitCounts; jcnl++)
				{
					if( unit[jcnl].submenu1.unitworksnum.i==vSErofCurCNL &&
						unit[jcnl].submenu1.unitworksnum.j)
					{
						CommandData[jcnl].Cmd6[1]&=0x0b; //整机智能关
						vMustSyncFlags[jcnl]=1;
					}
				}
			}
		}
		if(VarST3000.jobAB==1)
		{	EntireStatus.EntireIntelligent_A=0;}
		else
		{	EntireStatus.EntireIntelligent_B=0;}
		//____整机智能关闭
		Button(30, 240, 85, 45, 0x00, NULL, 192, 192, 192);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -