//-------------------------------------------------------------- void ofApp::update(){ //sequencing time if(!pausa){ if(ofGetElapsedTimeMillis() - elapsedTime > 3000.0) { nextStep = true; elapsedTime = ofGetElapsedTimeMillis(); enviado = false; } } //active step for(int i=0;i < 8; i++){ if(myStep[i]->inside(ofGetMouseX(), ofGetMouseY())){ whichStep = i; } } //activeStep for(int i=0;i <8; i++){ if(myStep[i]->active) activeStep = myStep[i]->id; } // send fx int fxCollection[4]; for(int i=0;i <4; i++){ fxCollection[i] = fxState[(activeStep*4)+i]; } sendFX(fxCollection); //colorize active step if(nextStep == true){ counter +=1; nextStep = false; if(counter > 7){ counter = 0; } } for(int j = 0; j < 32; j++){ pattern[j]->update(); if(pattern[j]->isSelected) movingPattern = pattern[j]->id-1; } for(int i=0;i < 8; i++){ myStep[i]->update(counter); } //chacking buttons state if(myButton[0]->action[0] == true){ reset(); myButton[0]->action[0] = false; } if(myButton[1]->action[1] == true){ random(); myButton[1]->action[1] = false; } if(myButton[2]->action[2] == true){ sendStatus(); myButton[2]->action[2] = false; } }
void DCC_Proxy::update(void) { if(!isPermitted()) return; //check to see if we need to emit a producer identified event if (_producer_identified_flag) { OLCB_Event e(PROXY_SLOT_OCCUPIED); while (!_link->sendProducerIdentified(NID, &e)); _producer_identified_flag = false; } uint32_t new_time = millis(); if(_active) { if(_update_alias) { Serial.println("reacquiring alias"); _update_alias = !_link->sendVerifyNID(NID, &DCC_NodeID); if(!_update_alias) //message has gone through _initial_blast = 10; //refresh status return; } //see if we need to send out any periodic updates if(_initial_blast) { Serial.print("Initial blast!! TRYING AGAIN! "); Serial.println(_initial_blast); _initial_blast--; //this is a hack to make sure the first commands get through while DCS Vnode is being allocated _dirty_speed = _dirty_FX = true; //send again! } if((new_time - _timer) >= 60000) { _timer = new_time; _dirty_speed = true; _dirty_FX = true; } if( _dirty_speed ) //if we are connected to CS, and either need to send an update or one minute has passed since last update: { sendSpeed(); } if( _dirty_FX ) //if we are connected to CS, and either need to send an update or one minute has passed since last update: { sendFX(); } } OLCB_Datagram_Handler::update(); }