Software: modifications and extensions Toon

Everything about software tools, new software development and toolchains. For developers, mostly.

Moderator: marcelr

Re: Software: modifications and extensions Toon

Postby Toonz » Sun Jan 01, 2017 10:03 pm

hvxl wrote:One remark, editing the location variable on line 108 of BuienradarApp.qml doesn't really help much as you still have 6344 hardcoded on line 132. Obviously you intended that to be location.


Thanks for spotting :-). Is corrected now.....

hvxl wrote:In addition, through experimentation I have found out that you can access the attributes this way:
    cNode.attributes["zin"].value
Or if you prefer:
    cNode.attributes.zin.value


Still can't get it to work. Which software version do you have on Toon (I am running 3.1.22)?
Toonz
Advanced Member
Advanced Member
 
Posts: 749
Joined: December 2016

Re: Software: modifications and extensions Toon

Postby RomMon » Mon Jan 02, 2017 12:12 am

I'm also interested in finding the console.log("") output, but so far have not found it.

Hooked up a serial cable to Toon, but also on there no console output.
Compiled ttylog (https://sourceforge.net/projects/ttylog) but unfortunately only causes the connection (e.g. /dev/ttymxc0) to lockup.
RomMon
Starting Member
Starting Member
 
Posts: 39
Joined: August 2016

Re: Software: modifications and extensions Toon

Postby Toonz » Mon Jan 02, 2017 12:58 am

RomMon wrote:I'm also interested in finding the console.log("") output, but so far have not found it.

Hooked up a serial cable to Toon, but also on there no console output.
Compiled ttylog (https://sourceforge.net/projects/ttylog) but unfortunately only causes the connection (e.g. /dev/ttymxc0) to lockup.


I believe having read that console.log() will show information in the log screen of QtCreator. I haven't played around with QtCreator yet... will give it a go soonish.....(not sure if it is compatible with the QT implementation on Toon).
Toonz
Advanced Member
Advanced Member
 
Posts: 749
Joined: December 2016

Re: Software: modifications and extensions Toon

Postby hvxl » Mon Jan 02, 2017 5:27 pm

Toonz wrote:Which software version do you have on Toon (I am running 3.1.22)?

3.2.18. But I would be very surprised if this was a recent addition.

This is what I now have in BuienradarApp.qml (lines 146 - 150):
Code: Select all
        if (cNode.tagName === "icoonactueel") {
                icoonlink = cNode.firstChild.nodeValue;
                icoonid = cNode.attributes["ID"].value;
                icoonzin = cNode.attributes["zin"].value;
        }

And I added this to BuienradarTile.qml:
Code: Select all
        Text {                                                                                 
                id: buienradarTileTitleText3
                text: app.icoonzin
                anchors {
                        baseline: parent.top
                        baselineOffset: 90
                        horizontalCenter: parent.horizontalCenter
                }
                font {
                        family: qfont.regular.name
                        pixelSize: 18
                }
                color: colors.clockTileColor
        }

Resulting in a tile like this:
toon1.png
toon1.png (6.78 KiB) Viewed 3854 times
Schelte
hvxl
Senior Member
Senior Member
 
Posts: 1106
Joined: June 2010

Re: Software: modifications and extensions Toon

Postby Toonz » Mon Jan 02, 2017 6:18 pm

Hvxl,

thanks a lot, this does it. Looking good on the tile as well.
I must have been getting blind looking at these two lines the past week ;-).

My current WIP is the addition of the weather station selection screens (based on the original Eneco weather app).
I also want to redesign the detail screen: make the weather forecast text box scrollable and smaller to allow more room for the 5 days forecast (want to add the daily wind forecast there).

Next pipeline project will be similar: create a traffic app (there is a similar public XML feed as well for that).

Many thanks for your support, much appreciated.
Toonz
Advanced Member
Advanced Member
 
Posts: 749
Joined: December 2016

Re: Software: modifications and extensions Toon

Postby marcelr » Mon Jan 02, 2017 6:38 pm

3.2.18. But I would be very surprised if this was a recent addition.

Correct, the qt libraries (package qt-libs - 5.3.1-06-setpos) were introduced in fw 3.0.29 and haven't been updated since.
Thanks Toonz, for your weather tile. Looks good.
marcelr
Advanced Member
Advanced Member
 
Posts: 934
Joined: May 2012
Location: Ehv

Re: Software: modifications and extensions Toon

Postby RomMon » Mon Jan 02, 2017 6:42 pm

Hvxl,

Nice find.
How did you find that?
From http://doc.qt.io/qt-4.8/qdeclarativeglobalobject.html I can see it should be supported. But how the commands structure should be is unclear to me.

Toonz,
The new version is looking nice.

I suspect that in the following lines you are missing 'var' (doesn't seem to cause issues on the Toon, but with html it did).
Also suspect that location is a reserved keyword in Qt. With html it tried to open a file "6344" each time.
location = "6344";
locationName = "Rotterdam";
And on line 132 you still have the location code hardcoded.
RomMon
Starting Member
Starting Member
 
Posts: 39
Joined: August 2016

Re: Software: modifications and extensions Toon

Postby Toonz » Mon Jan 02, 2017 8:25 pm

Hi RomMon,

Thanks for the comments. Hereby the latest WIP version:
changelog:
- 'var' added to the lines above
- removed the hardcoded filter on '6344'. 'Location is now used as selection filter as it should (thanks to RomMon)
- ID and zin tags now properly populated and added to the tile (thanks to HvxL)
- added the date/time of the latest weatherforecast from your favourite weatherstation to the detailed screen
- changed the refresh cycle from 15 minutes to 10 minutes to match the XML refresh rate on the buienradar server.
- as a teaser: I added a button to the Details screen ('Weerstation') to allow selection of your favourite weatherstation in the next release (you can press it now but nothing happens yet).

thanks for all your support on this forum, to be continued.....

EDIT (marcelr): Attachment removed, stable version of the app to be found in the Downloads thread.
Toonz
Advanced Member
Advanced Member
 
Posts: 749
Joined: December 2016

Re: Software: modifications and extensions Toon

Postby marcelr » Mon Jan 02, 2017 8:58 pm

@RomMon

All output from the code started in inittab is redirected to /dev/null:

from /etc/init.d/HCBv2:
Code: Select all
inittabwrap()
{
   cd ${PREFIX}/sbin
   # let hcb_comm restart fast
   if [ "${XTRAARG}" != "hcb_comm" ]
   then
      sleep 1 # prevent mega-rapid-hcb-comm-reconnects :P
   fi
   # replace current exec context with binary
   exec ${PREFIX}/sbin/${XTRAARG} --daemon >/dev/null 2>/dev/null
}


in this shell script, XTRAARG is the executable to be run (everything in/HCBv2/sbin, passed one by one to inittabwrap() ).

If you add an extra line with exceptional behaviour for qt-gui, you should be able to send the output to wherever you want it (to stdout and stderr in this case:).
Code: Select all
if [ "${XTRAARG}" != "qt-gui" ]
then
  exec ${PREFIX}/sbin/${XTRAARG} --daemon >/dev/null 2>/dev/null # normal behaviour
else
  exec ${PREFIX}/sbin/${XTRAARG} --daemon                        # tweaked
fi

or something along these lines.
You should be aware of the fact that toon's executables are very talkative. I didn't test qt-gui, but e.g., happ_thermstat spits out megabytes of console output in a matter of minutes.
marcelr
Advanced Member
Advanced Member
 
Posts: 934
Joined: May 2012
Location: Ehv

Re: Software: modifications and extensions Toon

Postby marcelr » Mon Jan 02, 2017 11:55 pm

Hmm, maybe adding the text for the weather type is not always a good idea ;-) :
(never mind the colour map, it's a frame buffer dump, converted to a jpeg in the GIMP, RGB should be reversed to BGR).
Attachments
screenshot.jpg
screenshot.jpg (40.24 KiB) Viewed 4097 times
marcelr
Advanced Member
Advanced Member
 
Posts: 934
Joined: May 2012
Location: Ehv

Re: Software: modifications and extensions Toon

Postby marcelr » Tue Jan 03, 2017 12:18 pm

@RomMon

I tested a little more.
It's a bit more complex than the standard start-up from inittab.
qt-gui has a wrapper script in between, startqt. This script adds command line arguments and also redirects everything to /dev/null.

For now, I tested the following and found it to be working:

Code: Select all
killall qt-gui; /HCBv2/sbin/qt-gui -platform linuxfb -plugin Tslib --daemon 2>&1

Execute this command in a terminal (on a _single_ line), and watch all output fly by. By the time you can start handling the gui, output rates calm down a little and you can see what's going on, including console.log() output :-).

I tried redirection to a fifo and then grep for relevant output, but that increases resources demand to a level sufficient to hang the machine in a few minutes.
marcelr
Advanced Member
Advanced Member
 
Posts: 934
Joined: May 2012
Location: Ehv

Re: Software: modifications and extensions Toon

Postby Toonz » Tue Jan 03, 2017 2:51 pm

marcelr wrote:Hmm, maybe adding the text for the weather type is not always a good idea ;-)

funny, it has only been 'Bewolkt' here since I started....
I now truncated the string if longer then 21 characters, your example now showing as 'heldere lucht en hier...""
Will be included in the next upload.
Thanks for flagging.
Toonz
Advanced Member
Advanced Member
 
Posts: 749
Joined: December 2016

Re: Software: modifications and extensions Toon

Postby Toonz » Wed Jan 04, 2017 5:45 pm

Latest buienradar app:

changelog:
- weather stations now selectable via maps
- added 'Bf' to wind line on tile (thanks Marcel for the example).
- 'Zin' text is truncated when too long for the tile (thanks Marcel).
- added this app to the menu of Toon

to do:
- redesign the detail screen: make the weather forecast text box scrollable and smaller;expand the 5 days forecast with daily wind forecasts. Cosmetic improvements
- store station selection permanently

Note on selection of weather stations:
- default station at startup is entered in BuienradarApp.qml line 18/19
- weather stations which are not yet selectable via the maps (don't know why Eneco didn't include these) can be entered in line 18/19 as well:
"6308" : "Cadzand";
"6283" : "Groenlo";
"6315" : "Hansweert";
"6258" : "Houtribdijk";
"6285" : "Schiermonnikoog";
"6209" : "IJmond";
"6225" : "IJmuiden";
"6320" : "Goeree";
"6312" : "Oosterschelde";
"6316" : "Schaar";
"6324" : "Stavenisse";
"6331" : "Tholen";
"6313" : "Vlakte ad Raan";
"6215" : "Voorschoten";
"6248" : "Wijdenes";
"6257" : "Wijk aan Zee";

- if I really have time on a rainy day I might add these to the maps as well ;-)

Request for help: I want to write the selected weather station to a local text file to use as startup value after a reboot. Reading values from a text file is easy in QML. However, in QML (using FileIO) it is not possible to write local files I believe. It might require c++ programming to create a plugin but that is beyond my skills.

P.S. Marcel, your solution to watch the console.log output has been invaluable the last days, finally proper error messages when loading the apps. Many thanks for that!

EDIT (marcelr): Attachment removed, stable version of the app to be found in the Downloads thread.
Toonz
Advanced Member
Advanced Member
 
Posts: 749
Joined: December 2016

Re: Software: modifications and extensions Toon

Postby marcelr » Wed Jan 04, 2017 9:52 pm

@Toonz,

For my toon, I added air pressure and changed the layout of the tile a little. See attached zip file. Mind you, it's a set of patched files only, so you still need the original from Toonz.
Need to squeeze in relative humidity and then it starts to look like an old school weather station (temperature, atmospheric pressure, relative humidity ;-) ).
Line truncation works, see attached tile.

This application helps me to finally learn some qml and javascript (learned to program when algol60 was still fashionable ...). I'm a complete newbie when it comes to those scripting languages, so thanks again for your efforts.

According to some guys at stackoverflow it is possible to do file IO in qml (5.6, not sure if 5.3.1 already has it, and then need to check toon's qt libraries):

http://stackoverflow.com/questions/1788 ... -in-qml-qt

EDIT: removed download file. You can find stable versions of the buienradar app in the Downloads thread.
Attachments
tile.jpg
tile.jpg (9.44 KiB) Viewed 3961 times
marcelr
Advanced Member
Advanced Member
 
Posts: 934
Joined: May 2012
Location: Ehv

Re: Software: modifications and extensions Toon

Postby Toonz » Thu Jan 05, 2017 6:29 pm

Next release....buienradar.

changelog:
- added airpressure (luchtdruk) to tile (thanks Marcel)
- added chill temperature (gevoelstemperatuur) to tile.
- added relative humidity (relatieve luchtvochtigheid) to tile
- reformatted tile (main temp in bold, changed relative positions)
- details screen weather forecast text is now smaller and scrollable (swipe like on your phone)

todo:
- add 5-day wind forecast to details screen

EDIT (marcelr): Attachment removed, stable version of the app to be found in the Downloads thread.
Toonz
Advanced Member
Advanced Member
 
Posts: 749
Joined: December 2016

PreviousNext

Return to Toon software development

Who is online

Users browsing this forum: No registered users and 0 guests

cron