Fix the log format.
This commit is contained in:
parent
0fc1073e91
commit
8a4dabed62
|
@ -23,7 +23,7 @@ Connect the board to PC by serial port and open the PC serial terminal.
|
||||||
support 2 kinds of IDEs
|
support 2 kinds of IDEs
|
||||||
|
|
||||||
- Keil MDK: open `RVMDK\FlashDB.uvprojx`
|
- Keil MDK: open `RVMDK\FlashDB.uvprojx`
|
||||||
- [RT-Thread Studio](https://www.rt-thread.io/studio.html): import this folder by import wizard
|
- [RT-Studio](https://www.rt-thread.io/studio.html): import this folder by import wizard
|
||||||
|
|
||||||
### Step3: build and download
|
### Step3: build and download
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ Connect the board to PC by serial port and open the PC serial terminal.
|
||||||
support 2 kinds of IDEs
|
support 2 kinds of IDEs
|
||||||
|
|
||||||
- Keil MDK: open `RVMDK\FlashDB.uvprojx`
|
- Keil MDK: open `RVMDK\FlashDB.uvprojx`
|
||||||
- [RT-Thread Studio](https://www.rt-thread.io/studio.html): import this folder by import wizard
|
- [RT-Studio](https://www.rt-thread.io/studio.html): import this folder by import wizard
|
||||||
|
|
||||||
### Step3: build and download
|
### Step3: build and download
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ Connect the board to PC by serial port and open the PC serial terminal.
|
||||||
support 2 kinds of IDEs
|
support 2 kinds of IDEs
|
||||||
|
|
||||||
- Keil MDK: open `RVMDK\FlashDB.uvprojx`
|
- Keil MDK: open `RVMDK\FlashDB.uvprojx`
|
||||||
- [RT-Thread Studio](https://www.rt-thread.io/studio.html): import this folder by import wizard
|
- [RT-Studio](https://www.rt-thread.io/studio.html): import this folder by import wizard
|
||||||
|
|
||||||
### Step3: build and download
|
### Step3: build and download
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ void kvdb_basic_sample(fdb_kvdb_t kvdb)
|
||||||
struct fdb_blob blob;
|
struct fdb_blob blob;
|
||||||
int boot_count = 0;
|
int boot_count = 0;
|
||||||
|
|
||||||
|
FDB_INFO("==================== kvdb_basic_sample ====================\n");
|
||||||
|
|
||||||
{ /* GET the KV value */
|
{ /* GET the KV value */
|
||||||
/* get the "boot_count" KV value */
|
/* get the "boot_count" KV value */
|
||||||
fdb_kv_get_blob(kvdb, "boot_count", fdb_blob_make(&blob, &boot_count, sizeof(boot_count)));
|
fdb_kv_get_blob(kvdb, "boot_count", fdb_blob_make(&blob, &boot_count, sizeof(boot_count)));
|
||||||
|
@ -41,6 +43,8 @@ void kvdb_basic_sample(fdb_kvdb_t kvdb)
|
||||||
fdb_kv_set_blob(kvdb, "boot_count", fdb_blob_make(&blob, &boot_count, sizeof(boot_count)));
|
fdb_kv_set_blob(kvdb, "boot_count", fdb_blob_make(&blob, &boot_count, sizeof(boot_count)));
|
||||||
FDB_INFO("set the 'boot_count' value to %d\n", boot_count);
|
FDB_INFO("set the 'boot_count' value to %d\n", boot_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FDB_INFO("===========================================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FDB_USING_KVDB */
|
#endif /* FDB_USING_KVDB */
|
||||||
|
|
|
@ -21,6 +21,8 @@ void kvdb_type_blob_sample(fdb_kvdb_t kvdb)
|
||||||
{
|
{
|
||||||
struct fdb_blob blob;
|
struct fdb_blob blob;
|
||||||
|
|
||||||
|
FDB_INFO("==================== kvdb_type_blob_sample ====================\n");
|
||||||
|
|
||||||
{ /* CREATE new Key-Value */
|
{ /* CREATE new Key-Value */
|
||||||
int temp_data = 36;
|
int temp_data = 36;
|
||||||
|
|
||||||
|
@ -54,6 +56,8 @@ void kvdb_type_blob_sample(fdb_kvdb_t kvdb)
|
||||||
fdb_kv_del(kvdb, "temp");
|
fdb_kv_del(kvdb, "temp");
|
||||||
FDB_INFO("delete the 'temp' finish\n");
|
FDB_INFO("delete the 'temp' finish\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FDB_INFO("===========================================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FDB_USING_KVDB */
|
#endif /* FDB_USING_KVDB */
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
void kvdb_type_string_sample(fdb_kvdb_t kvdb)
|
void kvdb_type_string_sample(fdb_kvdb_t kvdb)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
FDB_INFO("==================== kvdb_type_string_sample ====================\n");
|
||||||
{ /* CREATE new Key-Value */
|
{ /* CREATE new Key-Value */
|
||||||
char temp_data[10] = "36C";
|
char temp_data[10] = "36C";
|
||||||
|
|
||||||
|
@ -54,6 +56,8 @@ void kvdb_type_string_sample(fdb_kvdb_t kvdb)
|
||||||
fdb_kv_del(kvdb, "temp");
|
fdb_kv_del(kvdb, "temp");
|
||||||
FDB_INFO("delete the 'temp' finish\n");
|
FDB_INFO("delete the 'temp' finish\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FDB_INFO("===========================================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FDB_USING_KVDB */
|
#endif /* FDB_USING_KVDB */
|
||||||
|
|
|
@ -32,6 +32,8 @@ void tsdb_sample(fdb_tsdb_t tsdb)
|
||||||
{
|
{
|
||||||
struct fdb_blob blob;
|
struct fdb_blob blob;
|
||||||
|
|
||||||
|
FDB_INFO("==================== tsdb_sample ====================\n");
|
||||||
|
|
||||||
{ /* APPEND new TSL (time series log) */
|
{ /* APPEND new TSL (time series log) */
|
||||||
struct env_status status;
|
struct env_status status;
|
||||||
|
|
||||||
|
@ -74,6 +76,8 @@ void tsdb_sample(fdb_tsdb_t tsdb)
|
||||||
*/
|
*/
|
||||||
fdb_tsl_iter(tsdb, set_status_cb, tsdb);
|
fdb_tsl_iter(tsdb, set_status_cb, tsdb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FDB_INFO("===========================================================\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool query_cb(fdb_tsl_t tsl, void *arg)
|
static bool query_cb(fdb_tsl_t tsl, void *arg)
|
||||||
|
|
|
@ -1430,7 +1430,7 @@ static bool check_sec_hdr_cb(kv_sec_info_t sector, void *arg1, void *arg2)
|
||||||
size_t *failed_count = arg1;
|
size_t *failed_count = arg1;
|
||||||
fdb_kvdb_t db = arg2;
|
fdb_kvdb_t db = arg2;
|
||||||
|
|
||||||
FDB_INFO("Sector header check failed. Format this sector (0x%08" PRIX32 ").\n", sector->addr);
|
FDB_INFO("Sector header info is incorrect. Auto format this sector (0x%08" PRIX32 ").\n", sector->addr);
|
||||||
(*failed_count) ++;
|
(*failed_count) ++;
|
||||||
format_sector(db, sector->addr, SECTOR_NOT_COMBINED);
|
format_sector(db, sector->addr, SECTOR_NOT_COMBINED);
|
||||||
}
|
}
|
||||||
|
@ -1494,7 +1494,7 @@ fdb_err_t _fdb_kv_load(fdb_kvdb_t db)
|
||||||
sector_iterator(db, §or, FDB_SECTOR_STORE_UNUSED, &check_failed_count, db, check_sec_hdr_cb, false);
|
sector_iterator(db, §or, FDB_SECTOR_STORE_UNUSED, &check_failed_count, db, check_sec_hdr_cb, false);
|
||||||
/* all sector header check failed */
|
/* all sector header check failed */
|
||||||
if (check_failed_count == SECTOR_NUM) {
|
if (check_failed_count == SECTOR_NUM) {
|
||||||
FDB_INFO("All sector header check failed. Set it to default.\n");
|
FDB_INFO("All sector header is incorrect. Set it to default.\n");
|
||||||
fdb_kv_set_default(db);
|
fdb_kv_set_default(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -599,7 +599,7 @@ static bool check_sec_hdr_cb(tsdb_sec_info_t sector, void *arg1, void *arg2)
|
||||||
fdb_tsdb_t db = arg->db;
|
fdb_tsdb_t db = arg->db;
|
||||||
|
|
||||||
if (!sector->check_ok) {
|
if (!sector->check_ok) {
|
||||||
FDB_INFO("Sector (0x%08" PRIu32 ") header check failed.\n", sector->addr);
|
FDB_INFO("Sector (0x%08" PRIu32 ") header info is incorrect.\n", sector->addr);
|
||||||
(arg->check_failed) = true;
|
(arg->check_failed) = true;
|
||||||
return true;
|
return true;
|
||||||
} else if (sector->status == FDB_SECTOR_STORE_USING) {
|
} else if (sector->status == FDB_SECTOR_STORE_USING) {
|
||||||
|
|
Loading…
Reference in New Issue