0107的测试版本至公共仓库
This commit is contained in:
parent
aadb321405
commit
90f274cc04
Binary file not shown.
|
@ -0,0 +1,260 @@
|
|||
#include "app_ble_data.h"
|
||||
|
||||
extern device_parameter_t dev_par;
|
||||
extern iot_device_message_t i_dev_mess;
|
||||
extern iot_device_set_message_t i_set_mess;
|
||||
extern iot_control_t iot_ctl;
|
||||
extern rt_mailbox_t iot_mb_ctl;
|
||||
extern rtc_control_t rtc_ctl;
|
||||
/*
|
||||
* 蓝牙URC消息处理
|
||||
*/
|
||||
uint8_t b_urc_deal(uint8_t *data, uint8_t len)
|
||||
{
|
||||
rt_uint8_t *data_p = data;
|
||||
uint32_t temp = 0;
|
||||
uint8_t temp_buff[30] = {0};
|
||||
/*
|
||||
* 获取数据
|
||||
*/
|
||||
if(*data_p == 0xB0)
|
||||
{
|
||||
data_p++;
|
||||
if(*data_p == 0x01)
|
||||
{
|
||||
dev_power.ble_sleep_m = m_work;
|
||||
|
||||
if(i_set_mess.activate == true)
|
||||
{
|
||||
iot_ctl.i_bt_work = true;
|
||||
dev_power.host_sleep_m = m_work;
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_RTC, 5000);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_thread_mdelay(100);
|
||||
rt_device_write(app_ble_dev, RT_NULL, temp_buff, 23);
|
||||
}
|
||||
|
||||
LOG_OUT("BT_B0\r\n");
|
||||
}
|
||||
else if(*data_p == 0x99)
|
||||
{
|
||||
// LOG_OUT("reset\r\n");
|
||||
// dev_power.ble_sleep_m = m_work;
|
||||
// rt_device_write(app_ble_dev, RT_NULL, (uint8_t *)"B099\r\n", 6);
|
||||
// rt_thread_mdelay(1000);
|
||||
// rt_device_write(app_ble_dev, RT_NULL, (uint8_t *)"AT+DISC\r\n", 9);
|
||||
// rt_thread_mdelay(1000);
|
||||
// //复位
|
||||
// HAL_NVIC_SystemReset();
|
||||
}
|
||||
}
|
||||
else if(*data_p == 0XB1)
|
||||
{
|
||||
data_p++;
|
||||
|
||||
temp = *data_p;
|
||||
|
||||
if(*data_p == 0x01)
|
||||
{
|
||||
data_p++;
|
||||
i_set_mess.methane_low = *data_p<<8 ;
|
||||
data_p++;
|
||||
i_set_mess.methane_low |= *data_p;
|
||||
i_set_mess.methane_low *= 10;
|
||||
LOG_OUT("[%d]", i_set_mess.methane_low);
|
||||
}
|
||||
else if(*data_p == 0x02)
|
||||
{
|
||||
data_p++;
|
||||
i_set_mess.collect_period = *data_p<<8 ;
|
||||
data_p++;
|
||||
i_set_mess.collect_period |= *data_p;
|
||||
|
||||
rtc_ctl.iot_up_count = 0;
|
||||
rtc_ctl.collect_count =0;
|
||||
|
||||
i_set_mess.collect_period_save = i_set_mess.collect_period;
|
||||
|
||||
LOG_OUT("[%d]", i_set_mess.collect_period);
|
||||
|
||||
}
|
||||
else if(*data_p == 0x03)
|
||||
{
|
||||
data_p++;
|
||||
i_set_mess.up_period = *data_p<<8 ;
|
||||
data_p++;
|
||||
i_set_mess.up_period |= *data_p;
|
||||
|
||||
rtc_ctl.iot_up_count = 0;
|
||||
rtc_ctl.collect_count =0;
|
||||
|
||||
i_set_mess.up_period_save = i_set_mess.up_period;
|
||||
|
||||
LOG_OUT("[%d]", i_set_mess.up_period);
|
||||
}
|
||||
else if(*data_p == 0x04)
|
||||
{
|
||||
data_p++;
|
||||
memcpy(i_set_mess.utc, data_p, 4);
|
||||
LOG_OUT("[%x %x %x %x]", i_set_mess.utc[0],i_set_mess.utc[1],i_set_mess.utc[2],i_set_mess.utc[3]);
|
||||
}
|
||||
else if(*data_p == 0x05)
|
||||
{
|
||||
data_p++;
|
||||
i_set_mess.steal_flag = *data_p;
|
||||
LOG_OUT("[%d]", i_set_mess.steal_flag);
|
||||
}
|
||||
else if(*data_p == 0x06)
|
||||
{
|
||||
data_p++;
|
||||
i_set_mess.gps_flag = *data_p;
|
||||
LOG_OUT("[%d]", i_set_mess.gps_flag);
|
||||
}
|
||||
else if(*data_p == 0x07)
|
||||
{
|
||||
data_p++;
|
||||
memcpy(i_set_mess.app_longitude, data_p, 4);
|
||||
data_p += 4;
|
||||
memcpy(i_set_mess.app_latitude, data_p, 4);
|
||||
|
||||
LOG_OUT("[%x %x %x %x]", i_set_mess.app_longitude[0],i_set_mess.app_longitude[1],i_set_mess.app_longitude[2],i_set_mess.app_longitude[3]);
|
||||
LOG_OUT("[%x %x %x %x]", i_set_mess.app_latitude[0],i_set_mess.app_latitude[1],i_set_mess.app_latitude[2],i_set_mess.app_latitude[3]);
|
||||
}
|
||||
else if(*data_p == 0x08)
|
||||
{
|
||||
data_p++;
|
||||
i_set_mess.methane_high = *data_p<<8 ;
|
||||
data_p++;
|
||||
i_set_mess.methane_high |= *data_p;
|
||||
i_set_mess.methane_high *= 10;
|
||||
LOG_OUT("[%d]", i_set_mess.methane_high);
|
||||
}
|
||||
else if(*data_p == 0x09)
|
||||
{
|
||||
data_p++;
|
||||
i_set_mess.activate = *data_p;
|
||||
|
||||
rtc_ctl.iot_up_count = 0;
|
||||
rtc_ctl.collect_count =0;
|
||||
|
||||
LOG_OUT("[%d]", i_set_mess.activate);
|
||||
}
|
||||
else if(*data_p == 0x0A)
|
||||
{
|
||||
data_p++;
|
||||
|
||||
memcpy(i_set_mess.ip_port, data_p, 6);
|
||||
LOG_OUT("[%d %d %d %d]", i_set_mess.ip_port[0],i_set_mess.ip_port[1],i_set_mess.ip_port[2],i_set_mess.ip_port[3]);
|
||||
LOG_OUT("[%d]\r\n", (i_set_mess.ip_port[4]<<8 | i_set_mess.ip_port[5]) );
|
||||
}
|
||||
else if(*data_p == 0x0B)
|
||||
{
|
||||
LOG_OUT("dev_read\r\n");
|
||||
}
|
||||
|
||||
if(temp >= 1 && temp <= 0x0A)
|
||||
{
|
||||
temp_buff[0] = 0xB1;
|
||||
temp_buff[1] = temp;
|
||||
temp_buff[2] = 0x79;
|
||||
temp_buff[3] = 0x75;
|
||||
|
||||
rt_device_write(app_ble_dev, RT_NULL, temp_buff, 4);
|
||||
rt_thread_mdelay(10);
|
||||
LOG_OUT("B1=%d OK\r\n", temp);
|
||||
}
|
||||
else if(temp == 0x0B)
|
||||
{
|
||||
temp_buff[0] = 0xB1;
|
||||
temp_buff[1] = temp;
|
||||
temp_buff[2] = 0x19;
|
||||
temp_buff[3] = i_set_mess.activate;
|
||||
|
||||
temp_buff[4] = i_set_mess.collect_period>>8;
|
||||
temp_buff[5] = i_set_mess.collect_period&0xFF;
|
||||
|
||||
temp_buff[6] = i_set_mess.up_period>>8;
|
||||
temp_buff[7] = i_set_mess.up_period&0xFF;
|
||||
|
||||
temp_buff[8] = i_set_mess.methane_low>>8;
|
||||
temp_buff[9] = i_set_mess.methane_low&0xFF;
|
||||
|
||||
temp_buff[10] = i_set_mess.methane_high>>8;
|
||||
temp_buff[11] = i_set_mess.methane_high&0xFF;
|
||||
|
||||
memcpy(temp_buff+12, i_set_mess.ip_port, 6);
|
||||
|
||||
temp_buff[18] = i_set_mess.steal_flag;
|
||||
|
||||
temp_buff[19] = i_set_mess.gps_flag;
|
||||
|
||||
memcpy(temp_buff+20, i_set_mess.app_longitude, 4);
|
||||
memcpy(temp_buff+24, i_set_mess.app_latitude, 4);
|
||||
|
||||
rt_device_write(app_ble_dev, RT_NULL, temp_buff, 28);
|
||||
rt_thread_mdelay(10);
|
||||
LOG_OUT("B1=%d\r\n", temp);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
temp_buff[0] = 0xB1;
|
||||
temp_buff[1] = temp;
|
||||
temp_buff[2] = 0x69;
|
||||
temp_buff[3] = 0x82;
|
||||
|
||||
rt_device_write(app_ble_dev, RT_NULL, temp_buff, 4);
|
||||
rt_thread_mdelay(10);
|
||||
LOG_OUT("B1=%d ER\r\n", temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void app_bt_data_ret(void)
|
||||
{
|
||||
uint8_t temp_buff[24] = {0};
|
||||
|
||||
temp_buff[0] = 0xB0;
|
||||
temp_buff[1] = 0x01;
|
||||
|
||||
temp_buff[2] = i_dev_mess.methane[0];
|
||||
temp_buff[3] = i_dev_mess.methane[1];
|
||||
|
||||
temp_buff[4] = i_dev_mess.temperature[0];
|
||||
temp_buff[5] = i_dev_mess.temperature[1];
|
||||
|
||||
temp_buff[6] = i_dev_mess.voltage[0];
|
||||
temp_buff[7] = i_dev_mess.voltage[1];
|
||||
|
||||
temp_buff[8] = i_dev_mess.csq ;
|
||||
|
||||
temp_buff[9] = i_dev_mess.distance[0];
|
||||
temp_buff[10] = i_dev_mess.distance[1];
|
||||
|
||||
temp_buff[11] = i_dev_mess.water[1] ;
|
||||
|
||||
memcpy(temp_buff+12, i_dev_mess.gps_longitude, 4);
|
||||
memcpy(temp_buff+16, i_dev_mess.gps_latitude, 4);
|
||||
|
||||
temp_buff[20] = i_dev_mess.turn;
|
||||
|
||||
temp_buff[21] = i_dev_mess.methane_state[0];
|
||||
temp_buff[22] = i_dev_mess.methane_state[1];
|
||||
|
||||
rt_device_write(app_ble_dev, RT_NULL, temp_buff, 23);
|
||||
rt_thread_mdelay(10);
|
||||
LOG_OUT("BT_B0_RET\r\n");
|
||||
|
||||
// for(uint8_t t=0; t<23; t++)
|
||||
// {
|
||||
// LOG_OUT("%x ", temp_buff[t]);
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
#ifndef __APP_IOT_CTL_H
|
||||
#define __APP_IOT_CTL_H
|
||||
|
||||
#include "app_user.h"
|
||||
#define IOT_IP_MAX_LENGTH (60)
|
||||
#define IOT_IP_LENGTH (6)
|
||||
|
||||
#define NB_OPEN_ERR (2) //NB失败重试次数
|
||||
#define NB_OPEN_SUCC (10) //NB启动成功
|
||||
|
||||
#define NB_OTA_REQUEST_CNT (0) //升级请求
|
||||
#define NB_OTA_REQUEST_SUCC (10) //升级请求成功
|
||||
typedef enum
|
||||
{
|
||||
CMD_COLLECT = 0,
|
||||
CMD_DOWN_ACK,
|
||||
CMD_VERSION,
|
||||
CMD_OTA_MESSAGE,
|
||||
CMD_OTA_STATE,
|
||||
CMD_OTA_LOSE,
|
||||
}IOT_UP_CMD_T;
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
I_POWERON = 0,
|
||||
I_WORK,
|
||||
I_SLEEP,
|
||||
I_ALARM
|
||||
}IOT_RUN_STATE_T;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
I_CMD_IDLE = 0,
|
||||
I_CMD_POWER ,
|
||||
I_CMD_SEND ,
|
||||
I_CMD_SEND_ALARM,
|
||||
I_CMD_WAIT ,
|
||||
I_CMD_OTA_MESSAGE ,
|
||||
I_CMD_OTA_READY ,
|
||||
}IOT_SEND_CMD_T;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
I_LWM2M = 0,
|
||||
I_TCP_IP,
|
||||
}I_MODULE_TYPE_T;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
IOT_RUN_STATE_T i_run_ste;//推送AT状态
|
||||
IOT_SEND_CMD_T i_send_cmd;//发送命令
|
||||
|
||||
uint8_t i_alarm_up_flag;//报警上传
|
||||
uint8_t i_alarm_flag;//报警
|
||||
|
||||
uint16_t i_w_packet;//累积包数
|
||||
uint16_t i_w_packet_alarm;//累计报警的包数
|
||||
uint16_t i_w_packet_alarm_save;//累计报警的包数保存
|
||||
|
||||
|
||||
uint8_t i_w_flag;//写入标志
|
||||
|
||||
uint8_t i_module;//云平台
|
||||
|
||||
uint8_t i_rtc_up_flag;//rtc上传
|
||||
|
||||
uint8_t i_dev_work;//传感器工作
|
||||
uint8_t i_bt_work;//BT触发传感器
|
||||
|
||||
uint8_t i_nb_err;//NB启动异常计数
|
||||
uint8_t i_ota_request;//升级请求
|
||||
|
||||
}iot_control_t;
|
||||
|
||||
|
||||
|
||||
//EVT任务事件
|
||||
typedef enum
|
||||
{
|
||||
I_EVT_IDLE = 0,//空闲
|
||||
I_EVT_POWERON = 1,//电源上电事件
|
||||
|
||||
I_EVT_RET_SUCC = 2,//返回成功事件
|
||||
I_EVT_RET_FAIL = 3,//返回失败事件
|
||||
|
||||
I_EVT_UPDATA_SUCC = 4,//上传成功事件
|
||||
I_EVT_UPDATA_FAIL = 5,//上传失败事件
|
||||
|
||||
I_EVT_RTC = 6,//RTC触发事件
|
||||
I_EVT_SEND_ONCE = 7,//单次事件
|
||||
I_EVT_SEND_MORE = 8,//多次事件
|
||||
I_EVT_SEND_ALARM = 9,//报警事件
|
||||
|
||||
I_EVT_DOEN_ACK = 10,//下行应答
|
||||
I_EVT_VERSION = 11,//版本信息
|
||||
|
||||
I_EVT_SENSOR_REC = 12,//传感器反馈结果事件
|
||||
I_EVT_SENSOR_SEND = 13,//传感器控制参数事件
|
||||
|
||||
I_EVT_OTA_SEND = 14,//升级请求
|
||||
I_EVT_OTA_START = 15,//升级开始
|
||||
|
||||
I_EVT_SLEEP = 16,//休眠
|
||||
|
||||
}IOT_EVT_EVENT_T;
|
||||
|
||||
|
||||
|
||||
|
||||
extern iot_control_t iot_ctl;
|
||||
void iot_parameter_init(void);
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,619 @@
|
|||
#include "app_iot_ctl.h"
|
||||
|
||||
|
||||
|
||||
iot_control_t iot_ctl = {0};
|
||||
|
||||
|
||||
extern rt_timer_t iot_timer_3;
|
||||
extern rt_timer_t iot_timer_4;
|
||||
extern rt_mailbox_t iot_mb_at;
|
||||
extern rt_mailbox_t iot_mb_ctl;
|
||||
extern rt_uint8_t iot_read_buff[IOT_READ_BUFF_SIZE];
|
||||
extern rt_int16_t iot_read_len;
|
||||
|
||||
extern rt_uint8_t i_list_num;
|
||||
extern iot_cmd_list_t *i_list_select;
|
||||
|
||||
extern iot_cmd_list_t iot_list_poweron_lwm2m[];
|
||||
extern iot_cmd_list_t iot_list_updata_lwm2m[];
|
||||
extern iot_cmd_list_t iot_list_csq[];
|
||||
|
||||
extern iot_cmd_list_t iot_list_poweron_tcpip[];
|
||||
extern iot_cmd_list_t iot_list_updata_tcpip[];
|
||||
|
||||
|
||||
|
||||
extern iot_device_set_message_t i_set_mess;
|
||||
extern void i_cur_reset(void);
|
||||
|
||||
extern rt_mq_t sensor_rec_mq;
|
||||
extern rt_mq_t sensor_send_mq;
|
||||
|
||||
extern iot_device_message_t i_dev_mess;
|
||||
|
||||
extern rtc_control_t rtc_ctl;
|
||||
extern CircularBuffer ccbuff;
|
||||
|
||||
//临时变量
|
||||
uint32_t methane_temp1 =0;
|
||||
uint32_t voltage_temp2 =0;
|
||||
int16_t temperature_temp_3 =0;
|
||||
uint8_t temp1 = 0;
|
||||
|
||||
/*
|
||||
* 初始参数
|
||||
*/
|
||||
void iot_parameter_init(void)
|
||||
{
|
||||
iot_ctl.i_module = I_TCP_IP;
|
||||
|
||||
// iot_ctl.i_w_packet = 0;
|
||||
// iot_ctl.i_w_packet_alarm = 0;
|
||||
|
||||
iot_ctl.i_dev_work = false;
|
||||
iot_ctl.i_bt_work = false;
|
||||
|
||||
iot_ctl.i_nb_err = 0;
|
||||
|
||||
i_cur_reset();
|
||||
}
|
||||
/*
|
||||
* 等待云平台回应
|
||||
*/
|
||||
void iot_timeout_task_3(void *parameter)
|
||||
{
|
||||
if(iot_ctl.i_send_cmd == I_CMD_WAIT)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_OTA_SEND, 1000);
|
||||
}
|
||||
else if(iot_ctl.i_send_cmd == I_CMD_OTA_MESSAGE)
|
||||
{
|
||||
if(iot_ctl.i_ota_request++ < NB_OTA_REQUEST_CNT)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_OTA_SEND, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 超时关闭电源
|
||||
*/
|
||||
void iot_timeout_task_4(void *parameter)
|
||||
{
|
||||
if(iot_ctl.i_nb_err++ < (NB_OPEN_ERR-1) )
|
||||
{
|
||||
LOG_OUT("i_nb_err=%d\r\n", iot_ctl.i_nb_err);
|
||||
rt_timer_start(iot_timer_4);
|
||||
bsp_iot_open();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("err_close\r\n");
|
||||
|
||||
iot_ctl.i_run_ste = I_WORK;
|
||||
iot_ctl.i_send_cmd = I_CMD_POWER;
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_RET_SUCC, 1000);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 等待任务
|
||||
*/
|
||||
void iot_ctl_thread_task(void *parameter)
|
||||
{
|
||||
rt_thread_mdelay(100);
|
||||
LOG_OUT("iot_ctl_thread_task OK\r\n");
|
||||
|
||||
|
||||
uint32_t ctl_cmd = 0;
|
||||
uint32_t ctl_ret = 0;
|
||||
uint8_t rec_buff[64] = {0};
|
||||
uint32_t timestamp = 0;
|
||||
while (1)
|
||||
{
|
||||
ctl_ret = rt_mb_recv(iot_mb_ctl, &ctl_cmd, RT_WAITING_FOREVER);
|
||||
if(ctl_ret == RT_EOK)
|
||||
{
|
||||
|
||||
switch(ctl_cmd)
|
||||
{
|
||||
//空闲
|
||||
case I_EVT_IDLE:
|
||||
{
|
||||
LOG_OUT("I_EVT_IDLE\r\n");
|
||||
}
|
||||
break;
|
||||
//上电
|
||||
case I_EVT_POWERON:
|
||||
{
|
||||
LOG_OUT("I_EVT_POWERON\r\n");
|
||||
|
||||
while( (iot_read_len = rt_device_read(app_iot_dev, RT_NULL, RT_NULL, RT_NULL)) > 0)
|
||||
{
|
||||
LOG_OUT("l=%d\r\n", iot_read_len);
|
||||
for(uint8_t t=0; t<iot_read_len; t++)
|
||||
{
|
||||
LOG_OUT("%c",iot_read_buff[t]);
|
||||
}
|
||||
LOG_OUT("\r\n");
|
||||
//IP入网
|
||||
if((strstr(iot_read_buff, "+IP" ) != NULL))
|
||||
{
|
||||
rt_timer_stop(iot_timer_4);
|
||||
iot_ctl.i_nb_err = NB_OPEN_SUCC;
|
||||
|
||||
LOG_OUT("ip_ready\r\n");
|
||||
iot_ctl.i_run_ste = I_WORK;
|
||||
i_cur_reset();
|
||||
|
||||
if(iot_ctl.i_module == I_LWM2M)
|
||||
{
|
||||
i_list_select = iot_list_poweron_lwm2m;
|
||||
}
|
||||
else
|
||||
{
|
||||
i_list_select = iot_list_poweron_tcpip;
|
||||
}
|
||||
iot_ctl.i_send_cmd = I_CMD_POWER;
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
//返回成功
|
||||
case I_EVT_RET_SUCC:
|
||||
{
|
||||
LOG_OUT("I_EVT_RET_SUCC\r\n");
|
||||
//LOG_OUT("send_cmd=%d\r\n", iot_ctl.i_send_cmd);
|
||||
switch(iot_ctl.i_send_cmd)
|
||||
{
|
||||
//上电事件
|
||||
case I_CMD_POWER:
|
||||
{
|
||||
LOG_OUT("I_CMD_POWER\r\n");
|
||||
rt_timer_stop(iot_timer_4);
|
||||
|
||||
if(iot_ctl.i_bt_work == true)
|
||||
{
|
||||
LOG_OUT("i_bt_work 1\r\n");
|
||||
|
||||
iot_ctl.i_bt_work = false;
|
||||
app_bt_data_ret();
|
||||
rt_thread_mdelay(200);
|
||||
|
||||
iot_ctl.i_rtc_up_flag = true;
|
||||
}
|
||||
iot_ctl.i_dev_work = false;
|
||||
|
||||
iot_ctl.i_w_flag = false;
|
||||
|
||||
methane_temp1 = i_dev_mess.methane[0]<<8 | i_dev_mess.methane[1];
|
||||
LOG_OUT("methane=%d\r\n", methane_temp1);
|
||||
voltage_temp2 = i_dev_mess.voltage[0]<<8 | i_dev_mess.voltage[1];
|
||||
LOG_OUT("voltage=%d\r\n", voltage_temp2);
|
||||
temperature_temp_3 = i_dev_mess.temperature[0]<<8 | i_dev_mess.temperature[1];
|
||||
LOG_OUT("temper=%d\r\n", temperature_temp_3);
|
||||
//临时测试
|
||||
#if 0
|
||||
temp1 = 100;
|
||||
#endif
|
||||
|
||||
if(iot_ctl.i_nb_err != NB_OPEN_SUCC)
|
||||
{
|
||||
app_rtc_data_read(×tamp);
|
||||
|
||||
if(timestamp > TIMESTAMP_ERR_DEFAULT)
|
||||
{
|
||||
i_dev_mess.collect_time[0] = (timestamp >>24) & 0xFF;
|
||||
i_dev_mess.collect_time[1] = (timestamp >>16) & 0xFF;
|
||||
i_dev_mess.collect_time[2] = (timestamp >>8) & 0xFF;
|
||||
i_dev_mess.collect_time[3] = (timestamp ) & 0xFF;
|
||||
}
|
||||
}
|
||||
//侧翻振动
|
||||
if(i_dev_mess.turn != 0 )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//报警值存储
|
||||
if(methane_temp1 >= i_set_mess.methane_low)
|
||||
{
|
||||
i_dev_mess.logo = 0x07;
|
||||
app_iot_collect_write_cover(ALARM_SAVE, &iot_ctl.i_w_packet_alarm, &i_dev_mess, IOT_SEND_DATA_LEN);
|
||||
LOG_OUT("\r\ni_w_packet_alarm=%d\r\n", iot_ctl.i_w_packet_alarm);
|
||||
}
|
||||
//报警值判断
|
||||
if( (methane_temp1 >= i_set_mess.methane_low) ||
|
||||
(i_dev_mess.methane_state[1] != 0 ) ||
|
||||
(i_dev_mess.turn != 0 ) ||
|
||||
(temperature_temp_3 < -400 || temperature_temp_3 > 700) ||
|
||||
(voltage_temp2 < LOW_BATTERY_ALARM) ||
|
||||
(i_dev_mess.water[1] == 0x01) )
|
||||
{
|
||||
iot_ctl.i_alarm_flag = true;
|
||||
iot_ctl.i_alarm_up_flag = true;
|
||||
|
||||
LOG_OUT("i_alarm_flag\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iot_ctl.i_alarm_flag == true)
|
||||
{
|
||||
iot_ctl.i_alarm_flag = false;
|
||||
iot_ctl.i_alarm_up_flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
iot_ctl.i_w_flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
//报警上报标志
|
||||
if(iot_ctl.i_alarm_up_flag == true)
|
||||
{
|
||||
LOG_OUT("I_EVT_SEND_MORE\r\n");
|
||||
|
||||
iot_ctl.i_alarm_up_flag = false;
|
||||
i_dev_mess.logo = 0x01;
|
||||
app_iot_collect_write_cover(NORMAL_SAVE, &iot_ctl.i_w_packet, &i_dev_mess, IOT_SEND_DATA_LEN);
|
||||
|
||||
LOG_OUT("\r\ni_w_packet1=%d\r\n",iot_ctl.i_w_packet);
|
||||
|
||||
if(iot_ctl.i_nb_err == NB_OPEN_SUCC)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_MORE, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( iot_ctl.i_w_flag == true)
|
||||
{
|
||||
LOG_OUT("i_w_packet++\r\n");
|
||||
i_dev_mess.logo = 0x01;
|
||||
app_iot_collect_write_cover(NORMAL_SAVE, &iot_ctl.i_w_packet, &i_dev_mess, IOT_SEND_DATA_LEN);
|
||||
|
||||
LOG_OUT("\r\ni_w_packet2=%d\r\n",iot_ctl.i_w_packet);
|
||||
}
|
||||
|
||||
if(iot_ctl.i_rtc_up_flag == true)
|
||||
{
|
||||
LOG_OUT("i_rtc_up_flag\r\n");
|
||||
|
||||
if(iot_ctl.i_nb_err == NB_OPEN_SUCC)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_MORE, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//正常数据发送
|
||||
case I_CMD_SEND:
|
||||
{
|
||||
iot_ctl.i_w_packet--;
|
||||
LOG_OUT("I_CMD_SEND=%d\r\n",iot_ctl.i_w_packet);
|
||||
if(iot_ctl.i_w_packet >= 1)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_MORE, 1000);
|
||||
}
|
||||
else if(iot_ctl.i_w_packet == 0)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_VERSION, 1000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
//报警数据发送
|
||||
case I_CMD_SEND_ALARM:
|
||||
{
|
||||
iot_ctl.i_w_packet_alarm--;
|
||||
LOG_OUT("I_CMD_SEND_ALARM=%d\r\n",iot_ctl.i_w_packet_alarm);
|
||||
if(iot_ctl.i_w_packet_alarm >= 1)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_ALARM, 1000);
|
||||
}
|
||||
else if(iot_ctl.i_w_packet_alarm == 0)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_DOEN_ACK, 1000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
//发送完成等待下行
|
||||
case I_CMD_WAIT:
|
||||
{
|
||||
LOG_OUT("I_CMD_WAIT");
|
||||
LOG_OUT("=%d+%d\r\n",iot_ctl.i_w_packet, iot_ctl.i_w_packet_alarm);
|
||||
|
||||
if( ccbuff.read_flag_2 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(ALARM_SAVE);
|
||||
}
|
||||
|
||||
iot_ctl.i_ota_request = 0;
|
||||
rt_timer_start(iot_timer_3);
|
||||
}
|
||||
break;
|
||||
//等待升级信息
|
||||
case I_CMD_OTA_MESSAGE:
|
||||
{
|
||||
LOG_OUT("I_CMD_OTA_MESSAGE\r\n");
|
||||
rt_timer_start(iot_timer_3);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case I_CMD_OTA_READY:
|
||||
{
|
||||
LOG_OUT("I_CMD_OTA_READY\r\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
//失败关闭
|
||||
case I_EVT_RET_FAIL:
|
||||
{
|
||||
LOG_OUT("I_EVT_RET_FAIL\r\n");
|
||||
|
||||
if( ccbuff.read_flag_1 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(NORMAL_SAVE);
|
||||
}
|
||||
|
||||
if( ccbuff.read_flag_2 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(ALARM_SAVE);
|
||||
}
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
|
||||
}
|
||||
break;
|
||||
//RTC事件触发
|
||||
case I_EVT_RTC:
|
||||
{
|
||||
LOG_OUT("I_EVT_RTC %d+%d\r\n", iot_ctl.i_dev_work, iot_ctl.i_bt_work);
|
||||
|
||||
if(ccbuff.read_flag_2 == false)
|
||||
{
|
||||
if( iot_ctl.i_dev_work == false)
|
||||
{
|
||||
iot_ctl.i_dev_work = true;
|
||||
|
||||
LOG_OUT("SENSOR_CMD\r\n");
|
||||
|
||||
//主控电源开
|
||||
rt_thread_mdelay(500);
|
||||
DEV_POWER_HIGH;
|
||||
rt_thread_mdelay(500);
|
||||
|
||||
temp1 = SENSOR_CMD;
|
||||
rt_mq_send_wait(sensor_rec_mq, &temp1, 1, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//单次上传
|
||||
case I_EVT_SEND_ONCE:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
//多次上传
|
||||
//报警上次
|
||||
case I_EVT_SEND_MORE:
|
||||
case I_EVT_SEND_ALARM:
|
||||
{
|
||||
LOG_OUT("=%d+%d\r\n",iot_ctl.i_w_packet, iot_ctl.i_w_packet_alarm);
|
||||
if(ctl_cmd == I_EVT_SEND_MORE)
|
||||
{
|
||||
if(app_iot_collect_read_cover(NORMAL_SAVE, NULL, &i_dev_mess, IOT_SEND_DATA_LEN) == RT_EOK)
|
||||
{
|
||||
iot_ctl.i_send_cmd = I_CMD_SEND;
|
||||
}
|
||||
else
|
||||
{
|
||||
iot_ctl.i_w_packet = 0;
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_VERSION, 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(ctl_cmd == I_EVT_SEND_ALARM)
|
||||
{
|
||||
if(app_iot_collect_read_cover(ALARM_SAVE, NULL, &i_dev_mess, IOT_SEND_DATA_LEN) == RT_EOK)
|
||||
{
|
||||
iot_ctl.i_send_cmd = I_CMD_SEND_ALARM;
|
||||
}
|
||||
else
|
||||
{
|
||||
iot_ctl.i_w_packet_alarm = 0;
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_DOEN_ACK, 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//组包
|
||||
app_iot_up_update(CMD_COLLECT, NULL);
|
||||
LOG_OUT("I_EVT_SEND_MORE\r\n");
|
||||
i_cur_reset();
|
||||
if(iot_ctl.i_module == I_LWM2M)
|
||||
{
|
||||
i_list_select = iot_list_updata_lwm2m;
|
||||
}
|
||||
else
|
||||
{
|
||||
i_list_select = iot_list_updata_tcpip;
|
||||
}
|
||||
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 3000);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
//应答+版本
|
||||
case I_EVT_DOEN_ACK:
|
||||
case I_EVT_VERSION:
|
||||
{
|
||||
LOG_OUT("DOEN_ACK+VERSION\r\n");
|
||||
|
||||
i_cur_reset();
|
||||
|
||||
if(ctl_cmd == I_EVT_DOEN_ACK)
|
||||
{
|
||||
app_iot_up_update(CMD_DOWN_ACK, NULL);
|
||||
}
|
||||
else if(ctl_cmd == I_EVT_VERSION)
|
||||
{
|
||||
app_iot_up_update(CMD_VERSION, NULL);
|
||||
|
||||
}
|
||||
|
||||
iot_ctl.i_send_cmd = I_CMD_WAIT;
|
||||
i_list_select = iot_list_updata_tcpip;
|
||||
|
||||
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 3000);
|
||||
}
|
||||
break;
|
||||
|
||||
//接收传感器反馈
|
||||
case I_EVT_SENSOR_REC:
|
||||
{
|
||||
ctl_ret = rt_mq_recv(sensor_send_mq, rec_buff, SEND_MQ_SIZE, 5000);
|
||||
if(ctl_ret == RT_EOK)
|
||||
{
|
||||
//更新数据
|
||||
iot_device_message_update(rec_buff);
|
||||
}
|
||||
else
|
||||
{
|
||||
//清空
|
||||
memset(&i_dev_mess, 0x00, sizeof(i_dev_mess));
|
||||
}
|
||||
//IP切换
|
||||
extern uint8_t iot_ip_address[IOT_IP_MAX_LENGTH];
|
||||
extern uint8_t iot_ip_port_backup[IOT_IP_LENGTH];
|
||||
if( memcmp(i_set_mess.ip_port, iot_ip_port_backup, IOT_IP_LENGTH) != 0 )
|
||||
{
|
||||
LOG_OUT("ip_reset\r\n");
|
||||
memcpy(iot_ip_port_backup, i_set_mess.ip_port, IOT_IP_LENGTH);
|
||||
ip_with_port_to_string(NULL, iot_ip_port_backup[0], iot_ip_port_backup[1], iot_ip_port_backup[2],
|
||||
iot_ip_port_backup[3], (iot_ip_port_backup[4]<<8 | iot_ip_port_backup[5]) );
|
||||
}
|
||||
|
||||
LOG_OUT("ready_iot\r\n");
|
||||
iot_ctl.i_run_ste = I_POWERON;
|
||||
|
||||
//禁止进入低功耗
|
||||
rt_timer_stop(iot_timer_3);
|
||||
|
||||
//准备就绪
|
||||
iot_ctl.i_nb_err = 0;
|
||||
rt_timer_stop(iot_timer_4);
|
||||
rt_thread_mdelay(100);
|
||||
rt_timer_start(iot_timer_4);
|
||||
bsp_iot_open();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
//升级请求
|
||||
case I_EVT_OTA_SEND:
|
||||
{
|
||||
LOG_OUT("I_EVT_OTA_SEND\r\n");
|
||||
|
||||
i_cur_reset();
|
||||
app_iot_up_update(CMD_OTA_MESSAGE, NULL);
|
||||
iot_ctl.i_send_cmd = I_CMD_OTA_MESSAGE;
|
||||
i_list_select = iot_list_updata_tcpip;
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 3000);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
//休眠的设置
|
||||
case I_EVT_SLEEP:
|
||||
{
|
||||
LOG_OUT("IOT_EVT_SLEEP\r\n");
|
||||
|
||||
//资源监测
|
||||
extern void rtthread_info_logout(void);
|
||||
rtthread_info_logout();
|
||||
rt_thread_mdelay(1000);
|
||||
|
||||
i_cur_reset();
|
||||
bsp_iot_close();
|
||||
|
||||
device_lpuart1_switch(LPUART_PRODUCTION, 115200);
|
||||
rt_thread_mdelay(100);
|
||||
device_production_log_output();
|
||||
rt_thread_mdelay(100);
|
||||
device_lpuart1_switch(LPUART_CLOSE, NULL);
|
||||
|
||||
//甲烷浓度改变采集周期
|
||||
LOG_OUT("methane=%d\r\n", methane_temp1);
|
||||
if( (methane_temp1 >= i_set_mess.methane_low) && (methane_temp1 < i_set_mess.methane_high) )
|
||||
{
|
||||
i_set_mess.collect_period = 10;
|
||||
i_set_mess.up_period = 10;
|
||||
}
|
||||
else if( methane_temp1 >= i_set_mess.methane_high)
|
||||
{
|
||||
i_set_mess.collect_period = 5;
|
||||
i_set_mess.up_period = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
i_set_mess.collect_period = i_set_mess.collect_period_save;
|
||||
i_set_mess.up_period = i_set_mess.up_period_save;
|
||||
}
|
||||
|
||||
if( ccbuff.read_flag_1 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(NORMAL_SAVE);
|
||||
}
|
||||
|
||||
if( ccbuff.read_flag_2 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(ALARM_SAVE);
|
||||
}
|
||||
|
||||
dev_power.host_sleep_m = m_sleep;
|
||||
iot_ctl.i_dev_work = false;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
//空闲留间隙
|
||||
rt_thread_mdelay(100);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,605 @@
|
|||
#include "app_iot_ctl.h"
|
||||
|
||||
|
||||
|
||||
iot_control_t iot_ctl = {0};
|
||||
|
||||
|
||||
extern rt_timer_t iot_timer_3;
|
||||
extern rt_timer_t iot_timer_4;
|
||||
extern rt_mailbox_t iot_mb_at;
|
||||
extern rt_mailbox_t iot_mb_ctl;
|
||||
extern rt_uint8_t iot_read_buff[IOT_READ_BUFF_SIZE];
|
||||
extern rt_int16_t iot_read_len;
|
||||
|
||||
extern rt_uint8_t i_list_num;
|
||||
extern iot_cmd_list_t *i_list_select;
|
||||
|
||||
extern iot_cmd_list_t iot_list_poweron_lwm2m[];
|
||||
extern iot_cmd_list_t iot_list_updata_lwm2m[];
|
||||
extern iot_cmd_list_t iot_list_csq[];
|
||||
|
||||
extern iot_cmd_list_t iot_list_poweron_tcpip[];
|
||||
extern iot_cmd_list_t iot_list_updata_tcpip[];
|
||||
|
||||
|
||||
|
||||
extern iot_device_set_message_t i_set_mess;
|
||||
extern void i_cur_reset(void);
|
||||
|
||||
extern rt_mq_t sensor_rec_mq;
|
||||
extern rt_mq_t sensor_send_mq;
|
||||
|
||||
extern iot_device_message_t i_dev_mess;
|
||||
|
||||
extern rtc_control_t rtc_ctl;
|
||||
extern CircularBuffer ccbuff;
|
||||
|
||||
//临时变量
|
||||
uint32_t methane_temp1 =0;
|
||||
uint32_t voltage_temp2 =0;
|
||||
uint8_t temp1 = 0;
|
||||
|
||||
/*
|
||||
* 初始参数
|
||||
*/
|
||||
void iot_parameter_init(void)
|
||||
{
|
||||
iot_ctl.i_module = I_TCP_IP;
|
||||
|
||||
// iot_ctl.i_w_packet = 0;
|
||||
// iot_ctl.i_w_packet_alarm = 0;
|
||||
|
||||
iot_ctl.i_dev_work = false;
|
||||
iot_ctl.i_bt_work = false;
|
||||
|
||||
iot_ctl.i_nb_err = 0;
|
||||
|
||||
i_cur_reset();
|
||||
}
|
||||
/*
|
||||
* 等待云平台回应
|
||||
*/
|
||||
void iot_timeout_task_3(void *parameter)
|
||||
{
|
||||
if(iot_ctl.i_send_cmd == I_CMD_WAIT)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_OTA_SEND, 1000);
|
||||
}
|
||||
else if(iot_ctl.i_send_cmd == I_CMD_OTA_MESSAGE)
|
||||
{
|
||||
if(iot_ctl.i_ota_request++ < NB_OTA_REQUEST_CNT)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_OTA_SEND, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 超时关闭电源
|
||||
*/
|
||||
void iot_timeout_task_4(void *parameter)
|
||||
{
|
||||
if(iot_ctl.i_nb_err++ < (NB_OPEN_ERR-1) )
|
||||
{
|
||||
LOG_OUT("i_nb_err=%d\r\n", iot_ctl.i_nb_err);
|
||||
rt_timer_start(iot_timer_4);
|
||||
bsp_iot_open();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("err_close\r\n");
|
||||
|
||||
iot_ctl.i_run_ste = I_WORK;
|
||||
iot_ctl.i_send_cmd = I_CMD_POWER;
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_RET_SUCC, 1000);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* 等待任务
|
||||
*/
|
||||
void iot_ctl_thread_task(void *parameter)
|
||||
{
|
||||
rt_thread_mdelay(100);
|
||||
LOG_OUT("iot_ctl_thread_task OK\r\n");
|
||||
|
||||
|
||||
uint32_t ctl_cmd = 0;
|
||||
uint32_t ctl_ret = 0;
|
||||
uint8_t rec_buff[64] = {0};
|
||||
uint32_t timestamp = 0;
|
||||
while (1)
|
||||
{
|
||||
ctl_ret = rt_mb_recv(iot_mb_ctl, &ctl_cmd, RT_WAITING_FOREVER);
|
||||
if(ctl_ret == RT_EOK)
|
||||
{
|
||||
|
||||
switch(ctl_cmd)
|
||||
{
|
||||
//空闲
|
||||
case I_EVT_IDLE:
|
||||
{
|
||||
LOG_OUT("I_EVT_IDLE\r\n");
|
||||
}
|
||||
break;
|
||||
//上电
|
||||
case I_EVT_POWERON:
|
||||
{
|
||||
LOG_OUT("I_EVT_POWERON\r\n");
|
||||
|
||||
while( (iot_read_len = rt_device_read(app_iot_dev, RT_NULL, RT_NULL, RT_NULL)) > 0)
|
||||
{
|
||||
LOG_OUT("l=%d\r\n", iot_read_len);
|
||||
for(uint8_t t=0; t<iot_read_len; t++)
|
||||
{
|
||||
LOG_OUT("%c",iot_read_buff[t]);
|
||||
}
|
||||
LOG_OUT("\r\n");
|
||||
//IP入网
|
||||
if((strstr(iot_read_buff, "+IP" ) != NULL))
|
||||
{
|
||||
rt_timer_stop(iot_timer_4);
|
||||
iot_ctl.i_nb_err = NB_OPEN_SUCC;
|
||||
|
||||
LOG_OUT("ip_ready\r\n");
|
||||
iot_ctl.i_run_ste = I_WORK;
|
||||
i_cur_reset();
|
||||
|
||||
if(iot_ctl.i_module == I_LWM2M)
|
||||
{
|
||||
i_list_select = iot_list_poweron_lwm2m;
|
||||
}
|
||||
else
|
||||
{
|
||||
i_list_select = iot_list_poweron_tcpip;
|
||||
}
|
||||
iot_ctl.i_send_cmd = I_CMD_POWER;
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
//返回成功
|
||||
case I_EVT_RET_SUCC:
|
||||
{
|
||||
LOG_OUT("I_EVT_RET_SUCC\r\n");
|
||||
//LOG_OUT("send_cmd=%d\r\n", iot_ctl.i_send_cmd);
|
||||
switch(iot_ctl.i_send_cmd)
|
||||
{
|
||||
//上电事件
|
||||
case I_CMD_POWER:
|
||||
{
|
||||
LOG_OUT("I_CMD_POWER\r\n");
|
||||
rt_timer_stop(iot_timer_4);
|
||||
|
||||
if(iot_ctl.i_bt_work == true)
|
||||
{
|
||||
LOG_OUT("i_bt_work 1\r\n");
|
||||
|
||||
iot_ctl.i_bt_work = false;
|
||||
app_bt_data_ret();
|
||||
rt_thread_mdelay(200);
|
||||
|
||||
iot_ctl.i_rtc_up_flag = true;
|
||||
}
|
||||
iot_ctl.i_dev_work = false;
|
||||
|
||||
iot_ctl.i_w_flag = false;
|
||||
|
||||
methane_temp1 = i_dev_mess.methane[0]<<8 | i_dev_mess.methane[1];
|
||||
LOG_OUT("methane=%d\r\n", methane_temp1);
|
||||
voltage_temp2 = i_dev_mess.voltage[0]<<8 | i_dev_mess.voltage[1];
|
||||
LOG_OUT("voltage=%d\r\n", voltage_temp2);
|
||||
//临时测试
|
||||
#if 0
|
||||
temp1 = 100;
|
||||
#endif
|
||||
|
||||
if(iot_ctl.i_nb_err != NB_OPEN_SUCC)
|
||||
{
|
||||
app_rtc_data_read(×tamp);
|
||||
|
||||
if(timestamp > TIMESTAMP_ERR_DEFAULT)
|
||||
{
|
||||
i_dev_mess.collect_time[0] = (timestamp >>24) & 0xFF;
|
||||
i_dev_mess.collect_time[1] = (timestamp >>16) & 0xFF;
|
||||
i_dev_mess.collect_time[2] = (timestamp >>8) & 0xFF;
|
||||
i_dev_mess.collect_time[3] = (timestamp ) & 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
//报警值判断
|
||||
if((methane_temp1 >= i_set_mess.methane_low) ||
|
||||
(voltage_temp2 < LOW_BATTERY_ALARM) ||
|
||||
(i_dev_mess.water[1] == 0x01) ||
|
||||
(i_dev_mess.turn == 0x01) )
|
||||
{
|
||||
iot_ctl.i_alarm_flag = true;
|
||||
iot_ctl.i_alarm_up_flag = true;
|
||||
|
||||
i_dev_mess.logo = 0x07;
|
||||
app_iot_collect_write_cover(ALARM_SAVE, &iot_ctl.i_w_packet_alarm, &i_dev_mess, IOT_SEND_DATA_LEN);
|
||||
|
||||
LOG_OUT("\r\ni_w_packet_alarm=%d\r\n", iot_ctl.i_w_packet_alarm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(iot_ctl.i_alarm_flag == true)
|
||||
{
|
||||
iot_ctl.i_alarm_flag = false;
|
||||
iot_ctl.i_alarm_up_flag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
iot_ctl.i_w_flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
//报警上报标志
|
||||
if(iot_ctl.i_alarm_up_flag == true)
|
||||
{
|
||||
LOG_OUT("I_EVT_SEND_MORE\r\n");
|
||||
|
||||
iot_ctl.i_alarm_up_flag = false;
|
||||
i_dev_mess.logo = 0x01;
|
||||
app_iot_collect_write_cover(NORMAL_SAVE, &iot_ctl.i_w_packet, &i_dev_mess, IOT_SEND_DATA_LEN);
|
||||
|
||||
LOG_OUT("\r\ni_w_packet1=%d\r\n",iot_ctl.i_w_packet);
|
||||
|
||||
if(iot_ctl.i_nb_err == NB_OPEN_SUCC)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_MORE, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( iot_ctl.i_w_flag == true)
|
||||
{
|
||||
LOG_OUT("i_w_packet++\r\n");
|
||||
i_dev_mess.logo = 0x01;
|
||||
app_iot_collect_write_cover(NORMAL_SAVE, &iot_ctl.i_w_packet, &i_dev_mess, IOT_SEND_DATA_LEN);
|
||||
|
||||
LOG_OUT("\r\ni_w_packet2=%d\r\n",iot_ctl.i_w_packet);
|
||||
}
|
||||
|
||||
if(iot_ctl.i_rtc_up_flag == true)
|
||||
{
|
||||
LOG_OUT("i_rtc_up_flag\r\n");
|
||||
|
||||
if(iot_ctl.i_nb_err == NB_OPEN_SUCC)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_MORE, 1000);
|
||||
}
|
||||
else
|
||||
{
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//正常数据发送
|
||||
case I_CMD_SEND:
|
||||
{
|
||||
iot_ctl.i_w_packet--;
|
||||
LOG_OUT("I_CMD_SEND=%d\r\n",iot_ctl.i_w_packet);
|
||||
if(iot_ctl.i_w_packet >= 1)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_MORE, 1000);
|
||||
}
|
||||
else if(iot_ctl.i_w_packet == 0)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_VERSION, 1000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
//报警数据发送
|
||||
case I_CMD_SEND_ALARM:
|
||||
{
|
||||
iot_ctl.i_w_packet_alarm--;
|
||||
LOG_OUT("I_CMD_SEND_ALARM=%d\r\n",iot_ctl.i_w_packet_alarm);
|
||||
if(iot_ctl.i_w_packet_alarm >= 1)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SEND_ALARM, 1000);
|
||||
}
|
||||
else if(iot_ctl.i_w_packet_alarm == 0)
|
||||
{
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_DOEN_ACK, 1000);
|
||||
}
|
||||
}
|
||||
break;
|
||||
//发送完成等待下行
|
||||
case I_CMD_WAIT:
|
||||
{
|
||||
LOG_OUT("I_CMD_WAIT");
|
||||
LOG_OUT("=%d+%d\r\n",iot_ctl.i_w_packet, iot_ctl.i_w_packet_alarm);
|
||||
|
||||
if( ccbuff.read_flag_2 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(ALARM_SAVE);
|
||||
}
|
||||
|
||||
iot_ctl.i_ota_request = 0;
|
||||
rt_timer_start(iot_timer_3);
|
||||
}
|
||||
break;
|
||||
//等待升级信息
|
||||
case I_CMD_OTA_MESSAGE:
|
||||
{
|
||||
LOG_OUT("I_CMD_OTA_MESSAGE\r\n");
|
||||
rt_timer_start(iot_timer_3);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case I_CMD_OTA_READY:
|
||||
{
|
||||
LOG_OUT("I_CMD_OTA_READY\r\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
//失败关闭
|
||||
case I_EVT_RET_FAIL:
|
||||
{
|
||||
LOG_OUT("I_EVT_RET_FAIL\r\n");
|
||||
|
||||
if( ccbuff.read_flag_1 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(NORMAL_SAVE);
|
||||
}
|
||||
|
||||
if( ccbuff.read_flag_2 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(ALARM_SAVE);
|
||||
}
|
||||
//进入低功耗
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SLEEP, 1000);
|
||||
|
||||
}
|
||||
break;
|
||||
//RTC事件触发
|
||||
case I_EVT_RTC:
|
||||
{
|
||||
LOG_OUT("I_EVT_RTC %d+%d\r\n", iot_ctl.i_dev_work, iot_ctl.i_bt_work);
|
||||
|
||||
if(ccbuff.read_flag_2 == false)
|
||||
{
|
||||
if( iot_ctl.i_dev_work == false)
|
||||
{
|
||||
iot_ctl.i_dev_work = true;
|
||||
|
||||
LOG_OUT("SENSOR_CMD\r\n");
|
||||
|
||||
//主控电源开
|
||||
rt_thread_mdelay(500);
|
||||
DEV_POWER_HIGH;
|
||||
rt_thread_mdelay(500);
|
||||
|
||||
temp1 = SENSOR_CMD;
|
||||
rt_mq_send_wait(sensor_rec_mq, &temp1, 1, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
//单次上传
|
||||
case I_EVT_SEND_ONCE:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
//多次上传
|
||||
//报警上次
|
||||
case I_EVT_SEND_MORE:
|
||||
case I_EVT_SEND_ALARM:
|
||||
{
|
||||
LOG_OUT("=%d+%d\r\n",iot_ctl.i_w_packet, iot_ctl.i_w_packet_alarm);
|
||||
if(ctl_cmd == I_EVT_SEND_MORE)
|
||||
{
|
||||
if(app_iot_collect_read_cover(NORMAL_SAVE, NULL, &i_dev_mess, IOT_SEND_DATA_LEN) == RT_EOK)
|
||||
{
|
||||
iot_ctl.i_send_cmd = I_CMD_SEND;
|
||||
}
|
||||
else
|
||||
{
|
||||
iot_ctl.i_w_packet = 0;
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_VERSION, 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if(ctl_cmd == I_EVT_SEND_ALARM)
|
||||
{
|
||||
if(app_iot_collect_read_cover(ALARM_SAVE, NULL, &i_dev_mess, IOT_SEND_DATA_LEN) == RT_EOK)
|
||||
{
|
||||
iot_ctl.i_send_cmd = I_CMD_SEND_ALARM;
|
||||
}
|
||||
else
|
||||
{
|
||||
iot_ctl.i_w_packet_alarm = 0;
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_DOEN_ACK, 1000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//组包
|
||||
app_iot_up_update(CMD_COLLECT, NULL);
|
||||
LOG_OUT("I_EVT_SEND_MORE\r\n");
|
||||
i_cur_reset();
|
||||
if(iot_ctl.i_module == I_LWM2M)
|
||||
{
|
||||
i_list_select = iot_list_updata_lwm2m;
|
||||
}
|
||||
else
|
||||
{
|
||||
i_list_select = iot_list_updata_tcpip;
|
||||
}
|
||||
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 3000);
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
//应答+版本
|
||||
case I_EVT_DOEN_ACK:
|
||||
case I_EVT_VERSION:
|
||||
{
|
||||
LOG_OUT("DOEN_ACK+VERSION\r\n");
|
||||
|
||||
i_cur_reset();
|
||||
|
||||
if(ctl_cmd == I_EVT_DOEN_ACK)
|
||||
{
|
||||
app_iot_up_update(CMD_DOWN_ACK, NULL);
|
||||
}
|
||||
else if(ctl_cmd == I_EVT_VERSION)
|
||||
{
|
||||
app_iot_up_update(CMD_VERSION, NULL);
|
||||
|
||||
}
|
||||
|
||||
iot_ctl.i_send_cmd = I_CMD_WAIT;
|
||||
i_list_select = iot_list_updata_tcpip;
|
||||
|
||||
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 3000);
|
||||
}
|
||||
break;
|
||||
|
||||
//接收传感器反馈
|
||||
case I_EVT_SENSOR_REC:
|
||||
{
|
||||
ctl_ret = rt_mq_recv(sensor_send_mq, rec_buff, SEND_MQ_SIZE, 5000);
|
||||
if(ctl_ret == RT_EOK)
|
||||
{
|
||||
//更新数据
|
||||
iot_device_message_update(rec_buff);
|
||||
}
|
||||
else
|
||||
{
|
||||
//清空
|
||||
memset(&i_dev_mess, 0x00, sizeof(i_dev_mess));
|
||||
}
|
||||
//IP切换
|
||||
extern uint8_t iot_ip_address[IOT_IP_MAX_LENGTH];
|
||||
extern uint8_t iot_ip_port_backup[IOT_IP_LENGTH];
|
||||
if( memcmp(i_set_mess.ip_port, iot_ip_port_backup, IOT_IP_LENGTH) != 0 )
|
||||
{
|
||||
LOG_OUT("ip_reset\r\n");
|
||||
memcpy(iot_ip_port_backup, i_set_mess.ip_port, IOT_IP_LENGTH);
|
||||
ip_with_port_to_string(NULL, iot_ip_port_backup[0], iot_ip_port_backup[1], iot_ip_port_backup[2],
|
||||
iot_ip_port_backup[3], (iot_ip_port_backup[4]<<8 | iot_ip_port_backup[5]) );
|
||||
}
|
||||
|
||||
LOG_OUT("ready_iot\r\n");
|
||||
iot_ctl.i_run_ste = I_POWERON;
|
||||
|
||||
//禁止进入低功耗
|
||||
rt_timer_stop(iot_timer_3);
|
||||
|
||||
//准备就绪
|
||||
iot_ctl.i_nb_err = 0;
|
||||
rt_timer_stop(iot_timer_4);
|
||||
rt_thread_mdelay(100);
|
||||
rt_timer_start(iot_timer_4);
|
||||
bsp_iot_open();
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
//升级请求
|
||||
case I_EVT_OTA_SEND:
|
||||
{
|
||||
LOG_OUT("I_EVT_OTA_SEND\r\n");
|
||||
|
||||
i_cur_reset();
|
||||
app_iot_up_update(CMD_OTA_MESSAGE, NULL);
|
||||
iot_ctl.i_send_cmd = I_CMD_OTA_MESSAGE;
|
||||
i_list_select = iot_list_updata_tcpip;
|
||||
rt_mb_send_wait(iot_mb_at, I_AT_SEND, 3000);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
//休眠的设置
|
||||
case I_EVT_SLEEP:
|
||||
{
|
||||
LOG_OUT("IOT_EVT_SLEEP\r\n");
|
||||
|
||||
//资源监测
|
||||
extern void rtthread_info_logout(void);
|
||||
rtthread_info_logout();
|
||||
rt_thread_mdelay(1000);
|
||||
|
||||
i_cur_reset();
|
||||
bsp_iot_close();
|
||||
|
||||
device_lpuart1_switch(LPUART_PRODUCTION, 115200);
|
||||
rt_thread_mdelay(100);
|
||||
device_production_log_output();
|
||||
rt_thread_mdelay(100);
|
||||
device_lpuart1_switch(LPUART_CLOSE, NULL);
|
||||
|
||||
//甲烷浓度改变采集周期
|
||||
LOG_OUT("methane=%d\r\n", methane_temp1);
|
||||
if( (methane_temp1 >= i_set_mess.methane_low) && (methane_temp1 < i_set_mess.methane_high) )
|
||||
{
|
||||
i_set_mess.collect_period = 10;
|
||||
i_set_mess.up_period = 10;
|
||||
}
|
||||
else if( methane_temp1 >= i_set_mess.methane_high)
|
||||
{
|
||||
i_set_mess.collect_period = 5;
|
||||
i_set_mess.up_period = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
i_set_mess.collect_period = i_set_mess.collect_period_save;
|
||||
i_set_mess.up_period = i_set_mess.up_period_save;
|
||||
}
|
||||
|
||||
if( ccbuff.read_flag_1 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(NORMAL_SAVE);
|
||||
}
|
||||
|
||||
if( ccbuff.read_flag_2 == true)
|
||||
{
|
||||
app_iot_collect_read_retreat(ALARM_SAVE);
|
||||
}
|
||||
|
||||
dev_power.host_sleep_m = m_sleep;
|
||||
iot_ctl.i_dev_work = false;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
//空闲留间隙
|
||||
rt_thread_mdelay(100);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,267 @@
|
|||
#include "app_sensor_ctl.h"
|
||||
|
||||
rt_thread_t sensor_ctl_thread = RT_NULL;
|
||||
rt_mq_t sensor_rec_mq = RT_NULL;
|
||||
rt_mq_t sensor_send_mq = RT_NULL;
|
||||
|
||||
sensor_scan_control_t sensor_ctl = {0};
|
||||
sensor_data_t sensor_data = {0};
|
||||
extern iot_device_set_message_t i_set_mess;
|
||||
|
||||
extern rt_mailbox_t iot_mb_ctl;
|
||||
|
||||
void sensor_ctl_thread_task(void *parameter)
|
||||
{
|
||||
rt_thread_mdelay(100);
|
||||
LOG_OUT("sensor_ctl_thread_task\r\n");
|
||||
|
||||
uint8_t rec_cmd = 0;
|
||||
rt_uint32_t ctl_ret = 0;
|
||||
|
||||
sensor_ctl.mode = sleep_mode;
|
||||
sensor_ctl.step = idle_step;
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
ctl_ret = rt_mq_recv(sensor_rec_mq, &rec_cmd, 1, RT_WAITING_FOREVER);
|
||||
if(ctl_ret == RT_EOK)
|
||||
{
|
||||
//LOG_OUT("rec_cmd=%x\r\n", rec_cmd);
|
||||
if(rec_cmd == SENSOR_CMD)
|
||||
{
|
||||
sensor_ctl.step = methane_step;
|
||||
sensor_ctl.mode = work_mode;
|
||||
|
||||
//清空
|
||||
memset(&sensor_data, 0x00, sizeof(sensor_data));
|
||||
|
||||
//测试点禁止采集
|
||||
//sensor_ctl.step = finish_step;
|
||||
|
||||
while(sensor_ctl.step < finish_step)
|
||||
{
|
||||
//LOG_OUT("step=%d\r\n", sensor_ctl.step);
|
||||
rt_thread_mdelay(100);
|
||||
switch(sensor_ctl.step)
|
||||
{
|
||||
case methane_step:
|
||||
{
|
||||
if(app_gas_data_read(&sensor_data.methane, &sensor_data.temperature, &sensor_data.air, &sensor_data.err) == true)
|
||||
{
|
||||
LOG_OUT("methane=%d ", sensor_data.methane);
|
||||
LOG_OUT("te=%d ", sensor_data.temperature);
|
||||
LOG_OUT("a=%d ", sensor_data.air);
|
||||
LOG_OUT("err=%d\r\n", sensor_data.err);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("methane err\r\n");
|
||||
}
|
||||
sensor_ctl.step++;
|
||||
}
|
||||
break;
|
||||
|
||||
case triaxial_step:
|
||||
{
|
||||
if( i_set_mess.steal_flag == true)
|
||||
{
|
||||
if( app_triaxial_data_read(&sensor_data.direction_x, &sensor_data.direction_y, &sensor_data.direction_z, &sensor_data.shake) == true)
|
||||
{
|
||||
LOG_OUT("x=%d ", sensor_data.direction_x);
|
||||
LOG_OUT("y=%d ", sensor_data.direction_y);
|
||||
LOG_OUT("z=%d\r\n", sensor_data.direction_z);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("triaxial_err\r\n");
|
||||
}
|
||||
}
|
||||
sensor_ctl.step++;
|
||||
}
|
||||
break;
|
||||
|
||||
case temperature_step:
|
||||
{
|
||||
if( app_temper_data_read(&sensor_data.temper, &sensor_data.humidity) == true)
|
||||
{
|
||||
LOG_OUT("temper=%d ", sensor_data.temper);
|
||||
LOG_OUT("hu=%d\r\n", sensor_data.humidity);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("temperature_err\r\n");
|
||||
}
|
||||
sensor_ctl.step++;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case distance_step:
|
||||
{
|
||||
if( app_distance_data_read(&sensor_data.distance) == true)
|
||||
{
|
||||
LOG_OUT("distance=%d\r\n", sensor_data.distance);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("distance_err\r\n");
|
||||
}
|
||||
sensor_ctl.step++;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case water_step:
|
||||
{
|
||||
if( app_water_data_read(&sensor_data.water ) == true)
|
||||
{
|
||||
LOG_OUT("water=%d\r\n", sensor_data.water);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("water_err\r\n");
|
||||
}
|
||||
sensor_ctl.step++;
|
||||
}
|
||||
break;
|
||||
//RTC使用模组更新时间
|
||||
case rtc_step:
|
||||
{
|
||||
// if( app_rtc_data_read(&sensor_data.timestamp ) == true)
|
||||
// {
|
||||
// LOG_OUT("rtc_step ok\r\n");
|
||||
// LOG_OUT("timestamp=%d\r\n", sensor_data.timestamp);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// LOG_OUT("rtc_step err\r\n");
|
||||
// }
|
||||
sensor_ctl.step++;
|
||||
}
|
||||
break;
|
||||
|
||||
case battery_step:
|
||||
{
|
||||
//adc_work_open();
|
||||
//rt_thread_mdelay(100);
|
||||
|
||||
if( app_battery_data_read(&sensor_data.battery ) == true)
|
||||
{
|
||||
LOG_OUT("battery=%d\r\n", sensor_data.battery);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("battery_err\r\n");
|
||||
}
|
||||
sensor_ctl.step++;
|
||||
|
||||
//adc_work_close();
|
||||
}
|
||||
break;
|
||||
|
||||
case gps_step:
|
||||
{
|
||||
if(i_set_mess.gps_flag == true)
|
||||
{
|
||||
//禁用gps功能
|
||||
#if 1
|
||||
if( app_gps_data_read(&sensor_data.latitude, &sensor_data.longitude) == true)
|
||||
{
|
||||
LOG_OUT("latitude=%d ", sensor_data.latitude);
|
||||
LOG_OUT("longitude=%d\r\n", sensor_data.longitude);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("gps_err\r\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
sensor_ctl.step++;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case finish_step:
|
||||
{
|
||||
LOG_OUT("finish_ok\r\n");
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//数据块大小
|
||||
uint8_t sensor_size = sizeof(sensor_data);
|
||||
LOG_OUT("s_size=%dByte\r\n", sensor_size);
|
||||
//采集完成
|
||||
rt_mb_send_wait(iot_mb_ctl, I_EVT_SENSOR_REC, 5000);
|
||||
rt_thread_mdelay(100);
|
||||
//反馈数据
|
||||
rt_mq_send_wait(sensor_send_mq, &sensor_data, sizeof(sensor_data), 5000);
|
||||
}
|
||||
rt_thread_mdelay(200);
|
||||
|
||||
for(uint8_t t=0; t<5; t++)
|
||||
{
|
||||
ctl_ret = rt_mq_recv(sensor_rec_mq, &rec_cmd, 1, 100);
|
||||
LOG_OUT("ret=%d\r\n", ctl_ret);
|
||||
if(ctl_ret == -RT_ETIMEOUT)
|
||||
{
|
||||
LOG_OUT("RT_ETIMEOUT\r\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rt_uint8_t sensor_ctl_thread_init(void)
|
||||
{
|
||||
sensor_ctl_thread = rt_thread_create("sensor",
|
||||
sensor_ctl_thread_task,
|
||||
RT_NULL,
|
||||
SENSOR_CTL_THREAD_SIZE,
|
||||
SENSOR_CTL_THREAD_PRIORITY,
|
||||
SENSOR_CTL_THREAD_TICK);
|
||||
|
||||
if (sensor_ctl_thread != RT_NULL)
|
||||
{
|
||||
rt_thread_startup(sensor_ctl_thread);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_OUT("sensor_startup ERR\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
rt_uint8_t sensor_ctl_messagequeue_init(void)
|
||||
{
|
||||
sensor_rec_mq = rt_mq_create("s_r_mq",
|
||||
REC_MQ_SIZE,
|
||||
REC_MQ_NUM,
|
||||
RT_IPC_FLAG_FIFO);
|
||||
if(sensor_rec_mq != RT_NULL)
|
||||
{
|
||||
LOG_OUT("sensor_rec_mq ok\r\n");
|
||||
}
|
||||
|
||||
sensor_send_mq = rt_mq_create("s_s_mq",
|
||||
SEND_MQ_SIZE,
|
||||
SEND_MQ_NUM,
|
||||
RT_IPC_FLAG_FIFO);
|
||||
if(sensor_send_mq != RT_NULL)
|
||||
{
|
||||
LOG_OUT("sensor_send_mq ok\r\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int app_sensor_init(void)
|
||||
{
|
||||
|
||||
sensor_ctl_thread_init();
|
||||
sensor_ctl_messagequeue_init();
|
||||
}
|
|
@ -0,0 +1,288 @@
|
|||
#include "bsp_temperature.h"
|
||||
|
||||
|
||||
rt_device_t bsp_temper_dev = RT_NULL;
|
||||
extern iic_control_t iic_ctl_temper;
|
||||
|
||||
#if USE_IIC_EXTEND_TEMP
|
||||
|
||||
rt_err_t temper_init(rt_device_t dev)
|
||||
{
|
||||
uint32_t serial_number = 0;
|
||||
|
||||
user_iic_init();
|
||||
|
||||
LOG_OUT("temper_init\r\n");
|
||||
|
||||
uint8_t data_read[6] = {0};
|
||||
|
||||
user_iic_read_byte_more_16bit(SHT3X_ADDR, SHT3X_SERIAL_NUM, data_read, 6);
|
||||
|
||||
if( SHT3X_CRC_Check(data_read, 2, data_read[2]) == 1)
|
||||
{
|
||||
if( SHT3X_CRC_Check(data_read+3, 2, data_read[5]) == 1)
|
||||
{
|
||||
LOG_OUT("SHT3X_CRC_Check ok\r\n");
|
||||
}
|
||||
}
|
||||
for(uint8_t t=0; t<6; t++)
|
||||
{
|
||||
LOG_OUT("%x=%x\r\n", t, data_read[t]);
|
||||
}
|
||||
LOG_OUT("\r\n");
|
||||
|
||||
serial_number = (data_read[0]<<24) |
|
||||
(data_read[1]<<16) |
|
||||
(data_read[3]<<8) |
|
||||
(data_read[4]) ;
|
||||
|
||||
LOG_OUT("serial_number=%d \r\n", serial_number);
|
||||
return RT_EOK;
|
||||
}
|
||||
#else
|
||||
|
||||
rt_err_t temper_init(rt_device_t dev)
|
||||
{
|
||||
uint32_t serial_number = 0;
|
||||
//打开
|
||||
SHT3X_HIGH;
|
||||
SHT3X_SCL_HIGH;
|
||||
SHT3X_SDA_HIGH;
|
||||
rt_thread_mdelay(1000);
|
||||
|
||||
user_iic_init_extend(&iic_ctl_temper);
|
||||
|
||||
LOG_OUT("temper_init\r\n");
|
||||
|
||||
uint8_t data_read[6] = {0};
|
||||
|
||||
user_iic_read_byte_more_16bit_extend(&iic_ctl_temper, SHT3X_ADDR, SHT3X_SERIAL_NUM, data_read, 6);
|
||||
|
||||
for(uint8_t t=0; t<6; t++)
|
||||
{
|
||||
LOG_OUT("%x=%x\r\n", t, data_read[t]);
|
||||
}
|
||||
LOG_OUT("\r\n");
|
||||
|
||||
if( SHT3X_CRC_Check(data_read, 2, data_read[2]) == 1)
|
||||
{
|
||||
if( SHT3X_CRC_Check(data_read+3, 2, data_read[5]) == 1)
|
||||
{
|
||||
LOG_OUT("SHT3X_CRC_Check ok\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
serial_number = (data_read[0]<<24) |
|
||||
(data_read[1]<<16) |
|
||||
(data_read[3]<<8) |
|
||||
(data_read[4]) ;
|
||||
|
||||
LOG_OUT("serial_number=%d \r\n", serial_number);
|
||||
|
||||
//关闭
|
||||
SHT3X_LOW;
|
||||
SHT3X_SCL_LOW;
|
||||
SHT3X_SDA_LOW;
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
rt_err_t temper_open(rt_device_t dev, rt_uint16_t oflag)
|
||||
{
|
||||
//LOG_OUT("temper_open\r\n");
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
rt_err_t temper_close(rt_device_t dev)
|
||||
{
|
||||
//LOG_OUT("temper_close\r\n");
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
#if USE_IIC_EXTEND_TEMP
|
||||
|
||||
rt_size_t temper_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
|
||||
{
|
||||
LOG_OUT("temper_read\r\n");
|
||||
|
||||
uint8_t data_r[6] = {0};
|
||||
float Temperature = 0;
|
||||
float Humidity = 0;
|
||||
|
||||
user_iic_read_byte_more_16bit(SHT3X_ADDR, SHT3X_READ_DATA, data_r, 6);
|
||||
|
||||
for(uint8_t t=0; t<6; t++)
|
||||
{
|
||||
LOG_OUT("%x ",data_r[t]);
|
||||
}
|
||||
LOG_OUT("\r\n");
|
||||
|
||||
if( SHT3X_CRC_Check(data_r, 2, data_r[2]) == 1)
|
||||
{
|
||||
if( SHT3X_CRC_Check(data_r+3, 2, data_r[5]) == 1)
|
||||
{
|
||||
LOG_OUT("SHT3X_CRC_Check ok\r\n");
|
||||
|
||||
Temperature = data_r[0] << 8 | data_r[1];
|
||||
Humidity = data_r[3] << 8 | data_r[4];
|
||||
Temperature = (Temperature * 175.0 / 65535) - 45.0;
|
||||
Humidity = Humidity * 100.0 / 65535;
|
||||
LOG_OUT("Temperature=%f \r\n", Temperature);
|
||||
LOG_OUT("Humidity=%f \r\n", Humidity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
#else
|
||||
|
||||
|
||||
rt_size_t temper_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
|
||||
{
|
||||
LOG_OUT("temper_read\r\n");
|
||||
|
||||
uint8_t data_r[6] = {0};
|
||||
float Temperature = 0;
|
||||
float Humidity = 0;
|
||||
|
||||
int temp =0;
|
||||
uint8_t temp_buff[4] = {0};
|
||||
|
||||
//打开
|
||||
SHT3X_HIGH;
|
||||
SHT3X_SCL_HIGH;
|
||||
SHT3X_SDA_HIGH;
|
||||
rt_thread_mdelay(1000);
|
||||
|
||||
user_iic_read_byte_more_16bit_extend(&iic_ctl_temper, SHT3X_ADDR, SHT3X_READ_DATA, data_r, 6);
|
||||
for(uint8_t t=0; t<6; t++)
|
||||
{
|
||||
LOG_OUT("%x ",data_r[t]);
|
||||
}
|
||||
LOG_OUT("\r\n");
|
||||
|
||||
//关闭
|
||||
SHT3X_LOW;
|
||||
SHT3X_SCL_LOW;
|
||||
SHT3X_SDA_LOW;
|
||||
|
||||
if( SHT3X_CRC_Check(data_r, 2, data_r[2]) == 1)
|
||||
{
|
||||
if( SHT3X_CRC_Check(data_r+3, 2, data_r[5]) == 1)
|
||||
{
|
||||
LOG_OUT("CRC_Check ok\r\n");
|
||||
|
||||
Temperature = data_r[0] << 8 | data_r[1];
|
||||
Humidity = data_r[3] << 8 | data_r[4];
|
||||
Temperature = (Temperature * 175.0 / 65535) - 45.0;
|
||||
Humidity = Humidity * 100.0 / 65535;
|
||||
LOG_OUT("Temperature=%f \r\n", Temperature);
|
||||
LOG_OUT("Humidity=%f \r\n", Humidity);
|
||||
|
||||
temp = (short int)((Temperature+0.05)*10);
|
||||
|
||||
if(temp >= 0)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = (-(temp))|0x8000;
|
||||
}
|
||||
|
||||
temp_buff[0] = (temp>>8)&0xFF;
|
||||
temp_buff[1] = (temp)&0xFF;
|
||||
LOG_OUT("temp=%d \r\n", temp);
|
||||
|
||||
|
||||
temp = (int)((Humidity+0.05)*10);
|
||||
temp_buff[2] = (temp>>8)&0xFF;
|
||||
temp_buff[3] = (temp)&0xFF;
|
||||
LOG_OUT("hum=%d \r\n", temp);
|
||||
|
||||
memcpy(buffer, temp_buff, 4);
|
||||
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
rt_size_t temper_write(rt_device_t dev, rt_off_t pos, void *buffer, rt_size_t size)
|
||||
{
|
||||
//LOG_OUT("temper_write\r\n");
|
||||
}
|
||||
|
||||
rt_err_t temper_control(rt_device_t dev, int cmd, void *args)
|
||||
{
|
||||
//LOG_OUT("temper_control\r\n");
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
||||
int bsp_temper_init(void)
|
||||
{
|
||||
bsp_temper_dev = rt_device_create(RT_Device_Class_Char, 1);
|
||||
if(bsp_temper_dev == RT_NULL)
|
||||
{
|
||||
LOG_OUT("bsp_temper_dev ERR!!!\r\n");
|
||||
}
|
||||
|
||||
bsp_temper_dev->init = temper_init;
|
||||
bsp_temper_dev->open = temper_open;
|
||||
bsp_temper_dev->close = temper_close;
|
||||
bsp_temper_dev->read = temper_read;
|
||||
bsp_temper_dev->write = NULL;
|
||||
bsp_temper_dev->control = NULL;
|
||||
|
||||
rt_device_register(bsp_temper_dev, "temper", RT_DEVICE_FLAG_RDWR);
|
||||
|
||||
LOG_OUT("bsp_temper_init ok\r\n");
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
|
||||
uint8_t SHT3X_CRC_Check(uint8_t *check_data, uint8_t num, uint8_t check_crc)
|
||||
{
|
||||
uint8_t bit = 0; // bit mask
|
||||
uint8_t crc = 0xFF; // calculated checksum
|
||||
uint8_t byteCtr = 0; // byte counter
|
||||
|
||||
// calculates 8-Bit checksum with given polynomial x8+x5+x4+1
|
||||
for(byteCtr = 0; byteCtr < num; byteCtr++)
|
||||
{
|
||||
crc ^= (*(check_data+byteCtr));
|
||||
//crc校验,最高位是1就^0x31
|
||||
for(bit = 8; bit > 0; --bit)
|
||||
{
|
||||
if(crc & 0x80)
|
||||
crc = (crc << 1) ^ 0x31;
|
||||
else
|
||||
crc = (crc << 1);
|
||||
}
|
||||
}
|
||||
|
||||
LOG_OUT("crc=%x \r\n", crc);
|
||||
|
||||
if(crc==check_crc)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_SEGGER_RTT.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_SEGGER_RTT.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_SEGGER_RTT.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_SEGGER_RTT.h.sisc
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_rtt_log.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_rtt_log.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_rtt_log.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_RTT_rtt_log.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_battery.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_battery.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_battery.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_battery.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_at.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_at.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_at.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_at.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_ctl.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_ctl.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_ctl.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_ctl.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_data.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_data.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_data.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ble_data.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_dev.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_dev.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_dev.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_dev.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_distance.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_distance.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_distance.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_distance.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gas.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gas.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gas.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gas.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gps.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gps.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gps.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_gps.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_at.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_at.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_at.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_at.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_ctl.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_ctl.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_ctl.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_ctl.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_data.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_data.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_data.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_data.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_save.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_save.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_save.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_iot_save.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota_ctl.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota_ctl.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota_ctl.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_ota_ctl.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_rtc.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_rtc.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_rtc.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_rtc.h.sisc
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_triaxial.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_triaxial.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_triaxial.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_triaxial.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_water.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_water.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_water.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_app_app_water.h.sisc
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_applications_main.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_applications_main.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_at24c512.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_at24c512.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_at24c512.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_at24c512.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_battery.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_battery.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_battery.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_battery.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_ble.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_ble.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_ble.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_ble.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_distance.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_distance.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_distance.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_distance.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_eeprom.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_eeprom.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_eeprom.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_eeprom.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gas.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gas.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gas.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gas.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gps.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gps.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gps.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_gps.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iic.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iic.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iic.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iic.h.sisc
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iot.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iot.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iot.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_iot.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_power.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_power.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_power.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_power.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_rtc.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_rtc.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_rtc.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_rtc.h.sisc
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_triaxial.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_triaxial.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_triaxial.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_triaxial.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_uart.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_uart.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_uart.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_uart.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_w25q16.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_w25q16.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_w25q16.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_w25q16.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_water.c.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_water.c.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_water.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_bsp_bsp_water.h.sisc
vendored
Normal file
Binary file not shown.
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_cconfig.h.sisc
vendored
Normal file
BIN
app_wells_0107/source insight/wells.si4project/cache/parse/workspace1_wells_cconfig.h.sisc
vendored
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue