//----------------------------------------------------------- //DOS pushkeys void PushDOSKeys(CString src) { InitialKeyState(); AllOff(); DOSKey=true; __PushKeys(src); }
//----------------------------------------------------------- void __PushKeys(const char* src) { //Copyright by Data Solutions Pty Ltd (ACN 010 951 498) //All rights reserved. //Email for info: [email protected] // This is the routine that does all the work int index; CString SubStr; INT BrCnt; CHAR BrOpen; CHAR BrClose; CHAR Ch; CHAR nextCh; int srcLen=strlen(src); if (srcLen == 0) return; char ck[]={'+','^','%','!'}; void (*ckonfuncs[])()={SHIFTOn,CTRLOn,ALTOn,RALTOn}; void (*ckofffuncs[])()={SHIFTOff,CTRLOff,ALTOff,RALTOff}; index = 0; while (index<srcLen) { char nextCh = src[index + 1]; // control keys & functions bool controlkey = false; int ckidx; //is it a control key next? for (int ckidx = 0; ckidx < sizeof(ck) / sizeof(*ck); ckidx++) { if (nextCh == ck[ckidx]) { //contol key alone? if (srcLen == 1) { //turn control key on (*ckonfuncs[ckidx])(); //control key off (*ckofffuncs[ckidx])(); //exit return; } controlkey=true; break; } } //shift,ctrl,alt,ralt found if (controlkey && srcLen>=index+2) { BrOpen=src[index+2]; if ((BrOpen=='(')||(BrOpen=='{')) { if (BrOpen=='(') { BrClose=')'; } else { BrClose='}'; } index++; SubStr=""; BrCnt=1; while ((index<srcLen-1)&&(BrCnt!=0)) { index++; Ch=src[index+1]; if (Ch!=BrClose) { SubStr+=Ch; } else { BrCnt--; } if (Ch==BrOpen) BrCnt++; } // Turn control key on (*ckonfuncs[ckidx])(); // Push the keys if (SubStr!="") { if (BrOpen=='(') { __PushKeys(SubStr); } else { CString t=SubStr; if(ProcessFuncKey(t)) { t=""; } if (t.GetLength()>0) PushFnKey(t); } } // Turn control key off (*ckofffuncs[ckidx])(); } else { // The next key uses control index++; (*ckonfuncs[ckidx])(); OnKeyHandler(false,src[index+1]); (*ckofffuncs[ckidx])(); } } else if (nextCh=='{' && src!="{}" && src!="}{") { // Function keys index++; SubStr=""; while ((index<(srcLen-1))&&(src[index+1]!='}')) { SubStr+=src[index+1]; index++; } if(srcLen>1) { if (src[srcLen]=='}' && src[srcLen-1]=='}') { // Right brace OnKeyHandler(false,'}'); PushAKey('}'); index++; } else { CString k=SubStr; if (ProcessFuncKey(k)) { k=""; } else if(k.UpperCase().Pos("SLEEP")==1) { //sleep OnKeyHandler(false,k); } //**************************************** //clear clipboard else if (k.UpperCase().Pos("EMPTYCLIP")==1) { OnKeyHandler(false,k); } //run else if (k.UpperCase().Pos("RUN ")==1) { OnKeyHandler(false,k); } //not a function key (a 3} type of thing if(k.GetLength()>0) { PushFnKey(k); } } } } else if (nextCh=='~') { // The enter key ProcessFuncKey("ENTER"); } else { OnKeyHandler(false,nextCh); } index++; } //turn all control keys off AllOff(); }
void GACHAPON::nobori(){ float hue = 220.0; float dhue = 10.0; int d = 300; int dd = -15; AllOff(); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); for (int j = 3; j > 0; j--){ for (int i = 14 * (j - 1); i < 14 * j; i++){ front->setPixelColor(i, hue, 100, 15); } front->show(); delay(d); d += dd; hue += dhue; if (hue > 360) hue = 0; if (0 > hue) hue = 360; for (int i = 14 * (j - 1); i < 14 * j; i++){ fRight->setPixelColor(i, hue, 100, 15); } fRight->show(); delay(d); d += dd; hue += dhue; if (hue > 360) hue = 0; if (0 > hue) hue = 360; for (int i = 14 * (j - 1); i < 14 * j; i++){ bRight->setPixelColor(i, hue, 100, 15); } bRight->show(); delay(d); d += dd; hue += dhue; if (hue > 360) hue = 0; if (0 > hue) hue = 360; for (int i = 14 * (j - 1); i < 14 * j; i++){ bLeft->setPixelColor(i, hue, 100, 15); } bLeft->show(); delay(d); d += dd; hue += dhue; if (hue > 360) hue = 0; if (0 > hue) hue = 360; for (int i = 14 * (j - 1); i < 14 * j; i++){ fLeft->setPixelColor(i, hue, 100, 15); } fLeft->show(); delay(d); d += dd; hue += dhue; if (hue > 360) hue = 0; if (0 > hue) hue = 360; } delay(600); GradOff(); AllOff(); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); }
void GACHAPON::blur(){ float hue = 210; float ghue = 90; float firstHue = (hue + ghue) > 360 ? (hue + ghue) - 360 : (hue + ghue); float secondHue = (hue + ghue * 2) > 360 ? (hue + ghue * 2) - 360 : (hue + ghue * 2); float thirdHue = (hue + ghue * 3) > 360 ? (hue + ghue * 3) - 360 : (hue + ghue * 3); float fourthHue = (hue + ghue * 4) > 360 ? (hue + ghue * 4) - 360 : (hue + ghue * 4); const int b = 230; //初期化 for (int i = 0; i < LED_NUM; i++){ front->setPixelColor(i, HSV(hue, 100, 15)); fRight->setPixelColor(i, HSV(hue, 100, 15)); fLeft->setPixelColor(i, HSV(hue, 100, 15)); bRight->setPixelColor(i, HSV(hue, 100, 15)); bLeft->setPixelColor(i, HSV(hue, 100, 15)); front->setBrightness(b); fRight->setBrightness(b); fLeft->setBrightness(b); bRight->setBrightness(b); bLeft->setBrightness(b); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); } for (int i = 0; i < 150; i++){ front->setPixelColor(random(LED_NUM), HSV(firstHue, 100, 15)); fRight->setPixelColor(random(LED_NUM), HSV(firstHue, 100, 15)); fLeft->setPixelColor(random(LED_NUM), HSV(firstHue, 100, 15)); bRight->setPixelColor(random(LED_NUM), HSV(firstHue, 100, 15)); bLeft->setPixelColor(random(LED_NUM), HSV(firstHue, 100, 15)); front->setBrightness(b); fRight->setBrightness(b); fLeft->setBrightness(b); bRight->setBrightness(b); bLeft->setBrightness(b); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); } for (int i = 0; i < 150; i++){ front->setPixelColor(random(LED_NUM), HSV(secondHue, 100, 15)); fRight->setPixelColor(random(LED_NUM), HSV(secondHue, 100, 15)); fLeft->setPixelColor(random(LED_NUM), HSV(secondHue, 100, 15)); bRight->setPixelColor(random(LED_NUM), HSV(secondHue, 100, 15)); bLeft->setPixelColor(random(LED_NUM), HSV(secondHue, 100, 15)); front->setBrightness(b); fRight->setBrightness(b); fLeft->setBrightness(b); bRight->setBrightness(b); bLeft->setBrightness(b); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); } for (int i = 0; i < 150; i++){ front->setPixelColor(random(LED_NUM), HSV(thirdHue, 100, 15)); fRight->setPixelColor(random(LED_NUM), HSV(thirdHue, 100, 15)); fLeft->setPixelColor(random(LED_NUM), HSV(thirdHue, 100, 15)); bRight->setPixelColor(random(LED_NUM), HSV(thirdHue, 100, 15)); bLeft->setPixelColor(random(LED_NUM), HSV(thirdHue, 100, 15)); front->setBrightness(b); fRight->setBrightness(b); fLeft->setBrightness(b); bRight->setBrightness(b); bLeft->setBrightness(b); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); delay(1); } delay(500); GradOff(); AllOff(); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); }
void GACHAPON::Flower(){ AllOff(); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); int led = 0; char SpId[15] = {0,7,10,4,9,1,3,13,15,6,12,11,8,5,2}; for(char SNum = 0; SNum < 15; SNum++){ for(char i = 0; i < 50; i+=7){ for(int j = 0; j < 14; j++){ if(SpId[SNum] < 3){ led = SpId[SNum] * 14; front->setPixelColor(j + led, i, i, i); front->show(); } else if(SpId[SNum] < 6){ led = (SpId[SNum] - 3) * 14; fRight->setPixelColor(j + led, i, i, i); fRight->show(); } else if(SpId[SNum] < 9){ led = (SpId[SNum] - 6) * 14; fLeft->setPixelColor(j + led, i, i, i); fLeft->show(); } else if(SpId[SNum] < 12){ led = (SpId[SNum] - 9) * 14; bRight->setPixelColor(j + led, i, i, i); bRight->show(); } else if(SpId[SNum] < 15){ led = (SpId[SNum] - 12) * 14; bLeft->setPixelColor(j + led, i, i, i); bLeft->show(); } delay(1); } } } delay(700); for(char i = 50; i >= 1; i-=10){ for(char j = 0; j < 42; j++){ front->setPixelColor(j, i, i, i); fRight->setPixelColor(j, i, i, i); fLeft->setPixelColor(j, i, i, i); bRight->setPixelColor(j, i, i, i); bLeft->setPixelColor(j, i, i, i); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); delay(1); } } AllOff(); front->show(); fRight->show(); fLeft->show(); bRight->show(); bLeft->show(); }
HRESULT CCmdHandler::gatherDeviceData() { GLogger.LogMessage("FanucMTConnectAdapter::gatherDeviceData\n", HEAVYDEBUG); _set_se_translator( trans_func ); // correct thread? try { #if 0 if(!this->IsCNCRunning()) { ::Sleep(2000); return; } #endif #ifdef F15i if (!mConnected) _FS15D->connect(); if (mConnected) { //if(Globals.FanucVersion == "15i") { _FS15D->getVersion(); _FS15D->getInfo(); _FS15D->getLine(); _FS15D->getPositions(); _FS15D->getStatus(); _FS15D->getSpeeds(); _FS15D->getAlarmInfo(); } } #else #ifdef F15M if (!mConnected) _F15M->connect(); if (mConnected) { //if(Globals.FanucVersion == "15M") { _F15M->saveStateInfo(); _F15M->getVersion(); _F15M->getInfo(); _F15M->getLine(); _F15M->getPositions(); _F15M->getStatus(); // hack in getSpeeds _F15M->getSpeeds(); } } #else sHeartbeat=StdStringFormat("%d",heartbeat++); SetMTCTagValue("heartbeat", sHeartbeat ); if (!mConnected) { _iSeries->connect(); if (!mConnected) { AllOff(); return E_FAIL; } SetMTCTagValue("avail", "AVAILABLE" ); //else // _iSeries->getVersion(); } if (mConnected) { SetMTCTagValue("power", "ON" ); try { _iSeries->saveStateInfo(); if(FAILED(_iSeries->getInfo())) throw std::exception("getInfo fail"); if(FAILED(_iSeries->getLine())) throw std::exception("getLine fail"); if(FAILED(_iSeries->getPositions())) throw std::exception("getPositions fail"); if(FAILED(_iSeries->getStatus())) throw std::exception("getStatus fail"); if(FAILED(_iSeries->getSpeeds())) throw std::exception("getSpeeds fail"); if(FAILED(_iSeries->getAlarmInfo())) throw std::exception("getAlarmInfo fail"); } catch(std::exception errmsg) { std::stringstream tmp; tmp << "iSeries:: Failed " << errmsg.what(); _iSeries->LogErrorMessage(tmp.str().c_str(),-1); disconnect(); mConnected=false; AllOff(); return E_FAIL; } } #endif #endif } catch(...) { GLogger.Warning("FanucMTConnectAdapter::gatherDeviceData Exception Raised\n"); disconnect(); return E_FAIL; } return S_OK; }