Commits

F Malpartida committed b3953f3

Parametrized the drawBar method of the MMI.

Comments (0)

Files changed (1)

 #include "stepperCntrl.h"
 
 
+#define CHAR_WIDTH   5   // defined for bargraph display
+
+// Extenal variables with code location information
 extern unsigned int __bss_end;
 extern unsigned int __heap_start;
 extern void *__brkval;
 
-#define CHAR_WIDTH   5
-
-
-
 /*!
  @function
  @abstract   Return available RAM memory
 #endif
 }
 
-
-static void drawBars ( LCD *myLCD, int value, uint8_t row, uint8_t barLength, char start,
-                       char end )
+static void drawBars ( LCD *myLCD, int value, uint8_t col, uint8_t row, 
+                       uint8_t barLength, char start, char end, const char title[] )
 {
    int numBars;
    
    // Set initial titles on the display
-   myLCD->setCursor (7, row);
-   myLCD->print ( "Fn" );
+   myLCD->setCursor (col, row);
+   myLCD->print ( title );
    myLCD->print (start);
    
    // Calculate the size of the bar
    {
       numBars = barLength;
    }
-   myLCD->setCursor ( 8 + 2, row );
+   myLCD->setCursor ( col + sizeof(title) + 1, row );
    
    // Draw the bars
    while ( numBars-- )
    // Draw the fractions
    numBars = value % CHAR_WIDTH;
    myLCD->print ( char(numBars) );
-   myLCD->setCursor (barLength + 8 + 2, row);
+   myLCD->setCursor (barLength + sizeof(title) + 2, row);
    myLCD->print (end);
-
-   //@TODO: clean a bit the column position, right now it is a bit of a hack.
 }
 
 
    _lcd->print ( "T:" );
    _lcd->print ( _tempCont->tempGet(), 1 );
    
-   drawBars ( _lcd, speed, 0, 5, '[', ']' );
+   drawBars ( _lcd, speed, 7, 0, 5, '[', ']', "Fn" );
 #endif
    
    pos = _machCntrl->getPosition ();