int main() { PCComms_SetCustomInterruptHandler(&SerialCB); DisableAll(); PCComms_Start(); MotorComms_Start(); Timer_1_Start(); CyGlobalIntEnable; OpenExhaust_Write(1); CloseExhaust_Write(1); for(;;) { CyDelay(10); if(linesz !=0) { if(line[linesz-1]=='\n' || line[linesz-1]=='\r') //Assume that the computer isn't doing anything funky. //Q. What is our computer's favorite dance? //A. The Robot! { parseSerial(line,linesz); line[linesz]='\0'; linesz=0; } } else MotorComms_UartPutString("Boop"); } }
void ReallyDisableEverything() //For the pause mode. { DisableAll(); MotorControl1EN_Write(1); CyDelay(10); MotorComms_UartPutChar(0); MotorControl1EN_Write(0); MotorControl2EN_Write(1); CyDelay(10); MotorComms_UartPutChar(0); MotorControl2EN_Write(0); MotorControl3EN_Write(1); CyDelay(10); MotorComms_UartPutChar(0); MotorControl3EN_Write(0); MotorControl4EN_Write(1); CyDelay(10); MotorComms_UartPutChar(0); MotorControl4EN_Write(0); MotorControl5EN_Write(1); CyDelay(10); MotorComms_UartPutChar(0); MotorControl5EN_Write(0); }
int TcpClient::Connect( ) { if (m_state != kDisconnected) { return 1; } m_isAutoReconnect = true; DisableAll(); int ret = CreateNoBlock(); if (ret < 0) { return -1; } ret = ::connect(m_iFD, (sockaddr*) &(m_PeerAddr.GetSockAddrInet()), sizeof(sockaddr_in)); int savedErrno = (ret == 0) ? 0 : errno; switch (savedErrno) { case 0: case EINPROGRESS: case EINTR: case EISCONN: LOG_TRACE("kConnecting %d", m_iFD); m_state = kConnecting; EnableWriting(); ret = 0; break; case EAGAIN: case EADDRINUSE: case EADDRNOTAVAIL: case ECONNREFUSED: case ENETUNREACH: LOG_TRACE("kDisconnected %d", m_iFD); m_state = kDisconnected; ret = 0; break; case EACCES: case EPERM: case EAFNOSUPPORT: case EALREADY: case EBADF: case EFAULT: case ENOTSOCK: LOG_ERROR("connect error %d", savedErrno); DoClose(); ret = -1; break; default: LOG_ERROR("Unexpected error in Connect %d", savedErrno); DoClose(); ret = -1; break; } return ret; }
void opengl_texture_state::init(GLuint n_units) { Assert( n_units > 0 ); units = (opengl_texture_unit*) vm_malloc(n_units * sizeof(opengl_texture_unit)); num_texture_units = n_units; for (unsigned int unit = 0; unit < num_texture_units; unit++) { units[unit].active = GL_FALSE; units[unit].enabled = GL_FALSE; units[unit].used = GL_FALSE; default_values(unit); glActiveTexture(GL_TEXTURE0 + unit); if (unit < (GLuint)GL_supported_texture_units) { glDisable(GL_TEXTURE_GEN_S); glDisable(GL_TEXTURE_GEN_T); glDisable(GL_TEXTURE_GEN_R); glDisable(GL_TEXTURE_GEN_Q); } units[unit].texgen_S = GL_FALSE; units[unit].texgen_T = GL_FALSE; units[unit].texgen_R = GL_FALSE; units[unit].texgen_Q = GL_FALSE; if (unit < (GLuint)GL_supported_texture_units) { glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR); } units[unit].texgen_mode_S = GL_EYE_LINEAR; units[unit].texgen_mode_T = GL_EYE_LINEAR; units[unit].texgen_mode_R = GL_EYE_LINEAR; units[unit].texgen_mode_Q = GL_EYE_LINEAR; if (unit < (GLuint)GL_supported_texture_units) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE); glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_MODULATE); } units[unit].env_mode = GL_MODULATE; units[unit].env_combine_rgb = GL_MODULATE; units[unit].env_combine_alpha = GL_MODULATE; if (unit < (GLuint)GL_supported_texture_units) { glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f); glTexEnvf(GL_TEXTURE_ENV, GL_ALPHA_SCALE, 1.0f); } units[unit].rgb_scale = 1.0f; units[unit].alpha_scale = 1.0f; } DisableAll(); }
void BlobMgmt::OnDlgProcWmCommand(WPARAM wparam, LPARAM lparam) { switch(LOWORD(wparam)) { case IDCANCEL: if(ProcessCancel() == wyTrue) VERIFY(yog_enddialog(m_hwnddlg, 0)); break; case IDOK: if(ProcessOK() == wyTrue) VERIFY(yog_enddialog(m_hwnddlg, 1)); else VERIFY(yog_enddialog(m_hwnddlg, 0)); break; case IDC_SAVETOFILE: SaveToFile(); break; case IDC_IMPORT: OpenFromFile(); break; case IDC_SETNULL: { // if a user has selected it then we disable evrything // otherwise enable everything if(Button_GetCheck((HWND)lparam)== BST_CHECKED) DisableAll(wyTrue); else DisableAll(wyFalse); } break; case IDC_COMBO: { if((HIWORD(wparam))== CBN_SELENDOK) OnComboChange(); break; } } return; }
Pcsx2Config::SpeedhackOptions::SpeedhackOptions() { DisableAll(); // Set recommended speedhacks to enabled by default. They'll still be off globally on resets. WaitLoop = true; IntcStat = true; vuFlagHack = true; }
void SetMotor(int motor, int value) //Sets the speed on the motors. TODO: Remove 'Kill All Humans' subroutine. { char buff[255]; snprintf(buff,255,"Setting motor %d to %d\r\n",motor,value); PCComms_UartPutString(buff); switch(motor) { case 1: //Drive front right, MC2-2 (Sabertooth 11) DisableAll(); MotorControl1EN_Write(1); CyDelay(10); MotorComms_UartPutChar(value+127); break; case 2: //Drive rear X, MC2-2 (Sabertooth 13) DisableAll(); MotorControl2EN_Write(1); CyDelay(10); MotorComms_UartPutChar(value+127); break; case 3: //Drive front left, MC3-2 (Sabertooth 12) DisableAll(); MotorControl3EN_Write(1); CyDelay(10); MotorComms_UartPutChar(value+127); break; case 4: //Drive rear X, MC4-2 (Sabertooth 14) DisableAll(); MotorControl4EN_Write(1); CyDelay(10); MotorComms_UartPutChar(value+127); break; case 5: //Steering state control DisableAll(); Steering_Register_Write(value); break; } }
void CVoronoiDialog::SetState(int state) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); DisableAll(); switch(state) { case VORONOI_GENERATION: points_ClearPointsButton.EnableWindow(true); voronoi_MinDistEdit.EnableWindow(true); voronoi_InnerCurveOffsetEdit.EnableWindow(true); voronoi_GenerateButton.EnableWindow(true); voronoi_MinDistLabel.EnableWindow(true); voronoi_CurveOffsetLabel.EnableWindow(true); voronoi_DrawCellLines.EnableWindow(true); break; case TRIM: voronoi_DrawCellLines.EnableWindow(true); voronoi_ShowHideButton.EnableWindow(true); voronoi_UndoCurvesButton.EnableWindow(true); trim_TrimButton.EnableWindow(true); break; case DONE: trim_UndoTrimButton.EnableWindow(true); break; case POINT_GENERATION: default: attractor_AddPtAttractorButton.EnableWindow(true); attractor_AddCrvAttractorButton.EnableWindow(true); attractor_ViewEditAttractorButton.EnableWindow(true); attractor_DeleteAttractorButton.EnableWindow(true); attractor_StrengthEdit.EnableWindow(true); attractor_StrengthLabel.EnableWindow(true); attractor_strength_slider.EnableWindow(true); points_strength_slider.EnableWindow(true); points_NumPointEdit.EnableWindow(true); points_GenerateButton.EnableWindow(true); points_NumPtsLabel.EnableWindow(true); points_OverallStrengthLabel.EnableWindow(true); break; } }
void cBuildGameBuild::OnButtonBuild ( ) { m_pControls->SetButton ( 10 ); g_bBuildGameInProgress = true; DisableAll(); }
wyBool BlobMgmt::InitDlgVales() { wyString codepage; //if find dialog is open, we need to close find dialog if(pGlobals->m_pcmainwin->m_finddlg) { DestroyWindow(pGlobals->m_pcmainwin->m_finddlg); pGlobals->m_pcmainwin->m_finddlg = NULL; } VERIFY(m_hwndtab = GetDlgItem(m_hwnddlg, IDC_MAINTAB)); VERIFY(m_hwndedit = GetDlgItem(m_hwnddlg, IDC_TEXT)); VERIFY(m_hwndimage = GetDlgItem(m_hwnddlg, IDC_IMAGE)); VERIFY(m_hwndnull = GetDlgItem(m_hwnddlg, IDC_SETNULL)); VERIFY(m_hwndcombo = GetDlgItem(m_hwnddlg, IDC_COMBO)); InsertTab(m_hwndtab, 0, _(L"Text")); InsertTab(m_hwndtab, 1, _(L"Image")); // if its not word wrap then we need to destroy it. SetEditWordWrap(m_hwndedit, wyTrue, wyTrue); // just for the sake hide both of them VERIFY(ShowWindow(m_hwndimage, FALSE)); VERIFY(ShowWindow(m_hwndedit, FALSE)); if(m_piub && m_piub->m_isnull == wyTrue) { SendMessage(GetDlgItem(m_hwnddlg, IDC_SETNULL), BM_SETCHECK, BST_CHECKED, 0); DisableAll(); } SetWindowLongPtr(m_hwndimage, GWLP_USERDATA,(LONG_PTR)this); SetWindowLongPtr(m_hwndedit, GWLP_USERDATA,(LONG_PTR)this); SendMessage(m_hwndedit, SCI_SETCODEPAGE, SC_CP_UTF8, 0); //To avoid printing of special characters in scintilla on ctrl+F and ctrl+H SendMessage (m_hwndedit, SCI_CLEARCMDKEY, (SCMOD_CTRL << 16)|'F', 0); SendMessage (m_hwndedit, SCI_CLEARCMDKEY, (SCMOD_CTRL << 16)|'H', 0); //Line added because to turn off the margin SendMessage(m_hwndedit, SCI_SETMARGINWIDTHN,1,0); //m_encodingtype.SetAs(codepage.GetString()); //InitEncodingType(); m_wporigtextproc =(WNDPROC)SetWindowLongPtr(m_hwndedit, GWLP_WNDPROC,(LONG_PTR)TextProc); m_wporigpaintproc =(WNDPROC)SetWindowLongPtr(m_hwndimage, GWLP_WNDPROC,(LONG_PTR)ImageProc); //initializing text in combobox InitComboText(); ShowData(); // set the font after reading it from ini file. SetEditFont(m_hwndedit); // if its not editable then we disable all except the ok button if(m_edit == wyFalse) { DisableAll(); EnableWindow(GetDlgItem(m_hwnddlg, IDC_SETNULL), FALSE); EnableWindow(GetDlgItem(m_hwnddlg, IDC_TEXT), TRUE); SendMessage(GetDlgItem(m_hwnddlg, IDC_TEXT), EM_SETREADONLY, TRUE, TRUE); SetFocus(GetDlgItem(m_hwnddlg, IDC_TEXT)); } m_checkboxstate = SendMessage(GetDlgItem(m_hwnddlg, IDC_SETNULL), BM_GETCHECK, 0, 0); SendMessage(m_hwndedit, SCI_EMPTYUNDOBUFFER, 0, 0); return wyTrue; }
// all gamefixes are disabled by default. Pcsx2Config::GamefixOptions::GamefixOptions() { DisableAll(); }
//---------------------------------------------------------------------------------------------------------------------------------------- // balance un screen de greets void EtoileGreets::GoScreen(U32 num) { DisableAll(); switch (num) { case 0: Greets[0]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[0]->Enable(); Greets[1]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[1]->Enable(); Greets[2]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[2]->Enable(); Greets[3]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[3]->Enable(); break; case 1: Greets[4]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[4]->Enable(); Greets[5]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[5]->Enable(); Greets[6]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[6]->Enable(); Greets[7]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[7]->Enable(); break; case 2: Greets[8]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[8]->Enable(); Greets[9]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[9]->Enable(); Greets[10]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[10]->Enable(); Greets[11]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[11]->Enable(); break; case 3: Greets[11+1]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[11+1]->Enable(); Greets[12+1]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[12+1]->Enable(); Greets[13+1]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[13+1]->Enable(); Greets[14+1]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[14+1]->Enable(); break; case 4: Greets[15+1]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[15+1]->Enable(); Greets[16+1]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[16+1]->Enable(); Greets[17+1]->InterpoZoom(2.0f, 1.0f, 2.0f); Greets[17+1]->Enable(); Greets[18+1]->InterpoZoom(1.0f, 2.0f, 2.0f); Greets[18+1]->Enable(); break; case 5: Greets[19+1]->InterpoZoom(2.0f, 1.0f, 1.0f); Greets[19+1]->Enable(); Greets[20+1]->InterpoZoom(1.0f, 2.0f, 1.0f); Greets[20+1]->Enable(); Greets[21+1]->InterpoZoom(2.0f, 1.0f, 1.0f); Greets[21+1]->Enable(); Greets[22+1]->InterpoZoom(1.0f, 2.0f, 1.0f); Greets[22+1]->Enable(); break; } }