Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Topic:
Help! Ticker Tape Style Text for my Weather Module (screenshots included)
This thread has 12 replies. Displaying all posts.
Post 1 made on Wednesday June 2, 2010 at 14:48
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
I was wondering if someone has written some simple code to have a text field continuously scroll a text string of variable length across it. Any help would be greatly appreciated.

I stumbled across a piece of code that I modified to work on the Pronto that will simulated text being typed on the go (see below). The problem is that if the length of the text variable is longer than the text field, some of the characters simply do not get displayed. I am learning ProntoScript, but I am not quite at a level to figure this out yet. I would like this to display, if available, the severe weather info in my weather module. The module itself will be posted on this site once I have completed the coding and create some icons... screenshots to follow.


// Global variables
var max=0;
var wHeader = "Weather Warning: ";
var wText = "Severe thunderstorm watch in effect for Ottawa."

function textlist()
{
max= textlist.arguments.length;
for (i=0; i this[i]=textlist.arguments[i];
}
tl=new textlist(wHeader + wText);

var x=0; pos=0;
var l=tl[0].length;

function textticker()
{
CF.widget("test").label=tl[x].substring(0,pos)+"_";

if(pos++==l)
{
pos=0;
Activity.scheduleAfter(1000, textticker);
x++;
if(x==max)
x=0;
l=tl[x].length;
} else
Activity.scheduleAfter(50, textticker);
}

textticker();

Last edited by ScottGrimes on June 3, 2010 10:06.
Scott Grimes
Liquid Designs
Scott.Grimes@hotmail.com
OP | Post 2 made on Wednesday June 2, 2010 at 15:05
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
Here are the screenshots I promised!

Splash Screen

Weather Forecast

Weather Details

These are some of the features I have coded into the module.

1.   Full city and country or state name is displayed.
2.   Added text display of current conditions.
3.   Added 'Feels Like' temperature.
4.   Added probability of precipitation for each day.
5.   Units of measure is now stored in a global variable. Which
      gives you the capability to switch between metric and standard
      units on the fly. A reboot or re-install will default back to the
      units you set in the 'Parameters' page.
6.   Added some code to keep the city from reverting to the default (1)
      when switching between metric and standard units.
7.   The 5-day forecast data will display the average forecasted icon and
      text description up until 2:00pm local time. Between 2:00pm and time
      of sunset the current conditions data is to be used. After sunset,
      the night time forecast will be displayed. The reason for this is that
      forecasted data for the day is no longer available after 2:00pm and
      will only display an 'N/A' for both.
8.   Can switch between day and night forecast by pressing on the day
      button situated beside the '°C' button. The button will change to a
      moon and stars image to let you know you are viewing night data.
9.   If the length of the string for the weather text is too long, the
      short-form data string will be used.
10. Changed the graphics and layout and also used larger weather icons
      from www.weather.com. To be redone from scratch at a later date.
11. Used the new 'stretchImage' command to alter the size of the icons
      when necessary.
12. More detailed information about today's weather including the phase
      of the moon can be displayed in a pop-up window.

Currently working on figuring out the phases of the moon that can be obtained form the feed. I have figured out the following so far.

1. There are a total of 30 icons (numbered 0 to 29)
2. There are 8 text descriptions for the phases
        a) New Moon
        b) Waxing Crescent
        c) First Quarter
        d) Waxing Gibbous
        e) Full Moon
        f) Waning Gibbous
        g) Last Quarter
        h) Waning Crescent
3. I believe I have figured out the pattern of distribution of the icons between the 8 phases. I will confirm it over the next couple of weeks and create the appropriate icons to be displayed.

So far everything is functioning correctly. I am testing some code to store the high temp for the day, so that it is still available after 2:00pm when that data is no longer published by the weather channel.
Scott Grimes
Liquid Designs
Scott.Grimes@hotmail.com
Post 3 made on Thursday June 3, 2010 at 01:00
pnw
Long Time Member
Joined:
Posts:
September 2008
17
Your screenshots look great!

The ProntoScript Developer's Guide (v1.3) has an example script for Label Animation on page 38. The example stores the original label, and then scrolls it with 'label = label.substring(1)'. The scrolling speed is controlled with scheduleAfter. Once the label is blank, the function resets the label back to the original.

I won't post the entire example code here since it doesn't all apply, but it should be possible to adapt it to your needs.
OP | Post 4 made on Thursday June 3, 2010 at 10:04
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
On June 3, 2010 at 01:00, pnw said...
Your screenshots look great!

The ProntoScript Developer's Guide (v1.3) has an example script for Label Animation on page 38. The example stores the original label, and then scrolls it with 'label = label.substring(1)'. The scrolling speed is controlled with scheduleAfter. Once the label is blank, the function resets the label back to the original.

I won't post the entire example code here since it doesn't all apply, but it should be possible to adapt it to your needs.

Thanks for pointing me in the right direction. I have reduced the code down to what is necessary to make it work. I also got it to add the removed characters at the beginning of the text field and put them at the end. That way it looks like the text continuously loops around instead of removing characters at the start of the text until there is nothing left and then suddenly it starting all over again with the entire string again. I think it flows better this way... at least for my particular application.

I will test the code in the weather module itself... hopefully all goes well. Will keep you posted.

Scott
Scott Grimes
Liquid Designs
Scott.Grimes@hotmail.com
Post 5 made on Thursday June 3, 2010 at 12:27
pjjameso
Long Time Member
Joined:
Posts:
April 2008
73
Scott,

We think alike... after i was able to get the swa to work I too was wondering how to do scrolling text. Looks like you have found the answer.

Couple of questions, will the splash screen also follow the 5 day logic, eg forecast to 2pm, current till sunset, and then the nightime forecast?

One thing (minor compared to your effort, but kinda cool) I did was to pull actual photos of the weather condition and apply them to the background. Now instead of icons I see what the actual weather looks like. Only applied this to the splash screen not the five day outlook. Took awhile to find applicable 640x480 images but google nailed them down.

Thanks again for all your effort.
Paul
OP | Post 6 made on Thursday June 3, 2010 at 15:47
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
On June 3, 2010 at 12:27, pjjameso said...
Scott,

We think alike... after i was able to get the swa to work I too was wondering how to do scrolling text. Looks like you have found the answer.

Couple of questions, will the splash screen also follow the 5 day logic, eg forecast to 2pm, current till sunset, and then the nightime forecast?

One thing (minor compared to your effort, but kinda cool) I did was to pull actual photos of the weather condition and apply them to the background. Now instead of icons I see what the actual weather looks like. Only applied this to the splash screen not the five day outlook. Took awhile to find applicable 640x480 images but google nailed them down.

Thanks again for all your effort.

I decided to have the splash screen always display the current conditions (xml data that has '.cc.' in it). If you want to see the overall conditions for today, you merely press on the weather icon and it will take you the forecasted data.

You only run into the problem of data not available with the overall forecasted info (xml data that has '.dayf.day[0]' or .dayf.day[1] in it - 0 for day forecast, 1 for night). The only issue on the splash page after 2:00pm will be the hi temp value. However, once I test my code for storing and retrieving this value, there will be, except for certain conditions, no issues.

Very cool idea of replacing the background images based on current weather conditions on the fly.

For those interested here is some sample code for creating the ticker tape effect:

1. create a text field on a page making it as wide as you wish.
2. tag it SEVEREWEATHERTEXT
3. place the code below at the page level (the '//start of code' and '//end of code' does not need to be pasted).

The var swText is for testing purposes only. It will eventually contain the actual severe weather data from the xml stream once it is integrated into the weather module. The spaces (" ") added to the end of the swWarning are there to provide space between the end of the warning and start of the warning when it oops on itself.

//start of code:

var swTitle = "Weather Warning: ";
var swText = "Severe thunderstorm watch in effect for Ottawa.";
var swWarning = swTitle + swText + " ";

function severeWeatherTicker()
{
swWarning = swWarning + swWarning.charAt(0);
swWarning = swWarning.substring(1); // Remove the first character
CF.widget("SEVEREWEATHERTEXT").label = swWarning;
scheduleAfter(50, severeWeatherTicker);
}

severeWeatherTicker();

//end of code

If you would like to add a delay between from when the warning is displayed and when it actually begins to ticker tape along, remove the line 'severeWeatherTicker();' and add the following:

//start of code

function startAnimatedWeatherTicker()
{
CF.widget("SEVEREWEATHERTEXT").label = swWarning;
scheduleAfter(2000, severeWeatherTicker); // Start animating after 2 seconds
}

startAnimatedWeatherTicker();

//end of code

Hope this helps.
Scott Grimes
Liquid Designs
Scott.Grimes@hotmail.com
Post 7 made on Thursday June 3, 2010 at 19:35
anderson_ev123
Long Time Member
Joined:
Posts:
May 2010
71
Scott,

loving the HTC interface,

slightly off topic but have you tried using a pinch with photoshop for the htc flip clock yet, would look kinda cool for transitions, there is already a scrolling rss feed that i believe andre did a while back that may be of use to you otherwise for ideas if nothing else.

also someone did a 30 day proKNX mod (though i cant remember who now) that read the xml data for the meteo module and stored it in the pronto memory for graphical analysis which was also pretty awesome.

you should check it out if you havent already think it was called "protrend".

regards

Ev
OP | Post 8 made on Friday June 4, 2010 at 08:37
ScottGrimes
Long Time Member
Joined:
Posts:
April 2007
78
On June 3, 2010 at 19:35, anderson_ev123 said...
Scott,

loving the HTC interface,

slightly off topic but have you tried using a pinch with photoshop for the htc flip clock yet, would look kinda cool for transitions, there is already a scrolling rss feed that i believe andre did a while back that may be of use to you otherwise for ideas if nothing else.

also someone did a 30 day proKNX mod (though i cant remember who now) that read the xml data for the meteo module and stored it in the pronto memory for graphical analysis which was also pretty awesome.

you should check it out if you havent already think it was called "protrend".

regards

Ev

Hi Ev,

I have not had a chance to try my hand at animating the clock. I need to get a little more adept at javascript before I attempt it.

I did look at the rss feed that andre did... a little to complex for what I needed. If you look a couple of posts further up this thread, you will see the basic script that I posted in order to accomplish what I was trying to do. It works... I just need a little time to to implement it into my weather module.

I remember reading about the weather trending module, but again not what I am trying to accomplish. I will be just storing the current day's high temp in order to retrieve it after 2:00pm... when it is no longer being provided by the weather channel. I have the basics for this worked out... just need to test it over the weekend.

Thanks for the feedback.
Scott Grimes
Liquid Designs
Scott.Grimes@hotmail.com
Post 9 made on Sunday October 15, 2023 at 22:26
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
I know this is old but has anyone gotten this to work as of late?
Post 10 made on Monday October 16, 2023 at 21:47
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
Mike,

What is "this"? Scott's weather module or the scrolling text? This thread is over 13 years old.

Lyndel
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 11 made on Wednesday October 18, 2023 at 13:13
mpg7321
Regular Member
Joined:
Posts:
June 2020
111
Sorry, Scotts weather
Post 12 made on Thursday October 19, 2023 at 14:39
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
All the weather sources now require the user to sign up for an API-based account (OpenWeatherMap.org) and the access is via HTTPS which the Pronto sockets cannot do without lots of SSL coding that is not available.

Noel Blackman posted links on his site to links for weather maps, but then again, the protocol is HTTPS and not HTTP.

[Link: blackmancustoms.com]

You might RC Mail Scott to see what he's using today. I have not seen him on this site in quite some time.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 13 made on Sunday October 22, 2023 at 18:55
canavan
Long Time Member
Joined:
Posts:
July 2004
20
There's a really cool weather report site at [Link: wttr.in] - it's freely accessible, works with http, can output text, json, html and even images rendered on your own templates. Source and more infos at [Link: github.com]


Jump to


Protected Feature Before you can reply to a message...
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now.

Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.

Hosting Services by ipHouse