}";
#endif
+
+static const char* keepalive_fmt ="{ \"action\":\"heartbeat\", \"mac\":\"%s\" }";
+
typedef struct{
uint32_t cid;
char* mac;
static const char * weld_method_str[3] = {"TIG", "MIG", "MAG" };
+
+
char * devinfo_report_str( void )
{
static char tx_buf[500];
- static rpt_info_t to_rpt;
+ static rpt_info_t to_rpt;
+ static uint32_t last_rpt_tick = 0;
+ uint32_t now = xTaskGetTickCount();
+
+ if( last_rpt_tick == 0 )
+ last_rpt_tick = now;
if( get_new_rpt_info( &to_rpt ) < 0 ){
- return NULL;
+ if( now - last_rpt_tick < 30*1000 ){
+ //数据没有变化,不上报
+ return NULL;
+ }else{
+ //30秒上报一个心跳包
+ sprintf( (char*)tx_buf, keepalive_fmt, g_mac_str );
+ last_rpt_tick = now;
+ return tx_buf;
+ }
}
memcpy( &g_rpt_sent, &to_rpt, sizeof( g_rpt_sent ) );
g_rpt_sent.freq,
g_rpt_sent.gas
);
-
+ last_rpt_tick = now;
return tx_buf;
}