资源简介
本人测试分别使用远程服务器和本地服务器都可以实现OTA无线升级,升级后的程序稳定运行

代码片段和文件信息
/******************************************************************************
* Copyright 2015-2018 Espressif Systems (Wuxi)
*
* Description: entry file of user application
*
* Modification history:
* 2015/3/06 v1.0 create this file.
*******************************************************************************/
#include “c_types.h“
#include “user_interface.h“
#include “espconn.h“
#include “mem.h“
#include “osapi.h“
#include “upgrade.h“
#include “hsuser.h“
#ifdef OTA_UPGRADE_SUPPORT
void ICACHE_FLASH_ATTR ota_finished_callback(void *arg)
{
struct upgrade_server_info *update = arg;
if (update->upgrade_flag == true)
{
os_printf(“[OTA]success; rebooting!\n“);
system_upgrade_reboot();
}
else
{
os_printf(“[OTA]failed!\n“);
}
os_free(update->pespconn);
os_free(update->url);
os_free(update);
}
void ICACHE_FLASH_ATTR ota_start_Upgrade(uint8_t serverVersion const char *server_ip uint16_t port const char *path)
{
const char* file;
uint8_t userBin = system_upgrade_userbin_check();
switch (userBin)
{
case UPGRADE_FW_BIN1: file = “user2.4096.new.4.bin“; break; // user2.bin
case UPGRADE_FW_BIN2: file = “user1.4096.new.4.bin“; break; // user1.bin
default:
os_printf(“[OTA]Invalid userbin number!\n“);
return;
}
uint16_t version=1;
if (serverVersion <= version)
{
os_printf(“[OTA]No update. Server version:%d local version %d\n“ serverVersion version);
return;
}
os_printf(“[OTA]Upgrade available version: %d\n“ serverVersion);
struct upgrade_server_info* update = (struct upgrade_server_info *)os_zalloc(sizeof(struct upgrade_server_info));
update->pespconn = (struct espconn *)os_zalloc(sizeof(struct espconn));
os_memcpy(update->ip server_ip 4);
update->port = port;
os_printf(“[OTA]Server “IPSTR“:%d. Path: [%s]file: [%s]\n“ IP2STR(update->ip) update->port path file);
update->check_cb = ota_finished_callback;
update->check_times = 10000;
update->url = (uint8 *)os_zalloc(512);
os_sprintf((char*)update->url
“GET /%s%s HTTP/1.1\r\n“
“Host: “IPSTR“:%d\r\n“
“Connection: keep-alive\r\n“
“\r\n“
path file IP2STR(update->ip) update->port);
if (system_upgrade_start(update) == false)
{
os_printf(“[OTA]Could not start upgrade\n“);
os_free(update->pespconn);
os_free(update->url);
os_free(update);
}
else
{
os_printf(“[OTA]Upgrading...\n“);
}
}
#endif
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4374970 2017-10-12 14:36 wifi空中升级\2a-esp8266-sdk_getting_started_guide_cn.pdf
文件 1586971 2017-10-12 14:36 wifi空中升级\99c-esp8266_fota_upgrade_cn.pdf
文件 86171 2017-10-11 15:14 wifi空中升级\EasyWebSvr1.9.zip
文件 2444 2017-10-12 13:58 wifi空中升级\ota_upgrade.c
文件 1218 2017-10-12 15:34 wifi空中升级\wifi无线升级说明.txt
文件 143464 2017-10-12 15:12 wifi空中升级\服务器使用教程.docx
目录 0 2017-10-12 15:12 wifi空中升级
----------- --------- ---------- ----- ----
6195238 7
- 上一篇:ARCHIBUS案例
- 下一篇:基于nrf51822的TSM12触控例程
相关资源
- Global existence and behavior in thehigher-dim
- IBM TotalStorage7133串行磁盘系统高级型号
- IBM totalstorage NAS 500网关
- IBM TotalStorage NAS 200用户参考指南
- IBM TotalStorage FAStT200存储阵列
- IBM TotalStorage DS8000 性能白皮书
- IBM TotalStorage FAStT900存储阵列
- IBM TotalStorage DS4100产品手册
- IBM TotalStorage DS4400产品手册
- IBM TotalStorage DS4500产品手册
- IBM TotalStorage DS6000产品手册
- ComparePlugin.dll
- IBM TotalStorage DS300 和 DS400产品手册
- 思科力助新西兰Otago大学教育网智能建
- IBM TotalStorage FAStT600存储服务器
- Total Commander 9.21a KEY 注册
- Synthesis of Cyclohexanone-formaldehyde Resi
- One-pot synthesis of benzothiazolones from 2-h
- esp8266 win10驱动 cp2102
- CSDN文件---ESP8266.rar
- stm32103c8t6ESP8266串口转WIFI模块TCP服务器
- ESP8266ESP8266安卓控制端源代码
- 洛达153x OTA升级软件包加说明
- XP win7启动菜单修复工具NTBOOTautofix v
- nudemcu相关工具和固件测试稳定
- 单片机通过ESP8266上传温湿度数据
- STM32F407ZG_ESP8266例程
- ESP8266最新稳定版固件
- ESP8266AP模式控制51单片机亮灯.docx
- ESP8266使用MQTT协议连接阿里云
评论
共有 条评论