void USER_FUNC initDevicePin(void) { #ifdef BUZZER_RING_SUPPORT initBuzzerStatus(); #endif #ifdef EXTRA_SWITCH_SUPPORT registerExtraSwitchInterrupt(); #endif #ifdef DEVICE_KEY_SUPPORT if(checkResetType() != RESET_FOR_UPGRADE) { initKeyGpio(); #ifdef LIGHT_CHENGE_SUPPORT lum_lightLedInit(); lum_lightChangeIRQInit(); lum_lightHWTimerInit(TRUE); #endif } #endif #ifdef DEVICE_WIFI_LED_SUPPORT setWifiLedStatus(WIFI_LED_AP_DISCONNECT); #endif setSwitchStatus(SWITCH_CLOSE, SWITCH_PIN_1); #ifdef TWO_SWITCH_SUPPORT setSwitchStatus(SWITCH_CLOSE, SWITCH_PIN_2); #endif #ifdef CHANGE_BRIGHTNESS_SUPPORT lum_wifiLightLedInit(); #endif }
void USER_FUNC changeSwitchStatus(SWITCH_PIN_FLAG switchFlag) { if(getSwitchStatus(switchFlag) == SWITCH_OPEN) { setSwitchStatus(SWITCH_CLOSE, switchFlag); } else { setSwitchStatus(SWITCH_OPEN, switchFlag); } }
virtual void drawImGui(void* opt = nullptr) override { ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(0.85, 0.85, 0.85, 1.0)); ImGui::PushItemWidth(200); if ( ImGui::Combo("", &_currStatus, "Clear\0Set\0Toggle\0Randomize\0", 4) ) { if ( _currStatus == 0 ) setSwitchStatus(SwitchStatus2::CLEAR); else if ( _currStatus == 1 ) setSwitchStatus(SwitchStatus2::SET); else if ( _currStatus == 2 ) setSwitchStatus(SwitchStatus2::TOGGLE); else if ( _currStatus == 3 ) setSwitchStatus(SwitchStatus2::RANDOMIZE); else setSwitchStatus(SwitchStatus2::INVALID); } ImGui::PopItemWidth(); ImGui::PopStyleColor(); }