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 » Developing U++ » UppHub » LedLabel new package
LedLabel new package [message #42467] Tue, 18 March 2014 11:16 Go to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
I required to display Input / Output status for DIO.

I made a package for displaying LED with label.

It also can be used to show Toggle switch.

Test and package is included.




index.php?t=getfile&id=4470&private=0
  • Attachment: LedLabel.png
    (Size: 42.61KB, Downloaded 785 times)


Warm Regards

Deepak
Re: LedLabel new package [message #42469 is a reply to message #42467] Tue, 18 March 2014 11:17 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Package files.

With image probably I exceeded limit.

  • Attachment: LedLabel.7z
    (Size: 57.48KB, Downloaded 288 times)


Warm Regards

Deepak
Re: LedLabel new package [message #42470 is a reply to message #42467] Tue, 18 March 2014 11:27 Go to previous messageGo to next message
jerson is currently offline  jerson
Messages: 202
Registered: June 2010
Location: Bombay, India
Experienced Member

Very nice. Thank you
Re: LedLabel new package [message #42475 is a reply to message #42470] Tue, 18 March 2014 14:16 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Deep

They are cool Smile.

Personally I would add some things:
- Preconfigured classes are now like this:
class RedLed : public LedLabel {
public :
	RedLed() {
		On = LedImg::redLed();
		Off = LedImg::offLed();
		Status = false ;	
	}
};
I would move Status = false to LedLabel constructor and I would create a LedLabel constructor with on and off images.
LedLabel(Image on, Image off);

- To resize image to fit vertically and horizontally in control Size. "With custom image" first control (the one with "OFF") is cut.
index.php?t=getfile&id=4472&private=0
- To add push "Option like" buttons with on-off behavior but using images. The ones in the right side are very nice.
- To include .usc files. If it is difficult for you I could help
  • Attachment: Image.jpg
    (Size: 27.99KB, Downloaded 730 times)


Best regards
Iñaki
Re: LedLabel new package [message #42476 is a reply to message #42475] Tue, 18 March 2014 14:24 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Koldo,

Thank you for reviewing my package.

I will try implementing your suggestions.


Warm Regards

Deepak
Re: LedLabel new package [message #42477 is a reply to message #42476] Tue, 18 March 2014 15:11 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Koldo,

Quote:

I have not used .usc file in my programs before.
Any help welcome. Small example for my package. So that I can expand on it

I checked some .usc files from codebase. I think I will try it first.

I do constructor like this. Then what should be syntax for pre-configured LEDs?

LedLabel(Image on, Image off);


Warm Regards

Deepak

[Updated on: Tue, 18 March 2014 19:24]

Report message to a moderator

Re: LedLabel new package [message #42480 is a reply to message #42477] Tue, 18 March 2014 20:31 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 1075
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello Deep,

You are doing excelent job. But is there possibility to create procedural led painting? It will help a lot... Code sample:

class LedLable {
public:
    LedLable(const Color& ledColor) {
        this->ledColor = ledColor;
        // Do something with ledColor information.
    }

private:
    Color ledColor;
}

LedLable myLedLable(Color(0, 255, 0)); // <- Any color should be accepted here.


The second idea is to create array of leds (Similar sollution is implemented in LabView). More information you can find on following website: http://www.pererikstrandberg.se/blog/index.cgi?page=LabviewS impleForAndWhileLoops (First screenshot).

BTW, you can create whole package "LedCtrlLib" which will contain whole LED stuff. Think about it!

Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Tue, 18 March 2014 20:36]

Report message to a moderator

Re: LedLabel new package [message #42481 is a reply to message #42480] Wed, 19 March 2014 02:46 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi Klugier,

Quote:


BTW, you can create whole package "LedCtrlLib" which will contain whole LED stuff. Think about it!



Which features expected? Any feature reference available? Eventually I would like to make it complete LedCtrlLib.

What I have done satisfied my immediate need. I will add array as it is required to show 8 or 16 bit IO status from PLC.


Warm Regards

Deepak
Re: LedLabel new package [message #42483 is a reply to message #42481] Wed, 19 March 2014 08:52 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Nice. I have just two suggestions:

IMO,

	Image On, Off;
	bool Status;
	Label Caption;


should be private and some methods provided to change them. Besides, changing On/Off or Status should call Refresh to reflect changes.

Also, images in .iml file have wrong aliasing of borders. This means that with border other than something light-gray, borders will look ugly.
Re: LedLabel new package [message #42484 is a reply to message #42483] Wed, 19 March 2014 09:41 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3355
Registered: August 2008
Senior Veteran
Hello Deep

One additional detail. Instead of having ON and one OFF images, in some cases (mainly for leds and lights) you could have only one and internally generating a second one by darkening the provided one. If you like it I can provide you the function to do it.


Best regards
Iñaki
Re: LedLabel new package [message #42486 is a reply to message #42484] Wed, 19 March 2014 11:27 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Mirek,

Thanks for suggestions. I will make changes.

Koldo,

Internally I will prefer to have 2 separate images for on and off. So that Draw uses image depending on status. Images assigned during init only.

Calculating off state image from on state image is good suggestion.

I want to store the images and not calculate on the fly as it is displayed. Speed of display change should be as fast as possible. Would like to avoid calculations for display rendering.

Actually today I could compile Xenomai real time extension with UPP. Previously Real Time Process was 'c' only program running independently. Communicating with HMI through rtpipes. Real time thread runs every 1 millisecond. I tested the RT thread running every 250 micro sec. with UPP GUI running. Using EtherCAT protocol and hardware.

Display update ( io status display change ) will be done every 100 ms. Number of IOs will be large and may not fit one screen. Only selected IOs will be displayed.


Warm Regards

Deepak
Re: LedLabel new package [message #42970 is a reply to message #42467] Fri, 18 April 2014 16:31 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi,

I have now modified my package. Attempted to make changes as suggested.

This is my first attempt to use "usc" file.

Comments suggestions welcome.

I am using MakeImage to get Grayscale image. Are there any other way to create light grayscale image?
  ImgOff = MakeImage(imgon, Grayscale) ;


Array and "procedural led painting" is not yet added.
  • Attachment: LedLabel-1.7z
    (Size: 112.34KB, Downloaded 255 times)


Warm Regards

Deepak

[Updated on: Fri, 18 April 2014 16:33]

Report message to a moderator

Re: LedLabel new package [message #42976 is a reply to message #42467] Sat, 19 April 2014 16:24 Go to previous messageGo to next message
deep is currently offline  deep
Messages: 263
Registered: July 2011
Location: Bangalore
Experienced Member
Hi,

I have added "Procedural LED Painting"

Now any color can be given to led.
There are 6 predefined Led colors with images.
Custom Image can be used
  • Attachment: LedLabel-2.7z
    (Size: 112.90KB, Downloaded 263 times)


Warm Regards

Deepak
Re: LedLabel new package [message #43022 is a reply to message #42976] Wed, 23 April 2014 21:20 Go to previous message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi Deep,

I downloaded your package. Very nice new widget, I will use it in my own application.

Thank you very much for this really good work Very Happy

Regards

Biobytes
Previous Topic: Upp package binding for LLVM/Clang library (libclang)
Next Topic: VLCPlayer compile only with libvlc v. 1.1.10 and later
Goto Forum:
  


Current Time: Thu Mar 28 22:40:26 CET 2024

Total time taken to generate the page: 0.01962 seconds