Added flash upload function

This commit is contained in:
Jeroen Domburg
2015-07-23 16:10:51 +08:00
parent 7242baead5
commit 2fb0e70d9f
4 changed files with 35 additions and 17 deletions
+19 -5
View File
@@ -47,10 +47,22 @@ int myPassFn(HttpdConnData *connData, int no, char *user, int userLen, char *pas
}
#ifdef ESPFS_POS
CgiUploadEspfsParams espfsParams={
.espFsPos=ESPFS_POS,
.espFsSize=ESPFS_SIZE
CgiUploadFlashDef uploadParams={
.type=CGIFLASH_TYPE_ESPFS,
.fw1Pos=ESPFS_POS,
.fw2Pos=0,
.fwSize=ESPFS_SIZE,
};
#define INCLUDE_FLASH_FNS
#endif
#ifdef OTA_FLASH_SIZE_K
CgiUploadFlashDef uploadParams={
.type=CGIFLASH_TYPE_FW,
.fw1Pos=0x1000,
.fw2Pos=((OTA_FLASH_SIZE_K*1024)/2)+0x1000,
.fwSize=((OTA_FLASH_SIZE_K*1024)/2)-0x1000,
};
#define INCLUDE_FLASH_FNS
#endif
/*
@@ -71,8 +83,10 @@ HttpdBuiltInUrl builtInUrls[]={
{"/index.tpl", cgiEspFsTemplate, tplCounter},
{"/led.cgi", cgiLed, NULL},
{"/flash/download", cgiReadFlash, NULL},
{"/flash/next", cgiGetFirmwareNext, NULL},
{"/flash/upload", cgiUploadFirmware, NULL},
#ifdef INCLUDE_FLASH_FNS
{"/flash/next", cgiGetFirmwareNext, &uploadParams},
{"/flash/upload", cgiUploadFirmware, &uploadParams},
#endif
{"/flash/reboot", cgiRebootFirmware, NULL},
//Routines to make the /wifi URL and everything beneath it work.