| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- #include <string.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include "stm32f10x.h"
- #include "Timer.h"
- #include "OLED.h"
- #include "GPIOA.h"
- #include "Usart1.h"
- #include "Usart2.h"
- #include "Regist.h"
- #include "PumpBusiness.h"
- #include "CONFIG.h"
- #include "mbedtls_util.h"
- #include "Timer_Module.h"
- #include "Log_Module.h"
- #include "Tuoreniot.h"
- #include "bc260y.h"
- #include "At_Module.h"
- // 计时器
- static struct TIMER_Struct timer;
- //static uint8_t send_flag = 1;
- //static char AT_CMD[512];
- //static char pridnsaddr[20];
- int main(void)
- {
- // uint8_t memmem_flag = 0;
- Timer_Init();//定时器
- Usart1_Init();//打印串口
- Usart2_Init();//4G模块通信
- GPIOA_Init();//4G模块DTR IO口
-
- OLED_Init();
- OLED_Clear();
- OLED_ShowString(1, 1, "MS:");
-
- Log_Printf_Debug("1234\r\n");
- // my_delay_ms(5000);
-
- //注册设备,最多失败三次
-
- regist_device_sync();
-
- Log_Printf_Debug("注册结束\r\n");
-
- while(1)
- {
- // 循环执行udp客户端OLED_ShowNum
- OLED_ShowNum(1, 4, time_get_delay(&timer), 6);
-
- if(time_get_delay(&timer) > 60 * 1000)
- {
-
-
- time_clear(&timer);
- }
-
-
- // if(send_flag == 1)
- // {
- // enum Result result = bc260y.exit_sleep_2_sync();
- // if(result==Result_Success)
- // {
- // Log_Printf_Debug("退出休眠成功\r\n");
- // result = bc260y.set_qisde_sync(1);//开启回显
- // }
- // if(result==Result_Success)
- // {
- // Log_Printf_Debug("开启回显成功\r\n");
- // memset(pridnsaddr, 0, sizeof(pridnsaddr));
- // result = bc260y.query_dns_sync(pridnsaddr); // 查询DNS
- // Log_Printf_Debug("DNS: %s, %d\r\n", pridnsaddr, strlen(pridnsaddr));
- // }
- // if(result==Result_Success)
- // {
- // Log_Printf_Debug("查询DNS成功\r\n");
- // if(strlen(pridnsaddr) <= 1)
- // {
- // result = bc260y.set_dns_sync("114.114.114.114", "8.8.8.8"); // 设置DNS
- // if(result==Result_Success)
- // {
- // Log_Printf_Debug("设置DNS成功\r\n");
- // memset(pridnsaddr, 0, sizeof(pridnsaddr));
- // result = bc260y.query_dns_sync(pridnsaddr); // 查询DNS
- // Log_Printf_Debug("DNS: %s, %d\r\n", pridnsaddr, strlen(pridnsaddr));
- // }
- // }
- //
- // }
- //
- // send_flag = 0;
- // }
- // AT_Handle();
-
- pump_business_loop_execution();
-
-
-
- }
-
- }
|