   Serial.println((const char *)root["cmd"]);
 
   if (strcmp(root["cmd"], "on_off") == 0) {
-    digitalWrite(PIN_ON_OFF, LOW);
-    delay(SIM_BTN_DELAY);
-    digitalWrite(PIN_ON_OFF, HIGH);
+    press_btn(PIN_ON_OFF);
   } else if (strcmp(root["cmd"], "mode") == 0) {
-    digitalWrite(PIN_MODE, LOW);
-    delay(SIM_BTN_DELAY);
-    digitalWrite(PIN_MODE, HIGH);
+    press_btn(PIN_MODE);
   } else if (strcmp(root["cmd"], "fan") == 0) {
-    digitalWrite(PIN_FAN, LOW);
-    delay(SIM_BTN_DELAY);
-    digitalWrite(PIN_FAN, HIGH);
+    press_btn(PIN_FAN);
   } else if (strcmp(root["cmd"], "inc") == 0) {
-    digitalWrite(PIN_INC, LOW);
-    delay(SIM_BTN_DELAY);
-    digitalWrite(PIN_INC, HIGH);
+    press_btn(PIN_INC);
   } else if (strcmp(root["cmd"], "dec") == 0) {
-    digitalWrite(PIN_DEC, LOW);
-    delay(SIM_BTN_DELAY);
-    digitalWrite(PIN_DEC, HIGH);
+    press_btn(PIN_DEC);
   } else if (strcmp(root["cmd"], "get") == 0) {
     g_need_report = 1;
   }

    pinMode(SEG_PIN + i, INPUT);
  }

  pinMode(PIN_ON_OFF, OUTPUT);
  digitalWrite(PIN_ON_OFF, HIGH);
  pinMode(PIN_MODE, OUTPUT);
  digitalWrite(PIN_MODE, HIGH);
  pinMode(PIN_FAN, OUTPUT);
  digitalWrite(PIN_FAN, HIGH);
  pinMode(PIN_INC, OUTPUT);
  digitalWrite(PIN_INC, HIGH);
  pinMode(PIN_DEC, OUTPUT);
  digitalWrite(PIN_DEC, HIGH);
}

void loop() {

  handle_status();

  if (g_need_report) {
    //print_status();
    report_status();
    g_need_report = 0;
  }

