Use V307 flash

This commit is contained in:
cpq committed 2023-11-30 23:51:34 +00:00
1 parent c74534cf5e
commit 85d3e7f375
17 files changed
+1518 -1064

No files matched your search

+22
View File
@@ -4,12 +4,34 @@
#include "mongoose.h"
#include "net.h"
#define CONFIG_FILE "settings.bin"
static int s_sig_num;
static void signal_handler(int sig_num) {
signal(sig_num, signal_handler);
s_sig_num = sig_num;
}
bool web_load_settings(void *buf, size_t len) {
bool ok = false;
size_t size = 0;
void *data = mg_file_read(&mg_fs_posix, CONFIG_FILE, &size);
if (data == NULL) {
MG_ERROR(("Error reading %s", CONFIG_FILE));
} else if (size != len) {
MG_ERROR(("%s size != %lu", CONFIG_FILE, len));
} else {
memcpy(buf, data, len);
}
free(data);
return ok;
}
bool web_save_settings(void *buf, size_t len) {
MG_INFO(("Saving to %s", CONFIG_FILE));
return mg_file_write(&mg_fs_posix, CONFIG_FILE, buf, len);
}
int main(void) {
struct mg_mgr mgr;