void ICACHE_FLASH_ATTR debug_UploadExceptionInfo(void* arg) { struct espconn *pespconn = (struct espconn *)arg; os_printf("reset reason: %x\n", rtc_info_dbg.reason); uint8 debug_upload_buf[DEBUG_UPLOAD_BUF_LEN]; uint8* pInfo = debug_upload_buf; os_memset(debug_upload_buf,0,DEBUG_UPLOAD_BUF_LEN); uint8 devkey[41]; os_memset(devkey,0,sizeof(devkey)); user_esp_platform_get_devkey(devkey); if (rtc_info_dbg.reason == REASON_WDT_RST || rtc_info_dbg.reason == REASON_EXCEPTION_RST || rtc_info_dbg.reason == REASON_SOFT_WDT_RST) { os_sprintf(pInfo,UPLOAD_DEBUG_LOG,rtc_info_dbg.reason,rtc_info_dbg.exccause,rtc_info_dbg.epc1, rtc_info_dbg.epc2,rtc_info_dbg.epc3,rtc_info_dbg.excvaddr, rtc_info_dbg.depc,FlashDebugBufParam.DebugVersion ,devkey); }else{ return; } //os_printf("pInfo, len: %d : \r\n%s\r\n",os_strlen(pInfo),pInfo); #if ESP_MESH_SUPPORT mesh_json_add_elem(pInfo, sizeof(pInfo), (char*)mesh_GetMdevMac(), ESP_MESH_JSON_DEV_MAC_ELEM_LEN); #endif if(0 == espconn_esp_sent(pespconn, pInfo, os_strlen(pInfo))){ debug_DropExceptionInfo(); } }
void ICACHE_FLASH_ATTR light_SendMeshBroadcastUpgrade(uint32 nonce,char* version,int pkt_len) { struct espconn* pconn = (struct espconn*)user_GetUserPConn(); uint8* pkt_upgrade = (uint8*)os_zalloc(pkt_len); if(pkt_upgrade == NULL) return; os_sprintf(pkt_upgrade,UPGRADE_BROADCAST_CMD,nonce,version); //data_send_buf(pconn, true, pkt_upgrade,os_strlen(pkt_upgrade),NULL,0); espconn_esp_sent(pconn, pkt_upgrade, os_strlen(pkt_upgrade),0); os_free(pkt_upgrade); pkt_upgrade = NULL; }