Go to Post These are threads, and they are what hold the community together...so CD must be a threaded fastener right? - Andrew Blair [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 01-08-2010, 23:42
biojae's Avatar
biojae biojae is offline
Likes Omni drives :)
AKA: Justin Stocking
FTC #5011 (BOT SQUAD) && FTC#72(Garage bots)&& FRC#0399 (Eagle Robotics)
Team Role: College Student
 
Join Date: Oct 2008
Rookie Year: 2008
Location: Lancaster
Posts: 276
biojae is a jewel in the roughbiojae is a jewel in the roughbiojae is a jewel in the rough
Re: DS "User Message"

Quote:
Originally Posted by kamocat View Post
I'm making a CAN startup test, and want to send the results back to the driver. However, I'd rather not make anyone who uses this startup test have to fit this into their dashboard. I only plan to send the message once at the start of Autonomous Enabled.
If its your own message, then why can't you make it fit within the length of the box?
You could use multiple lines.

[edit]
Or, you could use this:
Code:
public class DriverStationLCDwWrap  {

    private static DriverStationLCD lcd = null;
    private static DriverStationLCDwWrap LCDw = null;//keep the singleton pattern going

    private DriverStationLCD.Line[] lcdLines =
    {DriverStationLCD.Line.kMain6, DriverStationLCD.Line.kUser2,
     DriverStationLCD.Line.kUser3, DriverStationLCD.Line.kUser4,
     DriverStationLCD.Line.kUser5, DriverStationLCD.Line.kUser6};

    private DriverStationLCDwWrap()
    {
        lcd = DriverStationLCD.getInstance();
    }

    public static DriverStationLCDwWrap getInstance()
    {
        if(LCDw == null)
            LCDw = new DriverStationLCDwWrap();
        return LCDw;
    }

    public void updateLCD()
    {
        lcd.updateLCD();
    }

    public void println(String text)
    {
        int length = text.length();
        int lines  = length / lcd.kLineLength;
        String blank = "                      "; // 21 spaces, clears the line.
        for(int i = 0; i < i < lcdLines.length; i++)
        {
            lcd.println(lcdLines[i], 1, blank); // Clear the all lines of previous text
        }

        for(int i = 0; i < (lines + 1) && i < lcdLines.length; i++)
        {
            int start = lcd.kLineLength*i;
            int end   = (start+lcd.kLineLength  >= length)? length : start+lcd.kLineLength;
            lcd.println(lcdLines[i], 1, text.substring(start, end));
        }
        updateLCD(); // call it since the the string has replaced the entire DS LCD buffer 
    }
}
(note, this is character wrapping. Your message can and will be chopped off to a new line)
For example: println("This is a very long message that will be split into several pieces");
becomes:
This is a very long m
essage that will be s
plit into several pie
ces
[/edit]
__________________
FTC Team 72 - No site
FRC Team 399 - http://www.team399.org
2010 Rockwell Collins Innovation in Control Award - (Use of the CAN bus, among other reasons) Phoenix, Arizona!

Last edited by biojae : 02-08-2010 at 02:11.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Emergency Stopped" message won't go away Lakedaimon General Forum 25 13-08-2012 22:14
"Demo Stamp not found" error message Gatto Programming 1 07-02-2007 23:17
"The Power of a Positive Team" Message Joe Matt General Forum 2 04-04-2005 09:48
Why would I "subscribe" to a message thread or a forum? Joe Johnson CD Forum Support 4 07-06-2001 22:07


All times are GMT -5. The time now is 23:10.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi