mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-23 11:44:53 +00:00
LFS nits
This commit is contained in:
1 parent
f62f3545b4
commit
81f6acbce7
19 files changed
+258
-128
No files matched your search
@@ -150,7 +150,7 @@ static bool graph1_fn(enum mg_dash_op op, struct mg_dash_user *u) {
|
||||
return true;
|
||||
}
|
||||
static struct mg_field_set set_graph1 = {"graph1", fields_graph1, graph1_fn,
|
||||
NULL, NULL};
|
||||
NULL, NULL};
|
||||
|
||||
#define NUM_POINTS_GRAPH2 100 // How many graph2 data points to send
|
||||
static char s_graph2_data[NUM_POINTS_GRAPH2 * 4 + 2 + 1];
|
||||
@@ -218,6 +218,7 @@ void mg_dash_init(struct mg_mgr *mgr) {
|
||||
|
||||
#if MG_ARCH == MG_ARCH_UNIX
|
||||
// Create demo files in the upload directory
|
||||
mkdir("/tmp", 0755);
|
||||
mkdir("/tmp/dashboard", 0755);
|
||||
mg_file_printf(&mg_fs_posix, "/tmp/dashboard/device-config.json",
|
||||
"{\"model\":\"example\",\"fw\":\"1.0\"}");
|
||||
|
||||
@@ -778,15 +778,22 @@ a, a:visited, a:link { text-decoration: none; }
|
||||
</div>
|
||||
|
||||
<div class="note">
|
||||
<p>The two default files are fake - you can delete them</p>
|
||||
<p>However the manager works - you can upload new files. They
|
||||
are uploaded to /tmp/ directory on the device.
|
||||
This requires stdio (fopen/fread/...) implemeneted.</p>
|
||||
<p>The easiest way to implement it is to use a filesystem like
|
||||
LittleFS on your internal or external flash
|
||||
and retarget the standard library to use it.</p>
|
||||
<p>See <a href="https://github.com/cpq/bare-metal-programming-guide/tree/main/templates/lfs/nucleo-h563zi">this example</a> on how LittleFS can be implemented on
|
||||
Nucleo-H563ZI internal flash partition.</p>
|
||||
<p>This file manager uses /tmp/dashboard/ directory.
|
||||
It works on any platform that supports
|
||||
standard file IO: fopen, fread, fwrite, fclose.
|
||||
This includes Linux/Mac/Windows.</p>
|
||||
<p>
|
||||
Mongoose provides a built-in LittleFS integration that
|
||||
makes stadard file IO work on embedded systems like STM32.
|
||||
For that, add "#define MG_ENABLE_LFS 1" to your
|
||||
mongoose_config.h
|
||||
</p>
|
||||
<p>See
|
||||
<a href="https://github.com/cesanta/embedded-web-file-manager">this ready-to-build example</a>
|
||||
which implements LittleFS on Nucleo-H563ZI internal flash. You
|
||||
can upload, delete and serve files on STM32 - which is
|
||||
a perfect use case for confuration files, keeping and viewing logs, etc.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user