Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Callbacks and Timers » Feature request: Synchronized timers?
Feature request: Synchronized timers? [message #36137] Thu, 03 May 2012 08:29 Go to next message
steffen is currently offline  steffen
Messages: 38
Registered: May 2007
Location: Denmark
Member

Hi,

I'm making a touch screen user interface for displaying information received by ModbusTCP. One part of this is showing alarms as flashing indicators, like ctrl's where I toggle the face color on a timer callback.

If more alarms is active at the same time, I would like them to flash "in sync".

In CtrlTimer, the lowest accessible function is SetTimerCallback, which only takes a delay parameter, I would like an overloaded function which also takes an initial delay parameter, so I could use a modulo of the GetTimeClick() as initial time value.

Current function:
void SetTimeCallback(int delay_ms, Callback cb, void *id) {
	Mutex::Lock __(sTimerLock);
	ASSERT(abs(delay_ms) < 0x40000000);
	LLOG("SetTimeCallback " << delay_ms << " " << id);
	sTimeCallback(GetTickCount() + abs(delay_ms), delay_ms, cb, id);
}

I simply wish for something like:
void SetTimeCallback(int initial_delay_ms, int delay_ms, Callback cb, void *id) {
	Mutex::Lock __(sTimerLock);
	ASSERT(abs(delay_ms) < 0x40000000);
	LLOG("SetTimeCallback " << delay_ms << " " << id);
	sTimeCallback(initial_delay_ms, delay_ms, cb, id);
}

Or should I do it in a completely different way?
Re: Feature request: Synchronized timers? [message #36139 is a reply to message #36137] Thu, 03 May 2012 08:36 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
steffen wrote on Thu, 03 May 2012 02:29

Hi,

I'm making a touch screen user interface for displaying information received by ModbusTCP. One part of this is showing alarms as flashing indicators, like ctrl's where I toggle the face color on a timer callback.

If more alarms is active at the same time, I would like them to flash "in sync".

In CtrlTimer, the lowest accessible function is SetTimerCallback, which only takes a delay parameter, I would like an overloaded function which also takes an initial delay parameter, so I could use a modulo of the GetTimeClick() as initial time value.

Current function:
void SetTimeCallback(int delay_ms, Callback cb, void *id) {
	Mutex::Lock __(sTimerLock);
	ASSERT(abs(delay_ms) < 0x40000000);
	LLOG("SetTimeCallback " << delay_ms << " " << id);
	sTimeCallback(GetTickCount() + abs(delay_ms), delay_ms, cb, id);
}

I simply wish for something like:
void SetTimeCallback(int initial_delay_ms, int delay_ms, Callback cb, void *id) {
	Mutex::Lock __(sTimerLock);
	ASSERT(abs(delay_ms) < 0x40000000);
	LLOG("SetTimeCallback " << delay_ms << " " << id);
	sTimeCallback(initial_delay_ms, delay_ms, cb, id);
}

Or should I do it in a completely different way?



I would use 50Hz timer and deduced all timings from absolute time.
Previous Topic: notes about callback
Next Topic: Callback to refresh docked window
Goto Forum:
  


Current Time: Fri Mar 29 14:55:52 CET 2024

Total time taken to generate the page: 0.01787 seconds