void measure::update(uint16_t x, uint16_t y, uint8_t z) { static unsigned long period = millis(); static bool os1 = false, os2 = false, os3 = false; static uint8_t d = 255; static uint8_t index = 0; if ( millis() - period > 1000 ) { period = millis(); if ( d > 0) d--; if (machine->c1.switched) { if ( d <= 250 ) d += 5; } index++; chart.setData(index%200, d / 3, machine->c1.switched , machine->c1.banned, machine->c2.switched , machine->c2.banned, machine->c3.switched , machine->c3.banned ); } machine->c1.update(0); machine->c2.update(0); machine->c3.update(0); digitalWrite(S1PIN, machine->c1.switched); digitalWrite(S2PIN, machine->c2.switched); digitalWrite(S3PIN, machine->c3.switched); // redraw Leds if (machine->c1.switched != os1) { updateLed(XL1, LEDY , machine->c1.switched); os1 = machine->c1.switched; } if (machine->c2.switched != os2 ) { updateLed(XL2, LEDY , machine->c2.switched ); os2 = machine->c2.switched; } if (machine->c3.switched != os3) { updateLed(XL3, LEDY , machine->c3.switched); os3 = machine->c3.switched; } b1.update(x, y, z); b2.update(x, y, z); b3.update(x, y, z); b4.update(x, y, z); }
void updateBypassMode(){ #ifdef OWLMODULAR bypass = false; updateLed(); #else if(isStompSwitchPressed()){ bypass = true; setLed(NONE); midi.sendCc(LED, 0); }else{ bypass = false; updateLed(); } #endif }
void RGBLed::setRGB(int red, int green, int blue) { currentColor.r = red; currentColor.g = green; currentColor.b = blue; updateLed(); }
void measure::enter() { tft->fillRect(0, 0, 320, 240, tft->color565(100, 0, 100)); tft->drawRoundRect(0, 0, 320, 240, 3, 0xfefe); Widget::theme->drawBox(tft, CHX, CHY, 240, 140, false); Widget::theme->drawBox(tft, CHX+10, CHY+10, 220, 120, true); // tft->drawBitmap(20, Y1, watercan, 32, 32,0); // tft->drawBitmap(20, Y2, watercan, 32, 32,0); // tft->drawBitmap(20, Y3, watercan, 32, 32,0); Serial.println("Measuring Mode"); machine->LoadFromEEPROM(); /*bg1.setThreshold(machine->c1.threshold); bg2.setThreshold(machine->c2.threshold); bg3.setThreshold(machine->c3.threshold); bg1.reDraw(); bg2.reDraw(); bg3.reDraw();*/ b1.reDraw(); b2.reDraw(); b3.reDraw(); b4.reDraw(); pinMode(S1PIN, OUTPUT); pinMode(S2PIN, OUTPUT); pinMode(S3PIN, OUTPUT); updateLed(XL1, LEDY, false); updateLed(XL2, LEDY, false); updateLed(XL3, LEDY, false); }
void WrapperUdpLed::handle(void) { int bytes = _udp.parsePacket(); if (bytes > 0) { Log.debug("UDP-Packet received, length: %i", bytes); if (bytes == _bufferSize) { _udp.readBytes(_udpBuffer, _bufferSize); Log.verbose("Contents: %s", _udpBuffer); for (int i=0; i<_ledCount; i++) { updateLed(i, _udpBuffer[i*3+0], _udpBuffer[i*3+1], _udpBuffer[i*3+2]); } refreshLeds(); } else { Log.debug("UDP-Packet size expected=%i, actual=%i", _bufferSize, bytes); } } }
/** * activate action of init view */ static void activate(void) { /* turn of power led */ updateLed(POWER_LED,led_on); /* reset init wait intervals */ intervals = 0; /* start Timer */ initTimer = setUpTimer(RUN_INTERVAL); DisplayState *displaystate = getDisplayState(); displaystate->gContextID = GrNewGC(); /* Back- Foreground color related stuff */ GrSetGCForeground(displaystate->gContextID, YELLOW); GrSetGCUseBackground(displaystate->gContextID, GR_FALSE); /* Select fonts */ displaystate->font = GrCreateFont((unsigned char *) FONTNAME, 14, NULL); GrSetGCFont(displaystate->gContextID, displaystate->font); GrText(displaystate->gWinID, displaystate->gContextID, 120, 30, "Initializing", -1, GR_TFASCII | GR_TFTOP); GrDestroyFont(displaystate->font); }
void toggleActiveSlot(){ patches.toggleActiveSlot(); updateLed(); midi.sendPatchParameterNames(); // todo: this should probably be requested from client }
void RGBLed::setIntensity(float intensity) { this->intensity = intensity; updateLed(); }
void GetMainBoardInfo(void) { u8 u8Tmp; u8NoRxIn0_5Cnt = 0; u8commStatus = 0; fgCommPannelErr = 0; u8ResendCnt = 0; u8LCSnrTemp = RxBuf[1]; u8BWSnrTemp = RxBuf[2]; u8LDSnrTemp = RxBuf[3]; u8LCHSSnrTemp = RxBuf[4]; if((RxBuf[11]&0x03)==0x03) u8BWHSSnrTemp = OFF_TMP_SET; else u8BWHSSnrTemp = 0; // u8BWHSSnrTemp = RxBuf[11]; if(u8PowerOnGetUserSetFormMainBoard==0) { u8LCUserSetTmp = RxBuf[7]; u8BWUserSetTmp = RxBuf[8]; u8LDUserSetTmp = RxBuf[9]; if( (u8LCSnrTemp != OFF_TMP_SET) && (u8LDSnrTemp != OFF_TMP_SET) ) { if(u8LCSnrTemp>u8LDSnrTemp) u8Tmp = u8LCSnrTemp - u8LDSnrTemp; else u8Tmp = u8LDSnrTemp - u8LCSnrTemp; if(u8Tmp<6) { u8AlarmFlag |= PWRON_FLASH_H; } else { u8AlarmFlag &= (u8)(~PWRON_FLASH_H); } u16PwrOnFlashH0_5sCnt = 0; } u8Mode = RxBuf[5]; u8ForceOff &= (u8)(~(LC_FORCE_OFF|BW_FORCE_OFF)); if( (RxBuf[10]&0x02)==0x02 ) u8ForceOff |= LC_FORCE_OFF; if( (RxBuf[10]&0x01)==0x01 ) u8ForceOff |= BW_FORCE_OFF; u8ModeBak=u8Mode; u8ForceOffBak=u8ForceOff; u8LCUserSetTmpBak=u8LCUserSetTmp; u8BWUserSetTmpBak=u8BWUserSetTmp; u8LDUserSetTmpBak=u8LDUserSetTmp; u8PowerOnGetUserSetFormMainBoard = 1; } else { if( (u8MainBoardOutput&LC_DOOR_OPEN) != (RxBuf[6]&LC_DOOR_OPEN) ) { // buz(BZR_DOWN_3); // u8MainBoardOutput = RxBuf[6]; //? if( (RxBuf[6]&LC_DOOR_OPEN)==0) u8LedTime = TO_OFF_LED_TIM; updateLed(0); } if( (u8AlarmFlag&PWRON_FLASH_H)==PWRON_FLASH_H) { if( (u8LCSnrTemp == OFF_TMP_SET) || (u8LDSnrTemp == OFF_TMP_SET) ) u8AlarmFlag &= (u8)(~PWRON_FLASH_H); if(u8LCSnrTemp>u8LDSnrTemp) u8Tmp = u8LCSnrTemp - u8LDSnrTemp; else u8Tmp = u8LDSnrTemp - u8LCSnrTemp; if(u8Tmp>=6) { u8AlarmFlag &= (u8)(~PWRON_FLASH_H); } } } u8MainBoardOutput = RxBuf[6]; if( (RxBuf[11]&0x01) == 0x01) { if( (RxBuf[11]&0xe1) == 0x21) { u8BWMaxSetTemp = C0; u8BWMinSetTemp = C0-14; u8BCDType = _BCD_220_; } else { u8BWMaxSetTemp = C0+20; u8BWMinSetTemp = C0-24; u8BCDType = _BCD_260_; } } if( (u8Mode ==FAST_COOL_MODE) || (u8Mode ==FAST_FREEZE_MODE)) { u8CmpCOntinueRunTim = 0; u8AlarmFlag &= (u8)(~LD_HIGH_ALARM); } // else if( (u8MainBoardOutput&CMP_RUNING) == 0) 20120209 { // u8CmpCOntinueRunTim = 0; // u8AlarmFlag &= (u8)(~LD_HIGH_ALARM); } if( (u8MainBoardOutput&LC_DOOR_OPEN) == 0) { u16DoorOpen1s = 0; u8AlarmFlag &= (u8)(~(DOOR_OPEN_ALARM)); } if( (RxBuf[10]&0xf0)==0x30 ) { u8OutState |= FactoryTest; } else { u8OutState &= (~FactoryTest)&0xff; u8ForceOff &= (u8)(~OUT_FACT_TEST); } }