                 {
                     if(rssiA > rssiB)
                     {
-                        rssi=rssiA;
-                        digitalWrite(receiverA_led, HIGH);
-                        digitalWrite(receiverB_led, LOW);
+                        receiver=useReceiverA;
+                        setReceiver(useReceiverA);
                     }
                     else
                     {
-                        rssi=rssiB;
-                        digitalWrite(receiverA_led, LOW);
-                        digitalWrite(receiverB_led, HIGH);
+                        receiver=useReceiverB;
+                        setReceiver(useReceiverB);
                     }
                 }
                 else {
                     if(digitalRead(receiverA_led) == HIGH) {
-                        rssi=rssiA;
-                        digitalWrite(receiverA_led, HIGH);
-                        digitalWrite(receiverB_led, LOW);
+                        receiver=useReceiverA;
+                        setReceiver(useReceiverA);
                     }
                     else {
-                        rssi=rssiB;
-                        digitalWrite(receiverA_led, LOW);
-                        digitalWrite(receiverB_led, HIGH);
+                        receiver=useReceiverB;
+                        setReceiver(useReceiverB);
                     }
                 }
                 break;
             case useReceiverA:
-                rssi=rssiA;
-                digitalWrite(receiverA_led, HIGH);
-                digitalWrite(receiverB_led, LOW);
+                receiver=useReceiverA;
+                setReceiver(useReceiverA);
                 break;
             case useReceiverB:
-                rssi=rssiB;
-                digitalWrite(receiverB_led, HIGH);
-                digitalWrite(receiverA_led, LOW);
+                receiver=useReceiverB;
+                setReceiver(useReceiverB);
                 break;
         }
     }
 #else
-    rssi=rssiA;
     digitalWrite(receiverA_led, HIGH);
 #endif
 

#define useReceiverA 1
#define useReceiverB 2
// rssi strenth should be 2% greater than other receiver before switch.
#define DIVERSITY_CUTOVER 2
#endif


            {
                case useReceiverAuto:
                    TV.draw_rect(8,3+1*MENU_Y_SIZE,100,12,  WHITE, INVERT); // auto
                    break;
                case useReceiverA:
                    TV.draw_rect(8,3+2*MENU_Y_SIZE,100,12,  WHITE, INVERT); // receiver a
