资源简介
本人测试分别使用远程服务器和本地服务器都可以实现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触控例程
相关资源
- stm32+esp8266上传数据到移动onenet平台
- ESP8266无线模块资料
- ESP8266 OLED 4Pin0.96 IIC测试程序.rar
- Total Commander v9.21a最新破解版
- ESP8266 wifi模块驱动代码
- ESP8266 调试工具
- ESP8266和STM32做server收发数据代码
- ESP8266原理图及库文件 altium designer
- ESP8266安卓APP
- ESP8266开发固件MQTT服务器
- ESP8266-01-01sRelay继电器模块的使用.zi
- STM32+OV2640+ESP8266图片传输
- STM32F407_ESP8266连接机智云
- struts2+spring2.5+hibernate3.2 annotation配置完
- STM32+ESP8266+smartconfig配网.zip
- Morehotair笑谈热设计_[美科迪班_著]_2
- STM32+ESP8266实现物联网
- potatsolite.zip
- ESP8266开发,实现MQTT客户端,与MQTT服
- TotalCommand8.52a全套包含注册Key-资源管
- STM32+ESP8266智能农场i项目开发程序
- ESP8266_RTOS_SDK-3.0
- ESP8266控制APP+源码合集.zip
- 超级好用卸载软件-Total_Uninstall_Pro_v
- 乐鑫8266官方开发资料
- esp8266 所有例程
- STM32 OV2640 ESP8266图像传输
- 基于DHT11的室内温湿度检测系统毕业设
- ESP8266WIFI模块.zip
- ESP8266WIFI模块学习资料
评论
共有 条评论