void display(void){ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Apagar ] glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); if(colorAmbient[0]==0.5) glClearColor(GRAY); else glClearColor(NIGHT); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Look at do observador ] GLfloat obsL [] = {raio*cos(angulo-PI/2)+obsP[0], 0 ,raio*sin(angulo-PI/2)+obsP[2]}; GLfloat lookLant[] = {raio*cos(angLant-PI/2), hLant ,raio*sin(angLant-PI/2)}; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Janela Visualizacao ] glViewport (0,0,200, 200); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Projeccao] glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho (-xC,xC,-yC,yC,-zC,zC); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Modelo+View(camera/observador) ] glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0, 0.5, 0, 0,0,0, 0, 0, -1); showLight(lookLant); //--------------------- Informacao glColor3f(0,0,0); int ctrlAmbiente=0; if(colorAmbient[0]==0.5) ctrlAmbiente=1; else ctrlAmbiente=0; sprintf(texto, "%d - Noite", ctrlAmbiente); desenhaTexto(texto,0.5,0,0.5); sprintf(texto, "%d - Tecto", ctrlLocal); desenhaTexto(texto,0.5,0,0.6); sprintf(texto, "%d - Foco", ctrlLant); desenhaTexto(texto,0.5,0,0.7); sprintf(texto, "%d - ColorM", ctrlMateriais); desenhaTexto(texto,0.5,0,0.8); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Objectos ] drawScene(MAP); glViewport (200,200,wScreen-200, hScreen-200); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Projeccao] glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(104, wScreen/hScreen, 0.01, zC*2); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Modelo+View(camera/observador) ] glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(obsP[0], obsP[1], obsP[2], obsL[0], obsL[1], obsL[2], 0, 1, 0); showLight(lookLant); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[ Objectos ] drawScene(PERSPECTIVE); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Actualizacao glutSwapBuffers(); }
void GetMessageFunction(uint8_t* Message) { if('f' == Message[6]) { if(0x03 == Message[7]) { if(0 == stringCMP(&Message[8], "AAA", 3)) // 计时工作开关 41H { // 计时加热 if('0' == Message[12]) { CancelKey(); Relay_Off_All(); FunctionReport(16); } else if('1' == Message[12]) { if(ENTER_START_WORK != DeviceStatus.enterMode) { SelectedFunction(); // 获取默认的时间、温度等参数。 showFunction(DeviceStatus.workState, ON); // 让功能指示灯常亮 showTime(DeviceStatus.workTime, ON, ON); // 显示工作时间 DeviceStatus.beepSW = ON; DeviceStatus.startWorkBeep = ON; // 工作提示音 DeviceStatus.beep = 0; DeviceStatus.knob = KNOB_DISABLE; // 禁用旋钮 DeviceStatus.setMode = SET_TIME; // 设置时间 DeviceStatus.preheat = OFF; // 让App控制时无预热功能。 showPreheat(ON); // 让预热指示灯显示, 如果带预热则亮,否则不会亮 if(DeviceStatus.preheat == ON) { DeviceStatus.startWork = OFF; // 清除工作指示标志 DeviceStatus.enterMode = ENTER_PREHEAT; // 预热工作状态 } else { DeviceStatus.startWork = ON; // 设置工作指示标志 DeviceStatus.enterMode = ENTER_START_WORK; // 倒计时加热 } if(DeviceStatus.workState == 8) RELAY_3_H; // 烤鸡功能 开转插 } else { KeyBeep(); } } } else if(0 == stringCMP(&Message[8], "AAB", 3)) // 自调 42H { SetFunction(16); } else if(0 == stringCMP(&Message[8], "AAC", 3)) // 预热自调 43H { SetFunction(15); } else if(0 == stringCMP(&Message[8], "AAD", 3)) // 发酵 44H { SetFunction(14); } else if(0 == stringCMP(&Message[8], "AAE", 3)) // 饼干 45H { SetFunction(13); } else if(0 == stringCMP(&Message[8], "AAF", 3)) // 烤饼 46H { SetFunction(12); } else if(0 == stringCMP(&Message[8], "AAG", 3)) // 蛋糕 47H { SetFunction(11); } else if(0 == stringCMP(&Message[8], "AAH", 3)) // 蛋挞 48H { SetFunction(10); } else if(0 == stringCMP(&Message[8], "AAI", 3)) // 面包 49H { SetFunction(9); } else if(0 == stringCMP(&Message[8], "AAJ", 3)) // 烤鸡 4AH { SetFunction(8); } else if(0 == stringCMP(&Message[8], "AAK", 3)) // 鸡翅 4BH { SetFunction(7); } else if(0 == stringCMP(&Message[8], "AAL", 3)) // 排骨 4CH { SetFunction(6); } else if(0 == stringCMP(&Message[8], "AAM", 3)) // 烤鱼 4DH { SetFunction(5); } else if(0 == stringCMP(&Message[8], "AAN", 3)) // 红薯 4EH { SetFunction(4); } else if(0 == stringCMP(&Message[8], "AAO", 3)) // 玉米 4FH { SetFunction(3); } else if(0 == stringCMP(&Message[8], "AAP", 3)) // 预热 50H { // DeviceStatus.workState = 2; // DeviceStatus.enterMode = ENTER_CHOICE_FUNCTION; showPreheat(ON); KeyBeep(); } else if(0 == stringCMP(&Message[8], "AAQ", 3)) // 炉灯 51H { //DeviceStatus.workState = 1; //DeviceStatus.enterMode = ENTER_CHOICE_FUNCTION; // 炉灯控制 if('0' == Message[12]) { RELAY_1_L; DeviceStatus.light = 0; } else if('1' == Message[12]) { RELAY_1_H; DeviceStatus.light = 1; } showLight(); KeyBeep(); } else if(0 == stringCMP(&Message[8], "AAR", 3)) // 52H { // DIY KeyBeep(); } else { KeyBeep(); } } } }