]> git.defcon.no Git - rctxduino/commitdiff
Code cleanup in display routine.
authorJon Langseth <jon.langseth@lilug.no>
Sun, 18 Mar 2012 21:20:11 +0000 (22:20 +0100)
committerJon Langseth <jon.langseth@lilug.no>
Sun, 18 Mar 2012 21:20:11 +0000 (22:20 +0100)
source/RCTXDuino/RCTXDuino.pde

index 1afb5ea66db2dfa7184ce33b5f5ac159f8c60540..a317dfa6d9e6971f4bf516b985b8aa23ba847e65 100644 (file)
@@ -843,63 +843,54 @@ void ui_handler()
 
   switch ( displaystate )
   {
-    case VALUES:
-         int current_input;
+               case VALUES:
+               int current_input;
+
+               row = 0; col = 0;
+               lcd.setCursor(col, row);
+               lcd.print("            ");
+               lcd.setCursor(col, row);
+
+               lcd.print("S1:");
+               lcd.print( keys[KEY_DR1] ? "On " : "Off" );
+               lcd.print(" S2:");
+               lcd.print( keys[KEY_DR2] ? "On " : "Off" );
+
+               row = 2; col = 0;
+               for (current_input=0; current_input<MAX_INPUTS; current_input++) {
+                       if (row == 6)
+                       {
+                               row = 2;
+                               col = 40;
+                       }
 
+                       // Overwriting the needed positions with
+                       // blanks cause less display-flicker than
+                       // actually clearing the display...
+                       lcd.setCursor(col, row);
+                       lcd.print("      ");
+                       lcd.setCursor(col, row);
+                       
+                       char mod_indicator = NULL;
+                       if (( keys[KEY_DR1] ) && (( model.dr[0] == current_input+1) || ( model.dr[1] == current_input+1)))
+                               mod_indicator = '/';
+                       if (( keys[KEY_DR2] ) && (( model.dr[2] == current_input+1) || ( model.dr[3] == current_input+1)))
+                               if (mod_indicator) mod_indicator = '|';
+                               else mod_indicator = '\\';
+                       
+                       if ( mod_indicator) lcd.print(mod_indicator);
+                       else lcd.print(" ");
+                       
+                       lcd.print( current_input+1);
+                       lcd.print(":");
+                       // Display uses percents, while PPM uses ratio....
+                       // New format on stick values
+                       lcd.print( (int)model.stick[current_input] );
 
-         row = 0;
-         col = 0;
-         
-         lcd.setCursor(col, row);
-         lcd.print("            ");
-       
-         lcd.setCursor(col, row);
-         lcd.print("S1:");
-         lcd.print( keys[KEY_DR1] ? "On " : "Off" );
-         lcd.print(" S2:");
-         lcd.print( keys[KEY_DR2] ? "On " : "Off" );
-
-         row = 2;
-         col = 0;
-         
-      for (current_input=0; current_input<MAX_INPUTS; current_input++) {
-               if (row == 6)
-               {
-                       row = 2;
-                       col = 40;
+                       row++;
                }
-
-        // Overwriting the needed positions with
-        // blanks cause less display-flicker than
-        // actually clearing the display...
-        lcd.setCursor(col, row);
-        lcd.print("      ");
-
-        lcd.setCursor(col, row);
-               
-               char mod_indicator = NULL;
-               
-               if (( keys[KEY_DR1] ) && (( model.dr[0] == current_input+1) || ( model.dr[1] == current_input+1)))
-                       mod_indicator = '/';
-
-               if (( keys[KEY_DR2] ) && (( model.dr[2] == current_input+1) || ( model.dr[3] == current_input+1)))
-                       if (mod_indicator) mod_indicator = '|';
-                       else mod_indicator = '\\';
-               
-               if ( mod_indicator) lcd.print(mod_indicator);
-               else lcd.print(" ");
-               
-               lcd.print( current_input+1);
-               lcd.print(":");
-        // Display uses percents, while PPM uses ratio....
-               // New format on stick values
-               lcd.print( (int)model.stick[current_input] );
-
-               row++;
-      }
       break;
 
-
     case BATTERY:    
       lcd.setCursor(0 , 0);
       lcd.print("Battery level: ");