 // create an instance of the TFT library
 TFT TFTscreen = TFT(cs, dc, rst);
 
-boolean displayRefresh = false;
+#define DISPLAY_REFRESH_L   0x01
+#define DISPLAY_REFRESH_C1  0x02
+#define DISPLAY_REFRESH_C2  0x04
+#define DISPLAY_REFRESH_SWR 0x08
+#define DISPLAY_REFRESH_BSY 0x10
+
+uint8_t displayRefreshFlags = 0;
 boolean isBusy = false;
 
 // char array

void busReceiver(char cmd, uint8_t length, const TCommand *payload) {
  switch (cmd) {
    case cmdStatus: {
        Serial.print("cnt=");
        Serial.print(payload->status.cnt);
        Serial.print(", Value fwd=");
        Serial.print(payload->status.adc.fwd);
        Serial.print(", Value rfl=");
        Serial.println(payload->status.adc.rfl);

        float rfl = payload->status.adc.rfl;
        float fwd = payload->status.adc.fwd;
        float p = (rfl / fwd);
        valueSWR = (1 + p) / (1 - p);

        valueRotateL = payload->status.pos.lPos;
        valueRotateC1 = payload->status.pos.c1Pos;
        valueRotateC2 = payload->status.pos.c2Pos;
        isBusy = payload->status.flags > 0;

        displayRefresh = true;
        break;
      }
    case cmdDebug: {

      */
    }
  }
  if (displayRefreshFlags != 0) {

    if ((displayRefreshFlags & DISPLAY_REFRESH_SWR) != 0) {
      displaySWRvalue();
      displayRefreshFlags &= ~DISPLAY_REFRESH_SWR;
    }
    if ((displayRefreshFlags & DISPLAY_REFRESH_L) != 0) {
      EraseDisplayL();
      displayL();
      displayRefreshFlags &= ~DISPLAY_REFRESH_L;
    }
    if ((displayRefreshFlags & DISPLAY_REFRESH_C1) != 0) {
      EraseDisplayC1();
      displayC1();
      displayRefreshFlags &= ~DISPLAY_REFRESH_C1;
    }
    if ((displayRefreshFlags & DISPLAY_REFRESH_C2) != 0) {
      EraseDisplayC2();
      displayC2();
      displayRefreshFlags &= ~DISPLAY_REFRESH_C2;
    }
    if ((displayRefreshFlags & DISPLAY_REFRESH_BSY) != 0) {
      if (!isBusy) {
        TFTscreen.stroke(255, 255, 0);                  // set the font color
        digitalWrite(40, LOW);
      } else {
        TFTscreen.stroke(0, 20, 20);
        digitalWrite(40, HIGH);
      }
      TFTscreen.setTextSize(1);
      TFTscreen.text("Ready", 50, 115);                // write the text to coordinates
      displayRefreshFlags &= ~DISPLAY_REFRESH_BSY;
    }
  }
}
