]> git.defcon.no Git - rctxduino/commitdiff
Added debug/status display of DR switches to display/UI Branch_7fcb511ebdc1482a0d8a5a200e0e6a3a82c4a3d9
authorJon Langseth <jon.langseth@lilug.no>
Sun, 18 Mar 2012 21:15:08 +0000 (22:15 +0100)
committerJon Langseth <jon.langseth@lilug.no>
Sun, 18 Mar 2012 21:15:08 +0000 (22:15 +0100)
fixed a DR-related bug in process_inputs()

source/RCTXDuino/RCTXDuino.pde

index f4661da586946b160b07bce027fcb1ee5c7e145f..1afb5ea66db2dfa7184ce33b5f5ac159f8c60540 100644 (file)
@@ -642,7 +642,7 @@ void process_inputs(void )
     // Test to see if dualrate-switch #1 applies to channel...
     if ( ( current_input == ( model.dr[2]-1) ) || ( current_input == ( model.dr[3]-1) ) )
     {
-            if ( !keys[KEY_DR1] )
+            if ( !keys[KEY_DR2] )
                     dr_val = ((float)model.dr[6])/100.0; 
             else
                     dr_val = ((float)model.dr[7])/100.0;
@@ -844,15 +844,29 @@ void ui_handler()
   switch ( displaystate )
   {
     case VALUES:
-      int current_input;
-         row = 1;
+         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 == 5)
+               if (row == 6)
                {
-                       row = 1;
-                       col = 44;
+                       row = 2;
+                       col = 40;
                }
 
         // Overwriting the needed positions with
@@ -860,13 +874,27 @@ void ui_handler()
         // 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;