I Heart Directives

The Start of the Port Directive

Now that I've been working in Angular for a little while, I can see the potential power of Directives.  Directives are neat, often self contained little views into your application.

Above is the beginning of the "Port" directive.  This is a view into the control, connectivity details and status of the serial port.  The code is in /widgets/port.js & port.html

It provides a means of seeing the conntion status of the serial port from a different service.  Since there are so many services which depend on a Serial port, it makes sense to incorporate the control and status of the serial port into a "little building block", which can be re-used wherever it is needed.

The beauty of it is adding it to a service page is a single line !

<port service-name="{{service.serial.name}}" ></port>

That is it !  - everything else is auto-worky !  It takes care of the messaging, the callbacks, the display, the js, the bindings, the commands...  in a single embedded line !

Still needs some work... I have to add the baudrate, data bits etc.. so it only "connect"s correctly after the Serial service connected once the first time.

I can see where directives will become more and more important - and the Views will be more useful, in that they can be "mash-ups" of views from other services.


I'm sure there are lots of little bugs, and probably some nice features to add - but the oscope is basically "worky" - and its better than before.  It updates with an published array, the update path is short, it by-passes queues when operating locally... and lots more !

Thanks for calamity for one of the last graphical pieces - he solved the ng-hide mystery, so now trace screens disappear when not used.

 

Not checked in yet - but I have Auto-Ranging with the Oscope now.  Auto-ranging graphs the electrical change over the entire screen.  I intent to make a canvas for each trace which is enabled.  Below is digital ringing with a floating digital input.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mats's picture

I heart widgets too

I just implemented the PinArrayControl methods in Ads1115, and thanks to the great Oscope widget, the Ads1115 GUI now also shows the Oscope .

GroG's picture

Ahahah :D That's great news

Ahahah :D

That's great news Mats !

Thanks for the Picture.

Mats's picture

Ads1115 Oscope

Wohooo. Worky....

But sometimes I don't get the black background. Hmmm....