@@ -782,12 +782,11 @@ void Force::start_up_menu() {
782782 tft.setCursor (40 , 5 );
783783 tft.setTextColor (ST7735_MAGENTA);
784784 tft.println (" Menu" );
785-
786785 tft.setCursor (0 , 20 );
787786 tft.setTextColor (ST7735_CYAN);
788787
789788 // option 0
790- tft.print (" device #: " );
789+ tft.print (" device #: " );
791790 tft.println (FRC);
792791 if (option == 0 ) {
793792 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
@@ -806,7 +805,7 @@ void Force::start_up_menu() {
806805 }
807806
808807 // option 1
809- tft.print (" Trial window: " );
808+ tft.print (" Trial window: " );
810809 tft.println (trial_window);
811810 if (option == 1 ) {
812811 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
@@ -826,9 +825,14 @@ void Force::start_up_menu() {
826825 }
827826
828827 // option 2
829- tft.print (" Left lever: " );
830- if (LeftActive == 1 ) tft.println (" Active" );
831- if (LeftActive == 0 ) tft.println (" Inactive" );
828+ tft.print (" Left lever: " );
829+ if (LeftActive == 1 ) {
830+ tft.println (" Active" );
831+ } else if (LeftActive == 0 ) {
832+ tft.println (" Inactive" );
833+ } else {
834+ tft.println (LeftActive);
835+ }
832836 if (option == 2 ) {
833837 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
834838 start_timer = millis ();
@@ -846,7 +850,7 @@ void Force::start_up_menu() {
846850 }
847851
848852 // option 3
849- tft.print (" Right lever: " );
853+ tft.print (" Right lever: " );
850854 if (RightActive == 1 ) tft.println (" Active" );
851855 if (RightActive == 0 ) tft.println (" Inactive" );
852856 if (option == 3 ) {
@@ -886,7 +890,7 @@ void Force::start_up_menu() {
886890 }
887891
888892 // option 5
889- tft.print (" force_req_Right: " );
893+ tft.print (" force_req_Right: " );
890894 tft.print (reqRight);
891895 tft.println (" g" );
892896 if (option == 5 ) {
@@ -977,7 +981,7 @@ void Force::start_up_menu() {
977981 tft.setTextColor (ST7735_CYAN);
978982
979983 // option 6
980- tft.print (" hold_Left: " );
984+ tft.print (" hold_Left: " );
981985 tft.print (hold_timeLeft);
982986 tft.println (" ms" );
983987 if (option == 6 ) {
@@ -986,20 +990,20 @@ void Force::start_up_menu() {
986990 Click ();
987991 hold_timeLeft += 10 ;
988992 delay (250 );
989- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
993+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
990994
991995 }
992996 if (! (buttons & TFTWING_BUTTON_LEFT)) {
993997 start_timer = millis ();
994998 Click ();
995999 hold_timeLeft -= 10 ;
9961000 delay (250 );
997- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1001+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
9981002 }
9991003 }
10001004
10011005 // option 7
1002- tft.print (" hold_Right: " );
1006+ tft.print (" hold_Right: " );
10031007 tft.print (hold_timeRight);
10041008 tft.println (" ms" );
10051009 if (option == 7 ) {
@@ -1008,35 +1012,35 @@ void Force::start_up_menu() {
10081012 Click ();
10091013 hold_timeRight += 10 ;
10101014 delay (250 );
1011- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1015+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10121016
10131017 }
10141018 if (! (buttons & TFTWING_BUTTON_LEFT)) {
10151019 start_timer = millis ();
10161020 Click ();
10171021 hold_timeRight -= 10 ;
10181022 delay (250 );
1019- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1023+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10201024 }
10211025 }
10221026
10231027 // option 8
1024- tft.print (" ratio Left: " );
1028+ tft.print (" ratio Left: " );
10251029 tft.println (ratioLeft);
10261030 if (option == 8 ) {
10271031 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
10281032 start_timer = millis ();
10291033 ratioLeft ++;
10301034 delay (250 );
1031- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1035+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10321036
10331037 }
10341038 if (! (buttons & TFTWING_BUTTON_LEFT)) {
10351039 start_timer = millis ();
10361040 ratioLeft --;
10371041 if (ratioLeft < 0 ) ratioLeft = 0 ;
10381042 delay (250 );
1039- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1043+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10401044 }
10411045 }
10421046
@@ -1048,54 +1052,54 @@ void Force::start_up_menu() {
10481052 start_timer = millis ();
10491053 ratioRight ++;
10501054 delay (250 );
1051- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1055+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10521056
10531057 }
10541058 if (! (buttons & TFTWING_BUTTON_LEFT)) {
10551059 start_timer = millis ();
10561060 ratioRight --;
10571061 if (ratioRight < 0 ) ratioRight = 0 ;
10581062 delay (250 );
1059- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1063+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10601064 }
10611065 }
10621066
10631067 // option 10
1064- tft.print (" dispense_delay: " );
1068+ tft.print (" dispense_delay: " );
10651069 tft.print (dispense_delay);
1066- tft.println (" s" );
1070+ tft.println (" s" );
10671071 if (option == 10 ) {
10681072 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
10691073 start_timer = millis ();
10701074 dispense_delay += 1 ;
10711075 delay (250 );
1072- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1076+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10731077
10741078 }
10751079 if (! (buttons & TFTWING_BUTTON_LEFT)) {
10761080 start_timer = millis ();
10771081 dispense_delay -= 1 ;
10781082 delay (250 );
1079- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1083+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10801084 }
10811085 }
10821086
10831087 // option 11
1084- tft.print (" dispense_amount: " );
1088+ tft.print (" dispense_amount: " );
10851089 tft.print (dispense_amount);
10861090 if (option == 11 ) {
10871091 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
10881092 start_timer = millis ();
10891093 dispense_amount += 100 ;
10901094 delay (250 );
1091- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1095+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10921096
10931097 }
10941098 if (! (buttons & TFTWING_BUTTON_LEFT)) {
10951099 start_timer = millis ();
10961100 dispense_amount -= 100 ;
10971101 delay (250 );
1098- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1102+ tft.fillRect (0 , (( option - 6 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
10991103 }
11001104 }
11011105
@@ -1174,16 +1178,16 @@ void Force::start_up_menu() {
11741178 tft.setTextColor (ST7735_CYAN);
11751179
11761180 // option 12
1177- tft.print (" timeout: " );
1181+ tft.print (" timeout: " );
11781182 tft.print (timeout_length);
1179- tft.println (" s" );
1183+ tft.println (" s" );
11801184 if (option == 12 ) {
11811185 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
11821186 start_timer = millis ();
11831187 Click ();
11841188 timeout_length += 1 ;
11851189 delay (250 );
1186- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1190+ tft.fillRect (0 , (( option - 12 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
11871191
11881192 }
11891193 if (! (buttons & TFTWING_BUTTON_LEFT)) {
@@ -1196,7 +1200,7 @@ void Force::start_up_menu() {
11961200 }
11971201
11981202 // option 13
1199- tft.print (" Prog ratio: " );
1203+ tft.print (" Prog ratio: " );
12001204 if (PR == 0 ) tft.println (" off" );
12011205 if (PR == 1 ) tft.println (" on" );
12021206 if (option == 13 ) {
@@ -1205,14 +1209,14 @@ void Force::start_up_menu() {
12051209 delay (250 );
12061210 PR = 1 ;
12071211 ratioLeft = 1 ; // all PR sessions will have the FR ratio of 1
1208- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1212+ tft.fillRect (0 , (( option - 12 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
12091213
12101214 }
12111215 if (! (buttons & TFTWING_BUTTON_LEFT)) {
12121216 start_timer = millis ();
12131217 delay (250 );
12141218 PR = 0 ;
1215- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1219+ tft.fillRect (0 , (( option - 12 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
12161220 }
12171221 }
12181222
@@ -1224,33 +1228,33 @@ void Force::start_up_menu() {
12241228 start_timer = millis ();
12251229 delay (250 );
12261230 trials_per_block ++;
1227- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1231+ tft.fillRect (0 , (( option - 12 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
12281232
12291233 }
12301234 if (! (buttons & TFTWING_BUTTON_LEFT)) {
12311235 start_timer = millis ();
12321236 delay (250 );
12331237 trials_per_block --;
1234- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1238+ tft.fillRect (0 , (( option - 12 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
12351239 }
12361240 }
12371241
12381242 // option 15
1239- tft.print (" Max force: " );
1243+ tft.print (" Max force: " );
12401244 tft.print (max_force);
12411245 tft.println (" g" );
12421246 if (option == 15 ) {
12431247 if (! (buttons & TFTWING_BUTTON_RIGHT)) {
12441248 start_timer = millis ();
12451249 delay (250 );
12461250 max_force ++;
1247- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1251+ tft.fillRect (0 , (( option - 12 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
12481252 }
12491253 if (! (buttons & TFTWING_BUTTON_LEFT)) {
12501254 start_timer = millis ();
12511255 delay (250 );
12521256 max_force--;
1253- tft.fillRect (0 , (option * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
1257+ tft.fillRect (0 , (( option - 12 ) * 8 ) + 19 , 160 , 9 , ST7735_BLUE); // highlight active bar
12541258 }
12551259 }
12561260
0 commit comments