/// Reset to peripheral projector setup (discards previous projectorsetup) void Tuning::resetToPeripheralSetup() { if (!tuning()) return; tuning()->projector().setSetup(Projector::PERIPHERAL); sessionModeChange(); emit projectorSetupChanged(); }
QSize TuningLayout::calculateSize(SizeType sizeType) const { int _border = 2; int _width = 0; int _height = _border; auto _parent = static_cast<Tuning*>(parent()); for (auto& _item : items_) { switch (_item.role_) { case Role::PARAMETER: case Role::TITLE: _height += 24 / _parent->devicePixelRatio(); break; case Role::PREVIEW: if (!tuning()) continue; /// Increase height by aspect ratio _height += _parent->width() / float(tuning()->width()) * tuning()->height(); break; } } _height += _border; return QSize(_width,_height); }
void TuningLayout::setGeometry(QRect const& _rect) { if (!tuning()) return; const int _border = 2; int _height = _border; auto _parent = static_cast<Tuning *>(parent()); /// Adjust geometry for each widget for (auto& _item : items_) { auto _widget = _item.widget(); /// Widget height is constant except for preview int _widgetHeight = _item.role_ == Role::PREVIEW ? _parent->width() / float(tuning()->width()) * tuning()->height() : 36 / _parent->devicePixelRatio(); _widget->setGeometry(_border, _height, _parent->width() - _border * 2, _widgetHeight); _widget->show(); /// Increase height _height += _widgetHeight; } }
/// Reset to free projector setup (discards previous projector setup) void Tuning::resetToFreeSetup() { if (!tuning()) return; tuning()->projector().setSetup(Projector::FREE); sessionModeChange(); emit projectorSetupChanged(); }
void Tuning::updateParameters() { if (!tuning() || signalsBlocked()) return; auto& _p = tuning()->projector(); _p.setYaw(getParamAsFloat("Yaw")); _p.setPitch(getParamAsFloat("Pitch")); _p.setRoll(getParamAsFloat("Roll")); switch(_p.setup()) { /// Handle free projector setup case Projector::FREE: _p.setPos( getParamAsFloat("X"), getParamAsFloat("Y"), getParamAsFloat("Z")); break; /// Handle Peripheral projector setup case Projector::PERIPHERAL: _p.setDeltaYaw(getParamAsFloat("Delta Yaw")); _p.setDistanceCenter(getParamAsFloat("Distance")); _p.setTowerHeight(getParamAsFloat("Tower Height")); _p.setShift(getParamAsFloat("Shift")); break; } tuning()->setColor(titleBar_->color()); glView_->update(); updateViews(); emit projectorSetupChanged(); }
void Tuning::sessionModeChange() { if (!dataModel()) return; QSignalBlocker blocker(this); if (windowState_ == NO_DISPLAY) { setGroup("Minimized"); return; } if (windowState_ == DISPLAY_ONLY) { setGroup("PreviewOnly"); return; } auto _mode = dataModel()->mode(); // Show close button only in screen- and projection setup titleBar_->setCloseButtonVisible( _mode == Session::Mode::SCREENSETUP || _mode == Session::Mode::ARRANGE); switch (_mode) { case Session::Mode::SCREENSETUP: setGroup("FOVSliders"); break; case Session::Mode::ARRANGE: if (windowState_ == ADJUSTMENT_SLIDERS) setGroup( tuning()->projector().setup() == Projector::FREE ? "FreeSetup" : "PeripheralSetup"); if (windowState_ == FOV_SLIDERS) setGroup("FOVSliders"); break; case Session::Mode::BLEND: case Session::Mode::WARP: case Session::Mode::COLORCORRECTION: case Session::Mode::EXPORT: setGroup("PreviewOnly"); break; case Session::Mode::LIVE: /// Generate calibration data for visualizer when switching to live // mode tuning()->visualizer()->generateCalibrationData(); setGroup("PreviewOnly"); break; default: break; } }
void Tuning::setKeyStone() { if (!tuning() || signalsBlocked()) return; tuning()->projector().setKeystone(getParamAsFloat("Keystone")); updateViews(); emit projectorSetupChanged(); }
/// Set Throw Ratio to projector from slider void Tuning::setThrowRatio() { if (!tuning() || signalsBlocked()) return; tuning()->projector().setThrowRatio(getParamAsFloat("Throw Ratio")); setParamAsFloat("FOV", tuning()->projector().fov().degrees()); updateViews(); emit projectorSetupChanged(); }
void Tuning::setFov() { if (!tuning() || isLocked()) return; tuning()->projector().setFov(getParamAsFloat("FOV")); setParamAsFloat("Throw Ratio",tuning()->projector().throwRatio()); updateViews(); emit projectorSetupChanged(); }
void Tuning::updateColor() { /// Widget color has the same color as tuning for (auto& _widget : this->parameters_) { QColor _color = isSelected_ ? titleBar_->color().name() : "#cccccc"; _widget->setStyleSheet("selection-background-color : "+_color.name()); if (tuning() && isSelected_) tuning()->setColor(_color); } update(); }
// three_hz_loop - 3.3hz loop void Sub::three_hz_loop() { set_leak_status(leak_detector.update()); failsafe_internal_pressure_check(); failsafe_internal_temperature_check(); // check if we've lost contact with the ground station failsafe_gcs_check(); // check if we've lost terrain data failsafe_terrain_check(); #if AC_FENCE == ENABLED // check if we have breached a fence fence_check(); #endif // AC_FENCE_ENABLED update_events(); #if CH6_TUNE_ENABLED == ENABLED // update ch6 in flight tuning tuning(); #endif }
void Tuning::startDrag() { if (!dataModel()) return; if (dataModel()->mode() != Session::Mode::SCREENSETUP) return; QDrag *drag = new QDrag(this); QMimeData *mimeData = new QMimeData; // Generate pixmap for projector QPixmap _pixmap(128, 128); { _pixmap.fill(tuning()->color()); QPainter _p(&_pixmap); QRect _rect(0, 0, 128, 128); QFont _font("Helvetica", 32); _p.setFont(_font); _p.drawRect(_rect.adjusted(1, 1, -2, -2)); _p.drawText(_rect, Qt::AlignCenter, QString("%1").arg(index() + 1)); _p.end(); } drag->setPixmap(_pixmap); mimeData->setText(QString("%1").arg(index())); drag->setMimeData(mimeData); drag->exec(); }
void Tuning::setTuning(int _index, omni::Session* _session) { bool _newTuning = (session_ != _session) || (index_ != _index); index_=_index; session_ = _session; if (_newTuning) { glView_->setSession(session_); glView_->setTuningIndex(index_); fullscreen_->setSession(session_); fullscreen_->setTuningIndex(index_); titleBar_->setColor(tuning()->color()); setParamAsFloat("FOV",tuning()->projector().fov().degrees()); setParamAsFloat("Throw Ratio",tuning()->projector().throwRatio()); auto _projSetup = tuning()->projector().setup(); if (_projSetup->getTypeId() == "FreeSetup") { auto* _p = static_cast<omni::proj::FreeSetup*>(_projSetup); setParamAsFloat("Yaw",_p->yaw().degrees()); setParamAsFloat("Pitch",_p->pitch().degrees()); setParamAsFloat("Roll",_p->roll().degrees()); setParamAsFloat("X",_p->pos().x()); setParamAsFloat("Y",_p->pos().y()); setParamAsFloat("Z",_p->pos().z()); } else if (_projSetup->getTypeId() == "PeripheralSetup") { auto* _p = static_cast<omni::proj::PeripheralSetup*>(_projSetup); setParamAsFloat("Yaw",_p->yaw().degrees()); setParamAsFloat("Pitch",_p->pitch().degrees()); setParamAsFloat("Roll",_p->roll().degrees()); setParamAsFloat("Delta Yaw",_p->deltaYaw().degrees()); setParamAsFloat("Distance",_p->distanceCenter()); setParamAsFloat("Tower Height",_p->towerHeight()); setParamAsFloat("Shift",_p->shift()); } sessionModeChange(); updateParameters(); } }
void Tuning::updateParameters() { if (!tuning() || isLocked()) return; auto* _projSetup = tuning()->projector().setup(); if (!_projSetup) return; /// Handle free projector setup if (_projSetup->getTypeId() == "FreeSetup") { auto* _p = static_cast<omni::proj::FreeSetup*>(_projSetup); _p->setYaw(getParamAsFloat("Yaw")); _p->setPitch(getParamAsFloat("Pitch")); _p->setRoll(getParamAsFloat("Roll")); _p->setPos( getParamAsFloat("X"), getParamAsFloat("Y"), getParamAsFloat("Z")); } /// Handle Peripheral projector setup if (_projSetup->getTypeId() == "PeripheralSetup") { auto* _p = static_cast<omni::proj::PeripheralSetup*>(_projSetup); _p->setYaw(getParamAsFloat("Yaw")); _p->setPitch(getParamAsFloat("Pitch")); _p->setRoll(getParamAsFloat("Roll")); _p->setDeltaYaw(getParamAsFloat("Delta Yaw")); _p->setDistanceCenter(getParamAsFloat("Distance")); _p->setTowerHeight(getParamAsFloat("Tower Height")); _p->setShift(getParamAsFloat("Shift")); } tuning()->projector().setup(); updateViews(); emit projectorSetupChanged(); }
// three_hz_loop - 3.3hz loop void Copter::three_hz_loop() { // check if we've lost contact with the ground station failsafe_gcs_check(); // check if we've lost terrain data failsafe_terrain_check(); #if AC_FENCE == ENABLED // check if we have breached a fence fence_check(); #endif // AC_FENCE_ENABLED // update ch6 in flight tuning tuning(); }
void Tuning::sessionModeChange() { if (!session()) return; if (windowState_ == NO_DISPLAY) { setGroup("Minimized"); return; } if (windowState_ == DISPLAY_ONLY) { setGroup("PreviewOnly"); return; } auto _mode = session()->mode(); // Show close button only in screen- and projection setup titleBar_->setCloseButtonVisible( _mode == Session::Mode::SCREENSETUP || _mode == Session::Mode::PROJECTIONSETUP); switch (_mode) { case Session::Mode::SCREENSETUP: setGroup("FOVSliders"); break; case Session::Mode::PROJECTIONSETUP: if (windowState_ == ADJUSTMENT_SLIDERS) setGroup(tuning()->projector().setup()->getTypeId().str()); if (windowState_ == FOV_SLIDERS) setGroup("FOVSliders"); break; case Session::Mode::WARP: case Session::Mode::BLEND: case Session::Mode::EXPORT: setGroup("PreviewOnly"); break; default: break; } fullscreen_->update(); }
// three_hz_loop - 3.3hz loop void Copter::three_hz_loop() { // check if we've lost contact with the ground station failsafe_gcs_check(); #if AC_FENCE == ENABLED // check if we have breached a fence fence_check(); #endif // AC_FENCE_ENABLED #if SPRAYER == ENABLED sprayer.update(); #endif update_events(); // update ch6 in flight tuning tuning(); }
void Tuning::detachScreen() { tuning()->setScreen(nullptr, 0); emit projectorSetupChanged(); layout()->update(); }
void Tuning::attachScreen(QScreen const *_screen, int _subScreenIndex) { tuning()->setScreen(_screen, _subScreenIndex); emit projectorSetupChanged(); layout()->update(); }