int InstallerWindow::OnMessage(UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_CLOSE: if (IsExecuting(1000 * 3)) return -1; EndExec(); InstallerUI::Terminate(); break; } return HtmlWindow::OnMessage(message, wParam, lParam); }
void PlayDrillCommandClass::execute() { if (IsExecuting()) { LOGF("SKIPPING PlayDrill command"); return; } parse(); LogSteps(); StopCommandClass::reset(); PauseCommandClass::reset(); resetInterruptCounter(); LOGF("=========== Initializing Bumper =========="); bumperOn(true/*resetCounter*/); LOGF("=========== Play Drill =========="); s_pExecutedDrill = this; bool bContinue= true; char pref[10]; while (true) { // handle incoming commands executeCommands(); if (StopCommandClass::IsStopped()) { m_execData.error= false; m_execData.feedData.result=MotorHelperClass::FR_NONE; break; } else if (PauseCommandClass::IsPaused()) { static unsigned long s_LedSetTime= 0; static bool s_yellowLed= false; unsigned long currentTime= millis(); if (currentTime - s_LedSetTime >= 250) { if (s_yellowLed) { Helper::setLedColor(0,0,255); // turn the RGB LED blue } else { Helper::setLedColor(255,215,0); // turn the RGB LED yellow } s_LedSetTime= currentTime; s_yellowLed= !s_yellowLed; } g_motorHelper.stopMotorsIfIdle(); } else { Step* pStep= NULL; for (int stepIndex= 0; stepIndex < m_Steps.getUsedElems(); ++stepIndex) { if (m_execData.nextStepIndex > 0) { // goto stepIndex= m_execData.nextStepIndex - 1; // 1-based m_execData.nextStepIndex= -1; } pStep= m_Steps[stepIndex]; LOGF3("============ Executing Step [", stepIndex+1, F("] ============")); bContinue= pStep->execute(m_execData); // handle incoming commands executeCommands(); if (StopCommandClass::IsStopped()) { m_execData.error= false; m_execData.feedData.result=MotorHelperClass::FR_NONE; bContinue= false; } else if (PauseCommandClass::IsPaused()) { g_motorHelper.stopMotorsIfIdle(); break; } if (!bContinue) break; g_TaskQueue.executeReadyTasks(); } if (!bContinue) break; } } // EOF while(true) g_motorHelper.stopMotors(); s_pExecutedDrill = NULL; bumperOff(); g_serialCom.fireEvent(EVENT_EXECUTE_STOPPED); // in case of error no sound if (!m_execData.error) { Helper::playSound(Helper::SND_FINISHED); } }