Author Topic: Graphical alternative for terminal.  (Read 3978 times)

0 Members and 1 Guest are viewing this topic.

Offline ekrzychoooo

  • Contributor
  • Posts: 9
  • Country: pl
Graphical alternative for terminal.
« on: August 27, 2013, 11:29:51 am »
I would like to present my project salamander.
The main idea of ??the salamander to enable easy configuration panel communicates with the microcontroller.
This can be a fun alternative to the terminal if you want to show on your PC screen data from our ADC uC eg, temperature, logic states.
The program also allows you to set / reset bits in the ports by clicking the mouse in the right bottom or set of analog values.
The entire panel composes of different elements that can be added as needed.
Each of the elements can be placed on the panel at any point by dragging it with the mouse.
Each element has a number of settings related to the appearance such as width, height, display range values.
Each element has its own address.


The program is free and available for download at www.my-electronics.eu

Configure the following panel as below takes a few minutes.




 Installation
After downloading the software installs in a standard way through the installer ..
It is recommended that before you uninstall the previous installation.
The default is installed in "c: \ program files \ Salamander".
Setup creates the "my documents" folder salamander, which is used to store configuration data.
Proper operation requires the installation of Java JRE 1.7
 

 Configuration.
On the "Tools" menu, select "Settings". This opens a blank panel
Now, with the list of items to select what interests us and click 'add'.
Use the mouse to drag the item to our panel. In the left pane displays the configuration module added item.

Characteristic elements

Thermometer

Element shows the data in the form of a thermometer bar. In this element can set a minimum and maximum value.
This is the range of the measured values.
Example frame setter value of 21.5 in the element with the address 22 (decimal).
LF_0__0_1__6_4__2_1__._ 5_CR
0A 30 30 31 36 34 32 31 2E 35 0D

 
analog Meter
Element simulating analog meter. The element can set the range of the measured values ??and the size.
Example frame setter value of 15.3 in the element with the address 1234 (hex).
LF 1 2 3 4 4 1 5. 3 CR
0A 31 32 33 34 34 31 35 2E 33 0D


counter
The element can count events. You can set the number of digits and the size of graphic element.
Counter allows you to increase the value other than one. Information increasing step is included in a data frame. While the program is the ability to set the initial value of the counter, alarm values ??and reset to zero.
Counter after reaching an alarm is signaled by the sound.
Example frame counter increasing by 5 at address 3 (dec);
LF 0 0 0 3 1 5 CR
0A 30 30 30 33 31 35 0D


element LED
Element is used to provide binary signals. You can configure the number of binary states in the range of 1 to 8, and the width and height of the element.
Height set by adjusting the font size of labels describing the signals. States led correspond to the bits in the data word. To light up all the LEDs should be sent to the value of FF and to suppress the value of 00
Frame sets the first 4 leds in the element with the address 32 (decimal)
LF 0 0 2 0 2 0 F CR
0A 30 30 32 30 32 30 46 0D
Text Label.
A text element is used to describe. These elements are in a layer over all the elements so they can be arranged in the area of other elements.
It is possible to set width, height, font size, color, and transparency.
This element can also be set by the incoming frame.
Example frame setter to "Volt" in the element of the address 0x0001.
LF 0 0 0 1 4 V o l t CR
0A 30 30 30 31 34 56 6F 6C 74 0D


Element switches.
Element is used to change the binary states. You can set the height, width and number of keys in the range 1 to 8
The data represent a byte whose bits correspond to an individual bits.
Example frames generated by setting all keys ON
LF 0 0 2 0 2 F F CR
0A 30 30 32 30 32 46 46 0D

Slider element
Element is used to set the analog values. You can set the width, height, and the range of the setting values??.
During operation, a new value can be set using the slider or by entering a value in the text box and approving the "Enter" key.
Frame created after setting the 68 (dec) with address 5
LF 0 0 0 5 2 4 4 CR
0A 30 30 30 35 32 34 34 0D








 
 
 

Offline AndrejaKo

  • Frequent Contributor
  • **
  • Posts: 271
  • Country: cs
Re: Graphical alternative for terminal.
« Reply #1 on: August 27, 2013, 11:24:53 pm »
Looks interesting! I felt the need for such a program when experimenting, but was too lazy to actually write it. Thanks for taking time to do this.

At the first look, program workflow doesn't look very good. For example, there's the need to manually restart the program when I'm done configuring. This makes it more difficult to change things "on the fly". It would be best if the need for restart was completely removed, but an automatic restart would be a step in the right direction. While I'm complaining about the configuration of elements, I think that there needs to be a way to edit current configuration. As far as I can see, the only way to do that would be to make a completely new one. This takes time and is a cause of frustration. Why should I have to make a new configuration, if I only want to edit a single value in a display? Also , it would be great if I could export and import configurations so I can have several of them. You're already writing configuration to files, so I don't see a reason why not to allow user to choose which one to use.

Next, there are the menus which serve no function but are still there. For example, there's the file->open menu. In my opinion, it just adds to user confusion. It's been a while since I did any AWT programming in Java, but if I remember correctly, it should be extremely easy to just hide it from user, until it actually does something. I think that there was something like "hidden" property which could be set for an element.
 Also in my opinion words `configure` and `options` are too similar. Make a longer version of the inscription, like configure display elements and serial port options or something like that. People can easily confuse the two menu options. It should be obvious which option does what.


On my computer I have 64 bit JRE installed. None of the RxTx stuff worked with it and there was no error message displayed to user about that and no mention of program NOT working in the documentation (or at last as far as I could find it). That's bad practice. I haven't worked with RxTx before, so I don't know how hard it is to get it to work on 64 bit systems, but I do know that it only takes a minute to add to the documentation that 32 bit JRE should be used. It would be even better to check when program is starting if JRE is 32 bit or not. You can check for example the System.getProperty("sun.arch.data.model") output to see if it's 64 bit and display a warning if it is. As a result, you simply get 32 or 64, so it shouldn't be too complicated to write an error message.

Finally, if the program can't find the manifest.mf, it will think that there is a new version available and ask the user to get it. That's actually great! Most of the auto-update features I've seen are very badly broken and this one actually does something very useful. It would be even better if it could somehow figure out if it's just the manifest.mf that's missing. I got to see that bug, when I didn't set the running directory correctly once.

Unfortunately, I couldn't see the Youtube video. For some reason, I can't load videos with low amount of views. :( I also don't have an AVR programmer at the moment, so I couldn't try out the demo on the microcontroller.

In any case, great work so far!
« Last Edit: August 27, 2013, 11:29:56 pm by AndrejaKo »
 

Offline ekrzychoooo

  • Contributor
  • Posts: 9
  • Country: pl
Re: Graphical alternative for terminal.
« Reply #2 on: August 28, 2013, 11:17:43 am »
AndrejaKo thank you for your post. I know that this program has a lot of difficulties. This is a release candidate. Showing it on the forum and look forward to exactly the posts.
The file menu open, it will operate in the future exactly as you write. This is the first light of the program :P
I do not know how to insert video here.
Thanks for all the suggestions.

The following sample program work for ATMEGA8
 

Offline jancumps

  • Supporter
  • ****
  • Posts: 1247
  • Country: be
  • New Low
Re: Graphical alternative for terminal.
« Reply #3 on: August 28, 2013, 11:45:51 am »


You can embed video if you use the Youtube http:// url in stead of https://
 

Offline ekrzychoooo

  • Contributor
  • Posts: 9
  • Country: pl
Re: Graphical alternative for terminal.
« Reply #4 on: August 29, 2013, 11:09:27 am »
Already a new version SalamandraRCf. In the configuration panel added "Reload" button.
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 7403
  • Country: us
    • SiliconValleyGarage
Re: Graphical alternative for terminal.
« Reply #5 on: August 29, 2013, 01:39:07 pm »
Good idea, but plenty of room for improvement

I dont want to do floating point calcs on a microcontroller. Make the objects intelligent.

So : for a thermometer:

LF<address><cmd><argument><cr>
Address : 4 digit hex code giving potential of 65535 ui elements
Cmd : 1 digit hex code
0: reset and create object , objecttype
1: set title:  argument is title for object (text to be displayed)
2: set minimum value
3: set maximum value
4: set offset
5: set gain
6: set textcolor
7: set backgroundcolor
8: set scalecolor
9: set alarmvalue high
A: set alarmvalue low
B: set alarmcolor
...
F : set value

Lets say i want a thermometer from -20 to + 50 degrees, white text black background , red alarmcolor , warning if passing 0 degree, warning if passing 30 degrees.
LF BEEF 0 THERM CR.   ' create thermometer object
LF BEEF 1 THERMOMETER CR ' set the object title
LF BEEF 2 -20 CR ' set minimum
LF BEEF 3 50 CR
LF BEEF 4 0 CR
LF BREF 5 1 CR
LF BEEF 6 FFFFFF CR
LF BEEF 7 000000 CR
LF BEEF 8 F32266 CR
LF BEEF 9 40 CR
LF BEEF A 0 CR
LF BEEF B FF0000 CR

This would have initialised the component.
Maybe you could use a two character command code and add top,left,width and height coordinated as well. That way the config strings could be built into the micros program. When connecting the ui would always build correctly.

Salamander would send a command to the micro that says : give me the ui code... You simply send a long ascii string. Done. Salamander would have a graphical 'builder , to create the string.

Now, in my a bove example i have set the thermometer the program assumes the micro will feed it data between -20 and 50 and will update the bargraph whenever i send
LF BEEF F 17.5 CR
this would show 17.5 degrees.

But, this assumes that calculations will have been done on the micro to perform scaling... This requires floating point !  The output of the micros adc is a byte from 0 to 255!
A bytecode of zero means -20, 255 means 50 degrees
So, by feeding offset and gain parameters to the object you can actually leave the floating point conversion to the pc.
Simply tell it that there is an offset of -20 and that the gain is 255/70 (-20 to 50 is 70 degrees 'span')

You could even provide to allow regular expressions so you could feed real formulas
LF BEEF C ((SQR(X * 2.17))/3.14)+1.17 CR

whenever you feed data it is multiplied by 2.17, square root pulled , divided by 3.14 and then 1.17 added..

You could define this as the salamander protocol.
A microcontroller would send a special character like the tilde ( which looks like a wiggling salamander) . Of on the othere side a salamander visualisation program is present it answers with a pound sign #. ( which looks like a fishing net maze ) so this 'traps' the salamander. This pound sign is the trigger for the micro to send the entire configuration string so the salamander client can build the user interface.

Storing the config string on the micro means that the user on the pc does not need to worry about having the correct ui file , and it cannot be misconfigured.

Just my 2 cents....

I like the idea...
« Last Edit: August 29, 2013, 01:44:35 pm by free_electron »
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 

Online mariush

  • Super Contributor
  • ***
  • Posts: 3954
  • Country: ro
  • .
Re: Graphical alternative for terminal.
« Reply #6 on: August 29, 2013, 01:51:52 pm »
Sparkfun has some displays with an integrated processor and memory onto which you can upload some widgets like the ones you show and then the microcontroller only has to send serial data to the display and display renders everything.

See https://www.sparkfun.com/products/11377

There's also a video or several videos on their Youtube channel showing them

 

Offline Harvs

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: au
Re: Graphical alternative for terminal.
« Reply #7 on: August 30, 2013, 12:02:16 am »
Sparkfun has some displays with an integrated processor

hmm, 4.3" display is $145.  You can buy two 7" Android tablets and a couple of bluetooth modules for that money and have the full Android dev tools at your power.

I like this Salamanda idea, and if it gets to a level of maturity I would use it.  In particular I think F_E's idea of reg exp is an excellent one, another step further than that would be to also allow a CSV lookup table to be associated with a control that maps a highly non-linear sensor.
 

Offline ekrzychoooo

  • Contributor
  • Posts: 9
  • Country: pl
Re: Graphical alternative for terminal.
« Reply #8 on: August 30, 2013, 02:38:07 pm »
You could even provide to allow regular expressions so you could feed real formulas
LF BEEF C ((SQR(X * 2.17))/3.14)+1.17 CR

free_electron, it is a good idea.

[LF] [Frame Type] [ADDRESS] [LENGTH DATA] [REG EX MATH] [PRECISION] [DATE] [CR]


REG EX MATH eg [5 * x/1024]. expression will be able to include sine, cosine, tangent cotangent log ln square root, etc..
PRECISION is the number of decimal points
DATA is a 16 bits (two bytes in the code naturally)

This allows reduction flash memory consumption of the processor. No data conversion in the microcontroller.
Small ATTINY + salamander and you can measure.

I think that within a week it will download.
« Last Edit: August 30, 2013, 02:50:34 pm by ekrzychoooo »
 

Offline free_electron

  • Super Contributor
  • ***
  • Posts: 7403
  • Country: us
    • SiliconValleyGarage
Re: Graphical alternative for terminal.
« Reply #9 on: August 30, 2013, 03:11:50 pm »
Split the dataand the regexpression. There is no need to transmit every time the expression.
You need to limit the amount of data that is sent. Only at startup does the micro send the expression

So the data fram would look like this

LF<target object><data type><data>CR

Target object is the UI element you eant to send info to. 4 hex chars giving 65535 elements
Data type tells the element  what property you want to change 2 hex chars giving 256 properties
Property 0 means : initialise the element with the given elementtype.
During ui creation you send the regexpression once.

After that you simply update data. The regexpression is applied upon reception of new data.

The ui program can be very small. You create objects on the fly
Whenever a command string is received you split it in 3 fields.
A simple parser does the rest.

Case datatype
  0: case data
      1 : dim button as new button
           Button.tag = address
       2: dim textbox as new textbox
           Textbox.tag = address
           
      End case
1: for each control as object in me.controls
    If tag=address ... Blablabl


I have a program that creates user interface conpletely dynamic.
At design time there is not a single element on the screen.
A simple text file contains the layout
At runtime the file is parsed, objects are created and positioned and the eventhandlers are dynamicaly hooked.

I use this to control the chips i work on. Whenever the registermap changes ( registers added, bit moved ) or i want a different control for a specific field i simply update the textfile. I don't need to write a simgle line of code.

So in essence this salamnder thing is the same. Send a bunch of commands on initialisation to create ui elelements. The ui handlers visualises and binds em.

After that only data is transferred.
Professional Electron Wrangler.
Any comments, or points of view expressed, are my own and not endorsed , induced or compensated by my employer(s).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf