예제 #1
0
void changeElemValue(uint8_t elemIndex, uint8_t newValue)
{
	DIMMER_ELEM_t* elem = &dimmer_elems[elemIndex];
	
	if(newValue < 5)
	{
		//Full OFF
		HAL_GPIO_PORT_clr(elem->portPtr, elem->mask);
		elem->currentValue = 0;
		elem->timerValue = 0; //Never changes
		
		//Stop the comparator if the partner elem doesn't use it
		if( (elemIndex < 3 && dimmer_elems[elemIndex + 3].timerValue == 0) || 
			(elemIndex >= 3 && dimmer_elems[elemIndex - 3].timerValue == 0))
		{
				setComparator(elemIndex, false);
		}			
	}else if(newValue >= 128)
	{
		//Full ON
		HAL_GPIO_PORT_set(elem->portPtr, elem->mask);
		elem->currentValue = 128;
		elem->timerValue = 0; //Never changes
		
		//Stop the comparator if the partner elem doesn't use it
		if( (elemIndex < 3 && dimmer_elems[elemIndex + 3].timerValue == 0) ||
			(elemIndex >= 3 && dimmer_elems[elemIndex - 3].timerValue == 0))
		{
			setComparator(elemIndex, false);
		}
	}else
	{
		//Dimming
		elem->currentValue = newValue;
		elem->timerValue = TIME_FRAGMENT * (128 - elem->currentValue);
	
		//Initialize the comparator if the partner elem didn't do it
		if((elemIndex == 0 && dimmer_elems[3].timerValue == 0)
		|| (elemIndex == 3 && dimmer_elems[0].timerValue == 0))
		{
			OCR5A = elem->timerValue;
			TIMSK5 |= (1 << OCIE5A);			// Enable TC5A interrupt		
		}
		else if((elemIndex == 1 && dimmer_elems[4].timerValue == 0)
			 || (elemIndex == 4 && dimmer_elems[1].timerValue == 0))
		{
			OCR5B = elem->timerValue;
			TIMSK5 |= (1 << OCIE5B);            // Enable TC5B interrupt
		}
		else if((elemIndex == 2 && dimmer_elems[5].timerValue == 0)
			 || (elemIndex == 5 && dimmer_elems[2].timerValue == 0))
		{
			OCR5C = elem->timerValue;
			TIMSK5 |= (1 << OCIE5C);            // Enable TC5C interrupt
		}
	}	
}
예제 #2
0
LLGroupList::LLGroupList(const Params& p)
:	LLFlatListViewEx(p)
	, mDirty(true) // to force initial update
{
	// Listen for agent group changes.
	gAgent.addListener(this, "new group");

	mShowIcons = gSavedSettings.getBOOL("GroupListShowIcons");
	setCommitOnSelectionChange(true);

	// Set default sort order.
	setComparator(&GROUP_COMPARATOR);

	// Set up context menu.
	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
	LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;

	registrar.add("People.Groups.Action",			boost::bind(&LLGroupList::onContextMenuItemClick,	this, _2));
	enable_registrar.add("People.Groups.Enable",	boost::bind(&LLGroupList::onContextMenuItemEnable,	this, _2));

	LLMenuGL* context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_groups.xml",
			gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
	if(context_menu)
		mContextMenuHandle = context_menu->getHandle();
}
LLAvatarList::LLAvatarList(const Params& p)
:	LLFlatListViewEx(p)
, mIgnoreOnlineStatus(p.ignore_online_status)
, mShowLastInteractionTime(p.show_last_interaction_time)
, mContextMenu(NULL)
, mDirty(true) // to force initial update
, mNeedUpdateNames(false)
, mLITUpdateTimer(NULL)
, mShowIcons(true)
, mShowInfoBtn(p.show_info_btn)
, mShowProfileBtn(p.show_profile_btn)
, mShowSpeakingIndicator(p.show_speaking_indicator)
, mShowPermissions(p.show_permissions_granted)
{
	setCommitOnSelectionChange(true);

	// Set default sort order.
	setComparator(&NAME_COMPARATOR);

	if (mShowLastInteractionTime)
	{
		mLITUpdateTimer = new LLTimer();
		mLITUpdateTimer->setTimerExpirySec(0); // zero to force initial update
		mLITUpdateTimer->start();
	}
	
	LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this));
}
예제 #4
0
LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
    :	LLInventoryItemsList(p)
{
    setComparator(&WEARABLE_TYPE_NAME_COMPARATOR);
    mIsStandalone = p.standalone;
    if (mIsStandalone)
    {
        // Use built-in context menu.
        setRightMouseDownCallback(boost::bind(&LLWearableItemsList::onRightClick, this, _2, _3));
    }
    mWornIndicationEnabled = p.worn_indication_enabled;
}
LLGroupList::LLGroupList(const Params& p)
:	LLFlatListViewEx(p),
	mForAgent(p.for_agent)
	, mDirty(true) // to force initial update
    , mShowIcons(false)
    , mShowNone(true)
{
	setCommitOnSelectionChange(true);

	// Set default sort order.
	setComparator(&GROUP_COMPARATOR);
    
    if (mForAgent)
	{
        enableForAgent(true);
    }
}
LLAvatarList::LLAvatarList(const Params& p)
:	LLFlatListViewEx(p)
, mIgnoreOnlineStatus(p.ignore_online_status)
, mShowLastInteractionTime(p.show_last_interaction_time)
, mContextMenu(NULL)
, mDirty(true) // to force initial update
, mNeedUpdateNames(false)
, mLITUpdateTimer(NULL)
, mShowIcons(p.show_icons)
, mShowInfoBtn(p.show_info_btn)
, mShowProfileBtn(p.show_profile_btn)
, mShowSpeakingIndicator(p.show_speaking_indicator)
, mShowPermissions(p.show_permissions_granted)
// [RLVa:KB] - Checked: 2010-04-05 (RLVa-1.2.2a) | Added: RLVa-1.2.0d
, mRlvCheckShowNames(false)
// [/RLVa:KB]
, mShowVoiceVolume(p.show_voice_volume)
, mShowRange(false)
, mShowStatusFlags(false)
, mShowUsername((bool)gSavedSettings.getBOOL("NameTagShowUsernames"))
, mShowDisplayName((bool)gSavedSettings.getBOOL("UseDisplayNames"))
, mIgnoreGlobalIcons(false)
, mShowAge(false)
, mShowPaymentStatus(false)
, mItemHeight(0)
// [Ansariel: Colorful radar]
, mUseRangeColors(false)
// [Ansariel: Colorful radar]
{
	setCommitOnSelectionChange(true);

	// Set default sort order.
	setComparator(&NAME_COMPARATOR);

	if (mShowLastInteractionTime)
	{
		mLITUpdateTimer = new LLTimer();
		mLITUpdateTimer->setTimerExpirySec(0); // zero to force initial update
		mLITUpdateTimer->start();
	}
	
	LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this));

	// <FS:Ansariel> FIRE-1089: List needs to update also if we change the username setting
	gSavedSettings.getControl("NameTagShowUsernames")->getSignal()->connect(boost::bind(&LLAvatarList::handleDisplayNamesOptionChanged, this));
}
예제 #7
0
LLAvatarList::LLAvatarList(const Params& p)
:	LLFlatListView(p)
, mIgnoreOnlineStatus(p.ignore_online_status)
, mShowLastInteractionTime(p.show_last_interaction_time)
, mContextMenu(NULL)
, mDirty(true) // to force initial update
, mLITUpdateTimer(NULL)
, mShowIcons(true)
, mShowInfoBtn(p.show_info_btn)
, mShowProfileBtn(p.show_profile_btn)
, mShowSpeakingIndicator(p.show_speaking_indicator)
{
	setCommitOnSelectionChange(true);

	// Set default sort order.
	setComparator(&NAME_COMPARATOR);

	if (mShowLastInteractionTime)
	{
		mLITUpdateTimer = new LLTimer();
		mLITUpdateTimer->setTimerExpirySec(0); // zero to force initial update
		mLITUpdateTimer->start();
	}
}
/*!
 * \brief ContainerSourceCollection::ContainerSourceCollection
 * \param name
 * \param comparator
 */
ContainerSourceCollection::ContainerSourceCollection(const QString& name,
                                                     DataObjectComparator comparator)
    : SourceCollection(name)
{
    setComparator(comparator);
}
void LLAvatarList::sortByName()
{
	setComparator(&NAME_COMPARATOR);
	sort();
}
예제 #10
0
TMAVectorOrdered::TMAVectorOrdered(PMAItemComparator icomp,int elems,int grow,bool delete_items):
    TMAVectorBase(elems,grow,delete_items)
{
    io_comp=NULL;
    setComparator(icomp);
}