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

📄 groundcontrol.ui.h

📁 采用gpio口来控制串口扩展芯片的驱动和测试程序
💻 H
📖 第 1 页 / 共 2 页
字号:
		    		    SWOFF0=BufferIn[8]&0x20;	//OFF0		    switch(SWOFF0)		    {				    case 0x00:					SWOFF1Label->setText("OPEN");				SWOFF1Label->setBackgroundColor(Qt::yellow);				break;			    case 0x20:					SWOFF1Label->setText("CLOSE");				SWOFF1Label->setBackgroundColor(Qt::green);				break;			    }		    		    SWOFF1=BufferIn[8]&0x10;		    switch(SWOFF1)		    {				    case 0x00:					SWOFF2Label->setText("OPEN");				SWOFF2Label->setBackgroundColor(Qt::yellow);				break;			    case 0x10:					SWOFF2Label->setText("CLOSE");				SWOFF2Label->setBackgroundColor(Qt::green);				break;			    }		    		    SWStation=BufferIn[9]&0xf0;		    switch(SWStation)		    {			    case 0xf0:					SWMSLabel->setText("Sub");				SWMSLabel->setBackgroundColor(Qt::yellow);				break;//SUB Station			    case 0x00:					SWMSLabel->setText("Main");				SWMSLabel->setBackgroundColor(Qt::green);				break;//Main Station				    default:						SWMSLabel->setText("ERROR");				SWMSLabel->setBackgroundColor(Qt::red);				break;//unknown state			    }		    		    SWMainFu=BufferIn[9]&0x0f;		    switch(SWMainFu)		    {			    case 0x0f:					SWctrlLabel->setText("Futaba");				SWctrlLabel->setBackgroundColor(Qt::yellow);				break; //Futaba Control			    case 0x00:					SWctrlLabel->setText("Station");				SWctrlLabel->setBackgroundColor(Qt::green);				break; //Station Control			    default:					SWctrlLabel->setText("ERROR");				SWctrlLabel->setBackgroundColor(Qt::red);				break;			    }//the end of switcher operation		    //execute navigator command 		    			m_nav=BufferIn[10];		    			/*switch(m_nav)		    {		    case 0x00:				NavLabel->setText("IDLE");			NavLabel->setBackgroundColor(Qt::yellow);			break;	//no nav command		    			case 0xFF:				NavLabel->setText("BACK");			NavLabel->setBackgroundColor(Qt::green);			CmdInputLabel->setText("Nav back");			break;		    default:					NavLabel->setText("Straight");			CmdInputLabel->setText("Nav fly");			NavLabel->setBackgroundColor(Qt::red);			break;		    }*/			if(m_nav!=0x00)//判断是否有导航指令			{				if(m_nav==0xff)	//判断是否为返航指令				{				NavLabel->setText("BACK");				NavLabel->setBackgroundColor(Qt::green);				CmdInputLabel->setText("Nav back");				}				else //判断是否有直飞指令				{				NavLabel->setText("Straight");				CmdInputLabel->setText("Nav fly");				NavLabel->setBackgroundColor(Qt::red);					}			}					    //execute set height command 		    m_height=BufferIn[11]*256+BufferIn[12];		    if((BufferIn[11]!=0xff)&&(BufferIn[12]!=0xff))	//if valid		    {			HeightLabel->setText(QString::number(m_height));			CmdInputLabel->setText("Heightset");			StateLabel->setText(QString::number(m_height));		    }		    					    //execute set platform command 		    m_platform=BufferIn[13];		    if(m_platform!=0xff)			{			switch(m_platform)		    {		    case 0x00:				PlatformLabel->setText("shouqi");			CmdInputLabel->setText("Platset");			StateLabel->setText(QString::number(m_platform));			break;		    case 0x01:				PlatformLabel->setText("NO1");			CmdInputLabel->setText("Platset");			StateLabel->setText(QString::number(m_platform));			break;		    case 0x02:				PlatformLabel->setText("NO2");			CmdInputLabel->setText("Platset");			StateLabel->setText(QString::number(m_platform));			break;		    /*			case 0xff:			PlatformLabel->setText("unvalid");						break;			*/		    default:			PlatformLabel->setText("error");						break;		    }			}					    //set control pole position		    PitchPosLabel->setText(QString::number(BufferIn[14]));		    RollPosLabel->setText(QString::number(BufferIn[15]));		    CoursePosLabel->setText(QString::number(BufferIn[16]));		    CollectPosLabel ->setText(QString::number(BufferIn[17]));		    ThrottlePosLabel->setText(QString::number(BufferIn[18]));		    //set zero point		    PitchZeroLabel->setText(QString::number(BufferIn[19]));		    RollZeroLabel->setText(QString::number(BufferIn[20]));		    CourseZeroLabel->setText(QString::number(BufferIn[21]));		    CollectZeroLabel->setText(QString::number(BufferIn[22]));		    ThrottleZeroLabel->setText(QString::number(BufferIn[23]));		    //key process state,set the zero point one by one		    switch(BufferIn[24])		    {		    case 0xFF:	//idle state			//set all the zero labels to default state			ZeroLabel->setFrameShape(QFrame::NoFrame);			ZeroLabel->setFrameShadow(QFrame::Plain);			PitchZeroLabel->setBackgroundColor(Qt::lightGray);			RollZeroLabel->setBackgroundColor(Qt::lightGray);			CourseZeroLabel->setBackgroundColor(Qt::lightGray);			ThrottleZeroLabel->setBackgroundColor(Qt::lightGray);			CollectZeroLabel->setBackgroundColor(Qt::lightGray);			break;		    case 0x01:	//menu 			CmdInputLabel->setText("key cmd");			StateLabel->setText("menu");			ZeroLabel->setFrameShape(QFrame::WinPanel);			ZeroLabel->setFrameShadow(QFrame::Sunken);			//ZeroLabel->setBackgroundColor(Qt::red);			break;			    case 0x20:	//menu->pitchzero			CmdInputLabel->setText("key cmd");			StateLabel->setText("Pitch0");			ZeroLabel->setFrameShape(QFrame::WinPanel);			ZeroLabel->setFrameShadow(QFrame::Sunken);			PitchZeroLabel->setBackgroundColor(Qt::red);			break;		    case 0x21:	//menu->Rollzero			CmdInputLabel->setText("key cmd");			StateLabel->setText("Roll0");			ZeroLabel->setFrameShape(QFrame::WinPanel);			ZeroLabel->setFrameShadow(QFrame::Sunken);			RollZeroLabel->setBackgroundColor(Qt::red);			break;		    case 0x22:	//menu->Course zero			CmdInputLabel->setText("key cmd");			StateLabel->setText("Course0");			ZeroLabel->setFrameShape(QFrame::WinPanel);			ZeroLabel->setFrameShadow(QFrame::Sunken);			CourseZeroLabel->setBackgroundColor(Qt::red);			break;		    case 0x23:	//menu->Collect zero			CmdInputLabel->setText("key cmd");			StateLabel->setText("Collect0");			ZeroLabel->setFrameShape(QFrame::WinPanel);			ZeroLabel->setFrameShadow(QFrame::Sunken);			CollectZeroLabel->setBackgroundColor(Qt::red);			break;		    case 0x24:	//menu->Throttle zero			CmdInputLabel->setText("key cmd");			StateLabel->setText("Throttle0");			ZeroLabel->setFrameShape(QFrame::WinPanel);			ZeroLabel->setFrameShadow(QFrame::Sunken);			ThrottleZeroLabel->setBackgroundColor(Qt::red);			break;		    case 0x30:	//menu->configure			CmdInputLabel->setText("key cmd");			StateLabel->setText("Configure");			ZeroLabel->setFrameShape(QFrame::NoFrame);			ZeroLabel->setFrameShadow(QFrame::Plain);			PitchZeroLabel->setBackgroundColor(Qt::lightGray);			RollZeroLabel->setBackgroundColor(Qt::lightGray);			CourseZeroLabel->setBackgroundColor(Qt::lightGray);			ThrottleZeroLabel->setBackgroundColor(Qt::lightGray);			CollectZeroLabel->setBackgroundColor(Qt::lightGray);			break;		    default:			CmdInputLabel->setText("key cmd");			StateLabel->setText("ERROR");			break;		    }		    //key board process		    if(BufferIn[25]!=0xff||BufferIn[26]!=0xff||BufferIn[27]!=0xff)		    {			m_number=BufferIn[25]+BufferIn[26]*256+BufferIn[27]*65536;			KeyLabel->setText(QString::number(m_number));	//debug:test key input valu			LCDNumber->display(m_number);		    }		     /* if(BufferIn[25]!=0xff)		    {			KeyLabel->setText(QString::number(BufferIn[25]));	//debug:test key input valu			LCDNumber->display(BufferIn[25]);		    }*/		    		    //debug by xubin		    CountLabel->setText(QString::number(BufferIn[2]));//show the frame counter value,if it changes,means frame is OK		}//the end of the frame data update check				count=BufferIn[2];			    }//the end of the check sum			}//the end of the frame head check    }    //the end of the serial buffer data number check    nread=0;        // timercounter++;    // timercounter=timercounter%10;    }void GroundControl::SlotClick(){    CmdInputLabel->setText("key cmd");    StateLabel->setText("menu");    ZeroLabel->setText("change");    ZeroLabel->setFrameShape(QFrame::WinPanel);    ZeroLabel->setFrameShadow(QFrame::Sunken);    ZeroLabel->setBackgroundColor( Qt::lightGray ) ;}

⌨️ 快捷键说明

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