|  | 
 
| https://club.gizwits.com/forum.php?mod=viewthread&tid=169268&highlight=esp8266按照上述的配网步骤走下来,机智云的代码也移植了,连线和烧录部分都没有什么问题,ESP8266和STM32单片机的通信也是畅通的,为什么连接不上呢? int main(void)
 { // 初始化外设
 ADCX_Init();
 Timer2_Init(9, 14398);
 Uart2_Init(115200);  // 初始化 USART2,波特率为 115200
 Uart1_Init(115200);
 IWDG_Init();
 OLED_Init();
 Bmp_Init();
 DHT11_Init();
 Key_Init();
 MOTOR_Init();
 LED_Init();
 Buzzer_Init();
 userInit();
 gizwitsInit();
 // 从 Flash 读取阈值
 Sensorthreshold.luxValue = FLASH_R(FLASH_START_ADDR);
 Sensorthreshold.smokeValue = FLASH_R(FLASH_START_ADDR + 2);
 Sensorthreshold.COValue = FLASH_R(FLASH_START_ADDR + 4);
 Sensorthreshold.AQIValue = FLASH_R(FLASH_START_ADDR + 6);
 GENERAL_TIM_Init();
 while (1)
 {
 IWDG_ReloadCounter(); // 重置看门狗;
 // 1. 处理协议(优先级最高)
 gizwitsHandle((dataPoint_t *)¤tDataPoint);
 // 2. 读取传感器数据
 SensorScan();
 // 3. 控制电机
 MotorOperation();
 // 4. 处理按键和显示
 if (KeyNum == KEY_1)
 {
 KeyNum = 0;
 model = !model;
 if (!model)
 {
 LED_OFF();
 Buzzer_OFF();
 }
 }
 // 5. 更新 OLED 显示
 if (oledPages == DISPLAY_PAGE1)
 {
 OLED_Menu1();
 SensorDataDisplay1();
 }
 else if (oledPages == DISPLAY_PAGE2)
 {
 OLED_Menu2();
 SensorDataDisplay2();
 }
 else if (oledPages == SETTINGS_PAGE)
 {
 OLED_SetInterfacevoid();
 OLED_Option(SetSelection());
 ThresholdModification(SetSelection());
 }
 // 6. 处理用户逻辑
 userHandle();
 }
 }
 
 
  
 | 
 |