• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

CFA634-TMC-KU (Scrolling Marquee help)

Neogeek

New member
Device: CFA634-TMC-KU
Feature: Scrolling Marquee aka 022
Scripting language: AutoIT ( http://www.autoitscript.com/autoit3/index.shtml )

I think the problem is my lack of understanding of this feature.
I can get the CFA634 to scroll the data I send to any line..
What I can't figure out is if I am not sending the data to it correctly. What I mean is...
What I expect when I enable scrolling marquee is all the data I send to that line to scroll across that line.
What I get is just the first 20 characters scrolling and any characters over the 20 going on to the next line.

Line 1 scrolling : This is the time for <scrolling>
Line 2 not scrolling:all good men to <not scrolling, as expected>

I did not tell it to "spill" over to line2 I was trying to figure out how to code more than 20 characters to scroll out from line1.
..am I making sense?
..do I just have to parse my data for line1 and feed it 20 characters at at time?

Thanks for any all help!
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

starlon

New member
If that doesn't work for you, here's an excellent scroll algorithm from lcd4linux. It provides just about everything: prefix, postfix, marquee, pingpong, left/center/right alignments... Be sure and credit the lcd4linux team if you offer the code for download.

Code:
void WidgetText::TextScroll()
{
    std::string pre = prefix_->P2S();
    std::string post = postfix_->P2S();

    std::string str = string_;

    int num, len, width, pad;
    unsigned int srcPtr = 0, dstPtr = 0;
    std::string src, dst;

    num = 0;
    len = str.length();
    width = length_ - pre.length() - post.length();
    if (width < 0)
	width = 0;

    switch (align_) {
    case ALIGN_LEFT:
	pad = 0;
	break;
    case ALIGN_CENTER:
	pad = (width - len) / 2;
	if (pad < 0)
	    pad = 0;
	break;
    case ALIGN_RIGHT:
	pad = width - len;
	if (pad < 0)
	    pad = 0;
	break;
    case ALIGN_AUTOMATIC:
	if (len <= width) {
	    pad = 0;
	    break;
	}
    case ALIGN_MARQUEE:
	pad = width - scroll_;
	scroll_++;
	if (scroll_ >= width + len)
	    scroll_ = 0;
	break;
    case ALIGN_PINGPONG:
#define PINGPONGWAIT 2

	/* scrolling is not necessary - center the str */
	if (len <= width) {
	    pad = (width - len) / 2;
	} else {
	    if (direction_ == 1)
		scroll_++;	/* scroll right */
	    else
		scroll_--;	/* scroll left */

	    /*pad = if positive, add leading space characters, else offset of str begin */
	    pad = 0 - scroll_;

	    if (pad < 0 - (len - width)) {
		if (delay_-- < 1) {	/* wait before switch direction */
		    direction_ = 0;	/* change scroll direction */
		    delay_ = PINGPONGWAIT;
		    scroll_ -= PINGPONGWAIT;
		}		/* else debug("wait1"); */
		pad = 0 - (len - width);
	    } else if (pad > 0) {
		if (delay_-- < 1) {
		    direction_ = 1;
		    delay_ = PINGPONGWAIT;
		    scroll_ += PINGPONGWAIT;
		}		/* else debug("wait2"); */
		pad = 0;
	    }

	}
	break;
    default:			/* not reached  */
	pad = 0;
    }

    dst.resize(length_);

    dstPtr = 0;
    num = 0;

    /* process prefix */
    src = pre;
    while (num < length_) {
	if (srcPtr == src.length())
	    break;
	dst[dstPtr++] = src[srcPtr++];
	num++;
    }

    src = str;

    /* pad blanks on the beginning */
    while (pad > 0 && num < length_) {
	dst[dstPtr++] = ' ';
	num++;
	pad--;
    }

    /* skip src chars (marquee) */
    std::string tmp = src;
    while (pad < 0) {
        src = tmp.substr(1, tmp.length()); 
        tmp = src;
	pad++;
    }


    /* copy content */
    while (num < length_) {
	if (srcPtr >= src.length())
	    break;
	dst[dstPtr++] = src[srcPtr++];
	num++;
    }

    /* pad blanks on the end */
    src = post;
    srcPtr = 0;
    len = src.length();
    while (num < length_ - len) {
	dst[dstPtr++] = ' ';
	num++;
    }

    /* process postfix */
    while (num < length_) {
	if (srcPtr >= src.length())
	    break;
	dst[dstPtr++] = src[srcPtr++];
	num++;
    }

    buffer_ = dst;

    /* finally, draw it! */
    if (Draw)
	Draw(this);
    else
        LCDError("WidgetText: No draw method.");
}
 
USB LCD Displays - Graphic and Character LCDs with a Keypad

Neogeek

New member
Thanks to both Starlon and Cosmicvoid.
I am still not the best script writer, or in other words I can read and tweak others code better then I can write my own.
That said, after reading and re-reading what Starlon pointed me to (duurr RTFM) my take away is that at best I get 40 characters per line even with scrolling? So I would have to use software (scripts) to keep it all on one line, like what Cosmicvoid linked me to, right?

What I am working on is weather info on my nightstand. The forcast data ("fcttext", http://api.wunderground.com/auto/wui/geo/ForecastXML/index.xml?query=Eugene,OR ) is longer then 40 characters so that's why I am trying to scroll it to one line.

Thanks again for all the help.
 
Top