Modbus RTU v1

This commit is contained in:
2026-06-11 16:51:52 -05:00
parent fe8acfbc2c
commit 254928cc18
1471 changed files with 39 additions and 171573 deletions

View File

@@ -105,6 +105,27 @@ static bool parse_i32(const char *s, int *out)
return true;
}
#define CONFIG_SPIFFS_BASE_PATH "/spiffs"
static void copy_csv_path(char *dst, size_t dst_size, const char *src)
{
if (dst == NULL || dst_size == 0U)
return;
if (src == NULL)
src = "";
if (src[0] == '/')
{
copy_str(dst, dst_size, src);
}
else
{
snprintf(dst, dst_size, CONFIG_SPIFFS_BASE_PATH "/%s", src);
dst[dst_size - 1U] = '\0';
}
}
static void copy_str(char *dst, size_t dst_size, const char *src)
{
if (dst == NULL || dst_size == 0U)
@@ -355,7 +376,7 @@ bool config_store_load(const char *filename, device_config_t *cfg)
}
else if (str_ieq(key, "csv"))
{
copy_str(dev->csv, sizeof(dev->csv), value);
copy_csv_path(dev->csv, sizeof(dev->csv), value);
}
}
}