added application log file in storage partition
This commit is contained in:
parent
832bd3e623
commit
918ac98b35
|
|
@ -40,5 +40,6 @@ esp_err_t spi_device_polling_transmit_synchronized(spi_device_handle_t handle, s
|
|||
|
||||
bool GetUserAppNeedReset(void);
|
||||
void SetUserAppNeedReset(bool res);
|
||||
void LogFile(char *fname, char *mess);
|
||||
|
||||
#endif /* COMPONENTS_WEBGUIAPPCOMPONENT_INCLUDE_WEBGUIAPP_H_ */
|
||||
|
|
|
|||
|
|
@ -65,7 +65,6 @@ StaticSemaphore_t xSemaphoreSPIBuf;
|
|||
|
||||
#define NETWORK_START_TIMEOUT (5)
|
||||
|
||||
static int NetworkStartTimeout = 0;
|
||||
static bool isUserAppNeedReset = false;
|
||||
|
||||
static void InitSysIO(void);
|
||||
|
|
@ -511,3 +510,22 @@ void SetUserAppNeedReset(bool res)
|
|||
isUserAppNeedReset = res;
|
||||
}
|
||||
|
||||
void LogFile(char *fname, char *mess)
|
||||
{
|
||||
char filename[32];
|
||||
strcpy(filename, "/data/");
|
||||
strcat(filename, fname);
|
||||
FILE *f = fopen(filename, "a");
|
||||
if (f == NULL)
|
||||
{
|
||||
ESP_LOGE(TAG, "Failed to open file %s for writing", filename);
|
||||
return;
|
||||
}
|
||||
fwrite(esp_log_system_timestamp(), 1, 12, f);
|
||||
fwrite(" ", 1, 1, f);
|
||||
fwrite(mess, 1, strlen(mess), f);
|
||||
fwrite("\r\n", 1, 2, f);
|
||||
fclose(f);
|
||||
ESP_LOGI(TAG, "File written to %s", filename);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user