View Single Post
  #6   Spotlight this post!  
Unread 31-01-2011, 08:55
demosthenes2k8's Avatar
demosthenes2k8 demosthenes2k8 is offline
Graduated but not gone
AKA: Matt Soucy
FRC #0166 (Chop Shop 166)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Merrimack, NH
Posts: 589
demosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to behold
Send a message via AIM to demosthenes2k8 Send a message via Yahoo to demosthenes2k8
Re: Need SmartDashboard Help

My team made a function (it's part of our framework) to make an interface for that dsLCD that behaves essentially exactly like printf.

Code:
/**
 * Send text to DS LCD display
 */
int DriverStationDisplay(const char* format, ...)
{
        va_list args;
        static string dash_string[6];
        static bool init=true;
        char formatted_string[DASHBOARD_BUFFER_MAX];
        if(init) {
                //Initializes it first call.
                for(int i=0;i<6;i++) {
                        dash_string[i] = "                     ";
                }
                init=false;
        }
        va_start( args, format );
        vsnprintf(formatted_string, DASHBOARD_BUFFER_MAX, format, args);
        va_end(args);
        
        //Move lines up to make room for the newline 
        for(int i=5; i>=1; i--) {
                dash_string[i] = dash_string[i-1];
        }
        dash_string[0] = formatted_string;

        for(int i=0; i<6; i++) {
                dsHandleLCD->PrintfLine((DriverStationLCD::Line)i, dash_string[i].c_str());
        }
        dsHandleLCD->UpdateLCD();
        return 0;
}
Feel free to use it, or even the whole framework, from http://framework.chopshop166.com/

And you're welcome for the launcher, Ben wrote it really quickly, but it's small and works very well!
__________________


GSR Dean's List Finalist 2011
Reply With Quote