 
   JsonArray& st = root.createNestedArray("status");
   for (int i = 0; i < CHILD_NUM; i++) {
-    st.add(g_status[i]);
+    st.add(g_child[i]->GetCtrl());
   }
   g_body_len = root.printTo((char *)g_buf + HEADER_LEN, BUF_LEN - HEADER_LEN);
 

  }
}

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  //Serial.setTimeout(100);
  Serial.println("setup...");

  for (int i = 0; i < CHILD_NUM; i++) {
    pinMode(FIRST_PIN + i, OUTPUT);
//    digitalWrite(FIRST_PIN + i, LOW);
  }

  get_all_status();
}

void loop() {
  // put your main code here, to run repeatedly:
  handle_input();

  if (millis() - g_check_ms > 1000) {
    check_status();
    g_check_ms = millis();
  }

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

  delay(20);
}

#define HEADER_LEN 4
#define BUF_LEN 256
#define FLAG_CHAR 0xaa

#define FIRST_PIN_CTRL 3
#define FIRST_PIN_LED 6
#define FIRST_PIN_PWM 9
#define FIRST_PIN_TOUCH A1

/* 检测到 MAX_LOW_CNT 次小于 MAX_LOW_ANNALOG 的电压后, 认为是面板发出了关的信号 */
#define MAX_LOW_CNT 16
#define MAX_LOW_ANNALOG 192

#define CHILD_NUM 1


class Child;

const char *g_devid = "switch_0";

uint8_t g_header[HEADER_LEN];
