mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-25 20:26:41 +00:00
Fix ESP8266 unzip
This commit is contained in:
parent
37face7114
commit
b520ae0253
@ -1082,8 +1082,10 @@ void dispatchSetup()
|
|||||||
dispatch_add_command(PSTR("discovery"), dispatch_send_discovery);
|
dispatch_add_command(PSTR("discovery"), dispatch_send_discovery);
|
||||||
dispatch_add_command(PSTR("factoryreset"), dispatch_factory_reset);
|
dispatch_add_command(PSTR("factoryreset"), dispatch_factory_reset);
|
||||||
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
#if HASP_USE_SPIFFS > 0 || HASP_USE_LITTLEFS > 0
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
dispatch_add_command(PSTR("unzip"), filesystemUnzip);
|
dispatch_add_command(PSTR("unzip"), filesystemUnzip);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if HASP_USE_CONFIG > 0
|
#if HASP_USE_CONFIG > 0
|
||||||
dispatch_add_command(PSTR("setupap"), oobeFakeSetup);
|
dispatch_add_command(PSTR("setupap"), oobeFakeSetup);
|
||||||
#endif
|
#endif
|
||||||
|
@ -11,21 +11,10 @@
|
|||||||
|
|
||||||
#include "hasp_debug.h"
|
#include "hasp_debug.h"
|
||||||
#include "hasp_filesystem.h"
|
#include "hasp_filesystem.h"
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
#include "rom/crc.h"
|
#include "rom/crc.h"
|
||||||
|
|
||||||
void filesystemInfo()
|
|
||||||
{ // Get all information of your SPIFFS
|
|
||||||
#ifdef ESP8266
|
|
||||||
FSInfo fs_info;
|
|
||||||
HASP_FS.info(fs_info);
|
|
||||||
Log.verbose(TAG_FILE, "Partition size: total: %d, used: %d", fs_info.totalBytes, fs_info.usedBytes);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef ESP32
|
|
||||||
Log.verbose(TAG_FILE, "Partition size: total: %d, used: %d", HASP_FS.totalBytes(), HASP_FS.usedBytes());
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void filesystemUnzip(const char*, const char* filename)
|
void filesystemUnzip(const char*, const char* filename)
|
||||||
{
|
{
|
||||||
File zipfile = HASP_FS.open(filename, FILE_READ);
|
File zipfile = HASP_FS.open(filename, FILE_READ);
|
||||||
@ -137,6 +126,20 @@ void filesystemUnzip(const char*, const char* filename)
|
|||||||
zipfile.close();
|
zipfile.close();
|
||||||
LOG_VERBOSE(TAG_FILE, F("extracting %s complete"), filename);
|
LOG_VERBOSE(TAG_FILE, F("extracting %s complete"), filename);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void filesystemInfo()
|
||||||
|
{ // Get all information of your SPIFFS
|
||||||
|
#ifdef ESP8266
|
||||||
|
FSInfo fs_info;
|
||||||
|
HASP_FS.info(fs_info);
|
||||||
|
Log.verbose(TAG_FILE, "Partition size: total: %d, used: %d", fs_info.totalBytes, fs_info.usedBytes);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ESP32
|
||||||
|
Log.verbose(TAG_FILE, "Partition size: total: %d, used: %d", HASP_FS.totalBytes(), HASP_FS.usedBytes());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void filesystemList()
|
void filesystemList()
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,10 @@ bool filesystemSetup(void);
|
|||||||
|
|
||||||
void filesystemList();
|
void filesystemList();
|
||||||
void filesystemInfo();
|
void filesystemInfo();
|
||||||
|
|
||||||
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
void filesystemUnzip(const char*, const char* filename);
|
void filesystemUnzip(const char*, const char* filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
enum { ZIP_NO_COMPRESSION = 0, ZIP_DEFLTATE = 8 };
|
enum { ZIP_NO_COMPRESSION = 0, ZIP_DEFLTATE = 8 };
|
||||||
typedef uint16_t zip_compression_method_t;
|
typedef uint16_t zip_compression_method_t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user