void TRACEPHY(ETH_TypeDef* mac, const eth_mac_cfg_t* cfg, const char* err) { RES_CODE res; uint32_t phyreg; TRACELN(""); TRACE1(err); for(uint32_t i=0; i<32; i++) { res = HAL_ETH_ReadPHYRegister(mac, cfg, i, &phyreg); TRACELN("PHY %02u %u %04X", i, res, phyreg); } }
/*---------------------------------------------------------------------*//** 解放 **//*---------------------------------------------------------------------*/ void DimzBody::cleanup(TerminateBodyCase tbcase) { TRACELN("{DimzBody::cleanup} called. tbcase=%d", tbcase); #if 0 // ソウマ スクリプトを削除 if(_script != 0L) { _script->destroy(); delete _script; _script = 0L; } #endif // フォントセット解放 if(_fontset != 0L) { _fontset->destroy(); delete _fontset; _fontset = 0L; } // 固定データの後処理 DimzFixedData::cleanup(); EtkBody::cleanup(tbcase); }
WEAK_C void __ttl_trow(unsigned int what, const char* file, unsigned int line, const char* func) { TRACELN("--------- EXCEPTION =%x ", what); TRACE1(file); TRACE("(%u) in ", line); TRACE1(func); TRACE1("() -------\r\n"); }
RES_CODE esp8266_module::process_read(CSocket* sock) { unsigned size, id; CSTRING cmd; TRACELN("WIFI: read %d?", sock->len); while( sock->sock_state == SOCKET_CONECTED) { if(!sock->len) { TRACE1(" done!"); return (sock->res & FLG_OK)| FLG_SIGNALED; } if(!received_size[sock->sock_id]) { if(!(sock->res & FLG_OK)) { // ако няма нотификация го слага в списъка с чакащи TRACE1(" wait!"); sock->res |= RES_BUSY_WAITING; return RES_IDLE; } return RES_SIG_OK; } if(!received_data[sock->sock_id]) break; id = sock->sock_id; size = sock->len; if(size > received_size[id]) size = received_size[id]; memcpy(sock->dst.as_voidptr, received_data[id], size); sock->dst.as_byteptr += size; sock->len -= size; if(received_size[id] > size) { memcpy(received_data[id], received_data[id] + size, received_size[id] - size); received_size[id] -= size; } else { received_size[id] = 0; delete received_data[id]; received_data[id] = NULL; return RES_SIG_OK; } } wifi_sleep(120); wifi_net_error(NET_ERR_SOCK_READ); TRACE_ERROR("\r\nWIFI:%s read INVALID", sock->client.task->name); return RES_SIG_ERROR; }
WEAK_C unsigned int usb_scan_to_ascii(uint32_t code, uint32_t modifier, uint32_t lang) { TRACELN("key %x:%x ", modifier, code); if(modifier & HID_KBD_MODIFIER_RIGHT_SHIFT) { // process CAPSLOCK if(code >= 0x04 && code <= 0x1D) { modifier ^= HID_KBD_MODIFIER_LEFT_SHIFT; } modifier ^= HID_KBD_MODIFIER_RIGHT_SHIFT; } //process SHIFTs only switch(modifier) { case HID_KBD_MODIFIER_NONE: if(code < sizeof(usb_hid_keycode)) { code = usb_hid_keycode[code]; } else code = 255; break; case HID_KBD_MODIFIER_LEFT_SHIFT: if(code < sizeof(usb_hid_keycode_s)) { code = usb_hid_keycode_s[code]; } else code = 255; break; default: TRACELN("unk key %x:%x", modifier, code); code = 255; break; } return code; }
SRCR_BEGIN_NS //////////////////////////////////////////////////////////////////////////// // クラス //========================================================================== // EventSys メソッド // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // アクセサ #if 0 /*---------------------------------------------------------------------*//** イベントモード後のゲームモードを設定 **//*---------------------------------------------------------------------*/ void EventSys::setEventAfterGameMode(s32 gmk) { _gmkAfterEvent = gmk; TRACELN(" - 3 -> _gmkAfterEvent=%d", _gmkAfterEvent); }
void DAC_ISR(DAC_DRIVER_INFO* drv_info) { DAC_DRIVER_DATA* drv_data = drv_info->drv_data; DAC_TypeDef* dac = drv_info->hw_base; uint32_t status; HANDLE hnd; status = dac->DAC_SR & (DAC_SR_DMAUDR1 | DAC_SR_DMAUDR2); TRACELN("DAC isr %x", status); if(status)//reset peripheral { // stop handles #if USE_DAC_DMA_DRIVER hnd = drv_data->pending[0]; if(hnd) { drv_data->pending[0] = NULL; usr_HND_SET_STATUS(hnd, RES_SIG_ERROR); } hnd = drv_data->pending[1]; if(hnd) { drv_data->pending[1] = NULL; usr_HND_SET_STATUS(hnd, RES_SIG_ERROR); } #endif // clear status dac->DAC_SR = status; //reset peripheral ConfigureDac(drv_info); //reset channels if(drv_data->dac_mode[0]) ConfigureDacChannel(dac, drv_data->dac_mode[0]); if(drv_data->dac_mode[1]) ConfigureDacChannel(dac, drv_data->dac_mode[1]); } }
/*---------------------------------------------------------------------*//** 解放 **//*---------------------------------------------------------------------*/ void AtArBody::cleanup(TerminateBodyCase tbcase) { TRACELN("{AtArBody::cleanup} called. tbcase=%d", tbcase); // ローディングスクリーンの破棄 if(_ldscr != 0L) { _ldscr->destroy(); _ldscr = 0L; } // ビデオカメラの破棄 if(_vcam != 0L) { _vcam->destroy(); _vcam = 0L; } // 懐中電灯の破棄 if(_torch != 0L) { _torch->destroy(); _torch = 0L; } // ムービーテクスチャの破棄 if(_mtex != 0L) { _mtex->destroy(); _mtex = 0L; } // 素材管理の削除 if(_mtrlmng != 0L) { _mtrlmng->destroy(); delete _mtrlmng; _mtrlmng = 0L; } // ムービーシーンの削除 MovieScene* movscene = (MovieScene*)_fsScenes[SCENE_MOVIE]; if(movscene != 0L) { movscene->destroy(); delete movscene; _fsScenes[SCENE_MOVIE] = 0L; } // AR シーンの削除 ArScene* arscene = (ArScene*)_fsScenes[SCENE_AR]; if(arscene != 0L) { arscene->destroy(); delete arscene; _fsScenes[SCENE_AR] = 0L; } // タイトルシーンの削除 TitleScene* ttscene = (TitleScene*)_fsScenes[SCENE_TITLE]; if(ttscene != 0L) { ttscene->destroy(); delete ttscene; _fsScenes[SCENE_TITLE] = 0L; } // フォントセット解放 if(_fontset != 0L) { _fontset->destroy(); delete _fontset; _fontset = 0L; } // 固定データの後処理 AtArFixedData::cleanup(); EtkBody::cleanup(tbcase); }
RES_CODE esp8266_module::process_write(CSocket* sock) { unsigned size;//, newsize, id; // unsigned int start_size, write_size, sock_state; CSTRING cmd; unsigned char snd_pending; while(1) { size = sock->len; if(!size) { TRACELN1("WIFI: write OK"); return RES_SIG_OK; } if(size >1022) size = 1022; if(sock->sock_state != SOCKET_CONECTED) break; // Send command cmd.format("+CIPSEND=%u,%u", sock->sock_id, size); TRACELN("WIFI: WRITE %d?", size); cmd_state |= WIFI_CMD_STATE_HND; if(wifi_send_cmd(cmd.c_str(), 20) != WIFI_CMD_STATE_RETURNED) { wifi_net_error(NET_ERR_SOCK_WRITE); return RES_SIG_ERROR; } // Send data snd_pending = '>'; do { process_input(rcv_hnd.signal, cmd.c_str(), snd_pending); if ( cmd_state >= WIFI_CMD_STATE_HND ) { if ( cmd_state & WIFI_CMD_STATE_HND ) { unsigned int mytime; cmd_state &= ~WIFI_CMD_STATE_HND; snd_pending = 0; rcv_hnd.tsk_start_read(&received_ch, 1); mytime = CURRENT_TASK->time; tsk_sleep(55); // data sheet recomendation if( snd_hnd.tsk_write(sock->src.as_voidptr, size, WIFI_WRITE_TOT) != RES_OK) break; CURRENT_TASK->time = mytime; } else { if ( cmd_state >= WIFI_CMD_STATE_OK ) break; // command completed with OK, ERROR .. } } } while(tsk_resume_wait_signal(rcv_hnd.signal)); // wifi_on_blink_transfer(this, GPRS_TRANSFER_INDICATOR); //Check the result if(cmd_state & WIFI_CMD_STATE_OK) { TRACE1(" done!"); sock->src.as_byteptr += size; sock->len -= size; continue; } if (cmd_state & WIFI_CMD_STATE_CMES) { TRACE_ERROR("\r\nWIFI:%s write ERROR", sock->client.task->name); } break; } wifi_sleep(120); wifi_net_error(NET_ERR_SOCK_WRITE); return RES_SIG_ERROR; }
RES_CODE usb_remote_hid_t::scan_hid(uint32_t port_indx, USBSubClassCode subcls, USBProtocolCode proto) { RES_CODE res; // select EPT_0 and device address ep0_hnd->mode.as_bytes[0] = EPT_0; // RX pipe ep0_hnd->mode.as_bytes[1] = EPT_0; // TX pipe res = hdc_init(port_indx); if(res == RES_OK) { epi_hnd->mode0 = ep0_hnd->mode0; // device hub port // TRACE Device descriptor TRACELN("HID: dev found %x:%x", dev_descriptor.idVendor, dev_descriptor.idProduct); trace_usb_descriptor(&dev_descriptor.as_generic); if(dev_descriptor.bDeviceClass == INTERFACE_DEFINED_CLASS) { //loop the configurations for(uint32_t cfg_indx=0; cfg_indx<dev_descriptor.bNumConfigurations; cfg_indx++) { res = get_config_descriptor(cfg_indx); if(res != RES_OK) break; // TRACE Configuration descriptor(s) trace_usb_descriptor(&config_descriptor->as_generic); //loop the interfaces for(uint32_t iface_indx=0; iface_indx<config_descriptor->bNumInterfaces; iface_indx++) { pid = usb_get_interface(config_descriptor, iface_indx); if(pid && pid->bDeviceClass == HID_DEVICE_CLASS && pid->bDeviceSubClass == subcls && pid->bDeviceProtocol == proto) { // set the configuration // set_configuration(0); res = set_configuration(config_descriptor->bConfigurationValue); if(res == RES_OK) { epi_hnd->mode.as_bytes[0] = EPT_0; epi_hnd->mode.as_bytes[1] = EPT_0; for(int i=0; i<pid->bNumEndpoints && i<2; i++) { USBEndpointDescriptor* ped; ped = usb_get_enpoint(config_descriptor, i); if(ped && ped->bmAttributes == ENDPOINT_TYPE_INTERRUPT) { if( ped->bEndpointAddress & 0x80 ) { if(epi_hnd->mode.as_bytes[0] == EPT_0) { epi_hnd->mode.as_bytes[0] = ped->bEndpointAddress & 0x7F; epi_hnd->mode.as_ushort[1] = ep0_hnd->mode.as_ushort[1]; //drv_state_cnt usb_svc_configendpoint(epi_hnd, &ped->as_generic); } } else { if(epi_hnd->mode.as_bytes[1] == EPT_0) { epi_hnd->mode.as_bytes[1] = ped->bEndpointAddress ; epi_hnd->mode.as_ushort[1] = ep0_hnd->mode.as_ushort[1]; //drv_state_cnt usb_svc_configendpoint(epi_hnd, &ped->as_generic); } } } } hid_idle = 255; get_idle(HID_REPORT_ALL); return RES_OK; } } } } } } if(res == RES_OK) res = RES_ERROR; return res; }
/*---------------------------------------------------------------------*//** フレーム制御 **//*---------------------------------------------------------------------*/ void EventSys::exec(ExecRes* res, const ExecCtx* ec) { if(_evdata == 0L) { return; } if(isEventPause()) { return; } // イベントポーズ中は抜ける EvSys::exec(res, ec); // テンポラリマターフラグ bool isExistTmpMatter = false; bool isRunTmpMatter = false; // テンポラリイベントの情報収集 for(int i = 0; i < _evdata->getMatterNum(); i++) { EventMatter* matter = (EventMatter*)_evdata->getMatter(i); bool isTmpMatter = false; if((EventIdDef::EVID_TMP__START_ <= matter->getEvId()) && (matter->getEvId() <= EventIdDef::EVID_TMP__END_)) { isTmpMatter = true; isExistTmpMatter = true; // テンポラリマターが存在している } if(isTmpMatter && matter->isBegin()) { isRunTmpMatter = true; // テンポラリマターが実行されている } } // テンポラリマターは存在するが、実行されていない場合は削除する if(isExistTmpMatter && !isRunTmpMatter) { _evdata->unloadTmpEvent(); } // ロックフラグによるゲームモードの変更 if(Game::getGame()->getGameMode()->getChildEndModeKind() == GameMode::MODE_GAME_INGAME_EVENT) { if(!isOperationLock()) // ロックしない { #if 1 // イベントモードを戻す Game::getGame()->getGameMode()->changePrevEndMode(GameMode::MODE_GAME_INGAME_EVENT); #else // ゲームモードを戻す if(_gmkAfterEvent != 0) { Game::getGame()->getGameMode()->changeEndMode((GameMode::ModeKind)_gmkAfterEvent); _gmkAfterEvent = 0; TRACELN(" - 1 -> _gmkAfterEvent=%d", _gmkAfterEvent); } #endif } } else // イベントモードではない { if(isOperationLock()) // ロック中である { // イベントモードに変更 #if 0 if(_gmkAfterEvent == 0) // setEventAfterGameMode などで未設定の場合 { _gmkAfterEvent = Game::getGame()->getGameMode()->getChildEndModeKindConsiderReserved(); // 変更前のモードを取得 TRACELN(" - 2 -> _gmkAfterEvent=%d", _gmkAfterEvent); } #endif Game::getGame()->getGameMode()->changeEndMode(GameMode::MODE_GAME_INGAME_EVENT); } } }
uint32_t HAL_ETH_GetReceivedFrame_IT(const eth_mac_cfg_t* cfg) { ETH_DMADescTypeDef* DmaRxDesc; uint32_t descriptor_count = 0; uint32_t status; DmaRxDesc = cfg->mac_data->RxDesc; while(1) { // try to get a frame do { descriptor_count++; status = DmaRxDesc->Status; if(status & ETH_DMARXDESC_OWN) return 0; //no or incomplete frame if(status & (ETH_DMARXDESC_AFM | ETH_DMARXDESC_ES)) break; // error or filter fail -> dump it if(cfg->ETH_MACCR & ETH_MACCR_IPCO) // IPv4 Checksum offload { if( (status & ETH_DMARXDESC_FT) && (status & (ETH_DMARXDESC_IPHCE | ETH_DMARXDESC_PCE))) { if((status & 0x1FF) == (ETH_DMARXDESC_LS | ETH_DMARXDESC_FT | ETH_DMARXDESC_PCE)) { // extended status available, check it if (!(DmaRxDesc->ExtendedStatus & ETH_DMAPTPRXDESC_IPCB) && (DmaRxDesc->ExtendedStatus & (ETH_DMAPTPRXDESC_IPPE | ETH_DMAPTPRXDESC_IPHE))) break; } else break; //check sum error } } if(descriptor_count == 1 && !(status & ETH_DMARXDESC_FS)) break; //not a first descriptor -> dump it if(status & ETH_DMARXDESC_LS) { // valid frame found cfg->mac_data->rx_len = (status & ETH_DMARXDESC_FL) >> 16; if(!cfg->mac_data->rx_len) break; TRACELN("ETH: rx %x %u * %u ", DmaRxDesc, descriptor_count, cfg->mac_data->rx_len); return descriptor_count; } } while( descriptor_count < cfg->ETH_RXBUFNB); // bad frame -> dump it DmaRxDesc = cfg->mac_data->RxDesc; while(descriptor_count) { TRACELN("ETH: rx drop %u res %x", DmaRxDesc, DmaRxDesc->Status); descriptor_count--; DmaRxDesc->Status = ETH_DMARXDESC_OWN; DmaRxDesc = DmaRxDesc->Buffer2NextDescAddr; } cfg->mac_data->RxDesc = DmaRxDesc; } return 0; }
RES_CODE HAL_ETH_Init(ETH_TypeDef* mac, const eth_mac_cfg_t* cfg) { uint32_t tmpreg; uint32_t res; RCC_ClocksTypeDef clocks; TRACELN("ETH Init"); /* Select MII or RMII Mode*/ if(cfg->mac_cfg_flags & MAC_CFG_FLG_IFCE_MII_RMII) { tmpreg = 0; do { mac->ETH_DMABMR |= ETH_DMABMR_SR; SYSCFG->SYSCFG_PMC |= SYSCFG_PMC_MII_RMII; if(++tmpreg > PHY_CONFIG_DELAY) { TRACEPHY(mac, cfg, "ETH NO PHY CLK!!"); break; } tsk_sleep(1); } while (!(SYSCFG->SYSCFG_PMC & SYSCFG_PMC_MII_RMII)); } else SYSCFG->SYSCFG_PMC &= ~SYSCFG_PMC_MII_RMII; /* Ethernet Software reset */ /* Set the SWR bit: resets all MAC subsystem internal registers and logic */ /* After reset all the registers holds their respective reset values */ mac->ETH_DMABMR |= ETH_DMABMR_SR; /* Wait for software reset */ tmpreg = 0; while (mac->ETH_DMABMR & ETH_DMABMR_SR) { tsk_sleep(1); if(++tmpreg > PHY_CONFIG_DELAY) { TRACEPHY(mac, cfg, "ETH MAC RST!!"); break; } } /*-------------------------------- MAC Initialization ----------------------*/ TRACEPHY(mac, cfg, "ETH PHY:"); /* Get the ETHERNET MACMIIAR value */ tmpreg = mac->ETH_MACMIIAR; /* Clear CSR Clock Range CR[2:0] bits */ tmpreg &= ~ETH_MACMIIAR_CR; /* Get hclk frequency value */ RCC_GetClocksFreq (&clocks); /* Set CR bits depending on hclk value */ if ((clocks.HCLK_Frequency >= 20000000) && (clocks.HCLK_Frequency < 35000000)) { /* CSR Clock Range between 20-35 MHz */ tmpreg |= ETH_MACMIIAR_CR_Div16; } else if ((clocks.HCLK_Frequency >= 35000000) && (clocks.HCLK_Frequency < 60000000)) { /* CSR Clock Range between 35-60 MHz */ tmpreg |= ETH_MACMIIAR_CR_Div26; } else if ((clocks.HCLK_Frequency >= 60000000) && (clocks.HCLK_Frequency < 100000000)) { /* CSR Clock Range between 60-100 MHz */ tmpreg |= ETH_MACMIIAR_CR_Div42; } else /* ((hclk >= 100000000)&&(hclk < 120000000)) */ { /* CSR Clock Range between 100-120 MHz */ tmpreg |= ETH_MACMIIAR_CR_Div62; } /* Write to ETHERNET MAC MIIAR: Configure the ETHERNET CSR Clock Range */ mac->ETH_MACMIIAR = tmpreg; /*-------------------- PHY initialization and configuration ----------------*/ res = HAL_ETH_Init_PHY(mac, cfg); /* Config MAC and DMA */ ETH_MACDMAConfig(mac, cfg); return res; }
static void key_post(unsigned int key) { TRACELN("[%2X]", key); usr_drv_icontrol(KEY_DRV_INDX, DCR_PARAMS, (void *)key); }
/*---------------------------------------------------------------------*//** フレーム制御 **//*---------------------------------------------------------------------*/ void FocusCursor::exec(ExecRes* res, const ExecCtx* ec) { if(!_isEnableOut) { return; } // 外部からの無効化 GameExecCtx* gec = (GameExecCtx*)ec; TouchPanel* ui = gec->getTouchPanel(); // フォーカスの有効性更新 _focusarr->updateValidity(); // フォーカスの座標値をリセット for(s32 i = 0; i < NUM_FOCUS_MAX; i++) { _focusarr->invalidateScreenPos(i); } // 有効性判定 _isEnableSelf = !gec->isLockOperating(); bool isEnableUiReact = _isEnableSelf && !gec->isOpenedLockGui() && !ui->isReacted() && (_fcntPreventTap == 0.0f); // タッチ操作による処理 if(isEnableUiReact) { PointF32 ptTouch, ptStart; bool isTap = false; bool isDblTapRel = false; if(!ui->isReacted()) { const f32 DIFF_TAP_RANGE = 20.0f; if(ui->isTapRelease(&ptTouch, &ptStart)) { isTap = ptTouch.isNear(&ptStart, DIFF_TAP_RANGE, DIFF_TAP_RANGE); } // 面積が狭いので、isClickRelease だとストレスに感じる if(ui->isDoubleClickRelease(&ptTouch)) { isDblTapRel = true; } } if(isTap || isDblTapRel) { Tfw* tfw = Game::getGame()->getTfw(); ASSERT(tfw != 0L); View* view = tfw->getView(); ASSERT(view != 0L); SorSgm* sgm = (SorSgm*)tfw->getSgManager(); ASSERT(sgm != 0L); Camera* cam = sgm->getVisibleCamera(); ASSERT(cam != 0L); UnitManager* unitmng = Game::getGame()->getUnitManager(); ASSERT(unitmng != 0L); for(int i = 0; i < unitmng->getUnitNum(); i++) { Unit* unit = unitmng->getUnitFromIndex(i); ASSERT(unit != 0L); if(!unit->isEnable()) { continue; } // 無効なユニットは除外 if(!unit->isEnableFocus()) { continue; } // フォーカスされないユニットは除外 if(unit->isHidden()) { continue; } // 隠し属性ユニットは除外 if(unit->getUnitType() == UNITTYPE_EQUIPMENT_ITEM) { continue; } // 所持品は除外 if(unit->getCenterPos()->z() >= cam->getLoc()->z()) { continue; } // カメラより手前は除外 // スクリーン座標に変換 Vector2F vScr; Gcalc::conv3dPosToScreenPos(&vScr, unit->getCenterPos(), cam, view); if(isDblTapRel) // ダブルクリック時は直接フォーカスをセットする { // 一度フォーカスをリセット for(int j = 0; j < NUM_FOCUS_MAX; j++) { setFocus(j, 0L, 0L); } // 範囲内かどうか判定して、範囲内だったらフォーカス設定する if(TFW_IS_NEAR(vScr.x(), ptTouch.x(), RANGE_TOTRG) && TFW_IS_NEAR(vScr.y(), ptTouch.y(), RANGE_TOTRG)) { // フォーカスをセット(上部でリセットしているので、[0] 決めうち) setFocus(0, unit, &vScr); // UI に反応済みフラグを立てる ui->setReacted(true); break; } } else if(isTap) // タップ時はメニューを表示 { // 範囲内かどうか判定して、範囲内だったらメニューを表示する TRACELN("{FocusCursor::exec} unit touch?; scr_x=%f, scr_y=%f, click_x=%d, click_y=%d", vScr.x(), vScr.y(), ptTouch.x(), ptTouch.y()); if(TFW_IS_NEAR(vScr.x(), ptTouch.x(), RANGE_TOTRG) && TFW_IS_NEAR(vScr.y(), ptTouch.y(), RANGE_TOTRG)) { showFocusMenu(unit, &vScr); // フォーカスメニュー表示 ui->setReacted(true); // UI に反応済みフラグを立てる } } } } } // フォーカスカーソルの画面位置を計算 for(s32 i = 0; i < NUM_FOCUS_MAX; i++) { // 無効になったユニットは外す const Unit* unitFocused = _focusarr->getUnit(i); if(unitFocused == 0L) { continue; } if(!unitFocused->isEnable()) { setFocus(i, 0L, 0L); } // スクリーン座標値が未計算の場合、計算する if(!_focusarr->isValidScreenPos(i)) { _focusarr->calcScreenPos(i); } } // マジッククラスターのフォーカスの画面位置を計算 MagicSys* mgsys = Game::getGame()->getMagicSys(); for(int i = 0; i < mgsys->getMaxClusterNum(); i++) { MagicCluster* mc = mgsys->getClusterFromIndex(i); if(mc == 0L) { continue; } if(!mc->isValid()) { continue; } mc->focusArray()->calcScreenPosAll(); } // タップ防止カウンタの更新 if(_fcntPreventTap > 0.0f) { _fcntPreventTap -= ec->getDeltaFrame(); if(_fcntPreventTap < 0.0f) { _fcntPreventTap = 0.0f; } } // カーソル回転角度の更新 _dangFocus += DANG_FOCUS_DELTA; if(_dangFocus > 180.0f) { _dangFocus -= 360.0f; } _dangFocusable += DANG_FOCUSABLE_DELTA; if(_dangFocusable > 180.0f) { _dangFocusable -= 360.0f; } }